# Global

##

### Methods

#### _formatTime() → {string}

Format seconds to "MM:SS" format.

Source:
  - Call.js, line 376

##### Returns:

Type:
  `string`

#### (private) _normalize(account, destination) → {string}

Normalize Destination URI

Source:
  - Endpoint.js, line 674

##### Parameters:

Name | Type | Description
--- | --- | ---
`account` |  |
`destination` | `string` |

##### Returns:

Type:
  `string`

#### (private) _onCallChanged(data)

Source:
  - Endpoint.js, line 598

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | `Object` |

##### Fires:

- Endpoint#event:call_changed

#### (private) _onCallReceived(data)

Source:
  - Endpoint.js, line 583

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | `Object` |

##### Fires:

- Endpoint#event:call_received

#### (private) _onCallScreenLocked(lock)

Source:
  - Endpoint.js, line 628

##### Parameters:

Name | Type | Description
--- | --- | ---
`lock` |  | bool

##### Fires:

- Endpoint#event:call_screen_locked

#### (private) _onCallTerminated(data)

Source:
  - Endpoint.js, line 613

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | `Object` |

##### Fires:

- Endpoint#event:call_terminated

#### (private) _onConnectivityChanged(available)

Source:
  - Endpoint.js, line 658

##### Parameters:

Name | Type | Description
--- | --- | ---
`available` |  | bool

##### Fires:

- Endpoint#event:connectivity_changed

#### (private) _onConnectivityChanged(data)

Source:
  - Endpoint.js, line 553

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | `Object` |

##### Fires:

- Endpoint#event:connectivity_changed

#### (private) _onMessageReceived(data)

Source:
  - Endpoint.js, line 643

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | `Object` |

##### Fires:

- Endpoint#event:message_received

#### (private) _onRegistrationChanged(data)

Source:
  - Endpoint.js, line 568

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | `Object` |

##### Fires:

- Endpoint#event:registration_changed

#### answerCall(call) → {Promise}

Send response to incoming INVITE request.

Source:
  - Endpoint.js, line 261

##### Parameters:

Name | Type | Description
--- | --- | ---
`call` | `Call` | Call instance

##### Returns:

Type:
  `Promise`

#### changeNetworkConfiguration(configuration) → {Promise}

Source:
  - Endpoint.js, line 125

##### Parameters:

Name | Type | Description
--- | --- | ---
`configuration` |  |

##### Returns:

Type:
  `Promise`

#### changeServiceConfiguration(configuration) → {Promise}

Source:
  - Endpoint.js, line 141

##### Parameters:

Name | Type | Description
--- | --- | ---
`configuration` |  |

##### Returns:

Type:
  `Promise`

#### createAccount(configuration) → {Promise}

Add a new account. If registration is configured for this account, this function would also start the SIP registration session with the SIP registrar server. This SIP registration session will be maintained internally by the library, and application doesn't need to do anything to maintain the registration session.

An example configuration: { name: "John Doe", username: "100", domain: "pbx.com", password: "XXXXXX",

proxy: "192.168.100.1:5060", // default disabled. transport: "TCP", // default TCP regServer: "pbx.com", // default taken from domain regTimeout: 300, // default 300 }

Source:
  - Endpoint.js, line 174

##### Parameters:

Name | Type | Description
--- | --- | ---
`configuration` | `Object` |

##### Returns:

Type:
  `Promise`

#### declineCall(call) → {Promise}

Hangup call by using Decline (603) method.

Source:
  - Endpoint.js, line 298

##### Parameters:

Name | Type | Description
--- | --- | ---
`call` | `Call` | Call instance

##### Returns:

Type:
  `Promise`

#### deleteAccount(account) → {Promise}

Delete an account. This will unregister the account from the SIP server, if necessary, and terminate server side presence subscriptions associated with this account.

Source:
  - Endpoint.js, line 217

##### Parameters:

Name | Type | Description
--- | --- | ---
`account` | `Account` |

##### Returns:

Type:
  `Promise`

#### dtmfCall(call, digits) → {Promise}

Send DTMF digits to remote using RFC 2833 payload formats.

Source:
  - Endpoint.js, line 484

##### Parameters:

Name | Type | Description
--- | --- | ---
`call` | `Call` | Call instance
`digits` | `String` | DTMF string digits to be sent as described on RFC 2833 section 3.10.

##### Returns:

Type:
  `Promise`

#### getAccountId() → {int}

The account ID where this message belongs.

Source:
  - Message.js, line 46

##### Returns:

Type:
  `int`

#### getAccountId() → {int}

The account ID where this call belongs.

Source:
  - Call.js, line 74

##### Returns:

Type:
  `int`

#### getAudioCount() → {int}

Number of simultaneous active audio streams for this call. If zero - audio is disabled in this call.

Source:
  - Call.js, line 274

##### Returns:

Type:
  `int`

#### getBody() → {String}

Message body, or NULL if no message body is attached to this mesage.

Source:
  - Message.js, line 94

##### Returns:

Type:
  `String`

#### getCallId() → {String}

Dialog Call-ID string.

Source:
  - Call.js, line 83

##### Returns:

Type:
  `String`

#### getConnectDuration() → {int}

Up-to-date call connected duration (zero when call is not established)

Source:
  - Call.js, line 107

##### Returns:

Type:
  `int`

#### getContactParams() → {String}

Additional parameters that will be appended in the Contact header for this account.

Source:
  - Account.js, line 82

##### Returns:

Type:
  `String`

#### getContactUri() → {String}

The Contact URI of the sender, if present.

Source:
  - Message.js, line 54

##### Returns:

Type:
  `String`

#### getContactUriParams() → {String}

Additional URI parameters that will be appended in the Contact URI for this account.

Source:
  - Account.js, line 91

##### Returns:

Type:
  `String`

#### getContentType() → {String}

MIME type of the message.

Source:
  - Message.js, line 102

##### Returns:

Type:
  `String`

#### getDomain() → {int|null}

Domain specified in Endpoint.createAccount().

Source:
  - Account.js, line 49

##### Returns:

Type:
  `int` | `null`

#### getFormattedConnectDuration() → {string}

Call duration in "MM:SS" format.

Source:
  - Call.js, line 134

##### Returns:

Type:
  `string`

#### getFormattedTotalDuration() → {string}

Call duration in "MM:SS" format.

Source:
  - Call.js, line 124

##### Returns:

Type:
  `string`

#### getFromName() → {String}

Sender name, or NULL if no name specified in URI.

Source:
  - Message.js, line 70

##### Returns:

Type:
  `String`

#### getFromNumber() → {String}

Sender number

Source:
  - Message.js, line 78

##### Returns:

Type:
  `String`

#### getFromUri() → {String}

URI of the sender.

Source:
  - Message.js, line 62

##### Returns:

Type:
  `String`

#### getId() → {int}

The account ID.

Source:
  - Account.js, line 17

##### Returns:

Type:
  `int`

#### getId() → {int}

Call identification.

Source:
  - Call.js, line 66

##### Returns:

Type:
  `int`

#### getLastReason() → {string}

The reason phrase describing the last status.

Source:
  - Call.js, line 358

##### Returns:

Type:
  `string`

#### getLastStatusCode() → {string}

Last status code heard, which can be used as cause code. Possible values:

- PJSIP_SC_TRYING / 100
- PJSIP_SC_RINGING / 180
- PJSIP_SC_CALL_BEING_FORWARDED / 181
- PJSIP_SC_QUEUED / 182
- PJSIP_SC_PROGRESS / 183
- PJSIP_SC_OK / 200
- PJSIP_SC_ACCEPTED / 202
- PJSIP_SC_MULTIPLE_CHOICES / 300
- PJSIP_SC_MOVED_PERMANENTLY / 301
- PJSIP_SC_MOVED_TEMPORARILY / 302
- PJSIP_SC_USE_PROXY / 305
- PJSIP_SC_ALTERNATIVE_SERVICE / 380
- PJSIP_SC_BAD_REQUEST / 400
- PJSIP_SC_UNAUTHORIZED / 401
- PJSIP_SC_PAYMENT_REQUIRED / 402
- PJSIP_SC_FORBIDDEN / 403
- PJSIP_SC_NOT_FOUND / 404
- PJSIP_SC_METHOD_NOT_ALLOWED / 405
- PJSIP_SC_NOT_ACCEPTABLE / 406
- PJSIP_SC_PROXY_AUTHENTICATION_REQUIRED / 407
- PJSIP_SC_REQUEST_TIMEOUT / 408
- PJSIP_SC_GONE / 410
- PJSIP_SC_REQUEST_ENTITY_TOO_LARGE / 413
- PJSIP_SC_REQUEST_URI_TOO_LONG / 414
- PJSIP_SC_UNSUPPORTED_MEDIA_TYPE / 415
- PJSIP_SC_UNSUPPORTED_URI_SCHEME / 416
- PJSIP_SC_BAD_EXTENSION / 420
- PJSIP_SC_EXTENSION_REQUIRED / 421
- PJSIP_SC_SESSION_TIMER_TOO_SMALL / 422
- PJSIP_SC_INTERVAL_TOO_BRIEF / 423
- PJSIP_SC_TEMPORARILY_UNAVAILABLE / 480
- PJSIP_SC_CALL_TSX_DOES_NOT_EXIST / 481
- PJSIP_SC_LOOP_DETECTED / 482
- PJSIP_SC_TOO_MANY_HOPS / 483
- PJSIP_SC_ADDRESS_INCOMPLETE / 484
- PJSIP_AC_AMBIGUOUS / 485
- PJSIP_SC_BUSY_HERE / 486
- PJSIP_SC_REQUEST_TERMINATED / 487
- PJSIP_SC_NOT_ACCEPTABLE_HERE / 488
- PJSIP_SC_BAD_EVENT / 489
- PJSIP_SC_REQUEST_UPDATED / 490
- PJSIP_SC_REQUEST_PENDING / 491
- PJSIP_SC_UNDECIPHERABLE / 493
- PJSIP_SC_INTERNAL_SERVER_ERROR / 500
- PJSIP_SC_NOT_IMPLEMENTED / 501
- PJSIP_SC_BAD_GATEWAY / 502
- PJSIP_SC_SERVICE_UNAVAILABLE / 503
- PJSIP_SC_SERVER_TIMEOUT / 504
- PJSIP_SC_VERSION_NOT_SUPPORTED / 505
- PJSIP_SC_MESSAGE_TOO_LARGE / 513
- PJSIP_SC_PRECONDITION_FAILURE / 580
- PJSIP_SC_BUSY_EVERYWHERE / 600
- PJSIP_SC_DECLINE / 603
- PJSIP_SC_DOES_NOT_EXIST_ANYWHERE / 604
- PJSIP_SC_NOT_ACCEPTABLE_ANYWHERE / 606
- PJSIP_SC_TSX_TIMEOUT / PJSIP_SC_REQUEST_TIMEOUT
- PJSIP_SC_TSX_TRANSPORT_ERROR / PJSIP_SC_SERVICE_UNAVAILABLE

Source:
  - Call.js, line 349

##### Returns:

Type:
  `string`

#### getLocalContact() → {String}

Local Contact. TODO: Provide example

Source:
  - Call.js, line 143

##### Returns:

Type:
  `String`

#### getLocalUri() → {String}

Local URI. TODO: Provide example

Source:
  - Call.js, line 152

##### Returns:

Type:
  `String`

#### getName() → {String}

Full name specified in Endpoint.createAccount().

Source:
  - Account.js, line 33

##### Returns:

Type:
  `String`

#### getPassword() → {String}

Password specified in Endpoint.createAccount().

Source:
  - Account.js, line 57

##### Returns:

Type:
  `String`

#### getProxy() → {String}

Proxy specified in Endpoint.createAccount().

Source:
  - Account.js, line 65

##### Returns:

Type:
  `String`

#### getReason() → {String|null}

Reason phrase received.

Source:
  - AccountRegistration.js, line 53

##### Returns:

Type:
  `String` | `null`

#### getRegContactParams() → {String}

Source:
  - Account.js, line 114

##### Returns:

Type:
  `String`

#### getRegHeaders() → {Object}

Source:
  - Account.js, line 121

##### Returns:

Type:
  `Object`

#### getRegistration() → {AccountRegistration}

Account registration status.

Source:
  - Account.js, line 129

##### Returns:

Type:
  `AccountRegistration`

#### getRegServer() → {String}

Port specified in Endpoint.createAccount().

Source:
  - Account.js, line 99

##### Returns:

Type:
  `String`

#### getRegTimeout() → {String}

Port specified in Endpoint.createAccount().

Source:
  - Account.js, line 107

##### Returns:

Type:
  `String`

#### getRemoteAudioCount() → {int}

Number of audio streams offered by remote.

Source:
  - Call.js, line 258

##### Returns:

Type:
  `int`

#### getRemoteContact() → {String}

Remote contact. TODO: Provide example

Source:
  - Call.js, line 161

##### Returns:

Type:
  `String`

#### getRemoteFormattedNumber() → {String}

Source:
  - Call.js, line 193

##### Returns:

Type:
  `String`

#### getRemoteName() → {String}

Callee name. Could be null if no name specified in URI.

Source:
  - Call.js, line 178

##### Returns:

Type:
  `String`

#### getRemoteNumber() → {String}

Callee number

Source:
  - Call.js, line 186

##### Returns:

Type:
  `String`

#### getRemoteOfferer() → {boolean}

Flag if remote was SDP offerer

Source:
  - Call.js, line 249

##### Returns:

Type:
  `boolean`

#### getRemoteUri() → {String}

Remote URI. TODO: Provide example

Source:
  - Call.js, line 170

##### Returns:

Type:
  `String`

#### getRemoteVideoCount() → {int}

Number of video streams offered by remote.

Source:
  - Call.js, line 266

##### Returns:

Type:
  `int`

#### getState() → {String}

Invite session state.

PJSIP_INV_STATE_NULL Before INVITE is sent or received PJSIP_INV_STATE_CALLING After INVITE is sent PJSIP_INV_STATE_INCOMING After INVITE is received. PJSIP_INV_STATE_EARLY After response with To tag. PJSIP_INV_STATE_CONNECTING After 2xx is sent/received. PJSIP_INV_STATE_CONFIRMED After ACK is sent/received. PJSIP_INV_STATE_DISCONNECTED Session is terminated.

Source:
  - Call.js, line 216

##### Returns:

Type:
  `String`

#### getStateText() → {String}

Text describing the state.

Source:
  - Call.js, line 225

##### Returns:

Type:
  `String`

#### getStatus() → {string|null}

Last registration status code (SIP status codes according to RFC 3261). If status code is empty, the account is currently not registered. Any other value indicates the SIP status code of the registration.

Source:
  - AccountRegistration.js, line 25

##### Returns:

Type:
  `string` | `null`

#### getStatusText() → {string|null}

String describing the registration status.

Source:
  - AccountRegistration.js, line 34

##### Returns:

Type:
  `string` | `null`

#### getTotalDuration() → {int}

Up-to-date call duration in seconds. Use local time to calculate actual call duration.

Source:
  - Call.js, line 95

##### Returns:

Type:
  `int`

#### getToUri() → {String}

URI of the destination message.

Source:
  - Message.js, line 86

##### Returns:

Type:
  `String`

#### getTransport() → {String}

Transport specified in Endpoint.createAccount().

Source:
  - Account.js, line 73

##### Returns:

Type:
  `String`

#### getURI() → {String}

This is the URL to be put in the request URI for the registration, and will look something like "sip:serviceprovider".

Source:
  - Account.js, line 25

##### Returns:

Type:
  `String`

#### getUsername() → {String}

Username specified in Endpoint.createAccount().

Source:
  - Account.js, line 41

##### Returns:

Type:
  `String`

#### getVideoCount() → {*}

Number of simultaneous active video streams for this call. If zero - video is disabled in this call.

Source:
  - Call.js, line 282

##### Returns:

Type:
  `*`

#### hangupCall(call) → {Promise}

Hangup call by using method that is appropriate according to the call state.

Source:
  - Endpoint.js, line 279

##### Parameters:

Name | Type | Description
--- | --- | ---
`call` | `Call` | Call instance

##### Returns:

Type:
  `Promise`

#### holdCall(call) → {Promise}

Put the specified call on hold. This will send re-INVITE with the appropriate SDP to inform remote that the call is being put on hold.

Source:
  - Endpoint.js, line 316

##### Parameters:

Name | Type | Description
--- | --- | ---
`call` | `Call` | Call instance

##### Returns:

Type:
  `Promise`

#### isActive()

Flag to tell whether this account is currently registered (has active registration session).

Source:
  - AccountRegistration.js, line 44

##### Returns:

boolean

#### makeCall(account, destination, callSettings, msgSettings)

Make an outgoing call to the specified URI. Available call settings:

- audioCount - Number of simultaneous active audio streams for this call. Setting this to zero will disable audio in this call.
- videoCount - Number of simultaneous active video streams for this call. Setting this to zero will disable video in this call. -

Source:
  - Endpoint.js, line 241

##### Parameters:

Name | Type | Description
--- | --- | ---
`account` | `Account` |
`destination` | `String` | Destination SIP URI.
`callSettings` | `PjSipCallSetttings` | Outgoing call settings.
`msgSettings` | `PjSipMsgData` | Outgoing call additional information to be sent with outgoing SIP message.

#### muteCall(call) → {Promise}

Source:
  - Endpoint.js, line 350

##### Parameters:

Name | Type | Description
--- | --- | ---
`call` | `Call` | Call instance

##### Returns:

Type:
  `Promise`

#### redirectCall(account, call, destination) → {Promise}

Redirect (forward) specified call to destination. This function will send response to INVITE to instruct remote call party to redirect incoming call to the specified destination/target.

Source:
  - Endpoint.js, line 463

##### Parameters:

Name | Type | Description
--- | --- | ---
`account` | `Account` | Account associated with call.
`call` | `Call` | The call to be transferred.
`destination` |  | URI of new target to be contacted. The URI may be in name address or addr-spec format.

##### Returns:

Type:
  `Promise`

#### registerAccount(account, bool) → {Promise}

Update registration or perform unregistration. If registration is configured for this account, then initial SIP REGISTER will be sent when the account is added. Application normally only need to call this function if it wants to manually update the registration or to unregister from the server.

Source:
  - Endpoint.js, line 199

##### Parameters:

Name | Type | Description
--- | --- | ---
`account` | `Account` |
`bool` |  | renew If renew argument is zero, this will start unregistration process.

##### Returns:

Type:
  `Promise`

#### start() → {Promise}

Returns a Promise that will be resolved once PjSip module is initialized. Do not call any function while library is not initialized.

Source:
  - Endpoint.js, line 70

##### Returns:

Type:
  `Promise`

#### unholdCall(call) → {Promise}

Release the specified call from hold. This will send re-INVITE with the appropriate SDP to inform remote that the call is resumed.

Source:
  - Endpoint.js, line 334

##### Parameters:

Name | Type | Description
--- | --- | ---
`call` | `Call` | Call instance

##### Returns:

Type:
  `Promise`

#### unMuteCall(call) → {Promise}

Source:
  - Endpoint.js, line 366

##### Parameters:

Name | Type | Description
--- | --- | ---
`call` | `Call` | Call instance

##### Returns:

Type:
  `Promise`

#### useEarpiece(call) → {Promise}

Source:
  - Endpoint.js, line 398

##### Parameters:

Name | Type | Description
--- | --- | ---
`call` | `Call` | Call instance

##### Returns:

Type:
  `Promise`

#### useSpeaker(call) → {Promise}

Source:
  - Endpoint.js, line 382

##### Parameters:

Name | Type | Description
--- | --- | ---
`call` | `Call` | Call instance

##### Returns:

Type:
  `Promise`

#### xferCall(account, call, destination) → {Promise}

Initiate call transfer to the specified address. This function will send REFER request to instruct remote call party to initiate a new INVITE session to the specified destination/target.

Source:
  - Endpoint.js, line 419

##### Parameters:

Name | Type | Description
--- | --- | ---
`account` | `Account` | Account associated with call.
`call` | `Call` | The call to be transferred.
`destination` |  | URI of new target to be contacted. The URI may be in name address or addr-spec format.

##### Returns:

Type:
  `Promise`

#### xferReplacesCall(call, destCall) → {Promise}

Initiate attended call transfer. This function will send REFER request to instruct remote call party to initiate new INVITE session to the URL of destCall. The party at destCall then should "replace" the call with us with the new call from the REFER recipient.

Source:
  - Endpoint.js, line 442

##### Parameters:

Name | Type | Description
--- | --- | ---
`call` | `Call` | The call to be transferred.
`destCall` | `Call` | The call to be transferred.

##### Returns:

Type:
  `Promise`

### Type Definitions

#### PjSipCallSetttings

An additional information to be sent with outgoing SIP message. It can (optionally) be specified for example with #Endpoint.makeCall(), #Endpoint.answerCall(), #Endpoint.hangupCall(),

#Endpoint.holdCall() and many more.

##### Properties:

Name | Type | Description
--- | --- | ---
`flag` | `number` | Bitmask of #pjsua_call_flag constants.
`req_keyframe_method` | `number` | This flag controls what methods to request keyframe are allowed on the call.
`aud_cnt` | `number` | Number of simultaneous active audio streams for this call. Setting this to zero will disable audio in this call.
`vid_cnt` | `number` | Number of simultaneous active video streams for this call. Setting this to zero will disable video in this call.

Source:
  - Endpoint.js, line 32

##### Type:

- `Object`

#### PjSipHdrList

SIP headers object, where each key is a header name and value is a header value. Example: { "X-Custom-Header": "Test Header Value", "X-Custom-ID": "Awesome Header" }

Source:
  - Endpoint.js, line 8

##### Type:

- `Object`

#### PjSipMsgData

An additional information to be sent with outgoing SIP message. It can (optionally) be specified for example with #Endpoint.makeCall(), #Endpoint.answerCall(), #Endpoint.hangupCall(),

#Endpoint.holdCall() and many more.

##### Properties:

Name | Type | Description
--- | --- | ---
`target_uri` | `String` | Indicates whether the Courage component is present.
`hdr_list` | `PjSipHdrList` | Additional message headers as linked list.
`content_type` | `String` | MIME type of optional message body.
`msg_body` | `String` | MIME type of optional message body.

Source:
  - Endpoint.js, line 19

##### Type:

- `Object`