Play sound file instead of ringing tone when dialing exten

Hi Guys

I have tried a lot however i am not able to achieve this.

Basically I have a sound file which I want to play when dialing a particular extension instead of just ringing tone.

I tried to do it with following however it doesn’t play the sound file

exten => 90006,1,Dial(SIP/90006,20,A(/var/lib/asterisk/sounds/en/welcome.gsm))

So basically when anyone dials 90006 it should play welcome.gsm instead of just a ringing tone.

Can anyone please point me to right direction to achieve this?

I tried following however it just plays the welcome file and I don’t receive any incoming calls to ext. 90006

exten => 90006,1,Answer()
exten => 90006,n,Playback(/root/EUROSOLAR-LUSIC/welcome)
exten => 90006,n,Dial(SIP/90006,20)

m option, or use a queue. NB. If you use a queue, and don’t use musiconhold to do this, the call will not be offered to the callee whilst the message is playing.

For Dial, you may find you need to use the dialstring & notation to a channel that never answers, to prevent end to end call progress overriding the m setting.

Hi david

Thanks for the reply.

m: Provide Music on Hold to the calling party until the called channel answers

I am looking at it on how to configure it any specific doc/link that shows how to configure it exactly?

Ok so tried “m” option and below is the verbose logs

== Using SIP RTP CoS mark 5
– Executing [90006@a2billing-did:1] Dial(“SIP/VOXBEAM-00000002”, “SIP/90006,20,m”) in new stack
== Using SIP RTP CoS mark 5
– Called SIP/90006
– Started music on hold, class ‘default’, on SIP/VOXBEAM-00000002
– SIP/90006-00000003 is ringing

As per logs it says “Started music on hold, class ‘default’, on SIP/VOXBEAM-00000002

Now my /etc/asterisk/musiconhold.conf has been configured as following

[default]
mode=files
directory=/root/EUROSOLAR-LUSIC

and my /root/EUROSOLAR-LUSIC contains

-rw-r–r-- 1 root root 618484 Feb 28 22:31 EUSO9012MSG1.alaw
-rw-r–r-- 1 root root 618484 Mar 1 19:24 EUSO9012MSG1.gsm
-rw-r–r-- 1 root root 1234403 Feb 26 21:58 EUSO9012MSG1.mp3
-rw-r–r-- 1 root root 618484 Feb 28 22:29 EUSO9012MSG1.ulaw
-rw-r–r-- 1 root root 13637608 Feb 28 22:28 EUSO9012MSG1.wav

however it doesn’t play that file, it just plays ringing tone

Any suggestions??

That’s because the remote end has sent ringing. To prevent that, you need to do what I said with the & option. That will generate a conflict as the state of the channel, so Asterisk will not pass through the call progress events.

You can use a local channel that never answers, as the second channel.

Hi david

Sorry but can you please point me to the document which explains on using “& option”?

I tried searching but not able to find it.

Thanks
Ajay

svn.digium.com/svn/asterisk/bran … onf.sample

wiki.asterisk.org/wiki/display/ … ation_Dial

Hi david

Thanks for the reply

I still don’t get it on how you want me to use & notation??
I have used & notation at times when i want to ring multiple extensions at once. However how do you want me to use here is still not clear to me

e.g.

exten => 1,1,Wait(10000)[/code]

Tried that but I still get ringing tone instead of sound file.

below is the verbose logs

– Executing [xxxxx@a2billing-did:1] Dial(“SIP/VOXBEAM-0000056a”, “SIP/90006&Local/1@neveranswer,20,m”) in new stack
== Using SIP RTP CoS mark 5
– Called SIP/90006
– Called Local/1@neveranswer
– Started music on hold, class ‘default’, on SIP/VOXBEAM-0000056a
– Executing [1@neveranswer:1] Wait(“Local/1@neveranswer-00000002;2”, “10000”) in new stack
– SIP/90006-0000056b connected line has changed. Saving it until answer for SIP/VOXBEAM-0000056a
– SIP/90006-0000056b is ringing
> 0xb7475698 – Probation passed - setting RTP source address to 46.19.210.37:12674
– Stopped music on hold on SIP/VOXBEAM-0000056a
== Spawn extension (a2billing-did, xxxxx, 1) exited non-zero on ‘SIP/VOXBEAM-0000056a’
== Spawn extension (neveranswer, 1, 1) exited non-zero on ‘Local/1@neveranswer-00000002;2’

You need to take these from the log file, not the screen, as the timing of these messages is important. Preferably enable millisecond time stamps.

I wonder if you haven’t answered on the incoming side. If so, you may need to use Progress, or, if the caller can’t cope with early media, Answer. This assumes that there is a delay between the incoming Ringing and the music on hold ending.

Generally these are all abuses of the Dial application and you may find that Queue is more tolerant of such abuses.

This seems like a complicated task to achieve. Shouldn’t it be easier?
I will try and let you guys know.

It’s a very unusual requirement.

Ok so I tried following

exten => xxxx,1,Progress()
exten => xxxx,n,Dial(SIP/90007,30,m(EUSO9012MSG1))

And it worked partially. If i call between peers in same context I can hear EUSO9012MSG1.wav
However if I try calling from PSTN, I still hear ringing instead of EUSO9012MSG1.wav

Any suggestions?

Answer the call or become a recognized network operator. Network operators won’t let ordinary users generate early media because it would enable people to provide phone services where no-one paid for the calls.