dialSip

View as Markdown

dialSip

  • dialSip(params): Promise<Call> - See Call for more details.

Makes an outbound call to a SIP endpoint.

Parameters

NameTypeDescription
paramsObject-
params.codecs?SipCodec[]Optional array of desired codecs in order of preference. Supported values are PCMU, PCMA, OPUS, G729, G722, VP8, H264. Default is parent leg codec(s).
params.fromstringThe party the call is coming from. Must be a SignalWire number or SIP endpoint that you own.
params.headers?SipHeader[]Array of SipHeader objects. Must be X- headers only, see example below.
params.maxPricePerMinute?numberThe 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.
params.timeout?numberThe time, in seconds, the call will ring before it is considered unanswered.
params.tostringThe party you are attempting to call.
params.webrtcMedia?booleanIf true, WebRTC media is negotiated. Default is parent leg setting.
params.sessionTimeout?numberNon-negative value, in seconds, to use for the SIP Session-Expires header. If 0 or unset, SignalWire will pick the default (typically 600).

Returns

Promise<Call> - See Call for more details.

A call object.

Example

1try {
2 const call = await client.dialSip({
3 from: "sip:xxx@yyy.zz",
4 to: "sip:ppp@qqq.rr",
5 timeout: 30,
6 headers: [
7 { name: "X-SomeKeyA", value: "SomeValueA" },
8 { name: "X-SomeKeyB", value: "SomeValueB" },
9 ],
10 });
11} catch (e) {
12 console.log("Call not answered.");
13}