<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][15404] </title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=15404">15404</a></dd>
<dt>Author</dt> <dd>anthm</dd>
<dt>Date</dt> <dd>2009-11-09 17:49:35 -0600 (Mon, 09 Nov 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>fix issue with global bypass_media_after_bridge messing up callflow</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcincludeswitch_typesh">freeswitch/trunk/src/include/switch_types.h</a></li>
<li><a href="#freeswitchtrunksrcmodapplicationsmod_dptoolsmod_dptoolsc">freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_sofiamod_sofiac">freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_sofiasofiac">freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c</a></li>
<li><a href="#freeswitchtrunksrcswitch_eventc">freeswitch/trunk/src/switch_event.c</a></li>
<li><a href="#freeswitchtrunksrcswitch_ivr_bridgec">freeswitch/trunk/src/switch_ivr_bridge.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcincludeswitch_typesh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/include/switch_types.h (15403 => 15404)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/include/switch_types.h        2009-11-09 22:26:28 UTC (rev 15403)
+++ freeswitch/trunk/src/include/switch_types.h        2009-11-09 23:49:35 UTC (rev 15404)
</span><span class="lines">@@ -929,6 +929,7 @@
</span><span class="cx">         CF_NOT_READY,
</span><span class="cx">         CF_SIGNAL_BRIDGE_TTL,
</span><span class="cx">         CF_MEDIA_BRIDGE_TTL,
</span><ins>+        CF_BYPASS_MEDIA_AFTER_BRIDGE,
</ins><span class="cx">         /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
</span><span class="cx">         CF_FLAG_MAX
</span><span class="cx"> } switch_channel_flag_t;
</span></span></pre></div>
<a id="freeswitchtrunksrcmodapplicationsmod_dptoolsmod_dptoolsc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (15403 => 15404)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c        2009-11-09 22:26:28 UTC (rev 15403)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c        2009-11-09 23:49:35 UTC (rev 15404)
</span><span class="lines">@@ -2144,7 +2144,7 @@
</span><span class="cx"> {
</span><span class="cx">         switch_channel_t *caller_channel = switch_core_session_get_channel(session);
</span><span class="cx">         switch_core_session_t *peer_session = NULL;
</span><del>-        const char *continue_on_fail = NULL, *failure_causes = NULL, 
</del><ins>+        const char *continue_on_fail = NULL, *failure_causes = NULL,
</ins><span class="cx">                 *v_campon = NULL, *v_campon_retries, *v_campon_sleep, *v_campon_timeout, *v_campon_fallback_exten = NULL;
</span><span class="cx">         switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
</span><span class="cx">         int campon_retries = 100, campon_timeout = 10, campon_sleep = 10, tmp, camping = 0, fail = 0, thread_started = 0;
</span><span class="lines">@@ -2383,6 +2383,10 @@
</span><span class="cx">                                 b_key = NULL;
</span><span class="cx">                         }
</span><span class="cx"> 
</span><ins>+                        if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE))) {
+                                switch_channel_set_flag(caller_channel, CF_BYPASS_MEDIA_AFTER_BRIDGE);
+                        }
+
</ins><span class="cx">                         switch_ivr_multi_threaded_bridge(session, peer_session, func, a_key, a_key);
</span><span class="cx">                 }
</span><span class="cx">                 
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiamod_sofiac"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (15403 => 15404)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c        2009-11-09 22:26:28 UTC (rev 15403)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c        2009-11-09 23:49:35 UTC (rev 15404)
</span><span class="lines">@@ -727,7 +727,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         while (!(tech_pvt-&gt;read_codec.implementation &amp;&amp; switch_rtp_ready(tech_pvt-&gt;rtp_session) &amp;&amp; !switch_channel_test_flag(channel, CF_REQ_MEDIA))) {
</span><del>-                if (--sanity &amp;&amp; switch_channel_ready(channel)) {
</del><ins>+                if (--sanity &amp;&amp; switch_channel_up(channel)) {
</ins><span class="cx">                         switch_yield(10000);
</span><span class="cx">                 } else {
</span><span class="cx">                         switch_channel_hangup(tech_pvt-&gt;channel, SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE);
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiasofiac"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (15403 => 15404)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c        2009-11-09 22:26:28 UTC (rev 15403)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c        2009-11-09 23:49:35 UTC (rev 15404)
</span><span class="lines">@@ -3922,7 +3922,7 @@
</span><span class="cx">                                                                                 SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX(&quot;cn telephone-event&quot;), 
</span><span class="cx">                                                                                 TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
</span><span class="cx">                                                         launch_media_on_hold(session);
</span><del>-
</del><ins>+                                                        
</ins><span class="cx">                                                         switch_core_session_rwunlock(other_session);
</span><span class="cx">                                                         goto done;
</span><span class="cx">                                                 }
</span><span class="lines">@@ -4391,14 +4391,6 @@
</span><span class="cx">                 if (refer_to-&gt;r_url-&gt;url_headers &amp;&amp; (rep = (char *)switch_stristr(&quot;Replaces=&quot;, refer_to-&gt;r_url-&gt;url_headers))) {
</span><span class="cx">                         sip_replaces_t *replaces;
</span><span class="cx">                         nua_handle_t *bnh;
</span><del>-
-                        if (switch_channel_test_flag(channel_a, CF_PROXY_MODE)) {
-                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, &quot;Cannot Attended Transfer BYPASS MEDIA CALLS!\n&quot;);
-                                switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, &quot;ATTENDED_TRANSFER_ERROR&quot;);
-                                nua_notify(tech_pvt-&gt;nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR(&quot;message/sipfrag&quot;),
-                                                   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR(&quot;SIP/2.0 403 Forbidden&quot;), SIPTAG_EVENT_STR(etmp), TAG_END());
-                                goto done;
-                        }
</del><span class="cx">                         
</span><span class="cx">                         if (rep) {
</span><span class="cx">                                 const char *br_a = NULL, *br_b = NULL;
</span><span class="lines">@@ -4515,7 +4507,7 @@
</span><span class="cx"> 
</span><span class="cx">                                                         if ((profile-&gt;media_options &amp; MEDIA_OPT_BYPASS_AFTER_ATT_XFER) &amp;&amp; (tmp = switch_core_session_locate(br_b))) {
</span><span class="cx">                                                                 switch_channel_t *tchannel = switch_core_session_get_channel(tmp);
</span><del>-                                                                switch_channel_set_variable(tchannel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE, &quot;true&quot;);
</del><ins>+                                                                switch_channel_set_flag(tchannel, CF_BYPASS_MEDIA_AFTER_BRIDGE);
</ins><span class="cx">                                                                 switch_core_session_rwunlock(tmp);
</span><span class="cx">                                                         }
</span><span class="cx">                                                         
</span></span></pre></div>
<a id="freeswitchtrunksrcswitch_eventc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/switch_event.c (15403 => 15404)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/switch_event.c        2009-11-09 22:26:28 UTC (rev 15403)
+++ freeswitch/trunk/src/switch_event.c        2009-11-09 23:49:35 UTC (rev 15404)
</span><span class="lines">@@ -884,6 +884,9 @@
</span><span class="cx">         (*event)-&gt;bind_user_data = todup-&gt;bind_user_data;
</span><span class="cx"> 
</span><span class="cx">         for (hp = todup-&gt;headers; hp; hp = hp-&gt;next) {
</span><ins>+                if (todup-&gt;subclass_name &amp;&amp; !strcmp(hp-&gt;name, &quot;Event-Subclass&quot;)) {
+                        continue;
+                }
</ins><span class="cx">                 switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, hp-&gt;name, hp-&gt;value);
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunksrcswitch_ivr_bridgec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/switch_ivr_bridge.c (15403 => 15404)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/switch_ivr_bridge.c        2009-11-09 22:26:28 UTC (rev 15403)
+++ freeswitch/trunk/src/switch_ivr_bridge.c        2009-11-09 23:49:35 UTC (rev 15404)
</span><span class="lines">@@ -165,13 +165,12 @@
</span><span class="cx">         switch_codec_t silence_codec = { 0 };
</span><span class="cx">         switch_frame_t silence_frame = { 0 };
</span><span class="cx">         int16_t silence_data[SWITCH_RECOMMENDED_BUFFER_SIZE/2] = { 0 };
</span><del>-        const char *silence_var, *var;
</del><ins>+        const char *silence_var;
</ins><span class="cx">         int silence_val = 0, bypass_media_after_bridge = 0;
</span><span class="cx">         const char *bridge_answer_timeout = NULL;
</span><span class="cx">         int answer_timeout, sent_update = 0;
</span><span class="cx">         time_t answer_limit = 0;
</span><span class="cx">         
</span><del>-
</del><span class="cx"> #ifdef SWITCH_VIDEO_IN_THREADS
</span><span class="cx">         struct vid_helper vh = { 0 };
</span><span class="cx">         uint32_t vid_launch = 0;
</span><span class="lines">@@ -190,6 +189,9 @@
</span><span class="cx">         chan_a = switch_core_session_get_channel(session_a);
</span><span class="cx">         chan_b = switch_core_session_get_channel(session_b);
</span><span class="cx"> 
</span><ins>+        bypass_media_after_bridge = switch_channel_test_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE);
+        switch_channel_clear_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE);
+
</ins><span class="cx">         ans_a = switch_channel_test_flag(chan_a, CF_ANSWERED);
</span><span class="cx"> 
</span><span class="cx">         if ((originator = switch_channel_test_flag(chan_a, CF_BRIDGE_ORIGINATOR))) {
</span><span class="lines">@@ -220,13 +222,11 @@
</span><span class="cx">                 goto end_of_bridge_loop;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if ((var = switch_channel_get_variable(chan_a, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE)) &amp;&amp; switch_true(var)) {
</del><ins>+        if (bypass_media_after_bridge) {
</ins><span class="cx">                 if (switch_stristr(&quot;loopback&quot;, switch_channel_get_name(chan_a)) || switch_stristr(&quot;loopback&quot;, switch_channel_get_name(chan_b))) {
</span><span class="cx">                         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, &quot;Cannot bypass media while bridged to a loopback address.\n&quot;);
</span><del>-                } else {
-                        switch_channel_set_variable(chan_a, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE, NULL);
</del><ins>+                        bypass_media_after_bridge = 0;
</ins><span class="cx">                 }
</span><del>-                bypass_media_after_bridge = 1;
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ((silence_var = switch_channel_get_variable(chan_a, &quot;bridge_generate_comfort_noise&quot;))) {                
</span><span class="lines">@@ -330,10 +330,11 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">                 if (loop_count &gt; DEFAULT_LEAD_FRAMES &amp;&amp; switch_channel_media_ack(chan_a) &amp;&amp; 
</span><del>-                        bypass_media_after_bridge &amp;&amp; switch_channel_test_flag(chan_a, CF_ANSWERED) &amp;&amp; 
</del><ins>+                        (bypass_media_after_bridge || switch_channel_test_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE)) &amp;&amp; switch_channel_test_flag(chan_a, CF_ANSWERED) &amp;&amp; 
</ins><span class="cx">                         switch_channel_test_flag(chan_b, CF_ANSWERED)) {
</span><span class="cx">                         switch_ivr_nomedia(switch_core_session_get_uuid(session_a), SMF_REBRIDGE);
</span><span class="cx">                         bypass_media_after_bridge = 0;
</span><ins>+                        switch_channel_clear_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE);
</ins><span class="cx">                 }
</span><span class="cx">                 
</span><span class="cx">                 /* if 1 channel has DTMF pass it to the other */
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>