Set waiting tone for asterisk agi function processing

半世苍凉 提交于 2019-11-28 07:38:11

问题


I am using asterisk with normal PHP AGI following this link the problem is that my PHP AGI takes 5 seconds to execute .I just want to set some waiting tone for the user to wait until the AGI is been processing. On the same link I found something:

set music: Enable/Disable Music on hold generator, example "SET MUSIC ON default

but I don't know exactly how to use I mean what would be the exact syntax and where do I put it.

I have tried adding

same => n,Set(CHANNEL(musicclass)=default)

but it didn't work.


回答1:


If you use phpagi, you have do something like this

$agi->set_music(true,"myholdclass")
...
$agi->set_music(false)

http://phpagi.sourceforge.net/phpagi2/docs/phpAGI/AGI.html#methodset_music

Sure you need first describe myholdclass in /etc/asterisk/musiconhold.conf




回答2:


You put some sound file into your sound directory:

/var/lib/asterisk/mysoundFile

Then call the playback function:

Playback(mysoundFile)

For more information: http://www.voip-info.org/wiki/view/Asterisk+cmd+Playback




回答3:


Please Check Out The Playtones Command.

exten => s,2,Playtones(dial)



回答4:


I have an easier solution for your problem.

You use Asterisk AGI for it, without needing to create an AGI script (I do not like the AGI mechanism. I have invented a framework that is more powerful, easier and flexible and allows me to do crazy stuff with Asterisk without ever touching the Dial plan or any other config file).

For you problem, just do the following;

  1. create a symbolic link for the '/bin/echo' application in the agi directory by:

    ln -s /bin/echo  /var/lib/asterisk/agi-bin/echo
    
  2. from your dial plan, start music on hold by calling exten => s,n,AGI( echo, SET MUSIC ON)

  3. do your action
  4. stop the music on hold by calling exten => s,n,AGI( echo, SET MUSIC OFF)
  5. transfer or do other things

This is the easiest way without needing to create AGI pages.



来源:https://stackoverflow.com/questions/32391634/set-waiting-tone-for-asterisk-agi-function-processing

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