Set waiting tone for asterisk agi function processing
Asked Answered
D

5

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.

Duthie answered 4/9, 2015 at 6:40 Comment(0)
R
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

Rainger answered 10/9, 2015 at 10:15 Comment(6)
thanks you very much for replying but I am not using php-agi I am using simple agi as stated in my questionDuthie
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 "Rainger
I have tryed setting the class throught asterisk but where do run SET MUSIC ON holdDuthie
you have send that to AGI connection you have(usually just print to stdout)Rainger
sorry but I am not able to understand you .I have to specify it in asterisk or php and what shpuld be the syntaxDuthie
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.Rainger
B
0

Please Check Out The Playtones Command.

exten => s,2,Playtones(dial)
Beanstalk answered 14/9, 2015 at 7:29 Comment(0)
O
0

Just some ways I can think of, not necessarily exhaustive list.

  1. You can use dialplan applications StartMusicOnHold to play hold music before invoking AGI and StopMusicOnHold stop hold music after AGI exits.

E.g. in extensions.conf (or includes)

exten => test,1,....
same => n,StartMusicOnHold()
same => n,AGI(....)
same => n,StopMusicOnHold()
  1. Play ringing sounds

You can get the caller to hear ringing sound, and to stop the Ringing you can execute "Answer()".

exten => test,1,....
same => n,Ringing()
same => n,AGI(....)
same => n,Answer()
  1. Instead of doing the above from the dialplan you can do both from within the AGI.

See SET MUSIC for hold music or use AGI with EXEC Ringing to do Ringing

  1. Or a library e.g. php-agi.
Opinionative answered 15/11, 2023 at 5:45 Comment(0)
T
-1

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

Tarahtaran answered 8/9, 2015 at 14:20 Comment(1)
no this is not what I want I want the tone to be played when request is processing not before agi requestDuthie
C
-1

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.

Continually answered 31/1, 2016 at 17:37 Comment(1)
This answer shows how to start/stop hold music from the dialplan by by using AGI script which is too convoluted. From the dialplan use applications for this purpose: StartMusicOnHold and StopMusicOnHold.Opinionative

© 2022 - 2024 — McMap. All rights reserved.