AGI Auto Answer

kerepuki
Posts: 21
Member Since:
2010-02-19

Hi everyone,

I am in discussions with a group about building an auto answer, enter a code and play a file system but wanted to get as much programming of this done myself so I can better understand. My background is PHP so I am OK programming what needs to be done.

I am still fairly new to Trixbox so any help is appreciated. What I want to do is have a script that answers ALL calls made to an inbound trunk/number. The script will play a recorded message, then ask for a code (get_data()) and then play another file related to that code. Each code/file pair will be stored in a remote MySQL server. Just really wanting to know the steps on how to auto answer a call and play a file first. Also there could be multiple agents requesting the recorded file at the same time.

I am running Trixbox 2.6 if this helps.

Thanks



stechnique
Posts: 733
Member Since:
2008-02-21
You need to create a custom

You need to create a custom extension and point your inbound route to it.
Your custom extension dialplan will start with Answer(), and then Playback(someaudiofile).
The AGI part will really only start once the input has been read, and you want to get the mysql query.



obeliks
Posts: 877
Member Since:
2010-03-14
The AGI part will really

The AGI part will really only start once the input has been read, and you want to get the mysql query.
Why are you saying this ?
Everything can be implemented in AGI.
It is also possible not to use AGI at all and still implement the functionality requested.



kerepuki
Posts: 21
Member Since:
2010-02-19
AGI

Hi, thanks for the responses.

I figured I could add something like exten=>AGI(myagifile.php) in the extensions_custom file and program everything in the .php file. As I said, still new to Asterisk programming and reading tutorials on how to do all this. There are still more requirements needed for the solution but baby steps ;). Doing this doesnt automatically answer the call and play the file unless I call the extension from an internal number.

Any code snippets would be helpful or any good resources anyone can think of to read.



stechnique
Posts: 733
Member Since:
2008-02-21
obeliks wrote: Why are you
obeliks wrote:
Why are you saying this ?
Everything can be implemented in AGI.

Might be, but that's how I'd do it.
AGI adds overhead and processing time, so if a simple dialplan command like Answer or Playback exists, why would I script it?
Perhaps remote mysql queries can be made from the dialplan but for more complex stuff like this I think it's more readable to us PHP coders to dump that part in AGI.
Feel free to debunk everything I say, but my way works with minimal effort.



kerepuki
Posts: 21
Member Since:
2010-02-19
Hi, there will be some

Hi, there will be some serious scripting needed like recording customer/agent responses, possibly so voice recognition, attaching recorded file to remote MySQL application, file reference codes etc.

Hence the AGI path as I already have my web application using a webphone to record files and attach to records in MySQL.

Anyway, any example code or resources on setting up custom extensions and dial plan info would be great.



kerepuki
Posts: 21
Member Since:
2010-02-19
Cant get it working

Hi,

So I have added a Custom extension but what would I put in the dial field? Also, whenever I point my inbound route to the extension it just hangs up. I have a simple say_digits but even that doesnt work.

I can get this extension to call my mobile when dialing in but I cant get it to use a custom dial plan.

Any help would be appreciated.



obeliks
Posts: 877
Member Since:
2010-03-14
Try reading this thread -

Try reading this thread - http://fonality.com/trixbox/forums/trixbox-forums/help/configure-...
it should give you some ideas.
Basically you do not want to define any extensions for your code, you need to define custom context for your trunk which will send the incoming call to your code.
You can also use Inbound Route + Custom Destination if you do not want all calls from the trunk to hit your code.



kerepuki
Posts: 21
Member Since:
2010-02-19
Great thanks. I will give it

Great thanks. I will give it a read.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.