Skip to main content

connect

Dial a SIP URI or phone number.

Parameters

NameTypeDescription
fromstringCaller ID number. Optional. Default is calling party caller ID number. Can be overwritten on each destination.
headersobjectCustom SIP headers to add to INVITE. Has no effect on calls to phone numbers. Optional. Default is not set.
codecsstringComma-separated string of codecs to offer. Has no effect on calls to phone numbers. Optional. Default is set based on SignalWire settings.
webrtc_mediabooleanIf true, WebRTC media is offered to the SIP endpoint. Has no effect on calls to phone numbers. Optional. Default is false.
session_timeoutintegerTime, in seconds, to set the SIP Session-Expires header in INVITE. Must be a positive, non-zero number. Has no effect on calls to phone numbers. Optional. Default is set based on SignalWire settings.
ringbackstring[]Array of play URIs to play as ringback tone. Optional. Default will play audio from the provider.
timeoutintegerMaximum time, in seconds, to wait for an answer. Optional. Default is 60.
max_durationintegerMaximum duration, in seconds, allowed for the call. Optional. Default is 14400 (4 hours).
answer_on_bridgebooleanDelay answer until the B-leg answers. Optional. Default is false.
call_state_urlstringWebhook url to send call state change notifications to for all legs. Optional. Default is not set. Can be overwritten on each destination.
call_state_eventsstring[]An array of call state event names to be notified about. Allowed event names are created, ringing, answered, and ended. Optional. Default is ["ended"]. Can be overwritten on each destination.
resultobject | arraySet up a switch on return_value by using an object or a cond statement by using an array.

In addition, you are required to specify one and only one of the following dialing parameters:

NameTypeDescription
serial_parallelobject[][]Array of arrays. Inner arrays contain destination objects to dial simultaneously. Outer array attempts each parallel group in order.
serialobject[]Array of destination objects to dial in order.
parallelobject[]Array of destination objects to dial simultaneously.
tostringSingle destination to dial. Possible values are a phone number (i.e.: "+15552345678") or sip uri (i.e. "sip:alice@example.com").

Parameters for destination

NameTypeDescription
tostringPhone number or SIP URI to dial. Required.
fromstringCaller ID number. Optional. Default is calling party caller ID number.
timeoutintegerMaximum time, in seconds, to wait for destination to answer. Optional. Default is 60.
call_state_urlstringWebhook url to send call state change notifications to. Optional. Default is not set.
call_state_eventsstring[]An array of call state event names to be notified about. Allowed event names are created, ringing, answered, and ended. Optional. Default is ["ended"].

Variables

Set by the method:

  • connect_result: (out) connected | failed.
  • connect_failed_reason: (out) Detailed reason for failure.
  • return_value: (out) Same value as connect_result.

Examples

Dial a single phone number

version: 1.0.0
sections:
main:
- connect:
from: "+15553214321"
to: "+15551231234"

Dial a single phone number and go to voicemail on failure

version: 1.0.0
sections:
main:
- connect:
from: "+15553214321"
to: "+15551231234"
result:
case:
connected:
- hangup
default:
- execute: "voicemail"
- hangup

Dial numbers in parallel

version: 1.0.0
sections:
main:
- connect:
parallel:
- to: "+15551231234"
- to: "+15553214321"

Dial SIP serially with a timeout

version: 1.0.0
sections:
main:
- connect:
timeout: 20
serial:
- from: "sip:chris@example.com"
to: "sip:alice@example.com"
- to: "sip:bob@example.com"
codecs: PCMU