[asterisk-dev] [Code Review] 2764: Add edit-MASTER-channel option to CHANNEL() function. To work around channel optimization removing my channel settings.
wdoekes
reviewboard at asterisk.org
Fri Aug 16 10:26:43 CDT 2013
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2764/
-----------------------------------------------------------
Review request for Asterisk Developers.
Repository: Asterisk
Description
-------
I'm trying to set a musicclass from a Local channel.
After the channels get bridged, the Local channels get optimized away
and now I get the wrong musicclass.
This patch fixes so I can alter the master CHANNEL settings instead.
Instead of:
Set(CHANNEL(musicclass)=special)
We do:
Set(CHANNEL(musicclass,M)=special)
If there is some other way I should've done this, I'd like to hear how :)
Diffs
-----
/trunk/funcs/func_channel.c 396839
Diff: https://reviewboard.asterisk.org/r/2764/diff/
Testing
-------
=== extensions.conf ===
[general]
[default]
exten => 1,1,Goto(direct,1)
exten => 2,1,Goto(local,1)
exten => 3,1,Goto(localm,1)
exten => direct,1,NoOp(Direct)
same => n,Set(CHANNEL(musicclass)=special)
same => n,NoOp(musicclass: ${CHANNEL(musicclass)})
same => n,Goto(dial,1)
exten => local,1,Dial(Local/local2 at default)
exten => local2,1,NoOp(Local, no Master)
same => n,Set(CHANNEL(musicclass)=special)
same => n,NoOp(musicclass: ${CHANNEL(musicclass)})
same => n,Goto(dial,1)
exten => localm,1,Dial(Local/localm2 at default)
exten => localm2,1,NoOp(Local, with Master)
same => n,Set(CHANNEL(musicclass,M)=special)
same => n,NoOp(musicclass: ${CHANNEL(musicclass,M)})
same => n,Goto(dial,1)
exten => dial,1,Dial(SIP/victim)
=== musiconhold.conf ===
[general]
[default]
mode=files
directory=moh
[special]
mode=files
directory=moh
=== output ===
`caller` calls `victim`, and `victim` presses hold.
Like expected, the only direct and localm channels get the right musicclass set.
1:
-- Executing [direct at default:1] NoOp("SIP/caller-00000000", "Direct") in new stack
-- Executing [direct at default:2] Set("SIP/caller-00000000", "CHANNEL(musicclass)=special") in new stack
-- Executing [direct at default:3] NoOp("SIP/caller-00000000", "musicclass: special") in new stack
...
-- Started music on hold, class 'special', on SIP/caller-00000000
2:
-- Executing [local at default:1] Dial("SIP/caller-00000004", "Local/local2 at default") in new stack
-- Called Local/local2 at default
-- Executing [local2 at default:1] NoOp("Local/local2 at default-00000001;2", "Local, no Master") in new stack
-- Executing [local2 at default:2] Set("Local/local2 at default-00000001;2", "CHANNEL(musicclass)=special") in new stack
-- Executing [local2 at default:3] NoOp("Local/local2 at default-00000001;2", "musicclass: special") in new stack
...
-- Move-swap optimizing Local/local2 at default-00000001;1 <-- SIP/victim-00000005.
...
-- Started music on hold, class 'default', on SIP/caller-00000004
3:
-- Executing [localm at default:1] Dial("SIP/caller-0000000c", "Local/localm2 at default") in new stack
-- Executing [localm2 at default:1] NoOp("Local/localm2 at default-00000005;2", "Local, with Master") in new stack
-- Called Local/localm2 at default
-- Executing [localm2 at default:2] Set("Local/localm2 at default-00000005;2", "CHANNEL(musicclass,M)=special") in new stack
-- Executing [localm2 at default:3] NoOp("Local/localm2 at default-00000005;2", "musicclass: special") in new stack
...
-- Move-swap optimizing Local/localm2 at default-00000002;1 <-- SIP/victim-00000007.
...
-- Started music on hold, class 'special', on SIP/caller-00000006
Thanks,
wdoekes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130816/b952c190/attachment.htm>
More information about the asterisk-dev
mailing list