local_clobber true|false (default false)<br><br>whether or not to allow (per-leg) local variables inside [] to take precedence over originate global variables in {}<br><br><br>{foo=value1,local_clobber=false}sofia/internal/<a href="mailto:100@test.com">100@test.com</a>,[foo=value2]sofia/internal/<a href="mailto:101@test.com">101@test.com</a><br>
<br>foo will be value1 on both legs<br><br>{foo=value1,local_clobber=true}sofia/internal/<a href="mailto:100@test.com">100@test.com</a>,[foo=value2]sofia/internal/<a href="mailto:101@test.com">101@test.com</a><br>
<br><br>foo will be value1 on all legs except the 101 who set it to value2<br><br><br><br><br><div class="gmail_quote">On Tue, Jan 26, 2010 at 5:53 AM, Alex To <span dir="ltr"><<a href="mailto:tonhudung@gmail.com">tonhudung@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<div>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Hi,</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Would somebody enlighten me on this trunk of code in the mentioned
file at line 2273:</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal" style="margin-left: 1.5in; text-indent: 0.5in;"><span style="font-size: 10pt; font-family: "Courier New"; color: blue;">if</span><span style="font-size: 10pt; font-family: "Courier New";"> (local_clobber) {</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">if</span> (var_event) {</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_event_t
*<span style="color: blue;">event</span>;</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_event_header_t
*header;</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: green;">/* install the vars from the {} params */</span></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">for</span> (header = var_event->headers; header; header =
header->next) {</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_channel_set_variable(originate_status[i].peer_channel,
header->name, header->value);</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> }</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_event_create(&<span style="color: blue;">event</span>, SWITCH_EVENT_CHANNEL_ORIGINATE);</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_assert(<span style="color: blue;">event</span>);</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_channel_event_set_data(originate_status[i].peer_channel,
<span style="color: blue;">event</span>);</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_event_fire(&<span style="color: blue;">event</span>);</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> }</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> }</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> </span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">if</span> (vdata) {</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">char</span> *var_array[1024] = { 0 };</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">int</span> var_count = 0;</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">if</span> ((var_count = switch_separate_string(vdata, <span style="color: rgb(163, 21, 21);">'|'</span>, var_array, (<span style="color: blue;">sizeof</span>(var_array)
/ <span style="color: blue;">sizeof</span>(var_array[0]))))) {</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">int</span> x = 0;</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">for</span> (x = 0; x < var_count; x++) {</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">char</span> *inner_var_array[2] = { 0 };</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">int</span> inner_var_count;</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">if</span> ((inner_var_count =</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_separate_string(var_array[x],
<span style="color: rgb(163, 21, 21);">'='</span>,</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> inner_var_array,
(<span style="color: blue;">sizeof</span>(inner_var_array) / <span style="color: blue;">sizeof</span>(inner_var_array[0])))) == 2) {</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> </span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_channel_set_variable(originate_status[i].peer_channel,
inner_var_array[0], inner_var_array[1]);</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> }</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> }</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> }</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> }</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> </span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">if</span> (!local_clobber) {</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">if</span> (var_event) {</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_event_t
*<span style="color: blue;">event</span>;</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_event_header_t
*header;</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: green;">/* install the vars from the {} params */</span></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> <span style="color: blue;">for</span> (header = var_event->headers; header; header =
header->next) {</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_channel_set_variable(originate_status[i].peer_channel,
header->name, header->value);</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> }</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_event_create(&<span style="color: blue;">event</span>, SWITCH_EVENT_CHANNEL_ORIGINATE);</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_assert(<span style="color: blue;">event</span>);</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_channel_event_set_data(originate_status[i].peer_channel,
<span style="color: blue;">event</span>);</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> switch_event_fire(&<span style="color: blue;">event</span>);</span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: "Courier New";"> }</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";"> }</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";">The
code block inside <span style="color: blue;">if</span> (local_clobber) and <span style="color: blue;">if</span> (!local_clobber) does exactly the same thing. May
I know is it by design and how does it actually work ? I am not sure what does
it mean by localClobber so if someone can spare sometime explaining, I would
really appreciate it.</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";">Thank
you</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";">Best
Regards</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";"> </span></p><font color="#888888">
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New";">Alex
To</span><span style="font-size: 11pt; color: rgb(31, 73, 125);"></span></p>
</font></div>
</div>
</div>
<br>_______________________________________________<br>
FreeSWITCH-dev mailing list<br>
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:+19193869900<br>