# new phone()
Class handling phone calls
Members
# (static) callEndCallback :Callable
a callback to execute when a call ends
Type:
- Callable
Methods
# (static) call(number, modalText, jamesMode, jamesID) → {Promise}
Function for checking the online status of the sip client
Parameters:
Name | Type | Description |
---|---|---|
number |
string | the phone number to call |
modalText |
string | Text to show on the status modal (gets smartified) |
jamesMode |
string | a mode to set for the pbx handler |
jamesID |
string | number | a relevant unique id to set the context for the current mode |
Returns:
- Type
- Promise
Example
j.phone.call("0123789","Calling an awesome dude");
# (static) call(number, modalText, jamesMode, jamesID) → {Promise}
Function for starting a call
Parameters:
Name | Type | Description |
---|---|---|
number |
string | the phone number to call |
modalText |
string | Text to show on the status modal (gets smartified) |
jamesMode |
string | a mode to set for the pbx handler |
jamesID |
string | number | a relevant unique id to set the context for the current mode |
Returns:
- Type
- Promise
Example
j.phone.call("0123789","Calling an awesome dude");
# (static) emergencyCall(text)
Function to start an emergency call
Parameters:
Name | Type | Description |
---|---|---|
text |
string | Text to show on the modal (default: "{$calling_emergency}...") |
Returns:
Promise
Example
await j.phone.emergencyCall()
# (static) getState() → {Promise.<string>}
Function to fetch the state of the current call
Returns:
a lowercase status
- Type
- Promise.<string>
Example
let state = await j.phone.getState();
# (static) hangUp(sendHangupRequest) → {Promise}
Function for ending a phone call
Parameters:
Name | Type | Description |
---|---|---|
sendHangupRequest |
boolean | if true, sends an api request to end the call (default: true) |
Returns:
- Type
- Promise
Example
j.phone.hangup();