[Help] Playing sound file during call without using Dial L

Hi,

I am stuck with a problem and searching on the internet didnt help.

I have to play a warning sound file on to the channel while it is in a call. I can not use the Dial command’s L option as the other requirement is to be able to increase the timeout of the call if the call credit increases during the call. I came to the conclusion that if you are using the L option on Dial command, you can decrease the timeout but not increase it.

Is there a way to play the recorded sound file to the channel during a call without using the Dial L option

Thanks in advance for your help.

More info …

I am using asterisk manager to increase the TIMEOUT(absolute) to reset the channel timeout.

How about using ChanSpy with the B option to barge connected to a Local channel directed to a Playback?

Thanks Malcolm

Let me try that out and get back to you … I have configured the chanspy application on the dialplan and it works fine but now i have to figure out a way to play the audio on the right channel … will take some time to do that as i am new to the asterisk :smile:

I tried another approach by using applicationmap by setting it up in features.conf

[applicationmap] lowcredit => 9,caller,Playback,hello-world

and then on the dialplan …

exten => s,n,Set(DYNAMIC_FEATURES=lowcredit) exten => s,n,Dial(SIP/CISCO/7625689${DEST},30)

It plays the hello-world audio when i send the dtmf from phone but when i try to do it from the manager as follows …

I can hear the dtmf being played but it doesnt trigger the feature

Any idea what can be the problem?

Try:

exten => s,n,Set(__DYNAMIC_FEATURES=lowcredit) 

thanks for the quick reply …

I tried that (i guess its inheritance) and reloaded the dialplan but i can still hear the dtmf on the right channel but it does not trigger the feature when calling it from the manager.

Hi Malcolm,

Can you elaborate on your suggested solution?

What is meant by Local channel directed to playback?

The Local channel allows you to connect local applications or other items. If you’re using the Manager, then do a Dial that dials a peer and connects it to a Local channel that points to the ChanSpy application, called with the B option.

Hi Malcolm

Just to clarify …

Can i do playback right after chanspy on the dialplan?

I am originating call between exten 123 and 456 like so:

And the dialplan looks like this:

[code][dummy]
exten => 123,1,Answer()
exten => 123,n,Wait(30)
exten => 123,n,Hangup()

exten => 456,1,Answer()
exten => 456,1,ChanSpy(“SIP”,b)
exten => 456,n,Playback(hello-world)
exten => 456,1,Hangup[/code]

I can see on the cli that the call was originated and asterisk plays the file on extension 456 (the local channels) but not the SIP channels. I am surely missing something …

The cli looks something like this:

== Spying on channel SIP/CISCO-00000029 [May 10 10:37:45] NOTICE[10006]: app_chanspy.c:414 start_spying: Attaching Local/123@dummy-e45f;1 to SIP/CISCO-00000029 [May 10 10:37:45] NOTICE[10006]: app_chanspy.c:414 start_spying: Attaching Local/123@dummy-e45f;1 to SIP/CISCO-00000029 [May 10 10:37:45] NOTICE[10006]: app_chanspy.c:414 start_spying: Attaching Local/123@dummy-e45f;1 to SIP/CISCOIN-00000028 -- Executing [123@dummy:1] NoOp("Local/123@dummy-d078;2", ""In Dummy"") in new stack -- Executing [123@dummy:2] Answer("Local/123@dummy-d078;2", "") in new stack -- Executing [456@dummy:1] Answer("Local/123@dummy-d078;1", "") in new stack -- Executing [456@dummy:2] Playback("Local/123@dummy-d078;1", "hello-world") in new stack -- <Local/123@dummy-d078;1> Playing 'hello-world.gsm' (language 'en') -- Executing [123@dummy:3] Playback("Local/123@dummy-d078;2", "hello-world") in new stack -- <Local/123@dummy-d078;2> Playing 'hello-world.gsm' (language 'en') -- Auto fallthrough, channel 'Local/123@dummy-d078;1' status is 'UNKNOWN' == Spawn extension (dummy, 123, 3) exited non-zero on 'Local/123@dummy-d078;2' == Spawn extension (nts-online, s, 7) exited non-zero on 'SIP/CISCOIN-00000028' == Done Spying on channel SIP/CISCO-00000029 -- <Local/123@dummy-a257;1> Playing 'beep.gsm' (language 'en')

Thanks for your continued help!

You would have to change extension 123 to dial the SIP phone instead of just waiting.

Hey Malcolm,

Thanks, got it working :smile:

The dialplan is as follows just so others can find it useful.

[code][dummy]
exten => 123,1,Answer()
exten => 123,n,Noop(“Dummy spy on ${CHANVAR}!!!”)
exten => 123,n,Set(__CHANVAR=${CHANVAR})
exten => 123,n,Dial(“Local/456@dummy”,30,A(hello-world))
exten => 123,n,Hangup()

exten => 456,1,Answer()
exten => 456,n,ChanSpy(${CHANVAR},qsBW)
exten => 456,n,Hangup()[/code]

Thanks again for your help,
Just need to make the code a bit efficient now :smile: