[asterisk-users] Switching between Music on Hold streams. [13.8.2]

Jonathan H lardconcepts at gmail.com
Mon May 9 08:50:06 CDT 2016


Hi there;

I didn't see any "G" option in the example above, and the usage for
the option parameters is entirely undocumented at
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Dial

The G options are as below
G - If the call is answered, transfer the calling party to the
specified priority and the called party to the specified priority plus
one.
context
exten
priority

I think I have something almost there now, with the following:

[streamdemo]
exten => s,1,Answer
exten => s,2,BackGround(menu)
exten => s,3,WaitExten
exten => s,4,Goto(s,2)
exten => _[2,3,4,5],1,Dial(Local/${EXTEN}@play-radio,,G(play-radio^${EXTEN}^2))
exten => _[2,3,4,5],2,Goto(s,2)

[play-radio]
Exten => _[2,3,4,5],1,Answer
exten => _[2,3,4,5],2,MusicOnHold(${CALLERID(name)}${EXTEN})
exten => _[2,3,4,5],3,Set(CHANNEL(language)=en_GB)
exten => _[2,3,4,5],4,BackGround(menu)
exten => _[2,3,4,5],5,WaitExten
exten => _[X,t,i],1,Goto(streamdemo,s,2)

However, it's like the play-radio channel can't "hear" the dtmf.

Here's the output -  once that MoH starts playing, no amount of button
pushing works. All I'm left with is a channel which isn't closed
properly when the phone is hung up.

By the way, it looks like that "G" option IS working because the MoH
starts, then the "called party" plays back an example piece of "menu"
audio while the MoH is playing, but seems to ignore the keypresses.

-- Executing [s at streamdemo:1] Answer("Local/s at root-00000002;2", "") in new stack
    -- Local/s at root-00000002;1 answered PJSIP/voipfone-201-00000002
    -- Channel Local/s at root-00000002;1 joined 'simple_bridge'
basic-bridge <3ac0c9be-2817-48e7-bcd8-4318eb1f9c2b>
    -- Channel PJSIP/voipfone-201-00000002 joined 'simple_bridge'
basic-bridge <3ac0c9be-2817-48e7-bcd8-4318eb1f9c2b>
    -- Executing [s at streamdemo:2]
BackGround("Local/s at root-00000002;2", "menu") in new stack
    -- <Local/s at root-00000002;2> Playing 'menu.alaw' (language 'en_GB')
    -- Executing [s at streamdemo:3] WaitExten("Local/s at root-00000002;2",
"") in new stack
    -- Executing [2 at streamdemo:1] Dial("Local/s at root-00000002;2",
"Local/2 at play-radio,,G(play-radio^2^2)") in new stack
    -- Called Local/2 at play-radio
    -- Executing [2 at play-radio:1]
Answer("Local/2 at play-radio-00000003;2", "") in new stack
    -- Local/2 at play-radio-00000003;1 answered Local/s at root-00000002;2
    -- Executing [2 at play-radio:2]
MusicOnHold("Local/s at root-00000002;2", "streamdemo2") in new stack
    -- Started music on hold, class 'streamdemo2', on channel
'Local/s at root-00000002;2'
    -- Executing [2 at play-radio:3] Set("Local/2 at play-radio-00000003;1",
"CHANNEL(language)=en_GB") in new stack
    -- Executing [2 at play-radio:4]
BackGround("Local/2 at play-radio-00000003;1", "menu") in new stack
    -- Executing [2 at play-radio:2]
MusicOnHold("Local/2 at play-radio-00000003;2", "streamdemo2") in new
stack
    -- Started music on hold, class 'streamdemo2', on channel
'Local/2 at play-radio-00000003;2'
    -- <Local/2 at play-radio-00000003;1> Playing 'menu.alaw' (language 'en_GB')
    -- Executing [2 at play-radio:5]
WaitExten("Local/2 at play-radio-00000003;1", "") in new stack
    -- Timeout on Local/2 at play-radio-00000003;1, going to 't'
    -- Executing [t at play-radio:1]
Goto("Local/2 at play-radio-00000003;1", "streamdemo,s,2") in new stack
    -- Goto (streamdemo,s,2)
    -- Executing [s at streamdemo:2]
BackGround("Local/2 at play-radio-00000003;1", "menu") in new stack
    -- <Local/2 at play-radio-00000003;1> Playing 'menu.alaw' (language 'en_GB')
    -- Executing [s at streamdemo:3]
WaitExten("Local/2 at play-radio-00000003;1", "") in new stack
    -- Timeout on Local/2 at play-radio-00000003;1, continuing...

On 8 May 2016 at 14:56, Dovid Bender <dovid at telecurve.com> wrote:
> Michael,
>
> What you do is you dial another context and then use the G option in the dial string. So something like this.
>
> [radio-main]
> Exten => s,1,answer
> Exten => s,2,Background(play-menu)
> Exten => s,3,waitexten
> Exten => S,4,Goto(s,2)
>
> Exten => 1,1,Dial(Local/CNN at play-radio)
> Exten => 1,2,Goto(s,2)
>
> Exten => 2,1,Dial(Local/NPR at play-radio)
> Exten => 2,2,Goro(s,2)
>
> [play-radio]
> Exten => _[A-Z].,1,Answer
> Exten => _[A-Z].,2,Musiconhold(${EXTEN})
>
>
> Regards,
>
> Dovid
>
> -----Original Message-----
> From: Jonathan H <lardconcepts at gmail.com>
> Sender: asterisk-users-bounces at lists.digium.comDate: Sun, 8 May 2016 11:36:42
> To: Asterisk Users Mailing List - Non-Commercial Discussion<asterisk-users at lists.digium.com>
> Reply-To: Asterisk Users Mailing List - Non-Commercial Discussion
>  <asterisk-users at lists.digium.com>
> Subject: [asterisk-users] Switching between Music on Hold streams. [13.8.2]
>
> I'd like multiple people to be able to dial in and listen to various
> live radio streams.
>
> I was told that the correct resource-friendly way would be to setup a
> MoH class, and then select that from the dialplan.
>
> This works well, but how do I switch between streams?
>
> Someone correct me if I'm wrong, but from previous similar questions a
> few years ago it seems like once you've entered a MoH class, there is
> no exit.
>
> But might there be some trick involved merged or bridged calls, or
> chan_spy or something, so that callers could quickly switch between 3
> streams with a keypress?
>
> Thank you!
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>                http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>                http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users



More information about the asterisk-users mailing list