1. BackgroundDetect - this application allows you to play a sound file and to stop in with voice.
NOTE: This application is valid for Asterisk version 1.0.9 and above.
Syntax:
BackgroundDetect(filename[|sil][|min|max]])
Purpose and usage
This application is very similar to the Background one. The new moment here is that you can stop the sound file and jump to a special extension, called talk extension, by voice. So you can say something in the microphone and the sound message will stop and the call will be redirected.
To see how the application works we recommend to use our IAX softphone Idefisk. You can download it from here. Please also read our tutorial to learn how to configure it to work with Asterisk PBX.
Asterisk PBX configurations
NOTE: This is only an example of what for you can use this application. Of course you can use it and for other things.
We need two registered users in iax.conf file. This is because we are going to use the IAX2 protocol. If you want to use other protocol such as SIP or MGCP, you have to do the configurations below respectively in sip.conf or mgcp.conf.
So, we have registered the users anatoliy and user1
Type=friend means that this user can make and receive calls. Host=dynamic means that the IP is not static but dynamic through a DHCP server. Allow=all means that the line which this user will use, could support all audio codecs. Context=test - this shows that this user is working with the extensions in this context of the configuration file extensions.conf.
So, in our example when somebody dials 222, the call will be answered by the Answer application. The next executed extension will be the one which contains the GoTo application. Thanks to this application, the call will be redirected to the extension s with priority 1. The extension includes the BackgroundDetect application. So, the caller will hear the sound file indicated in the brackets of this application. In our example the caller will hear the file demo-instruct. The message in the sound file could be something similar to this: Thank you for using our services. If you would like to be connected to an operator please press 1, press 2 for....etc, or some kind of a welcome message.
The supported format for the sound file is .gsm.
While the message is running, the user is allowed to enter an extension. The caller does not have to wait until the end of the message. If our caller press one, the call will be connected to the extension with the Dial application. Thanks to it the call will be connected to the user anatoliy through the IAX2 channel.
Here, it comes the difference between the Background and the BackgroundDetect applications. With BackgroundDetect you can interrupt the sound message even with your voice.
Except the filename, as arguments in the brackets of the application, you can also set three other parameters related to the voice command.
sil - this is for the silence after you say something. It is a time in ms
min - this is the starting point from which to start to talk. The time is in ms
max - this is the end point. This point is followed by a period of time for silence. Set by the sil parameter. The time is in ms
By default the parameters are set to: 1000ms for the sil, 100ms for the min and infinity for the max parameter.
In our example we have set these parameters to: 500 - sil, 1000 - min and we left infinity for the max.
So, if our caller decides to interrupt the sound file by voice, the only ting he/she has to do is to say something into the microphone and to leave half a second(500ms) silence after that.
There is one special moment with this application. When you say something the playing of the sound file will stop and the execution will continue with...?
So what would be the next executed extension when you say something? As you can see there is no argument for an extension.
The next executed extension will be the special extension called talk extension. In our example we have set for this extension the application Dial. Thanks to it, the caller will be connected to the user user1 through the IAX2 channel. When the caller say something, the sound file will stop and the call will be redirected to the extension talk.
What will happen if the user does not press any key or does not say something while the message is running? If the user does not press any key or does not say something and the message is finished, then the next executed extension will be the special t extension(timeout extension). If such one does not exist then the line will be hung up.
If the caller enters an invalid or non-existing extension then the next executed extension will be the special extension i (invalid extension). If such one does not exist - the line will be hung up.
More about the invalid and timeout extensions you can read in our tutorial about the extensions.conf file.
We recommend you always to make an extension for hanging up in order to be sure that the Asterisk PBX will close the line after the conversation is over.
2. Screenshots of what you can see on the CLI of the Asterisk PBX
3. Additional information
For more information about extensions.conf you can check here.
For more information about iax.conf you can check here.
This application is tested with our IAX softphone Idefisk. You can download it from here. For more information about this softphone please read our tutorial.
If you would like to test this application with the SIP channel you can read our tutorials about the SIP Softphones to learn how to configure them to work with Asterisk PBX
Kailan (9hb1cidobyt at yahoo dot com) 20 November 2016 08:34:46 Now we know who the selnbise one is here. Great post! http://bvpfmkffmn.com [url=http://mojmnv.com]mojmnv[/url] [link=http://fyhhmvygsvt.com]fyhhmvygsvt[/link]
Keischa (jywboyq8m at mail dot com) 18 November 2016 02:44:39 Absolutely first rate and <a href="http://qcpnshzj.com">cob-trppoetomed,</a> gentlemen!