In order to authorize with Twilio Voice certain SIDs and API keys and secrets need to be set for the domain. The JSON object for this is of the form:
"khanchat.onetechnology.com": {
"accountSid": "ACda6d0dc86c5d8e4f9bc38d2c65cb7068",
"twimlAppSid": "AP790b21f8cedcbfd9d389e92b66939916",
"apiKey": "SK74f0e340cb54587726b8a31c8f0e9725",
"apiSecret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"callerId": "+18446310364"
}
Next, create a TwiML App. A TwiML Application can be created in the TwiML Application Console.
The Request URL of the TwiML app should be set to https://twilio-backend.onetechnology.com/voice/[[[DOMAIN]]]
.
If a different Twilio API Key should be used, it would need to be created at Create API Key and the values of apiKey
and apiSecret
should be set to the newly created SID and secret.
initTwilioVoice()
Initializes the Twilio Voice JS SDK and retrieves an access token to use when communicating with Twilio services. Will require a ONEplatform Bearer Token to be set with an app domain before running. In other words, the user should be logged in and able to run authenticated workflows before calling this.
twilioOutgoingCall(toNumber: string, fromNumber: string)
Attempts to make an outgoing call to toNumber
with caller ID set as fromNumber
. Accepts phone numbers in the form of +15551231234
.
twilioDisconnectCall()
Disconnects the currently active call.
onTwilioCallAccepted
onTwilioCallCancelled
onTwilioCallDisconnected
onTwilioCallRinging