Jonathan H
2016-May-09 13:50 UTC
[asterisk-users] Switching between Music on Hold streams. [13.8.2]
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
Dovid Bender
2016-May-09 14:24 UTC
[asterisk-users] Switching between Music on Hold streams. [13.8.2]
Sorry about that it's the g option:
g: Proceed with dialplan execution at the next priority in the current
extension if the destination channel hangs up.
What you are doing is "dialing" another location that picks up. When
you
press # the called leg hangs up and the call continues in the dialplan.
On Mon, May 9, 2016 at 9:50 AM, Jonathan H <lardconcepts at gmail.com>
wrote:
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.digium.com/pipermail/asterisk-users/attachments/20160509/9c68e19d/attachment.html>
A J Stiles
2016-May-09 17:00 UTC
[asterisk-users] Switching between Music on Hold streams. [13.8.2]
On Monday 09 May 2016, Jonathan H wrote:> ..... {stuff deleted} ..... > [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)You have an error in your dialplan! The pattern _[2,3,4,5] will match any of 2, a comma, 3, a comma (again), 4, a comma or 5. I think you might mean _[2345] which will match any of 2, 3, 4 or 5 (but not a comma), and contains no tautologies. -- AJS Note: Originating address only accepts e-mail from list! If replying off- list, change address to asterisk1list at earthshod dot co dot uk .
Jonathan H
2016-May-09 17:18 UTC
[asterisk-users] Switching between Music on Hold streams. [13.8.2]
Thanks Joshua and everyone,
Joshua's solution seems a lot simpler and works well. Only one thing
now - The reason I named the classes as I did, was so that I could
select the class based on callerID plus extension.
Unless I've misread it, I'm limited to 9 switchable classes via the
"digit=#" option, is that correct?
Or is there a clever hack around this?
extensions.conf
[streamdemo]
exten => s,1,Answer
exten => s,2,BackGround(menu)
exten => s,3,WaitExten
exten => _[2,3,4,5],1,MusicOnHold(${CALLERID(name)}${EXTEN})
;exten => s,5,Goto(s,2)
exten => _[X,t,i],1,Goto(streamdemo,s,2)
and in musiconhold.conf (4 is commented out as it's AAC and I've not
figured that one out yet - bonus points to someone who can point the
way!)
[streamdemo2]
mode=custom
digit=2
application=/usr/bin/mpg123 -q -r 8000 -f 32768 --mono -s
http://185.14.85.162:8020
[streamdemo3]
mode=custom
digit=3
application=/usr/bin/mpg123 -q -r 8000 -f 32768 --mono -s
http://stream.acbradio.org:8000/mainstream.mp3
;[streamdemo4]
;mode=custom
;digit=4
;application=/usr/bin/mpg123 -q -r 8000 -f 32768 --mono -s
http://199.180.75.27:80/
;http://www.mushroomfm.com/media/listen.pls
[streamdemo5]
digit=5
mode=custom
application=/usr/bin/mpg123 -q -r 8000 -f 32768 --mono -s
http://206.225.87.121:8000/
On 9 May 2016 at 18:00, A J Stiles <asterisk_list at earthshod.co.uk>
wrote:> On Monday 09 May 2016, Jonathan H wrote:
>> ..... {stuff deleted} .....
>> [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)
>
> You have an error in your dialplan! The pattern _[2,3,4,5] will match any
of
> 2, a comma, 3, a comma (again), 4, a comma or 5.
>
> I think you might mean _[2345] which will match any of 2, 3, 4 or 5 (but
> not a comma), and contains no tautologies.
>
>
> --
> AJS
>
> Note: Originating address only accepts e-mail from list! If replying off-
> list, change address to asterisk1list at earthshod dot co dot uk .
>
> --
> _____________________________________________________________________
> -- 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