<!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][16422] </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=16422">16422</a></dd>
<dt>Author</dt> <dd>anthm</dd>
<dt>Date</dt> <dd>2010-01-20 13:09:57 -0600 (Wed, 20 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>add uuid_simplify and sip_auto_simplify</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcincludeswitch_typesh">freeswitch/trunk/src/include/switch_types.h</a></li>
<li><a href="#freeswitchtrunksrcmodapplicationsmod_commandsmod_commandsc">freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c</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="#freeswitchtrunksrcmodendpointsmod_sofiasofia_gluec">freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_sofiasofia_presencec">freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.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 (16421 => 16422)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/include/switch_types.h        2010-01-20 19:05:35 UTC (rev 16421)
+++ freeswitch/trunk/src/include/switch_types.h        2010-01-20 19:09:57 UTC (rev 16422)
</span><span class="lines">@@ -676,7 +676,7 @@
</span><span class="cx">         SWITCH_MESSAGE_INDICATE_AUDIO_SYNC,
</span><span class="cx">         SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA,
</span><span class="cx">         SWITCH_MESSAGE_INDICATE_UUID_CHANGE,
</span><del>-        SWITCH_MESSAGE_INDICATE_SIMPLIFY,
</del><ins>+        SWITCH_MESSAGE_INDICATE_WARNING,
</ins><span class="cx">         SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO,
</span><span class="cx">         SWITCH_MESSAGE_INVALID
</span><span class="cx"> } switch_core_session_message_types_t;
</span></span></pre></div>
<a id="freeswitchtrunksrcmodapplicationsmod_commandsmod_commandsc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (16421 => 16422)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c        2010-01-20 19:05:35 UTC (rev 16421)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c        2010-01-20 19:09:57 UTC (rev 16422)
</span><span class="lines">@@ -2295,22 +2295,28 @@
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#define SIMPLIFY_SYNTAX &quot;&lt;uuid&gt;&quot;
-SWITCH_STANDARD_API(uuid_simplify_function)
</del><ins>+#define WARNING_SYNTAX &quot;&lt;uuid&gt; &lt;warning&gt;&quot;
+SWITCH_STANDARD_API(uuid_warning_function)
</ins><span class="cx"> {
</span><del>-        switch_status_t status = SWITCH_STATUS_SUCCESS;
</del><ins>+        char *mycmd = NULL, *argv[2] = { 0 };
+        int argc = 0;
+        switch_status_t status = SWITCH_STATUS_FALSE;
</ins><span class="cx"> 
</span><del>-        if (zstr(cmd)) {
-                stream-&gt;write_function(stream, &quot;-USAGE: %s\n&quot;, SIMPLIFY_SYNTAX);
</del><ins>+        if (!zstr(cmd) &amp;&amp; (mycmd = strdup(cmd))) {
+                argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+        }
+
+        if (zstr(cmd) || argc &lt; 2 || zstr(argv[0]) || zstr(argv[1])) {
+                stream-&gt;write_function(stream, &quot;-USAGE: %s\n&quot;, WARNING_SYNTAX);
</ins><span class="cx">         } else {
</span><span class="cx">                 switch_core_session_message_t msg = { 0 };
</span><span class="cx">                 switch_core_session_t *lsession = NULL;
</span><span class="cx"> 
</span><del>-                msg.message_id = SWITCH_MESSAGE_INDICATE_SIMPLIFY;
-                msg.string_arg = cmd;
</del><ins>+                msg.message_id = SWITCH_MESSAGE_INDICATE_WARNING;
+                msg.string_arg = argv[1];
</ins><span class="cx">                 msg.from = __FILE__;
</span><span class="cx"> 
</span><del>-                if ((lsession = switch_core_session_locate(cmd))) {
</del><ins>+                if ((lsession = switch_core_session_locate(argv[0]))) {
</ins><span class="cx">                         status = switch_core_session_receive_message(lsession, &amp;msg);
</span><span class="cx">                         switch_core_session_rwunlock(lsession);
</span><span class="cx">                 }
</span><span class="lines">@@ -2322,6 +2328,7 @@
</span><span class="cx">                 stream-&gt;write_function(stream, &quot;-ERR Operation Failed\n&quot;);
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        switch_safe_free(mycmd);
</ins><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -4111,7 +4118,7 @@
</span><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;uuid_setvar_multi&quot;, &quot;uuid_setvar_multi&quot;, uuid_setvar_multi_function, SETVAR_MULTI_SYNTAX);
</span><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;uuid_setvar&quot;, &quot;uuid_setvar&quot;, uuid_setvar_function, SETVAR_SYNTAX);
</span><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;uuid_transfer&quot;, &quot;Transfer a session&quot;, transfer_function, TRANSFER_SYNTAX);
</span><del>-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_simplify&quot;, &quot;Try to cut out of a call path / attended xfer&quot;, uuid_simplify_function, SIMPLIFY_SYNTAX);
</del><ins>+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_warning&quot;, &quot;send popup&quot;, uuid_warning_function, WARNING_SYNTAX);
</ins><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;xml_locate&quot;, &quot;find some xml&quot;, xml_locate_function, &quot;[root | &lt;section&gt; &lt;tag&gt; &lt;tag_attr_name&gt; &lt;tag_attr_val&gt;]&quot;);
</span><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;xml_wrap&quot;, &quot;Wrap another api command in xml&quot;, xml_wrap_api_function, &quot;&lt;command&gt; &lt;args&gt;&quot;);
</span><span class="cx">         switch_console_set_complete(&quot;add alias add&quot;);
</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 (16421 => 16422)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c        2010-01-20 19:05:35 UTC (rev 16421)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c        2010-01-20 19:09:57 UTC (rev 16422)
</span><span class="lines">@@ -758,6 +758,17 @@
</span><span class="cx">         switch_core_session_receive_message(session, &amp;msg);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+SWITCH_STANDARD_APP(warning_function)
+{
+        switch_core_session_message_t msg = { 0 };
+
+        /* Tell the channel to redirect */
+        msg.from = __FILE__;
+        msg.string_arg = data;
+        msg.message_id = SWITCH_MESSAGE_INDICATE_WARNING;
+        switch_core_session_receive_message(session, &amp;msg);
+}
+
</ins><span class="cx"> SWITCH_STANDARD_APP(respond_function)
</span><span class="cx"> {
</span><span class="cx">         switch_core_session_message_t msg = { 0 };
</span><span class="lines">@@ -3027,6 +3038,8 @@
</span><span class="cx">                                    SAF_SUPPORT_NOMEDIA);
</span><span class="cx">         SWITCH_ADD_APP(app_interface, &quot;send_display&quot;, &quot;Send session a new display&quot;, &quot;Send session a new display.&quot;, display_function, &quot;&lt;text&gt;&quot;,
</span><span class="cx">                                    SAF_SUPPORT_NOMEDIA);
</span><ins>+        SWITCH_ADD_APP(app_interface, &quot;send_warning&quot;, &quot;Send session a popup&quot;, &quot;Send session a popup.&quot;, warning_function, &quot;&lt;text&gt;&quot;,
+                                   SAF_SUPPORT_NOMEDIA);
</ins><span class="cx">         SWITCH_ADD_APP(app_interface, &quot;respond&quot;, &quot;Send session respond&quot;, &quot;Send a respond message to a session.&quot;, respond_function, &quot;&lt;respond_data&gt;&quot;,
</span><span class="cx">                                    SAF_SUPPORT_NOMEDIA);
</span><span class="cx">         SWITCH_ADD_APP(app_interface, &quot;deflect&quot;, &quot;Send call deflect&quot;, &quot;Send a call deflect.&quot;, deflect_function, &quot;&lt;deflect_data&gt;&quot;, SAF_SUPPORT_NOMEDIA);
</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 (16421 => 16422)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c        2010-01-20 19:05:35 UTC (rev 16421)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c        2010-01-20 19:09:57 UTC (rev 16422)
</span><span class="lines">@@ -1151,59 +1151,25 @@
</span><span class="cx">                 goto end;
</span><span class="cx"> 
</span><span class="cx">         case SWITCH_MESSAGE_INDICATE_BRIDGE:
</span><del>-                {
-                        const char *network_addr_a, *network_addr_b, *simplify_a, *simplify_b;
-                        int s_ok = 0;
</del><ins>+                if (switch_rtp_ready(tech_pvt-&gt;rtp_session)) {
+                        const char *val;
+                        int ok = 0;
</ins><span class="cx"> 
</span><del>-                        simplify_a = switch_channel_get_variable(channel, &quot;sip_auto_simplify&quot;);
-                        simplify_b = switch_channel_get_variable_partner(channel, &quot;sip_auto_simplify&quot;);
-                        
-                        if (switch_true(simplify_a)) {
-                                if (switch_true(simplify_b) &amp;&amp; !switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
-                                        s_ok = 0;
-                                } else {
-                                        s_ok = 1;
-                                }
</del><ins>+                        if (sofia_test_flag(tech_pvt, TFLAG_PASS_RFC2833) &amp;&amp; switch_channel_test_flag_partner(channel, CF_FS_RTP)) {
+                                switch_rtp_set_flag(tech_pvt-&gt;rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
+                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, &quot;%s activate passthru 2833 mode.\n&quot;, switch_channel_get_name(channel));
</ins><span class="cx">                         }
</span><span class="cx"> 
</span><del>-                        if (s_ok) {
-                                network_addr_a = switch_channel_get_variable(channel, &quot;network_addr&quot;);
-                                network_addr_b = switch_channel_get_variable_partner(channel, &quot;network_addr&quot;);
-                                
-                                if (!zstr(network_addr_a) &amp;&amp; !zstr(network_addr_b) &amp;&amp; !strcmp(network_addr_a, network_addr_b)) {
-                                        if (strcmp(network_addr_a, switch_str_nil(tech_pvt-&gt;profile-&gt;sipip)) &amp;&amp; 
-                                                strcmp(network_addr_a, switch_str_nil(tech_pvt-&gt;profile-&gt;extsipip))) {
-                                                switch_core_session_message_t smsg = { 0 };
-                                        
-                                                smsg.message_id = SWITCH_MESSAGE_INDICATE_SIMPLIFY;
-                                                smsg.from = __FILE__;
-                                                
-                                                status = switch_core_session_receive_message(session, &amp;smsg);
-                                        }
-                                }
</del><ins>+                        if ((val = switch_channel_get_variable(channel, &quot;rtp_autoflush_during_bridge&quot;))) {
+                                ok = switch_true(val);
+                        } else {
+                                ok = sofia_test_pflag(tech_pvt-&gt;profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
</ins><span class="cx">                         }
</span><span class="cx">                         
</span><del>-                        if (switch_rtp_ready(tech_pvt-&gt;rtp_session)) {
-                                const char *val;
-                                int ok = 0;
-
-                                if (sofia_test_flag(tech_pvt, TFLAG_PASS_RFC2833) &amp;&amp; switch_channel_test_flag_partner(channel, CF_FS_RTP)) {
-                                        switch_rtp_set_flag(tech_pvt-&gt;rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
-                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
-                                                                          &quot;%s activate passthru 2833 mode.\n&quot;, switch_channel_get_name(channel));
-                                }
-
-                                if ((val = switch_channel_get_variable(channel, &quot;rtp_autoflush_during_bridge&quot;))) {
-                                        ok = switch_true(val);
-                                } else {
-                                        ok = sofia_test_pflag(tech_pvt-&gt;profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
-                                }
-                        
-                                if (ok) {
-                                        rtp_flush_read_buffer(tech_pvt-&gt;rtp_session, SWITCH_RTP_FLUSH_STICK);
-                                } else {
-                                        rtp_flush_read_buffer(tech_pvt-&gt;rtp_session, SWITCH_RTP_FLUSH_ONCE);
-                                }
</del><ins>+                        if (ok) {
+                                rtp_flush_read_buffer(tech_pvt-&gt;rtp_session, SWITCH_RTP_FLUSH_STICK);
+                        } else {
+                                rtp_flush_read_buffer(tech_pvt-&gt;rtp_session, SWITCH_RTP_FLUSH_ONCE);
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">                 goto end;
</span><span class="lines">@@ -1416,49 +1382,26 @@
</span><span class="cx">                 }
</span><span class="cx">                 break;
</span><span class="cx"> 
</span><del>-        case SWITCH_MESSAGE_INDICATE_SIMPLIFY:
</del><ins>+        case SWITCH_MESSAGE_INDICATE_WARNING:
</ins><span class="cx">                 {
</span><del>-                        char *ref_to, *ref_by;
-                        const char *uuid;
-                        const char *call_id = NULL, *to_user = NULL, *to_host = NULL, *to_tag = NULL, *from_tag = NULL, *from_user, *from_host;
-                        
-                        if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
-                                switch_core_session_t *rsession;
-                                if ((rsession = switch_core_session_locate(uuid))) {
-                                        switch_channel_t *rchannel = switch_core_session_get_channel(rsession);
-                                        call_id = switch_channel_get_variable(rchannel, &quot;sip_call_id&quot;);
-
-                                        to_user = switch_channel_get_variable(rchannel, &quot;sip_to_user&quot;);
-
-                                        if (switch_channel_direction(rchannel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
-                                                to_host = switch_channel_get_variable(rchannel, &quot;sip_to_host&quot;);
-                                                from_user = switch_channel_get_variable(channel, &quot;sip_from_user&quot;);
-                                                from_host = switch_channel_get_variable(channel, &quot;sip_from_host&quot;);
-                                        } else {
-                                                to_host = switch_channel_get_variable(channel, &quot;sip_to_host&quot;);
-                                                from_user = switch_channel_get_variable(rchannel, &quot;sip_from_user&quot;);
-                                                from_host = switch_channel_get_variable(rchannel, &quot;sip_from_host&quot;);
</del><ins>+                        char *message;
+                        if (!zstr(msg-&gt;string_arg)) {
+                                const char *ua = switch_channel_get_variable(tech_pvt-&gt;channel, &quot;sip_user_agent&quot;);
+                                
+                                if (!sofia_test_flag(tech_pvt, TFLAG_UPDATING_DISPLAY)) {
+                                                
+                                        if ((ua &amp;&amp; (switch_stristr(&quot;polycom&quot;, ua)))) {
+                                                message = switch_mprintf(&quot;Warning: 399 devnull \&quot;%s\&quot;&quot;, msg-&gt;string_arg);
+                                                sofia_set_flag_locked(tech_pvt, TFLAG_UPDATING_DISPLAY);
+                                                nua_update(tech_pvt-&gt;nh, 
+                                                                   TAG_IF(!zstr(message), SIPTAG_HEADER_STR(message)),
+                                                                   TAG_IF(!zstr(tech_pvt-&gt;user_via), SIPTAG_VIA_STR(tech_pvt-&gt;user_via)),
+                                                                   TAG_END());
+                                                free(message);
</ins><span class="cx">                                         }
</span><span class="cx"> 
</span><del>-                                        to_tag = switch_channel_get_variable(rchannel, &quot;sip_to_tag&quot;);
-                                        from_tag = switch_channel_get_variable(rchannel, &quot;sip_from_tag&quot;);
-                                        switch_core_session_rwunlock(rsession);
</del><span class="cx">                                 }
</span><span class="cx">                         }
</span><del>-                        
-                        if (to_user &amp;&amp; to_host &amp;&amp; from_user &amp;&amp; from_host &amp;&amp; call_id &amp;&amp; to_tag &amp;&amp; from_tag) {
-                                char in[512] = &quot;&quot;, out[1536] = &quot;&quot;;
-
-                                switch_snprintf(in, sizeof(in), &quot;%s;to-tag=%s;from-tag=%s&quot;, call_id, to_tag, from_tag);
-                                switch_url_encode(in, out, sizeof(out));
-
-                                ref_to = switch_mprintf(&quot;&lt;sip:%s@%s?Replaces=%s&gt;&quot;, to_user, to_host, out); 
-                                ref_by = switch_mprintf(&quot;&lt;sip:%s@%s&gt;&quot;, from_user, from_host);
-
-                                nua_refer(tech_pvt-&gt;nh, SIPTAG_REFER_TO_STR(ref_to), SIPTAG_REFERRED_BY_STR(ref_by), TAG_END());
-                                switch_safe_free(ref_to);
-                                switch_safe_free(ref_by);
-                        }
</del><span class="cx">                 }
</span><span class="cx">                 break;
</span><span class="cx">         case SWITCH_MESSAGE_INDICATE_DISPLAY:
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiasofiac"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (16421 => 16422)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c        2010-01-20 19:05:35 UTC (rev 16421)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c        2010-01-20 19:09:57 UTC (rev 16422)
</span><span class="lines">@@ -4774,40 +4774,6 @@
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-nua_handle_t *sofia_global_nua_handle_by_replaces(sip_replaces_t *replaces)
-{
-        nua_handle_t *nh = NULL;
-        switch_hash_index_t *hi;
-        const void *var;
-    void *val;
-    sofia_profile_t *profile;
-        switch_xml_t xml_root;
-        const char *err;
-
-        if ((xml_root = switch_xml_open_root(1, &amp;err))) {
-                switch_xml_free(xml_root);
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, &quot;Reload XML [%s]\n&quot;, err);
-        }
-
-        switch_mutex_lock(mod_sofia_globals.hash_mutex);
-        if (mod_sofia_globals.profile_hash) {
-        for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
-                        switch_hash_this(hi, &amp;var, NULL, &amp;val);
-            if ((profile = (sofia_profile_t *) val)) {
-                                if (!(nh = nua_handle_by_replaces(profile-&gt;nua, replaces))) {
-                                        nh = nua_handle_by_call_id(profile-&gt;nua, replaces-&gt;rp_call_id);
-                                }
-                                if (nh) break;
-                        }
-                }
-        }
-        switch_mutex_unlock(mod_sofia_globals.hash_mutex);
-        
-        return nh;
-
-}
-
-
</del><span class="cx"> void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[])
</span><span class="cx"> {
</span><span class="cx">         /* Incoming refer */
</span><span class="lines">@@ -4862,7 +4828,7 @@
</span><span class="cx"> 
</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><del>-                        nua_handle_t *bnh = NULL;
</del><ins>+                        nua_handle_t *bnh;
</ins><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">@@ -4882,16 +4848,9 @@
</span><span class="cx">                                         switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, &quot;Memory Error!\n&quot;);
</span><span class="cx">                                         goto done;
</span><span class="cx">                                 }
</span><del>-                                
-                                if ((replaces = sip_replaces_make(home, rep))) {
-                                        if (!(bnh = nua_handle_by_replaces(nua, replaces))) {
-                                                if (!(bnh = nua_handle_by_call_id(nua, replaces-&gt;rp_call_id))) {
-                                                        bnh = sofia_global_nua_handle_by_replaces(replaces);
-                                                }
-                                        }
-                                }
</del><span class="cx"> 
</span><del>-                                if (bnh) {
</del><ins>+                                if ((replaces = sip_replaces_make(home, rep))
+                                        &amp;&amp; (bnh = nua_handle_by_replaces(nua, replaces))) {
</ins><span class="cx">                                         sofia_private_t *b_private = NULL;
</span><span class="cx">                                         private_object_t *b_tech_pvt = NULL;
</span><span class="cx">                                         switch_core_session_t *b_session = NULL;
</span><span class="lines">@@ -6121,12 +6080,8 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (!bnh &amp;&amp; sip-&gt;sip_replaces) {
-                if (!(bnh = nua_handle_by_replaces(nua, sip-&gt;sip_replaces))) {
-                        if (!(bnh = nua_handle_by_call_id(nua, sip-&gt;sip_replaces-&gt;rp_call_id))) {
-                                bnh = sofia_global_nua_handle_by_replaces(sip-&gt;sip_replaces);
-                        }
-                }
</del><ins>+        if (sip-&gt;sip_replaces) {
+                bnh = nua_handle_by_replaces(nua, sip-&gt;sip_replaces);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (bnh) {
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiasofia_gluec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (16421 => 16422)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c        2010-01-20 19:05:35 UTC (rev 16421)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c        2010-01-20 19:09:57 UTC (rev 16422)
</span><span class="lines">@@ -1435,7 +1435,6 @@
</span><span class="cx">         char *route_uri = NULL;
</span><span class="cx">         sofia_destination_t *dst = NULL;
</span><span class="cx">         sofia_cid_type_t cid_type = tech_pvt-&gt;profile-&gt;cid_type;
</span><del>-        char *d_url = NULL, *url = NULL, *dest_host = NULL, *url_str = NULL;
</del><span class="cx"> 
</span><span class="cx">         rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER);
</span><span class="cx"> 
</span><span class="lines">@@ -1452,33 +1451,15 @@
</span><span class="cx">         check_decode(cid_name, session);
</span><span class="cx">         check_decode(cid_num, session);
</span><span class="cx"> 
</span><del>-        if (zstr(tech_pvt-&gt;dest)) {
-                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt-&gt;session), SWITCH_LOG_ERROR, &quot;URL Error!\n&quot;);
-                return SWITCH_STATUS_FALSE;
-        }
-        
-        if ((d_url = sofia_glue_get_url_from_contact(tech_pvt-&gt;dest, 1))) {
-                url = d_url;
-        } else {
-                url = tech_pvt-&gt;dest;
-        }
-        
-        url_str = url;
-
-        if ((dest_host = strchr(url_str, '@'))) {
-                dest_host++;
-        }
-
-
</del><span class="cx">         if (!tech_pvt-&gt;from_str) {
</span><span class="cx">                 const char* sipip;
</span><span class="cx">                 const char* format;
</span><span class="cx">                 const char *alt = NULL;
</span><span class="cx"> 
</span><del>-                sipip = tech_pvt-&gt;profile-&gt;sipip;
-
-                if (sofia_glue_check_nat(tech_pvt-&gt;profile, dest_host)) {
</del><ins>+                if (sofia_glue_check_nat(tech_pvt-&gt;profile, tech_pvt-&gt;remote_ip)) {
</ins><span class="cx">                         sipip = tech_pvt-&gt;profile-&gt;extsipip;
</span><ins>+                } else {
+                        sipip = tech_pvt-&gt;profile-&gt;extsipip ? tech_pvt-&gt;profile-&gt;extsipip : tech_pvt-&gt;profile-&gt;sipip;
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 format = strchr(sipip, ':') ? &quot;\&quot;%s\&quot; &lt;sip:%s%s[%s]&gt;&quot; : &quot;\&quot;%s\&quot; &lt;sip:%s%s%s&gt;&quot;;
</span><span class="lines">@@ -1511,9 +1492,9 @@
</span><span class="cx">         sofia_set_flag_locked(tech_pvt, TFLAG_READY);
</span><span class="cx"> 
</span><span class="cx">         if (!tech_pvt-&gt;nh) {
</span><del>-
</del><ins>+                char *d_url = NULL, *url = NULL;
</ins><span class="cx">                 sofia_private_t *sofia_private;
</span><del>-                char *invite_contact = NULL, *to_str, *use_from_str, *from_str;
</del><ins>+                char *invite_contact = NULL, *to_str, *use_from_str, *from_str, *url_str;
</ins><span class="cx">                 const char *t_var;
</span><span class="cx">                 char *rpid_domain = &quot;cluecon.com&quot;, *p;
</span><span class="cx">                 const char *priv = &quot;off&quot;;
</span><span class="lines">@@ -1526,6 +1507,19 @@
</span><span class="cx">                 const char *from_var = switch_channel_get_variable(tech_pvt-&gt;channel, &quot;sip_from_uri&quot;);
</span><span class="cx">                 const char *from_display = switch_channel_get_variable(tech_pvt-&gt;channel, &quot;sip_from_display&quot;);
</span><span class="cx">                 
</span><ins>+                if (zstr(tech_pvt-&gt;dest)) {
+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt-&gt;session), SWITCH_LOG_ERROR, &quot;URL Error!\n&quot;);
+                        return SWITCH_STATUS_FALSE;
+                }
+
+                if ((d_url = sofia_glue_get_url_from_contact(tech_pvt-&gt;dest, 1))) {
+                        url = d_url;
+                } else {
+                        url = tech_pvt-&gt;dest;
+                }
+
+                url_str = url;
+
</ins><span class="cx">                 if (from_var) {
</span><span class="cx">                         if (strncasecmp(from_var, &quot;sip:&quot;, 4) || strncasecmp(from_var, &quot;sips:&quot;, 5)) {
</span><span class="cx">                                 use_from_str = switch_core_session_strdup(tech_pvt-&gt;session, from_var);
</span><span class="lines">@@ -4007,7 +4001,7 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 free(test_sql);
</span><del>-                test_sql = switch_mprintf(&quot;delete from sip_dialogs where hostname='%q' and expires &gt;= 0&quot;, mod_sofia_globals.hostname);
</del><ins>+                test_sql = switch_mprintf(&quot;delete from sip_dialogs where hostname='%q' and expires &gt; 0&quot;, mod_sofia_globals.hostname);
</ins><span class="cx"> 
</span><span class="cx">                 if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL, NULL) != SWITCH_ODBC_SUCCESS) {
</span><span class="cx">                         switch_odbc_handle_exec(odbc_dbh, &quot;DROP TABLE sip_dialogs&quot;, NULL, NULL);
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiasofia_presencec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (16421 => 16422)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c        2010-01-20 19:05:35 UTC (rev 16421)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c        2010-01-20 19:09:57 UTC (rev 16422)
</span><span class="lines">@@ -1885,10 +1885,6 @@
</span><span class="cx">                 full_from = sip_header_as_string(profile-&gt;home, (void *) sip-&gt;sip_from);
</span><span class="cx">                 full_via = sip_header_as_string(profile-&gt;home, (void *) sip-&gt;sip_via);
</span><span class="cx">                 
</span><del>-                if (sip-&gt;sip_expires-&gt;ex_delta &gt; 31536000) {
-                        sip-&gt;sip_expires-&gt;ex_delta = 31536000;
-                }
-
</del><span class="cx">                 exp_delta = profile-&gt;force_subscription_expires ? profile-&gt;force_subscription_expires : (sip-&gt;sip_expires ? sip-&gt;sip_expires-&gt;ex_delta : 3600);
</span><span class="cx">                 
</span><span class="cx">                 if (exp_delta) {
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>