<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 />





 <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>
 <br />









<p>- Matt</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.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&#39;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&#39;ve done this, I&#39;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 =&gt; 1,1,Goto(direct,1)
exten =&gt; 2,1,Goto(local,1)
exten =&gt; 3,1,Goto(localm,1)

exten =&gt; direct,1,NoOp(Direct)
        same =&gt; n,Set(CHANNEL(musicclass)=special)
        same =&gt; n,NoOp(musicclass: ${CHANNEL(musicclass)})
        same =&gt; n,Goto(dial,1)

exten =&gt; local,1,Dial(Local/local2@default)
exten =&gt; local2,1,NoOp(Local, no Master)
        same =&gt; n,Set(CHANNEL(musicclass)=special)
        same =&gt; n,NoOp(musicclass: ${CHANNEL(musicclass)})
        same =&gt; n,Goto(dial,1)

exten =&gt; localm,1,Dial(Local/localm2@default)
exten =&gt; localm2,1,NoOp(Local, with Master)
        same =&gt; n,Set(CHANNEL(musicclass,M)=special)
        same =&gt; n,NoOp(musicclass: ${CHANNEL(musicclass,M)})
        same =&gt; n,Goto(dial,1)

exten =&gt; 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(&quot;SIP/caller-00000000&quot;, &quot;Direct&quot;) in new stack
    -- Executing [direct@default:2] Set(&quot;SIP/caller-00000000&quot;, &quot;CHANNEL(musicclass)=special&quot;) in new stack
    -- Executing [direct@default:3] NoOp(&quot;SIP/caller-00000000&quot;, &quot;musicclass: special&quot;) in new stack
...
    -- Started music on hold, class &#39;special&#39;, on SIP/caller-00000000

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

3:
    -- Executing [localm@default:1] Dial(&quot;SIP/caller-0000000c&quot;, &quot;Local/localm2@default&quot;) in new stack
    -- Executing [localm2@default:1] NoOp(&quot;Local/localm2@default-00000005;2&quot;, &quot;Local, with Master&quot;) in new stack
    -- Called Local/localm2@default
    -- Executing [localm2@default:2] Set(&quot;Local/localm2@default-00000005;2&quot;, &quot;CHANNEL(musicclass,M)=special&quot;) in new stack
    -- Executing [localm2@default:3] NoOp(&quot;Local/localm2@default-00000005;2&quot;, &quot;musicclass: special&quot;) in new stack
...
    -- Move-swap optimizing Local/localm2@default-00000002;1 &lt;-- SIP/victim-00000007.
...
    -- Started music on hold, class &#39;special&#39;, 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>