This repository is intended to provide developers, who are looking to develop their applications on the Inteliquent Voice Platform, with useful code from basic building blocks to entire apps. Our goal at Inteliquent is to get your development team to a useful code as fast as possible.
Note: Each code snippet should be associated with an Inteliquent Number/Domain to function as described below.
- Hello World
- Hello World w/ callback
- Initial script w/ callback
- Forward call to SIP URI
- Forward call to another number
- Forward call to four numbers and loadshare among them
- Forward call to registered SIP client
- Number masking with external proxy
- Transfer caller between two agents
- Dial from registered client
- Snippet
- Record something
- Record something in your GCP bucket
- Voicemail
- Outbound A2P call
- IVR
- IVR with Hubspot integration
- Authenticated conference
- Live transcription
- Key word spotter
- Bi-lingual conversational IVR
- AMD with beep detection
- Appointment reminder
- Busy
- SIP.js SDK that can be used to integrate with Inteliquent
- Inteliquent specific Integration snippet .js
Hello World see xml
- Call is answered
- "Hello World" text is played after text-to-speech conversion.
- Call is hung-up
Hello World with callback see xml
- Call is answered
- "Hello World" text is played after text-to-speech conversion.
- Call is hung-up
- Call related information is sent to specified webhook
Initial script with callback and "Hello World" response see xml
Note: This script is equivalent to default webhook configuration seen with e.g. Twilio but with some customization to showcase flexibility. The script expects to receive additional XML from the called webservice with instructions of what to do next.
- Call is accepted (183 Session Progress returned)
- Caller hears ringing (200OK + ACK)
- Webhook is sent to a defined URL with useful parameters ( JSON) as well as information in the HTTP header that can be used for authentication for example. The webservice can use this information to determine what the next steps should be. In our case the webservice responds with simple Hello World XML script.
- The script will wait up to 4 seconds for this response after which timeout is declared (error equivalent)
- In case of a timeout or error (e.g. 404) message will be played to a caller informing them of an issue. The script will wait 1 second before this message is played to account for possible network latency don't and to ensure the cut message is not cut off.
- Originating call leg is hung up
Forward call to SIP URI see xml
- Call is Accepted
- Ringing tone is played to calling leg
- New call leg is initiated to SIP URI
INBOUND_CALLER_NUMBER
variable is used as Caller Id- When SIP URI answers the two call legs are joined
- When either party hangs up both call legs are hung up
Forward call to another number see xml
- Call is Accepted
- Ringing tone is played to calling leg
- New call leg is initiated to a dialable number
INBOUND_CALLER_NUMBER
variable is used as Caller Id- When called party answers the two call legs are joined
- When either party hangs up both call legs are hung up
Forward call to four numbers and loadshare among them see xml
- Call is Accepted
- Ringing tone is played to calling leg
- Array of four numbers is loaded as a variable (this array could be requested dynamically with a webhook as well)
- One number is selected at random and stored as variable called
RANDOM
- New call leg is initiated to the randomly selected number
- When called party answers the two call legs are joined
- When either party hangs up both call legs are hung up
Forward call to registered SIP client see xml
- Call is Accepted
- Ringing tone is played to calling leg
- New call leg is initiated to a registered client on Inteliquent's network
INBOUND_CALLER_NUMBER
variable is used as Caller Id- When called party answers the two call legs are joined
- When either party hangs up both call legs are hung up
Note 1: Inteliquent's syntax allows for the full control of all call legs. This requires that each leg is named. The name is also used to hang up the specific leg should the other one be disconnected first.
Note 2: Client specific domains include the
vp.sip.global
suffix. Customer specific registration domain will be established during customer onboarding.
Number masking with external proxy see xml
- Call is Accepted
- Webhook is sent to masking proxy containing useful network parameters. JSON response is expected with values of the proxy_from and proxy_to numbers
- JSON parameters are saved in order to be used later in the call
- New call leg is dialed with the new to/from values
- When called party answers, the two call legs are joined
- When either party hangs up both call legs are hung up
Transfer caller between two agents see xml
- Caller hears IVR prompt
- Caller is instructed to press
1
or2
- Based on their choice SIP client (agent) or WebRTC client(operator) are dialed and connected
- Customer is provided with option of how to transfer call at any time.
- If customer pressed
1
and wishes to be transferred to WebRTC operator she can press2
- During the transfer the other call leg is hung up.
- If caller hangs up all call legs are terminated
Dial from registered SIP client see xml
- Call from client is Accepted
- Ringing tone is played to calling leg
- New call leg is initiated to PSTN
INBOUND_CALLER_NUMBER
variable is used as Caller Id andINBOUND_CALLEE_NUMBER
variable is used for the dialed number.- When called party answers the two call legs are joined
- When either party hangs up both call legs are hung up
Snippet see xml
- Call is answered
helloworld
snippet is referenced- the snippet will convert "Hello World" text to speech and play it to customer.
- Call is hung-up
Note: Snippets are re-usable code objects. As such they need to be defined at the beginning of the script before any call event (e.g. ) Snippets are very useful in IVRs
Record something see xml
- Call is answered
record_and_playback
snippet is called- Text is converted to speech and played
- External Audio file with the "Beep" sound is played
- Recording with maximum duration of 5 seconds is started.
- After the 5 second elapsed time the recorded audio is played to customer.
- Call is hung up
Note: In this example Inteliquent's internal storage product is used. The next example demonstrates the use of Bring Your Own storage functionality as an alternative(Google Cloud Platform is supported). We expect to add AWS to BYOS offering soon.
Record something in your GCP bucket see xml
- GCP authentication and account information is declared
- Call is answered
record_and_playback
snippet is called- Text is converted to speech and played
- External Audio file with the "Beep" sound is played
- Recording with maximum duration of 10 seconds is started.
- Format of the file is
mp3
(wav is the used if omitted) - After the 10 second elapsed time the recorded audio is played to customer.
- Call is hung up
Note: For more detail refer to our API documentation
Voicemail see xml
- Snippet
voicemail
is declared - Call is accepted
- Leg to registered client is dialed.
- Timer of 20 seconds for the registered client to answer is started
- Upon expiration of the timer the client leg is hung up
voicemail
snippet is called- Voicemail prompt is played to the caller
- Audio file with "beep" sound is played
- Recording with 1 minute max duration is started
- When recording is complete link to the recording and call parameters is POSTed to a webhook.
- At the end of the 1 minute timer or whenever the caller hangs up all legs are hung up.
- Bonus:
voicemail
snippet is called for variety of cause codes generated by the platform.
Note: For more detail refer to our Disconnect Codes
Outbound A2P call see xml
- Call from +17200000001 to +17200000002 is dialed
- When +17200000002 answers text converted to speech is played.
- Call is hung-up
Note: A2P calls are cURL calls to https://external-api.inteliquent.net/v2/callback/submit?apiKey= , API Key is required before this API endpoint can be used. Above is an example of XML script included in the cURL.
IVR see xml
This code plays back the number pressed on your keypad.
- Snippet
main_menu
is declared - Snippet
ready_dtmfs
is declared - Call is answered
- Snippet
main_menu
is called - All previous DTMF tones are flushed out
- Main Menu text is converted to speech and played
- Snippet
ready_dtmfs
is declared - Users is asked to press keys 0-9 on their keypad
- Depending on the digit pressed the user hears
Your pressed digit
. - User is returned to the main menu and can press any of the digits again.
- Limit of 99 loops is put on the IVR.
IVR with Hubspot Integration see xml
This code is for complex Pizza shop IVR that personalizes the customer experience thanks to integration with Hubspot
- Customer information is looked up based on their calling number
- If record is found, customer is greeted by their name
- They are offered the option to order what they had last time
- They are also offer to use credit card on file
- If they want to make a new choice they are given that option and can choose both size and type of pizza.
- Their order is repeated
- They can still use their card on file or can enter new credit card
- Credit card information is sent to payement gateway
- Order information is sent to the restaurants POS system
- Caller hears a thank you messege and call hangs up.
Authenticated Conference see xml
This code provides example of authenticated audio conference
- This script should be attached to a conference access number
- Caller will hear prompt to enter conference id
- When customer enters 6 digits a webhook will be sent to customer portal.
- If the conference exists, the webservice will return PIN code to the platform
- Caller will hear prompt to enter PIN code.
- If the PIN code is entered correctly the caller is placed into the conference.
- Once the caller is joined into the conference she hears message
You are now part of the conference room number 654321
- Customer will have 3 opportunities to enter conf. room and PIN correctly. After 3 failed attempts the call ends
Live transcription see xml
This code will answer a call, record what the caller says and return the transcription to caller in real time
- GCP authentication and account information is declared
- Call is answered
- Disclaimer prompt is played to the caller
- Recording with max duration of 10 seconds is started
- Live transcription is started that provides results back every 1s to the specified webhook URL.
- Upon expiration of 10 second timer call is hung up
- Link to the recording is sent to specified webhook
Note 1: This service uses our integration with Google and requires Google Account.
Note 2: For more detail refer to our API documentation
Key Word Spotter see xml
This code will return webhook whenever specified word is uttered.
- GCP authentication and account information is declared
- Call is answered
- Prompt is played
- Recording with max duration of 10 seconds is started
- Key word spotting service is declared with spotting for words "Yes" and "No".
- Webhook information for what information should be sent to webhook whenever each word is detected is specified.
- Upon expiration of 10 second timer call is hung up
- Link to the recording is sent to specified webhook
Note: For more detail refer to our API documentation
Bi-lingual Conversational IVR see xml
This is an example of 3 layer bi-lingual (English/Spanish) conversational IVR. This is a more advanced application of the key word spotter.
- GCP authentication and account information is declared
- Call is answered
- Main Menu prompts are played in English and Spanish.
- If customer presses #2 the Spanish language branch is selected, if customer does nothing the English branch is used.
- Key words are declared for the key word spotter together with the language of the branch.
- Correct language and voice for Text-to-Speech is declared.
- Depending on the key word utterances calls may be routed to an agent.
- Fake ringing tone is used to simulate a call to an agent. In real scenario this would be replaced with a
<dial>
verb
Note: This is an example of a serverless IVR, if decision making logic is required
<query>
can be declared in every<onSpeak>
event to return the desired behavior.
AMD with beep detection see xml
This is an example of an API call that will deliver voice message to a customer or customer's voicemail and is very useful for all voice notification use cases
- Call to a number is dialed
- When call is answered, 1 second pause is added to allow the human to start listening to the message
- It is assumed that human will answer and an audio file intended for the human is played
- Answering machine detection (AMD) is started at the same time.
- If voicemail greeting is detected by AMD the message for the human is stopped
- When the voicemail beep is detected, a message intended for voicemail is played
- When the message is completed call is hung up.
Note: A2P calls are cURL calls to https://external-api.inteliquent.net/v2/callback/submit?apiKey= , API Key is required before this API endpoint can be used. Above is an example of XML script included in the cURL.
Appointment Reminder see xml
This is an example of an API call that call customer and reminder of their medical appointemnt and will allow them to change it if required
- Call to patient's number is dialed
- API call to your scheduling system is initiated based on patient's number to retrieve any existing appointment times to remind them off
- Patient hears welcome message with appointment reminder
- Answering machine detection (AMD) is started at the same time and follows the logic in the previous example
- Customer is given a choice to keep the existing time or reschedule
- If they reschedule the newly entered dates are sent back to the scheduling system and if desired time is confirmed patient is notified
- If date and time are not available Patient is notified and they are asked to dial the office to reschedule their appintment
Note: A2P calls are cURL calls to https://external-api.inteliquent.net/v2/callback/submit?apiKey= , API Key is required before this API endpoint can be used. Above is an example of XML script included in the cURL.
Busy Tone see xml
This code will play busy tone to the caller
- Plays busy tone without answering the call