altervoice-asterisk-callbot
v1.1.5
Published
Jovo plugin for Altervoice asterisk integration
Downloads
32
Readme
Altervoice Asterisk Callbot
Altervoice Asterisk Callbot
- About
- Installation
- Prerequisite
- Jovo Integration
- Actions to Telephony platform
- Jovo Model
- Data from Telephony platform
- Events from Telephony platform
- Support
About
Altervoice Asterisk Callbot is a plugin of JOVO framework. It works with telephony platform such as Asterisk and the Altervoice Speech Controller module developed by Altervoice
Installation
npm install altervoice-asterisk-callbot
Prerequisite
To use the plugin, you must deploy and properly configure the following systems :
The plugin works with Dialogflow NUL engine
Additionally the Altervoice Speech Controller must be connected with STT and TTS engines
Jovo Integration
Setup
Import Dialogflow and altervoice-asterisk-callbot plugins. Install middlewares as shown in this example.
const { App } = require('jovo-framework');
const { Dialogflow } = require('jovo-platform-dialogflow');
const { AltervoiceAsteriskCallbot } = require('altervoice-asterisk-callbot');
const app = new App();
app.use(
new Dialogflow().use(
new AltervoiceAsteriskCallbot()
)
})
app.setHandler({
LAUNCH() {
this.tell("Hello callbot");
}
})
The tell() method disable the voice recognition during the prompt. Then the call hang up. Use ask() method to maintain the call. More JOVO Basic concepts
Actions to Telephony platform
The Jovo handler has new method to send actions to Asterisk
app.setHandler({
LAUNCH() {
this.addActions({telephonyHangup:true, setMode : 'AFTER_PLAY'}});
}
})
In this example, the application hangup the call after playing the prompt
The first attribut of object define the action type that can be :
- telephonyDtmf : {grammar:string}
to set allowed dtmf regex. Setting is maintained active until new regex or "" string
- telephonyMaxCall : {duration:number, prompt: string|SpeechBuilder }
to set the maximum duration of call. duration is in seconds. prompt is the ssml content. When the max duration is riched, the prompt is played back and call hangup
- telephonyInact : {duration:number, prompt: string|SpeechBuilder, max_count:number }
to set the user inactivity. duration is maximum duration of user inactivity in seconds. prompt is the ssml content to be play back. max_count is the number of prompt is played. When the user inactivity occurs all prompt and reprompt defined in ask() method are played, until the max_count is riched. If the max_count is bigger than number of prompt and reprompt defined in ask() method, the warning prmpt is played.
- telephonyCallTransfer : {phoneNumber: string}
to transfer the call to an other destination number.
- telephonyCallCancel : true
to cancel the call transfer .
- telephonyHangup : boolean
to hangup the call
- telephonyError : string| SpeechBuilder;
to set ssml content when any error occurs
SetMode attribut defines when the action must be applied. It can be:
- BEFORE_PLAY : the action is applied before the prompt is played back (ex: DTMf grammar change).
- AFTER_PLAY : the action is applied after playing is complete (ex: call transfer)
- AFTER_INACT : the action is applied after the inactivity delay is over (ex: hangup)
Jovo Model
Use the jovo model to associate the event and the Intent
"intents": [
{ "name": "dtmfIntent",
"dialogflow": {"events": [{"name": "TELEPHONY_DTMF"}]}
}
]
In this example : intent "dtmfIntent" is associated with TELEPHONY_DTMF event.
Data from Telephony platform
Asterisk Speech Controller send events when the user or call change.
The Jovo handler has new method to get data from Asterisk, such as getDtmf().
app.setHandler({
dtmfIntent() {
const digits = this.getDtmf();
}
})
In this example : getDtmf() method is used to get the DTMF sequence when dtmfIntent is run by the jovo handler.
Events from Telephony platform
Here are the list of events and associated methods to get data from the Telephony platform :
- TELEPHONY_DTMF : sent when user press key on the phone and the sequence matches the active regex.
getDtmf(void) return an object {digits:string}
- TELEPHONY_HANGUP : sent when call has hangup.
getResult(void) return an object {cause_txt :string, cause_code: number}
- TELEPHONY_RESULT : sent when the call status has changed. Example when a call transfer is in progress.
getResult(void) return an object {cause_txt :string, cause_code: number}
Support
Visit Altervoice website https://www.altervoice.com