<!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][14537] </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=14537">14537</a></dd>
<dt>Author</dt> <dd>mrene</dd>
<dt>Date</dt> <dd>2009-08-16 14:01:35 -0500 (Sun, 16 Aug 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>mod_sofia: we need to handle redirects before checking for proxy mode if we want them to work in bypass or proxy media (<a href="http://jira.freeswitch.org/browse/IRC-00">IRC-00</a>)</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcmodendpointsmod_sofiasofiac">freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcmodendpointsmod_sofiasofiac"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (14536 => 14537)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c        2009-08-16 18:05:35 UTC (rev 14536)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c        2009-08-16 19:01:35 UTC (rev 14537)
</span><span class="lines">@@ -2950,115 +2950,7 @@
</span><span class="cx">
</span><span class="cx">                         sofia_glue_set_extra_headers(channel, sip, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
</span><span class="cx">                 }
</span><del>-
-                if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
-
-                        if (!sofia_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
-                                return;
-                        }
-
-                        sofia_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
-
-                        if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
-                                const char *r_sdp = NULL;
-                                switch_core_session_message_t msg = { 0 };
-
-                                if (sip->sip_payload && sip->sip_payload->pl_data &&
-                                        sip->sip_content_type && sip->sip_content_type->c_subtype && switch_stristr("sdp", sip->sip_content_type->c_subtype)) {
-                                        tech_pvt->remote_sdp_str = switch_core_session_strdup(tech_pvt->session, sip->sip_payload->pl_data);
-                                        r_sdp = tech_pvt->remote_sdp_str;
-                                        sofia_glue_tech_proxy_remote_addr(tech_pvt);
-                                }
-
-                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n", status, phrase);
-
-                                msg.message_id = SWITCH_MESSAGE_INDICATE_RESPOND;
-                                msg.from = __FILE__;
-                                msg.numeric_arg = status;
-                                msg.string_arg = switch_core_session_strdup(other_session, phrase);
-                                if (r_sdp) {
-                                        msg.pointer_arg = switch_core_session_strdup(other_session, r_sdp);
-                                        msg.pointer_arg_size = strlen(r_sdp);
-                                }
-                                if (switch_core_session_receive_message(other_session, &msg) != SWITCH_STATUS_SUCCESS) {
-                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Other leg is not available\n");
-                                        nua_respond(tech_pvt->nh, 403, "Hangup in progress", TAG_END());
-                                }
-                                switch_core_session_rwunlock(other_session);
-                        }
-                        return;
-                }
-
-                if ((status == 180 || status == 183 || status == 200)) {
-                        const char *astate = "early";
-                        url_t *from = NULL, *to = NULL, *contact = NULL;
-
-                        if (sip->sip_to) {
-                                to = sip->sip_to->a_url;
-                        }
-                        if (sip->sip_from) {
-                                from = sip->sip_from->a_url;
-                        }
-                        if (sip->sip_contact) {
-                                contact = sip->sip_contact->m_url;
-                        }
-
-                        if (status == 200) {
-                                astate = "confirmed";
-                        }
-
-                        if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED) &&
-                                !switch_channel_test_flag(channel, CF_RING_READY)) {
-                                const char *from_user = "", *from_host = "", *to_user = "", *to_host = "", *contact_user = "", *contact_host = "";
-                                const char *user_agent = "", *call_id = "";
-                                char *sql = NULL;
-
-                                if (sip->sip_user_agent) {
-                                        user_agent = switch_str_nil(sip->sip_user_agent->g_string);
-                                }
-
-                                if (sip->sip_call_id) {
-                                        call_id = switch_str_nil(sip->sip_call_id->i_id);
-                                }
-
-                                if (to) {
-                                        from_user = switch_str_nil(to->url_user);
-                                }
-
-                                if (from) {
-                                        from_host = switch_str_nil(from->url_host);
-                                        to_user = switch_str_nil(from->url_user);
-                                        to_host = switch_str_nil(from->url_host);
-                                }
-
-                                if (contact) {
-                                        contact_user = switch_str_nil(contact->url_user);
-                                        contact_host = switch_str_nil(contact->url_host);
-                                }
-
-                                if (profile->pres_type) {
-                                        sql = switch_mprintf("insert into sip_dialogs "
-                                                                                 "(call_id,uuid,sip_to_user,sip_to_host,sip_from_user,sip_from_host,contact_user,"
-                                                                                 "contact_host,state,direction,user_agent,profile_name,hostname) "
-                                                                                 "values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
-                                                                                 call_id,
-                                                                                 switch_core_session_get_uuid(session),
-                                                                                 to_user, to_host, from_user, from_host, contact_user,
-                                                                                 contact_host, astate, "outbound", user_agent,
-                                                                                 profile->name, mod_sofia_globals.hostname);
-
-                                        switch_assert(sql);
-
-                                        sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
-                                }
-                        } else if (status == 200 && (profile->pres_type)) {
-                                char *sql = NULL;
-                                sql = switch_mprintf("update sip_dialogs set state='%s' where uuid='%s';\n", astate, switch_core_session_get_uuid(session));
-                                switch_assert(sql);
-                                sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
-                        }
-                }
-
</del><ins>+                
</ins><span class="cx">                 if (channel && sip && (status == 300 || status == 302 || status == 305) && switch_channel_test_flag(channel, CF_OUTBOUND)) {
</span><span class="cx">                         sip_contact_t * p_contact = sip->sip_contact;
</span><span class="cx">                         int i = 0;
</span><span class="lines">@@ -3191,6 +3083,116 @@
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><ins>+
+                if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
+
+                        if (!sofia_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
+                                return;
+                        }
+
+                        sofia_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
+
+                        if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
+                                const char *r_sdp = NULL;
+                                switch_core_session_message_t msg = { 0 };
+
+                                if (sip->sip_payload && sip->sip_payload->pl_data &&
+                                        sip->sip_content_type && sip->sip_content_type->c_subtype && switch_stristr("sdp", sip->sip_content_type->c_subtype)) {
+                                        tech_pvt->remote_sdp_str = switch_core_session_strdup(tech_pvt->session, sip->sip_payload->pl_data);
+                                        r_sdp = tech_pvt->remote_sdp_str;
+                                        sofia_glue_tech_proxy_remote_addr(tech_pvt);
+                                }
+
+                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n", status, phrase);
+
+                                msg.message_id = SWITCH_MESSAGE_INDICATE_RESPOND;
+                                msg.from = __FILE__;
+                                msg.numeric_arg = status;
+                                msg.string_arg = switch_core_session_strdup(other_session, phrase);
+                                if (r_sdp) {
+                                        msg.pointer_arg = switch_core_session_strdup(other_session, r_sdp);
+                                        msg.pointer_arg_size = strlen(r_sdp);
+                                }
+                                if (switch_core_session_receive_message(other_session, &msg) != SWITCH_STATUS_SUCCESS) {
+                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Other leg is not available\n");
+                                        nua_respond(tech_pvt->nh, 403, "Hangup in progress", TAG_END());
+                                }
+                                switch_core_session_rwunlock(other_session);
+                        }
+                        return;
+                }
+
+                if ((status == 180 || status == 183 || status == 200)) {
+                        const char *astate = "early";
+                        url_t *from = NULL, *to = NULL, *contact = NULL;
+
+                        if (sip->sip_to) {
+                                to = sip->sip_to->a_url;
+                        }
+                        if (sip->sip_from) {
+                                from = sip->sip_from->a_url;
+                        }
+                        if (sip->sip_contact) {
+                                contact = sip->sip_contact->m_url;
+                        }
+
+                        if (status == 200) {
+                                astate = "confirmed";
+                        }
+
+                        if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED) &&
+                                !switch_channel_test_flag(channel, CF_RING_READY)) {
+                                const char *from_user = "", *from_host = "", *to_user = "", *to_host = "", *contact_user = "", *contact_host = "";
+                                const char *user_agent = "", *call_id = "";
+                                char *sql = NULL;
+
+                                if (sip->sip_user_agent) {
+                                        user_agent = switch_str_nil(sip->sip_user_agent->g_string);
+                                }
+
+                                if (sip->sip_call_id) {
+                                        call_id = switch_str_nil(sip->sip_call_id->i_id);
+                                }
+
+                                if (to) {
+                                        from_user = switch_str_nil(to->url_user);
+                                }
+
+                                if (from) {
+                                        from_host = switch_str_nil(from->url_host);
+                                        to_user = switch_str_nil(from->url_user);
+                                        to_host = switch_str_nil(from->url_host);
+                                }
+
+                                if (contact) {
+                                        contact_user = switch_str_nil(contact->url_user);
+                                        contact_host = switch_str_nil(contact->url_host);
+                                }
+
+                                if (profile->pres_type) {
+                                        sql = switch_mprintf("insert into sip_dialogs "
+                                                                                 "(call_id,uuid,sip_to_user,sip_to_host,sip_from_user,sip_from_host,contact_user,"
+                                                                                 "contact_host,state,direction,user_agent,profile_name,hostname) "
+                                                                                 "values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
+                                                                                 call_id,
+                                                                                 switch_core_session_get_uuid(session),
+                                                                                 to_user, to_host, from_user, from_host, contact_user,
+                                                                                 contact_host, astate, "outbound", user_agent,
+                                                                                 profile->name, mod_sofia_globals.hostname);
+
+                                        switch_assert(sql);
+
+                                        sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+                                }
+                        } else if (status == 200 && (profile->pres_type)) {
+                                char *sql = NULL;
+                                sql = switch_mprintf("update sip_dialogs set state='%s' where uuid='%s';\n", astate, switch_core_session_get_uuid(session));
+                                switch_assert(sql);
+                                sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+                        }
+                }
+
+
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if (!session && (status == 180 || status == 183 || status == 200)) {
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>