<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://reviewboard.asterisk.org/r/2764/">https://reviewboard.asterisk.org/r/2764/</a>
     </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On August 21st, 2013, 1:47 p.m. UTC, <b>Matt Jordan</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Why not use pre-dial to put the musicclass directly on the channel that will survive, as opposed to the Local channel?</pre>
 </blockquote>







</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Because I have no pre-dial in this old branch, mostly.  But now I don't need it on the local channel anymore.

Thanks for the review!</pre>
<br />










<p>- wdoekes</p>


<br />
<p>On August 16th, 2013, 3:26 p.m. UTC, wdoekes wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers.</div>
<div>By wdoekes.</div>


<p style="color: grey;"><i>Updated Aug. 16, 2013, 3:26 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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 :)</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">=== 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@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@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@default:1] NoOp("SIP/caller-00000000", "Direct") in new stack
    -- Executing [direct@default:2] Set("SIP/caller-00000000", "CHANNEL(musicclass)=special") in new stack
    -- Executing [direct@default:3] NoOp("SIP/caller-00000000", "musicclass: special") in new stack
...
    -- Started music on hold, class 'special', on SIP/caller-00000000

2:
    -- Executing [local@default:1] Dial("SIP/caller-00000004", "Local/local2@default") in new stack
    -- Called Local/local2@default
    -- Executing [local2@default:1] NoOp("Local/local2@default-00000001;2", "Local, no Master") in new stack
    -- Executing [local2@default:2] Set("Local/local2@default-00000001;2", "CHANNEL(musicclass)=special") in new stack
    -- Executing [local2@default:3] NoOp("Local/local2@default-00000001;2", "musicclass: special") in new stack
...
    -- Move-swap optimizing Local/local2@default-00000001;1 <-- SIP/victim-00000005.
...
    -- Started music on hold, class 'default', on SIP/caller-00000004

3:
    -- Executing [localm@default:1] Dial("SIP/caller-0000000c", "Local/localm2@default") in new stack
    -- Executing [localm2@default:1] NoOp("Local/localm2@default-00000005;2", "Local, with Master") in new stack
    -- Called Local/localm2@default
    -- Executing [localm2@default:2] Set("Local/localm2@default-00000005;2", "CHANNEL(musicclass,M)=special") in new stack
    -- Executing [localm2@default:3] NoOp("Local/localm2@default-00000005;2", "musicclass: special") in new stack
...
    -- Move-swap optimizing Local/localm2@default-00000002;1 <-- SIP/victim-00000007.
...
    -- Started music on hold, class 'special', on SIP/caller-00000006</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/trunk/funcs/func_channel.c <span style="color: grey">(396839)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/2764/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>