<!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][16004] </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=16004">16004</a></dd>
<dt>Author</dt> <dd>anthm</dd>
<dt>Date</dt> <dd>2009-12-19 11:43:05 -0600 (Sat, 19 Dec 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre><a href="http://jira.freeswitch.org/browse/MODSOFIA-48">MODSOFIA-48</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcmodendpointsmod_sofiamod_sofiac">freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_sofiamod_sofiah">freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h</a></li>
<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_sofiamod_sofiac"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (16003 => 16004)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c        2009-12-18 23:19:53 UTC (rev 16003)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c        2009-12-19 17:43:05 UTC (rev 16004)
</span><span class="lines">@@ -503,16 +503,29 @@
</span><span class="cx">                         /* Send the 200 OK */
</span><span class="cx">                         if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
</span><span class="cx">                                 char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
</span><del>-                                nua_respond(tech_pvt->nh, SIP_200_OK,
-                                                        SIPTAG_CONTACT_STR(tech_pvt->profile->url),
-                                                        SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-                                                        SOATAG_REUSE_REJECTED(1),
-                                                        SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
-                                                        TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
-                                                        TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
-                                                                 SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
-                                                        TAG_END());
</del><span class="cx">
</span><ins>+                                if (sofia_use_soa(tech_pvt)) {
+                                        nua_respond(tech_pvt->nh, SIP_200_OK,
+                                                                SIPTAG_CONTACT_STR(tech_pvt->profile->url),
+                                                                SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                                                                SOATAG_REUSE_REJECTED(1),
+                                                                SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
+                                                                TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+                                                                TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
+                                                                         SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
+                                                                TAG_END());
+                                } else {
+                                        nua_respond(tech_pvt->nh, SIP_200_OK,
+                                                                NUTAG_MEDIA_ENABLE(0),
+                                                                SIPTAG_CONTACT_STR(tech_pvt->profile->url),
+                                                                TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+                                                                SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+                                                                SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str),                                                                
+                                                                TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
+                                                                         SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
+                                                                TAG_END());
+                                }
+
</ins><span class="cx">                                 switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Sent a 200 OK, waiting for ACK\n");
</span><span class="cx">                                 switch_safe_free(extra_headers);
</span><span class="cx">                         }
</span><span class="lines">@@ -590,19 +603,36 @@
</span><span class="cx">
</span><span class="cx">         if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
</span><span class="cx">                 char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
</span><del>-                nua_respond(tech_pvt->nh, SIP_200_OK,
-                                        NUTAG_AUTOANSWER(0),
-                                        TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
-                                        SIPTAG_HEADER_STR(generate_pai_str(session)),
-                                        NUTAG_SESSION_TIMER(session_timeout),
-                                        SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-                                        SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
-                                        SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-                                        SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
-                                        TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
-                                        TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
-                                                 SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
-                                        TAG_END());
</del><ins>+                if (sofia_use_soa(tech_pvt)) {
+                        nua_respond(tech_pvt->nh, SIP_200_OK,
+                                                NUTAG_AUTOANSWER(0),
+                                                TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
+                                                SIPTAG_HEADER_STR(generate_pai_str(session)),
+                                                NUTAG_SESSION_TIMER(session_timeout),
+                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+                                                SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
+                                                SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                                                SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
+                                                TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+                                                TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
+                                                         SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
+                                                TAG_END());
+                } else {
+                        nua_respond(tech_pvt->nh, SIP_200_OK,
+                                                NUTAG_AUTOANSWER(0),
+                                                NUTAG_MEDIA_ENABLE(0),
+                                                TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
+                                                SIPTAG_HEADER_STR(generate_pai_str(session)),
+                                                NUTAG_SESSION_TIMER(session_timeout),
+                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+                                                SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
+                                                SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+                                                SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str),                                                
+                                                TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+                                                TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
+                                                         SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
+                                                TAG_END());
+                }
</ins><span class="cx">                 switch_safe_free(extra_headers);
</span><span class="cx">                 sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
</span><span class="cx">         }
</span><span class="lines">@@ -1235,10 +1265,20 @@
</span><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                         if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
</span><del>-                                nua_respond(tech_pvt->nh, SIP_200_OK,
-                                                        SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-                                                        SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-                                                        SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
</del><ins>+                                if (sofia_use_soa(tech_pvt)) {
+                                        nua_respond(tech_pvt->nh, SIP_200_OK,
+                                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+                                                                SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                                                                SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
+                                                                TAG_END());
+                                } else {
+                                        nua_respond(tech_pvt->nh, SIP_200_OK,
+                                                                NUTAG_MEDIA_ENABLE(0),
+                                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+                                                                SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+                                                                SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str),                                                                
+                                                                TAG_END());
+                                }
</ins><span class="cx">                                 switch_channel_mark_answered(channel);
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="lines">@@ -1604,12 +1644,21 @@
</span><span class="cx">                                                         sofia_glue_tech_patch_sdp(tech_pvt);
</span><span class="cx">                                                         sofia_glue_tech_proxy_remote_addr(tech_pvt);
</span><span class="cx">                                                 }
</span><del>-                                                nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-                                                                        SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-                                                                        SOATAG_REUSE_REJECTED(1),
-                                                                        SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
-                                                                        TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
-                                                                        TAG_END());
</del><ins>+                                                if (sofia_use_soa(tech_pvt)) {
+                                                        nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+                                                                                SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                                                                                SOATAG_REUSE_REJECTED(1),
+                                                                                SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
+                                                                                TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+                                                                                TAG_END());
+                                                } else {
+                                                        nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+                                                                                NUTAG_MEDIA_ENABLE(0),
+                                                                                SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+                                                                                SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str),                                                        
+                                                                                TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+                                                                                TAG_END());
+                                                }
</ins><span class="cx">                                         } else {
</span><span class="cx">                                                 nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
</span><span class="cx">                                                                         TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
</span><span class="lines">@@ -1725,20 +1774,36 @@
</span><span class="cx">
</span><span class="cx">                                 if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
</span><span class="cx">                                         char *extra_header = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
</span><del>-                                        nua_respond(tech_pvt->nh,
-                                                                SIP_183_SESSION_PROGRESS,
-                                                                NUTAG_AUTOANSWER(0),
-                                                                TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
-                                                                SIPTAG_HEADER_STR(generate_pai_str(session)),
-                                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-                                                                SOATAG_REUSE_REJECTED(1),
-                                                                SOATAG_ORDERED_USER(1),
-                                                                SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
-                                                                SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"),
-                                                                TAG_IF(!zstr(extra_header), SIPTAG_HEADER_STR(extra_header)),
-                                                                TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
-                                                                         SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
-                                                                TAG_END());
</del><ins>+                                        if (sofia_use_soa(tech_pvt)) {
+                                                nua_respond(tech_pvt->nh,
+                                                                        SIP_183_SESSION_PROGRESS,
+                                                                        NUTAG_AUTOANSWER(0),
+                                                                        TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
+                                                                        SIPTAG_HEADER_STR(generate_pai_str(session)),
+                                                                        SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+                                                                        SOATAG_REUSE_REJECTED(1),
+                                                                        SOATAG_ORDERED_USER(1),
+                                                                        SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
+                                                                        SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"),
+                                                                        TAG_IF(!zstr(extra_header), SIPTAG_HEADER_STR(extra_header)),
+                                                                        TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
+                                                                                 SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
+                                                                        TAG_END());
+                                        } else {
+                                                nua_respond(tech_pvt->nh,
+                                                                        SIP_183_SESSION_PROGRESS,
+                                                                        NUTAG_AUTOANSWER(0),
+                                                                        NUTAG_MEDIA_ENABLE(0),
+                                                                        TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
+                                                                        SIPTAG_HEADER_STR(generate_pai_str(session)),
+                                                                        SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+                                                                        SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+                                                                        SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str),                                                                        
+                                                                        TAG_IF(!zstr(extra_header), SIPTAG_HEADER_STR(extra_header)),
+                                                                        TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
+                                                                                 SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
+                                                                        TAG_END());
+                                        }
</ins><span class="cx">                                         switch_safe_free(extra_header);
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiamod_sofiah"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (16003 => 16004)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h        2009-12-18 23:19:53 UTC (rev 16003)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h        2009-12-19 17:43:05 UTC (rev 16004)
</span><span class="lines">@@ -254,6 +254,7 @@
</span><span class="cx">         TFLAG_3PCC_HAS_ACK,
</span><span class="cx">         TFLAG_PASS_RFC2833,
</span><span class="cx">         TFLAG_UPDATING_DISPLAY,
</span><ins>+        TFLAG_ENABLE_SOA,
</ins><span class="cx">         /* No new flags below this line */
</span><span class="cx">         TFLAG_MAX
</span><span class="cx"> } TFLAGS;
</span><span class="lines">@@ -835,6 +836,10 @@
</span><span class="cx"> void sofia_reg_release_gateway__(const char *file, const char *func, int line, sofia_gateway_t *gateway);
</span><span class="cx"> #define sofia_reg_release_gateway(x) sofia_reg_release_gateway__(__FILE__, __SWITCH_FUNC__, __LINE__, x);
</span><span class="cx">
</span><ins>+#define sofia_use_soa(_t) (sofia_test_flag(_t, TFLAG_ENABLE_SOA)                \
+                                                 && !switch_channel_test_flag(_t->channel, CF_PROXY_MODE) \
+                                                 && !switch_channel_test_flag(_t->channel, CF_PROXY_MEDIA))
+
</ins><span class="cx"> #define check_decode(_var, _session) do {                                                                \
</span><span class="cx">                 assert(_session);                                                                                                \
</span><span class="cx">                 if (!zstr(_var)) {                                                                \
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiasofiac"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (16003 => 16004)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c        2009-12-18 23:19:53 UTC (rev 16003)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c        2009-12-19 17:43:05 UTC (rev 16004)
</span><span class="lines">@@ -2480,6 +2480,7 @@
</span><span class="cx">                                 sofia_set_pflag(profile, PFLAG_SQL_IN_TRANS);
</span><span class="cx">                                 profile->shutdown_type = "false";
</span><span class="cx">                                 profile->local_network = "localnet.auto";
</span><ins>+                                sofia_set_flag(profile, TFLAG_ENABLE_SOA);
</ins><span class="cx">
</span><span class="cx">                                 for (param = switch_xml_child(settings, "param"); param; param = param->next) {
</span><span class="cx">                                         char *var = (char *) switch_xml_attr_soft(param, "name");
</span><span class="lines">@@ -2914,6 +2915,13 @@
</span><span class="cx">                                                 } else {
</span><span class="cx">                                                         sofia_clear_pflag(profile, PFLAG_SQL_IN_TRANS);
</span><span class="cx">                                                 }
</span><ins>+
+                                        } else if (!strcasecmp(var, "enable-soa")) {
+                                                if (switch_true(val)) {
+                                                        sofia_set_flag(profile, TFLAG_ENABLE_SOA);
+                                                } else {
+                                                        sofia_clear_flag(profile, TFLAG_ENABLE_SOA);
+                                                }
</ins><span class="cx">                                         } else if (!strcasecmp(var, "bitpacking")) {
</span><span class="cx">                                                 if (!strcasecmp(val, "aal2")) {
</span><span class="cx">                                                         profile->codec_flags = SWITCH_CODEC_FLAG_AAL2;
</span><span class="lines">@@ -3736,6 +3744,7 @@
</span><span class="cx">         char st[80] = "";
</span><span class="cx">         int is_dup_sdp = 0;
</span><span class="cx">         switch_event_t *s_event = NULL;
</span><ins>+        char *p;
</ins><span class="cx">
</span><span class="cx">         tl_gets(tags,
</span><span class="cx">                         NUTAG_CALLSTATE_REF(ss_state),
</span><span class="lines">@@ -3745,7 +3754,16 @@
</span><span class="cx">                         NUTAG_ANSWER_SENT_REF(answer_sent),
</span><span class="cx">                         SIPTAG_REPLACES_STR_REF(replaces_str), SOATAG_LOCAL_SDP_STR_REF(l_sdp), SOATAG_REMOTE_SDP_STR_REF(r_sdp), TAG_END());
</span><span class="cx">         
</span><del>-        
</del><ins>+        /* This marr in our code brought to you by people who can't read........*/
+        if (tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_BAD_IANANAME && r_sdp && (p = (char *) switch_stristr("g729a/8000", r_sdp))) {
+                p += 4;
+                *p++ = '/';
+                *p++ = '8';
+                *p++ = '0';
+                *p++ = '0';
+                *p++ = '0';
+                *p++ = ' ';
+        }
</ins><span class="cx">
</span><span class="cx">         if (ss_state == nua_callstate_terminated) {
</span><span class="cx">
</span><span class="lines">@@ -4000,12 +4018,21 @@
</span><span class="cx">                                                 sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
</span><span class="cx">                                                 sofia_set_flag_locked(tech_pvt, TFLAG_3PCC);
</span><span class="cx">                                                 switch_channel_set_state(channel, CS_HIBERNATE);
</span><del>-                                                nua_respond(tech_pvt->nh, SIP_200_OK,
-                                                                        SIPTAG_CONTACT_STR(tech_pvt->profile->url),
-                                                                        SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-                                                                        SOATAG_REUSE_REJECTED(1),
-                                                                        SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
-                                                                        TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
</del><ins>+                                                if (sofia_use_soa(tech_pvt)) {
+                                                        nua_respond(tech_pvt->nh, SIP_200_OK,
+                                                                                SIPTAG_CONTACT_STR(tech_pvt->profile->url),
+                                                                                SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                                                                                SOATAG_REUSE_REJECTED(1),
+                                                                                SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
+                                                                                TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+                                                } else {
+                                                        nua_respond(tech_pvt->nh, SIP_200_OK,
+                                                                                NUTAG_MEDIA_ENABLE(0),
+                                                                                SIPTAG_CONTACT_STR(tech_pvt->profile->url),
+                                                                                SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+                                                                                SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str),
+                                                                                TAG_END());
+                                                }
</ins><span class="cx">                                         } else if (sofia_test_pflag(profile, PFLAG_3PCC_PROXY)) {
</span><span class="cx">                                                 //3PCC proxy mode delays the 200 OK until the call is answered
</span><span class="cx">                                                 switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
</span><span class="lines">@@ -4090,12 +4117,21 @@
</span><span class="cx">                                                         }
</span><span class="cx">                                                         sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
</span><span class="cx">                                                         
</span><del>-                                                        nua_respond(tech_pvt->nh, SIP_200_OK,
-                                                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-                                                                                SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-                                                                                SOATAG_REUSE_REJECTED(1),
-                                                                                SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
-                                                                                TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
</del><ins>+                                                        if (sofia_use_soa(tech_pvt)) {
+                                                                nua_respond(tech_pvt->nh, SIP_200_OK,
+                                                                                        SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+                                                                                        SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                                                                                        SOATAG_REUSE_REJECTED(1),
+                                                                                        SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
+                                                                                        TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+                                                        } else {
+                                                                nua_respond(tech_pvt->nh, SIP_200_OK,
+                                                                                        NUTAG_MEDIA_ENABLE(0),
+                                                                                        SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+                                                                                        SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+                                                                                        SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str),
+                                                                                        TAG_END());
+                                                        }
</ins><span class="cx">                                                         launch_media_on_hold(session);
</span><span class="cx">                                                         
</span><span class="cx">                                                         switch_core_session_rwunlock(other_session);
</span><span class="lines">@@ -4165,13 +4201,20 @@
</span><span class="cx">                                         if (tech_pvt->local_crypto_key) {
</span><span class="cx">                                                 sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
</span><span class="cx">                                         }
</span><del>-                                        nua_respond(tech_pvt->nh, SIP_200_OK,
-                                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-                                                                SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-                                                                SOATAG_REUSE_REJECTED(1),
-                                                                SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
-                                                                TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
-
</del><ins>+                                        if (sofia_use_soa(tech_pvt)) {
+                                                nua_respond(tech_pvt->nh, SIP_200_OK,
+                                                                        SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+                                                                        SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                                                                        SOATAG_REUSE_REJECTED(1),
+                                                                        SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
+                                                                        TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+                                        } else {
+                                                nua_respond(tech_pvt->nh, SIP_200_OK,
+                                                                        NUTAG_MEDIA_ENABLE(0),
+                                                                        SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+                                                                        SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+                                                                        TAG_END());
+                                        }
</ins><span class="cx">                                         if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_REINVITE) == SWITCH_STATUS_SUCCESS) {
</span><span class="cx">                                                 switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(session));
</span><span class="cx">                                                 switch_event_fire(&s_event);
</span><span class="lines">@@ -6127,14 +6170,24 @@
</span><span class="cx">                                         sofia_glue_set_local_sdp(b_tech_pvt, NULL, 0, NULL, 0);
</span><span class="cx">                                 }
</span><span class="cx">
</span><del>-                                nua_update(b_tech_pvt->nh,
-                                                 SIPTAG_CONTACT_STR(b_tech_pvt->reply_contact),
-                                                 SOATAG_USER_SDP_STR(b_tech_pvt->local_sdp_str),
-                                                 SOATAG_REUSE_REJECTED(1),
-                                                 SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
-                                                 TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
-                                                 TAG_IF(!zstr(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)),
-                                                 TAG_END());
</del><ins>+                                if (sofia_use_soa(b_tech_pvt)) {
+                                        nua_update(b_tech_pvt->nh,
+                                                         SIPTAG_CONTACT_STR(b_tech_pvt->reply_contact),
+                                                         SOATAG_USER_SDP_STR(b_tech_pvt->local_sdp_str),
+                                                         SOATAG_REUSE_REJECTED(1),
+                                                         SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
+                                                         TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
+                                                         TAG_IF(!zstr(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)),
+                                                         TAG_END());
+                                } else {
+                                        nua_update(b_tech_pvt->nh,
+                                                         NUTAG_MEDIA_ENABLE(0),
+                                                         SIPTAG_CONTACT_STR(b_tech_pvt->reply_contact),
+                                                         SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+                                                         TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
+                                                         TAG_IF(!zstr(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)),
+                                                         TAG_END());
+                                }
</ins><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                 }
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>