Play soundfile while dialing?


#1

Hi community,

I want to play a sound file in the background, let’s say with some sort of product informations to the caller, while I’m dialing out to transfer the call.


exten => 99,1,Answer
exten => 99,2,Dial(Sip/88|60|A(productinfo))
exten => 99,3,Hangup

but it won’t work.

Do you have any ideas how to solve this problem?

Mike


#2

try creating a musiconhold class called “productinfo” that contains an mp3 of the sound file you want, then

exten => 99,1,Dial(Sip/88|60|m(productinfo)) exten => 99,2,Hangup should do what you want


#3

Hi Baconbuttie

[quote=“baconbuttie”]try creating a musiconhold class called “productinfo” that contains an mp3 of the sound file you want, then
[/quote]

no wont work because there are 800 different produkt informations which will be played

Mike


#4

i also tried to use the background() command
— docu
Background(filename)

Starts playing a given sound file, but immediately returns, permitting the sound file to play in the background while the next commands (if any) execute.

wont work because the next command is executetd AFTER and not WHILE playing the sound file…

i just want to create a gateway and play a sound file until the call is answered

answer call
play soundfile for the caller (sound depends on the callers areacode, we have about 500 aerea codes on germany)
while playing sound file initiate the dial(zap/g0/089123456)
hangup

Mike


#5

ok, i still think my way is the way to go. you could setup 500 MoH classes, then pass the trimmed calleridnumber as the MoH class, ensuring you play musiconhold that’s appropriate for their area.
you need to do it this way because as soon as you introduce a Dial command, it’s either going to generate ringing, killing any message you’re trying to play otherwise.


#6

Hi baconbuttie

hmmm…
still not satisfing.

i want to play commercial ads.
i’ll get them by a php-agi script looking up some mysql tables.

so these queues have to be dynamic because if someone runs out of money i have to switch to the next commercial advertisement.

isn’t there a possibility to tranfser the call to a local (virtual) extension, initiate the dial command and when established, take back or pickup the call from that extension?

Mike

cool signature :smile:


#7

mike,

that’s your first mention of queues. are you actually going to use a queue or a dialplan such as you posted originally ?

either way, i still think you’re better off doing this as MoH. you should be able to specify an application as the MoH provider, then you can do your db lookups, stream the right file for the caller etc etc.

there may be another way of doing what you want without some major programming, but i can’t think of one right now.


#8

Hi baconbuttie

actually i’m doing it in this way:


exten => 99,1,Ringing
exten => 99,2,Wait(2)
exten => 99,3,agi(my.php,0${CALLERIDNUM})
exten => 99,4,Hangup

my.php does some echos to the asterisk

exec BackGround "commercial"
exec Dial Zap/g0/0891234567

thats all. No Queues so far.

Mike


#9

Hi Baconbuttie,

i really have no idea how to specify an application as MoH provider …

can you gve me some documentation hints where i can find it ?

Mike


#10

look docs for musiconhold.conf. You should use:

mymohclass1 => custom:/var/lib/asterisk/dir_of_ads,/usr/bin/myapp 1
mymohclass2 => custom:/var/lib/asterisk/dir_of_ads,/usr/bin/myapp 2

mymohclassn => custom:/var/lib/asterisk/dir_of_ads,/usr/bin/myapp n

where myapp is an app that does your “commercial_selection” stuff, based on the parameter (1,2, etc…) and then streams on stdout the audio data in raw format. To do the actual streaming, your app could call another app, for instance “rawplayer” with the filename of the chosen commercial, capturing its stdout and copying it to “myapp” stdout.
This should do the trick…

Hope this helps…