7

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.

TylerH
  • 19,065
  • 49
  • 65
  • 86
codegasmer
  • 1,304
  • 1
  • 12
  • 40

4 Answers4

2

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

arheops
  • 14,867
  • 1
  • 15
  • 27
  • thanks you very much for replying but I am not using php-agi I am using simple agi as stated in my question – codegasmer Sep 10 '15 at 10:22
  • I recommend you use phpagi. No sense do your own bycicle. If you are using custom script, you just need send "SET MUSIC ON holdclass_here\r " – arheops Sep 10 '15 at 10:37
  • I have tryed setting the class throught asterisk but where do run `SET MUSIC ON hold` – codegasmer Sep 10 '15 at 10:49
  • you have send that to AGI connection you have(usually just print to stdout) – arheops Sep 10 '15 at 11:24
  • sorry but I am not able to understand you .I have to specify it in asterisk or php and what shpuld be the syntax – codegasmer Sep 10 '15 at 12:14
  • you should use phpagi with syntaxt above or print to stdout ias described in 3 comment above. There are no way give syntax for custom agi system you use. – arheops Sep 10 '15 at 15:39
0

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

Serhat Akay
  • 492
  • 3
  • 10
0

Please Check Out The Playtones Command.

exten => s,2,Playtones(dial)
TylerH
  • 19,065
  • 49
  • 65
  • 86
Ullas S
  • 1
  • 1
0

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.

TylerH
  • 19,065
  • 49
  • 65
  • 86
funda
  • 1