answer
Answer incoming call and set an optional maximum duration.
Properties
answer
An object that accepts the following properties.
answer.max_duration
Maximum duration in seconds for the call. Also accepts a SWML variable reference (string) such as ${vars.max_call_seconds}, which is substituted when the method runs and must resolve to a valid duration.
answer.codecs
Codecs to offer, as a comma-separated string ("PCMU,PCMA,OPUS") or an array of strings with one codec per entry. Each array entry can also be a SWML variable reference, resolved when the method runs.
Valid codecs depend on the call type:
- Phone calls:
PCMU,PCMA,G722,G729,AMR-WB. - SIP and WebRTC calls: all of the above, plus
OPUS,VP8,H264.
If the requested codecs aren’t valid for the call type, they’re ignored, a relay_script_method_parameter_invalid_value warning is reported, and answer continues without them.
answer.username
Username to use for SIP authentication challenges. Applied only together with a password that isn’t empty after variable expansion.
answer.password
Password to use for SIP authentication challenges. When it isn’t empty after variable expansion, it’s applied together with username.
Variables
Set by the method:
- answer_result: (out)
successorfailed.successis also set when there was nothing to answer, for example on an outbound call or a call that’s already answered, so it doesn’t by itself mean this method newly answered the call.failedmeans the answer request for this invocation was unsuccessful.