connectSip
connectSip
- connectSip(
params):Promise<Call>
Attempt to connect an existing call to a new outbound SIP call. The two devices will hear each other. You can wait until the new peer is disconnected by calling disconnected.
Parameters
Object containing the parameters for connecting the call to a SIP endpoint.
The party the call is coming from. Must be a SignalWire number or SIP endpoint that you own.
The party you are attempting to call.
The time, in seconds, the call will ring before it is considered unanswered.
Array of SipHeader objects. Must be X- headers only, see example below.
Array of desired codecs in order of preference. Supported values are PCMU, PCMA, OPUS, G729, G722, VP8, H264. Default is parent leg codec(s). See SipCodec.
If true, WebRTC media is negotiated. Default is parent leg setting.
Non-negative value, in seconds, to use for the SIP Session-Expires header. If 0 or unset, SignalWire will pick the default (typically 600).
The maximum price in USD acceptable for the call to be created. If the rate for the call is greater than this value, the call will not be created. If not set, all calls will be created. Price can have a maximum of four decimal places, i.e. 0.0075.
Ringback audio to play to the call leg. You can play audio, TTS, silence or ringtone. See VoicePlaylist.
Webhook URL to which SignalWire will send call status change notifications. See the payload specifications under CallState.
An array of event names to be notified about. Allowed values are created, ringing, answered, and ended.
Returns
Promise<Call>
A promise that resolves to a Call object that you can use to control the new peer.
The promise resolves only after the new peer picks up the call.
Example
In this example, we connect a inbound call to a internal SIP endpoint. We play a ringback tone to the inbound call leg while waiting for the SIP endpoint to answer. Once the SIP endpoint answers, we wait for the peer to hangup and then hangup the inbound call.