Availability: v1.5.3+
The EnxRoom.makeOutboundCall()
method allows you to initiate an Outbound Call to PSTN Number or SIP URI while being in the session, thus inviting the called participant to join the session on accepting the call.
Method: EnxRoom.makeOutboundCall(dialout_number, cli_number, options, callback)
Parameters:
dialout_number
– String. It can be either a PSTN Number or a SIP URI to dial out. For Phone Number, use country code without “00” or “+”.cli_number
– String. Calling Line Identification Number to be added as the originator of the Call. In the case of PSTN Phone Numbers, this will be validated against your purchased number or opted Shared Number. In case if the CLI does not match, the call will fail with an error “CLI mismatch”.options
– Availability: v2.0.2+name
– String. Name of the dialled participant. If the name is omitted, the dialled Phone Number is used as the name.
early_media
– Boolean. Default false. If set totrue
, the ringer is played in the Room when dial-out is initiated. On the other hand, if set tofalse
, the ringer will not be placed in the Room when dial-out is in progress.silent_join
– Boolean. Defaulttrue
. If set totrue
, the dialled participant is not put into the Room until he answers the call. On the other hand, when it is set tofalse
, he will be put into the Room as soon as dial-out is in progress and ringer will be played.
callback
– It returns the dial-out request result. Failure notifications are given with error codes.
Note: early_media
and silent_join
may not be used together.
Event Listener:
dial-state-events
– Notification to the call initiator about the state of the dial-out process as received from Gateway. The JSON Response returns states as: initiated, dialing, connected, dtmf-collected, and disconnected.
var dialout_option = { "name": "John", "early_media": false, "silent_join": true }; room.makeOutboundCall('91999999999', '1999999999', dialout_option, function(resp) { // Whether Dial-Out requests accepted. resp JSON example /* { "result": 0, "msg": "Success" } */ }); room.addEventListener("dial-state-events ", function(evt) { // evnt JSON contains state of dial-out process, example { number: "9999999999", /* Dialled Phone Number of SIP URI */ state: "connected", /* State of the dial-out Process */ description: "Detailed description" } /* evt.state may be initiated, dialing, connected, dtmf-collected & disconnected */ });
Error Codes / Exceptions
Code | Description |
---|---|
1141 | Dial out request already in process. |
1142 | CLI doesn’t match with configured phone number. |
4124 | Dialed-out phone number doesn’t exist. |