Asterisk Dialplan (extensions.conf) Applications

南楼画角 提交于 2019-12-10 10:44:56

问题


i am developing an application that shall allow users to access their mail boxes using their phones. I developped an IVR menu of which users will make use to retrieve their mails. More specifically I write an AGI in perl to retrieve the mails. The issue is that the AGI execution takes quite a long time.To this end, I need to make my users hear some music played back in the background while the agi being executed. That is, i need to make the "AGI" and "MusicOnHold" applications in my dialplan execute simultaneously. Any clue how I can achieve this?


回答1:


This may not be the answer you expected, but if you plan to create a proper application for doing stuff over the phone, have a look at other solutions apart from asterisk. Both yate and (as far as I know - never tried this one for anything serious) freeswitch implement a more asynchronous interface where you can connect an incoming call to whatever sound source you want without losing control over it. They may be a much better choice for advanced applications.

Asterisk is cool for simple logic, but if you need some processing in the background and leaving the call in some state for an undefined time, it becomes quite hard to manage.




回答2:


You can issue SET MUSIC ON from you AGI applications, process your calculations, then issue SET MUSIC OFF.

If you want the music to be interruptable, issue this:

CONTROL STREAM FILE <filename> "0123456789*#" "0" "" "" ""

The second parameter is the list of digits able to interrupt the music.

It's better not to mix AGI and dialplan commands.

AGI is capable of everything dialplan is capable of, but AGI is implemented in a full fledged programming language and therefore gives you more control over the execution logic.




回答3:


Is the complete execution taking a long time or just starting up the app? If the whole execution takes too long then you can do what Quassnoi says, start the music as soon as the AGI program starts.

If startup time is the problem, then you might need to implement something with FastAGI, so that your app is always running and listening for connections over a socket. The performance is much much better in an environment with a lot of AGI calls.



来源:https://stackoverflow.com/questions/930166/asterisk-dialplan-extensions-conf-applications

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!