<!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][15110] </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=15110">15110</a></dd>
<dt>Author</dt> <dd>anthm</dd>
<dt>Date</dt> <dd>2009-10-07 17:35:21 -0500 (Wed, 07 Oct 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>auto update displays in more places</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcincludeswitch_callerh">freeswitch/trunk/src/include/switch_caller.h</a></li>
<li><a href="#freeswitchtrunksrcincludeswitch_coreh">freeswitch/trunk/src/include/switch_core.h</a></li>
<li><a href="#freeswitchtrunksrcincludeswitch_ivrh">freeswitch/trunk/src/include/switch_ivr.h</a></li>
<li><a href="#freeswitchtrunksrcmodapplicationsmod_dptoolsmod_dptoolsc">freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_sofiamod_sofiac">freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_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>
<li><a href="#freeswitchtrunksrcswitch_callerc">freeswitch/trunk/src/switch_caller.c</a></li>
<li><a href="#freeswitchtrunksrcswitch_ivr_bridgec">freeswitch/trunk/src/switch_ivr_bridge.c</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcincludeswitch_callerh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/include/switch_caller.h (15109 => 15110)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/include/switch_caller.h        2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/include/switch_caller.h        2009-10-07 22:35:21 UTC (rev 15110)
</span><span class="lines">@@ -67,6 +67,10 @@
</span><span class="cx">         const char *caller_id_name;
</span><span class="cx">         /*! Caller ID Number */
</span><span class="cx">         const char *caller_id_number;
</span><ins>+        /*! Callee ID Name */
+        const char *callee_id_name;
+        /*! Callee ID Number */
+        const char *callee_id_number;
</ins><span class="cx">         uint8_t caller_ton;
</span><span class="cx">         uint8_t caller_numplan;
</span><span class="cx">         /*! Caller Network Address (when applicable) */
</span></span></pre></div>
<a id="freeswitchtrunksrcincludeswitch_coreh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/include/switch_core.h (15109 => 15110)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/include/switch_core.h        2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/include/switch_core.h        2009-10-07 22:35:21 UTC (rev 15110)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx">         const char *_file;
</span><span class="cx">         const char *_func;
</span><span class="cx">         int _line;
</span><del>-
</del><ins>+        const char *string_array_arg[10];
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> /*! \brief A generic object to pass as a thread's session object to allow mutiple arguements and a pool */
</span></span></pre></div>
<a id="freeswitchtrunksrcincludeswitch_ivrh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/include/switch_ivr.h (15109 => 15110)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/include/switch_ivr.h        2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/include/switch_ivr.h        2009-10-07 22:35:21 UTC (rev 15110)
</span><span class="lines">@@ -408,6 +408,8 @@
</span><span class="cx">                                                                                                          switch_originate_flag_t flags
</span><span class="cx">                                                                                                          );
</span><span class="cx">
</span><ins>+SWITCH_DECLARE(void) switch_ivr_bridge_display(switch_core_session_t *session, switch_core_session_t *peer_session);
+
</ins><span class="cx"> /*!
</span><span class="cx"> \brief Bridge Audio from one session to another
</span><span class="cx"> \param session one session
</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 (15109 => 15110)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c        2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c        2009-10-07 22:35:21 UTC (rev 15110)
</span><span class="lines">@@ -792,7 +792,7 @@
</span><span class="cx">         if (switch_strlen_zero(data)) {
</span><span class="cx">                 switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
</span><span class="cx">         } else {
</span><del>-                name = switch_core_session_strdup(session, data);
</del><ins>+                name = switch_core_strdup(caller_profile->pool, data);
</ins><span class="cx">                 val = strchr(name, '=');
</span><span class="cx">
</span><span class="cx">                 if (val) {
</span><span class="lines">@@ -816,6 +816,12 @@
</span><span class="cx">                 if (!strcasecmp(name, "caller_id_number")) {
</span><span class="cx">                         caller_profile->caller_id_number = val;
</span><span class="cx">                 }
</span><ins>+                if (!strcasecmp(name, "callee_id_name")) {
+                        caller_profile->callee_id_name = val;
+                }
+                if (!strcasecmp(name, "callee_id_number")) {
+                        caller_profile->callee_id_number = val;
+                }
</ins><span class="cx">                 if (val && !strcasecmp(name, "caller_ton")) {
</span><span class="cx">                         caller_profile->caller_ton = (uint8_t) atoi(val);
</span><span class="cx">                 }
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiamod_sofiac"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (15109 => 15110)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c        2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c        2009-10-07 22:35:21 UTC (rev 15110)
</span><span class="lines">@@ -175,7 +175,7 @@
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-char * generate_pai_str(switch_core_session_t *session)
</del><ins>+char *generate_pai_str(switch_core_session_t *session)
</ins><span class="cx"> {
</span><span class="cx">         private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
</span><span class="cx">         const char *callee_name = NULL, *callee_number = NULL;
</span><span class="lines">@@ -185,6 +185,12 @@
</span><span class="cx">                 if (!(callee_number = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_number"))) {
</span><span class="cx">                         callee_number = tech_pvt->caller_profile->destination_number;
</span><span class="cx">                 }
</span><ins>+
+                if (!strchr(callee_number, '@')) {
+                        char *tmp = switch_core_session_sprintf(session, "sip:%s@cluecon.com", callee_number);
+                        callee_number = tmp;
+                }
+
</ins><span class="cx">                 pai = switch_core_session_sprintf(tech_pvt->session, "P-Asserted-Identity: \"%s\" <%s>", callee_name, callee_number);
</span><span class="cx">         }
</span><span class="cx">         return pai;
</span><span class="lines">@@ -1257,20 +1263,46 @@
</span><span class="cx">
</span><span class="cx">         case SWITCH_MESSAGE_INDICATE_DISPLAY:
</span><span class="cx">                 {
</span><del>-                        if (!switch_strlen_zero(msg->string_arg)) {
</del><ins>+                        const char *name = msg->string_array_arg[0], *number = msg->string_array_arg[1];
+                        char *arg = NULL;
+                        char *argv[2] = { 0 };
+                        int argc;
+                        
+                        if (switch_strlen_zero(name) && !switch_strlen_zero(msg->string_arg)) {
+                                arg = strdup(msg->string_arg);
+                                switch_assert(arg);
+
+                                argc = switch_separate_string(arg, '|', argv, (sizeof(argv) / sizeof(argv[0])));
+                                name = argv[0];
+                                number = argv[1];
+
+                        }
+
+
+                        if (!switch_strlen_zero(name)) {
</ins><span class="cx">                                 char message[256] = "";
</span><span class="cx">                                 const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
</span><span class="cx">
</span><ins>+                                if (switch_strlen_zero(number)) {
+                                        number = tech_pvt->caller_profile->destination_number;
+                                }
+
</ins><span class="cx">                                 if (ua && switch_stristr("snom", ua)) {
</span><del>-                                        snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", msg->string_arg, tech_pvt->caller_profile->destination_number);
-                                        nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
-                                } else if (ua && switch_stristr("polycom", ua)) {
-                                        snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", msg->string_arg, tech_pvt->caller_profile->destination_number);
</del><ins>+                                        snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", name, number);
+                                        nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+                                                         TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+                                                         SIPTAG_PAYLOAD_STR(message), TAG_END());
+                                } else if (ua && (switch_stristr("polycom", ua) || switch_stristr("FreeSWITCH", ua))) {
+                                        snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", name, number);
</ins><span class="cx">                                         nua_update(tech_pvt->nh,
</span><span class="cx">                                                          TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
</span><ins>+                                                         TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
</ins><span class="cx">                                                          TAG_END());
</span><span class="cx">                                 }
</span><ins>+
</ins><span class="cx">                         }
</span><ins>+
+                        switch_safe_free(arg);
</ins><span class="cx">                 }
</span><span class="cx">                 break;
</span><span class="cx">
</span><span class="lines">@@ -1284,11 +1316,14 @@
</span><span class="cx">
</span><span class="cx">                                 if (ua && switch_stristr("snom", ua)) {
</span><span class="cx">                                         snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", msg->string_arg, tech_pvt->caller_profile->destination_number);
</span><del>-                                        nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
</del><ins>+                                        nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+                                                         TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+                                                         SIPTAG_PAYLOAD_STR(message), TAG_END());
</ins><span class="cx">                                 } else if (ua && switch_stristr("polycom", ua)) {
</span><span class="cx">                                         snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", msg->string_arg, tech_pvt->caller_profile->destination_number);
</span><span class="cx">                                         nua_update(tech_pvt->nh,
</span><span class="cx">                                                          TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
</span><ins>+                                                         TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
</ins><span class="cx">                                                          TAG_END());
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="lines">@@ -1553,6 +1588,10 @@
</span><span class="cx">
</span><span class="cx"> end_lock:
</span><span class="cx">
</span><ins>+        if (msg->message_id == SWITCH_MESSAGE_INDICATE_ANSWER || msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
+                sofia_send_callee_id(session, NULL, NULL);
+        }
+
</ins><span class="cx">         switch_mutex_unlock(tech_pvt->sofia_mutex);
</span><span class="cx">
</span><span class="cx"> end:
</span><span class="lines">@@ -2669,12 +2708,12 @@
</span><span class="cx"> {
</span><span class="cx">         switch_call_cause_t cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
</span><span class="cx">         switch_core_session_t *nsession = NULL;
</span><del>-        char *data, *profile_name, *dest;
</del><ins>+        char *data, *profile_name, *dest, *dest_num = NULL;
</ins><span class="cx">         sofia_profile_t *profile = NULL;
</span><span class="cx">         switch_caller_profile_t *caller_profile = NULL;
</span><span class="cx">         private_object_t *tech_pvt = NULL;
</span><span class="cx">         switch_channel_t *nchannel;
</span><del>-        char *host = NULL, *dest_to = NULL;
</del><ins>+        char *host = NULL, *dest_to = NULL, *p;
</ins><span class="cx">         const char *hval = NULL;
</span><span class="cx">
</span><span class="cx">         *new_session = NULL;
</span><span class="lines">@@ -2894,8 +2933,16 @@
</span><span class="cx">         }
</span><span class="cx">         switch_channel_set_variable(nchannel, "sip_destination_url", tech_pvt->dest);
</span><span class="cx">
</span><ins>+        dest_num = switch_core_session_strdup(nsession, dest);
+        if ((p = strchr(dest_num, ':'))) {
+                dest_num = p + 1;
+                if ((p = strchr(dest_num, '@'))) {
+                        *p = '\0';
+                }
+        }
+
</ins><span class="cx">         caller_profile = switch_caller_profile_clone(nsession, outbound_profile);
</span><del>-        caller_profile->destination_number = switch_core_strdup(caller_profile->pool, dest);
</del><ins>+        caller_profile->destination_number = switch_core_strdup(caller_profile->pool, dest_num);
</ins><span class="cx">         switch_channel_set_caller_profile(nchannel, caller_profile);
</span><span class="cx">         switch_channel_set_flag(nchannel, CF_OUTBOUND);
</span><span class="cx">         sofia_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
</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 (15109 => 15110)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h        2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h        2009-10-07 22:35:21 UTC (rev 15110)
</span><span class="lines">@@ -147,7 +147,8 @@
</span><span class="cx">
</span><span class="cx"> typedef enum {
</span><span class="cx">         MFLAG_REFER = (1 << 0),
</span><del>-        MFLAG_REGISTER = (1 << 1)
</del><ins>+        MFLAG_REGISTER = (1 << 1),
+        MFLAG_UPDATE = (1 << 2)
</ins><span class="cx"> } MFLAGS;
</span><span class="cx">
</span><span class="cx"> typedef enum {
</span><span class="lines">@@ -910,3 +911,6 @@
</span><span class="cx"> switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *user, const char *host, const char *event, const char *contenttype, const char *body, const char *o_contact, const char *network_ip);
</span><span class="cx"> char *sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix);
</span><span class="cx"> void sofia_glue_set_extra_headers(switch_channel_t *channel, sip_t const *sip, const char *prefix);
</span><ins>+void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg);
+void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *profile, sip_t const *sip, switch_bool_t send);
+void sofia_send_callee_id(switch_core_session_t *session, const char *name, const char *number);
</ins></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiasofiac"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (15109 => 15110)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c        2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c        2009-10-07 22:35:21 UTC (rev 15110)
</span><span class="lines">@@ -52,8 +52,8 @@
</span><span class="cx">
</span><span class="cx"> static void set_variable_sip_param(switch_channel_t *channel, char *header_type, sip_param_t const *params);
</span><span class="cx">
</span><del>-static void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg);
</del><span class="cx">
</span><ins>+
</ins><span class="cx"> static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
</span><span class="cx">                                                                          char const *phrase,
</span><span class="cx">                                                                          nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
</span><span class="lines">@@ -376,6 +376,105 @@
</span><span class="cx">         
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void sofia_send_callee_id(switch_core_session_t *session, const char *name, const char *number)
+{
+        const char *uuid;
+        switch_core_session_t *session_b;
+        switch_channel_t *channel = switch_core_session_get_channel(session);
+        switch_caller_profile_t *caller_profile = switch_channel_get_caller_profile(channel);
+
+
+        if (switch_strlen_zero(name)) {
+                name = caller_profile->callee_id_name;
+        }
+
+        if (switch_strlen_zero(number)) {
+                number = caller_profile->callee_id_number;
+        }
+
+        if (switch_strlen_zero(name)) {
+                name = "unknown";
+        }
+        
+        if (switch_strlen_zero(number)) {
+                number = caller_profile->destination_number;
+        }
+        
+        if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (session_b = switch_core_session_locate(uuid))) {
+                switch_core_session_message_t msg = { 0 };
+                
+                msg.message_id = SWITCH_MESSAGE_INDICATE_DISPLAY;
+                msg.string_array_arg[0] = name;
+                msg.string_array_arg[1] = number;
+                msg.from = __FILE__;
+                switch_core_session_receive_message(session_b, &msg);
+                switch_core_session_rwunlock(session_b);
+        }
+}
+
+void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *profile, sip_t const *sip, switch_bool_t send)
+{
+        switch_channel_t *channel = switch_core_session_get_channel(session);
+        sip_p_asserted_identity_t *passerted = NULL;
+        char *name = "unknown";
+        const char *number = "unknown", *tmp;
+        switch_caller_profile_t *caller_profile;
+        char *dup = NULL;
+
+        if (sip->sip_to) {
+                number = sip->sip_to->a_url->url_user;
+        }
+
+        if ((passerted = sip_p_asserted_identity(sip))) {
+                if (passerted->paid_url && passerted->paid_url->url_user) {
+                        number = passerted->paid_url->url_user;
+                }
+                if (!switch_strlen_zero(passerted->paid_display)) {
+                        dup = strdup(passerted->paid_display);
+                        if (*dup == '"') {
+                                name = dup + 1;
+                        } else {
+                                name = dup;
+                        }
+                        if (end_of(name) == '"') {
+                                end_of(name) = '\0';
+                        }
+                }
+        }
+
+        if ((tmp = switch_channel_get_variable(channel, "sip_callee_id_name"))) {
+                name = (char *)tmp;
+        }
+
+        if ((tmp = switch_channel_get_variable(channel, "sip_callee_id_number"))) {
+                number = tmp;
+        }
+
+        caller_profile = switch_channel_get_caller_profile(channel);
+        caller_profile->callee_id_name = switch_core_strdup(caller_profile->pool, name);
+        caller_profile->callee_id_number = switch_core_strdup(caller_profile->pool, number);
+
+        if (send) {
+                sofia_send_callee_id(session, NULL, NULL);
+        }
+
+        switch_safe_free(dup);
+}
+
+
+static void sofia_handle_sip_i_update(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[])
+{
+        if (!(profile->mflags & MFLAG_UPDATE)) {
+                nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
+                return;
+        }
+
+
+        sofia_update_callee_id(session, profile, sip, SWITCH_TRUE);
+}
+
+
+
</ins><span class="cx"> void sofia_event_callback(nua_event_t event,
</span><span class="cx">                                                  int status,
</span><span class="cx">                                                  char const *phrase,
</span><span class="lines">@@ -540,6 +639,9 @@
</span><span class="cx">         case nua_i_info:
</span><span class="cx">                 sofia_handle_sip_i_info(nua, profile, nh, session, sip, tags);
</span><span class="cx">                 break;
</span><ins>+        case nua_i_update:
+                if (session) sofia_handle_sip_i_update(nua, profile, nh, session, sip, tags);
+                break;
</ins><span class="cx">         case nua_r_update:
</span><span class="cx">                 break;
</span><span class="cx">         case nua_r_refer:
</span><span class="lines">@@ -896,7 +998,7 @@
</span><span class="cx">         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created agent for %s\n", profile->name);
</span><span class="cx">
</span><span class="cx">         nua_set_params(profile->nua,
</span><del>-                                 SIPTAG_ALLOW_STR("INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO"),
</del><ins>+                                 SIPTAG_ALLOW_STR("INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO"),
</ins><span class="cx">                                  NUTAG_APPL_METHOD("OPTIONS"),
</span><span class="cx">                                  NUTAG_APPL_METHOD("REFER"),
</span><span class="cx">                                  NUTAG_APPL_METHOD("REGISTER"),
</span><span class="lines">@@ -910,6 +1012,7 @@
</span><span class="cx">                                  NUTAG_ENABLEMESSENGER(1),
</span><span class="cx">                                  TAG_IF((profile->mflags & MFLAG_REGISTER), NUTAG_ALLOW("REGISTER")),
</span><span class="cx">                                  TAG_IF((profile->mflags & MFLAG_REFER), NUTAG_ALLOW("REFER")),
</span><ins>+                                 TAG_IF((profile->mflags & MFLAG_UPDATE), NUTAG_ALLOW("UPDATE")),
</ins><span class="cx">                                  TAG_IF(!sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_ALLOW("PRACK")),
</span><span class="cx">                                  NUTAG_ALLOW("INFO"),
</span><span class="cx">                                  NUTAG_ALLOW("NOTIFY"),
</span><span class="lines">@@ -945,6 +1048,7 @@
</span><span class="cx">                                          NUTAG_AUTOALERT(0),
</span><span class="cx">                                          TAG_IF((profile->mflags & MFLAG_REGISTER), NUTAG_ALLOW("REGISTER")),
</span><span class="cx">                                          TAG_IF((profile->mflags & MFLAG_REFER), NUTAG_ALLOW("REFER")),
</span><ins>+                                         TAG_IF((profile->mflags & MFLAG_UPDATE), NUTAG_ALLOW("UPDATE")),
</ins><span class="cx">                                          NUTAG_ALLOW("INFO"),
</span><span class="cx">                                          TAG_IF(profile->pres_type, NUTAG_ALLOW("PUBLISH")),
</span><span class="cx">                                          TAG_IF(profile->pres_type, NUTAG_ENABLEMESSAGE(1)),
</span><span class="lines">@@ -2172,7 +2276,7 @@
</span><span class="cx">                                 switch_mutex_init(&profile->flag_mutex, SWITCH_MUTEX_NESTED, profile->pool);
</span><span class="cx">                                 profile->dtmf_duration = 100;
</span><span class="cx">                                 profile->tls_version = 0;
</span><del>-                                profile->mflags = MFLAG_REFER | MFLAG_REGISTER;
</del><ins>+                                profile->mflags = MFLAG_REFER | MFLAG_REGISTER | MFLAG_UPDATE;
</ins><span class="cx">                                 profile->rport_level = 1;
</span><span class="cx">                                 sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
</span><span class="cx">                                 sofia_set_pflag(profile, PFLAG_DISABLE_100REL);
</span><span class="lines">@@ -2413,6 +2517,8 @@
</span><span class="cx">                                                 profile->mflags &= ~MFLAG_REFER;
</span><span class="cx">                                         } else if (!strcasecmp(var, "disable-register") && switch_true(val)) {
</span><span class="cx">                                                 profile->mflags &= ~MFLAG_REGISTER;
</span><ins>+                                        } else if (!strcasecmp(var, "disable-update") && switch_true(val)) {
+                                                profile->mflags &= ~MFLAG_UPDATE;
</ins><span class="cx">                                         } else if (!strcasecmp(var, "media-option")) {
</span><span class="cx">                                                 if (!strcasecmp(val, "resume-media-on-hold")) {
</span><span class="cx">                                                         profile->media_options |= MEDIA_OPT_MEDIA_ON_HOLD;
</span><span class="lines">@@ -2996,6 +3102,10 @@
</span><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                         sofia_glue_set_extra_headers(channel, sip, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
</span><ins>+
+                        if (sip_p_asserted_identity(sip)) {
+                                sofia_update_callee_id(session, profile, sip, SWITCH_FALSE);
+                        }
</ins><span class="cx">                 }
</span><span class="cx">                 
</span><span class="cx">                 if (channel && sip && (status == 300 || status == 302 || status == 305) && switch_channel_test_flag(channel, CF_OUTBOUND)) {
</span><span class="lines">@@ -4144,7 +4254,12 @@
</span><span class="cx">                                                                         moh = tmp;
</span><span class="cx">                                                                 }
</span><span class="cx">                                                                 //switch_channel_set_variable(a_channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE, "true");
</span><del>-                                                                switch_channel_set_variable_printf(a_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE, "'endless_playback:%s':inline", moh);
</del><ins>+                                                                if (moh) {
+                                                                        switch_channel_set_variable_printf(a_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE,
+                                                                                                                                         "'endless_playback:%s',park:inline", moh);
+                                                                } else {
+                                                                        switch_channel_set_variable(a_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE, "park:inline");
+                                                                }
</ins><span class="cx">                                                                 //switch_channel_set_variable_printf(a_channel, "park_command", "moh");
</span><span class="cx">                                                                 switch_core_session_rwunlock(a_session);
</span><span class="cx">                                                         }
</span><span class="lines">@@ -4157,8 +4272,8 @@
</span><span class="cx">                                                         
</span><span class="cx">                                                                                         
</span><span class="cx">                                                 } else if (br_a && br_b) {
</span><del>-                                                        switch_core_session_t *new_b_session = NULL, *a_session = NULL, *tmp = NULL;
-                                                
</del><ins>+                                                        switch_core_session_t *tmp = NULL;
+                                                        
</ins><span class="cx">                                                         switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Attended Transfer [%s][%s]\n",
</span><span class="cx">                                                                                          switch_str_nil(br_a),
</span><span class="cx">                                                                                          switch_str_nil(br_b));
</span><span class="lines">@@ -4179,18 +4294,6 @@
</span><span class="cx">                                                         switch_channel_set_variable(channel_b, "park_timeout", "2");
</span><span class="cx">                                                         switch_channel_set_state(channel_b, CS_PARK);
</span><span class="cx">                                                         
</span><del>-
-                                                        new_b_session = switch_core_session_locate(br_b);
-                                                        a_session = switch_core_session_locate(br_a);
-                                                        sofia_info_send_sipfrag(a_session, new_b_session);
-
-                                                        if (new_b_session) {
-                                                                switch_core_session_rwunlock(new_b_session);
-                                                        }
-
-                                                        if (a_session) {
-                                                                switch_core_session_rwunlock(a_session);
-                                                        }
</del><span class="cx">                                                 } else {
</span><span class="cx">                                                         if (!br_a && !br_b) {
</span><span class="cx">                                                                 switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot transfer channels that are not in a bridge.\n");
</span><span class="lines">@@ -5521,7 +5624,7 @@
</span><span class="cx">         nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg)
</del><ins>+void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg)
</ins><span class="cx"> {
</span><span class="cx">         private_object_t *b_tech_pvt = NULL, *a_tech_pvt = NULL;
</span><span class="cx">         char message[256] = "";
</span><span class="lines">@@ -5542,7 +5645,10 @@
</span><span class="cx">                                 } else {
</span><span class="cx">                                         snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", acp->caller_id_name, acp->caller_id_number);
</span><span class="cx">                                 }
</span><del>-                                nua_info(b_tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
</del><ins>+                                nua_info(b_tech_pvt->nh,
+                                                 SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+                                                 TAG_IF(!switch_strlen_zero(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)),
+                                                 SIPTAG_PAYLOAD_STR(message), TAG_END());
</ins><span class="cx">                         } else if (ua && switch_stristr("polycom", ua)) {
</span><span class="cx">                                 if (switch_strlen_zero(acp->caller_id_name)) {
</span><span class="cx">                                         snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", acp->caller_id_number, acp->caller_id_number);
</span><span class="lines">@@ -5551,6 +5657,7 @@
</span><span class="cx">                                 }
</span><span class="cx">                                 nua_update(b_tech_pvt->nh,
</span><span class="cx">                                                  TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
</span><ins>+                                                 TAG_IF(!switch_strlen_zero(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)),
</ins><span class="cx">                                                  TAG_END());
</span><span class="cx">                         }
</span><span class="cx">                 }
</span></span></pre></div>
<a id="freeswitchtrunksrcswitch_callerc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/switch_caller.c (15109 => 15110)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/switch_caller.c        2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/switch_caller.c        2009-10-07 22:35:21 UTC (rev 15110)
</span><span class="lines">@@ -78,7 +78,8 @@
</span><span class="cx">         profile_dup_clean(destination_number, profile->destination_number, pool);
</span><span class="cx">         profile->uuid = SWITCH_BLANK_STRING;
</span><span class="cx">         profile->chan_name = SWITCH_BLANK_STRING;
</span><del>-
</del><ins>+        profile->callee_id_name = SWITCH_BLANK_STRING;
+        profile->callee_id_number = SWITCH_BLANK_STRING;
</ins><span class="cx">         switch_set_flag(profile, SWITCH_CPF_SCREEN);
</span><span class="cx">         profile->pool = pool;
</span><span class="cx">         return profile;
</span><span class="lines">@@ -95,6 +96,8 @@
</span><span class="cx">         profile_dup(tocopy->dialplan, profile->dialplan, pool);
</span><span class="cx">         profile_dup(tocopy->caller_id_name, profile->caller_id_name, pool);
</span><span class="cx">         profile_dup(tocopy->caller_id_number, profile->caller_id_number, pool);
</span><ins>+        profile_dup(tocopy->callee_id_name, profile->callee_id_name, pool);
+        profile_dup(tocopy->callee_id_number, profile->callee_id_number, pool);
</ins><span class="cx">         profile_dup(tocopy->network_addr, profile->network_addr, pool);
</span><span class="cx">         profile_dup(tocopy->ani, profile->ani, pool);
</span><span class="cx">         profile_dup(tocopy->aniii, profile->aniii, pool);
</span><span class="lines">@@ -139,15 +142,21 @@
</span><span class="cx">         if (!strcasecmp(name, "caller_id_name")) {
</span><span class="cx">                 return caller_profile->caller_id_name;
</span><span class="cx">         }
</span><ins>+        if (!strcasecmp(name, "caller_id_number")) {
+                return caller_profile->caller_id_number;
+        }
+        if (!strcasecmp(name, "callee_id_name")) {
+                return caller_profile->callee_id_name;
+        }
+        if (!strcasecmp(name, "callee_id_number")) {
+                return caller_profile->callee_id_number;
+        }
</ins><span class="cx">         if (!strcasecmp(name, "ani")) {
</span><span class="cx">                 return caller_profile->ani;
</span><span class="cx">         }
</span><span class="cx">         if (!strcasecmp(name, "aniii")) {
</span><span class="cx">                 return caller_profile->aniii;
</span><span class="cx">         }
</span><del>-        if (!strcasecmp(name, "caller_id_number")) {
-                return caller_profile->caller_id_number;
-        }
</del><span class="cx">         if (!strcasecmp(name, "network_addr")) {
</span><span class="cx">                 return caller_profile->network_addr;
</span><span class="cx">         }
</span></span></pre></div>
<a id="freeswitchtrunksrcswitch_ivr_bridgec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/switch_ivr_bridge.c (15109 => 15110)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/switch_ivr_bridge.c        2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/switch_ivr_bridge.c        2009-10-07 22:35:21 UTC (rev 15110)
</span><span class="lines">@@ -78,6 +78,58 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+
+static void send_display(switch_core_session_t *session, switch_core_session_t *peer_session) {
+
+        switch_core_session_message_t msg = { 0 };
+        switch_caller_profile_t *caller_profile;
+        switch_channel_t *caller_channel;
+        const char *name, *number;
+
+        caller_channel = switch_core_session_get_channel(session);
+        caller_profile = switch_channel_get_caller_profile(caller_channel);
+
+        if (switch_channel_direction(caller_channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+                name = caller_profile->callee_id_name;
+                number = caller_profile->callee_id_number;
+                
+                if (switch_strlen_zero(name)) {
+                        name = caller_profile->destination_number;
+                }
+                if (switch_strlen_zero(number)) {
+                        number = caller_profile->destination_number;
+                }
+        } else {
+                name = caller_profile->caller_id_name;
+                number = caller_profile->caller_id_number;
+                
+                if (switch_strlen_zero(name)) {
+                        name = caller_profile->destination_number;
+                }
+                if (switch_strlen_zero(number)) {
+                        number = caller_profile->destination_number;
+                }
+        }
+
+
+        msg.message_id = SWITCH_MESSAGE_INDICATE_DISPLAY;
+        msg.string_array_arg[0] = name;
+        msg.string_array_arg[1] = number;
+        msg.from = __FILE__;
+        
+        switch_core_session_receive_message(peer_session, &msg);
+
+}
+
+
+SWITCH_DECLARE(void) switch_ivr_bridge_display(switch_core_session_t *session, switch_core_session_t *peer_session)
+{
+
+        send_display(session, peer_session);
+        send_display(peer_session, session);
+
+}
+
</ins><span class="cx"> struct switch_ivr_bridge_data {
</span><span class="cx">         switch_core_session_t *session;
</span><span class="cx">         char b_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
</span><span class="lines">@@ -838,6 +890,8 @@
</span><span class="cx">                 switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Call has no media... Redirecting to signal bridge.\n");
</span><span class="cx">                 return switch_ivr_signal_bridge(session, peer_session);
</span><span class="cx">         }
</span><ins>+        
+        switch_ivr_bridge_display(session, peer_session);
</ins><span class="cx">
</span><span class="cx">         switch_channel_set_flag(caller_channel, CF_BRIDGE_ORIGINATOR);
</span><span class="cx">
</span><span class="lines">@@ -1084,8 +1138,7 @@
</span><span class="cx">         switch_core_session_t *originator_session, *originatee_session, *swap_session;
</span><span class="cx">         switch_channel_t *originator_channel, *originatee_channel, *swap_channel;
</span><span class="cx">         switch_status_t status = SWITCH_STATUS_FALSE;
</span><del>-        switch_caller_profile_t *cp, *originator_cp, *originatee_cp;
-        char *p;
</del><ins>+        switch_caller_profile_t *originator_cp, *originatee_cp;
</ins><span class="cx">         switch_channel_state_t state;
</span><span class="cx">
</span><span class="cx">         if ((originator_session = switch_core_session_locate(originator_uuid))) {
</span><span class="lines">@@ -1153,26 +1206,8 @@
</span><span class="cx">                         switch_channel_set_variable(originator_channel, "original_caller_id_name", originator_cp->caller_id_name);
</span><span class="cx">                         switch_channel_set_variable(originator_channel, "original_caller_id_number", originator_cp->caller_id_number);
</span><span class="cx">
</span><del>-                        cp = switch_caller_profile_clone(originatee_session, originatee_cp);
-                        cp->destination_number = switch_core_strdup(cp->pool, originator_cp->caller_id_number);
-                        cp->caller_id_number = switch_core_strdup(cp->pool, originator_cp->caller_id_number);
-                        cp->caller_id_name = switch_core_strdup(cp->pool, originator_cp->caller_id_name);
-                        cp->rdnis = switch_core_strdup(cp->pool, originatee_cp->destination_number);
-                        if ((p = strchr(cp->rdnis, '@'))) {
-                                *p = '\0';
-                        }
-                        switch_channel_set_caller_profile(originatee_channel, cp);
</del><ins>+
</ins><span class="cx">                         switch_channel_set_originator_caller_profile(originatee_channel, switch_caller_profile_clone(originatee_session, originator_cp));
</span><del>-
-                        cp = switch_caller_profile_clone(originator_session, originator_cp);
-                        cp->destination_number = switch_core_strdup(cp->pool, originatee_cp->caller_id_number);
-                        cp->caller_id_number = switch_core_strdup(cp->pool, originatee_cp->caller_id_number);
-                        cp->caller_id_name = switch_core_strdup(cp->pool, originatee_cp->caller_id_name);
-                        cp->rdnis = switch_core_strdup(cp->pool, originator_cp->destination_number);
-                        if ((p = strchr(cp->rdnis, '@'))) {
-                                *p = '\0';
-                        }
-                        switch_channel_set_caller_profile(originator_channel, cp);
</del><span class="cx">                         switch_channel_set_originatee_caller_profile(originator_channel, switch_caller_profile_clone(originator_session, originatee_cp));
</span><span class="cx">
</span><span class="cx">                         switch_channel_stop_broadcast(originator_channel);
</span><span class="lines">@@ -1203,6 +1238,8 @@
</span><span class="cx">                         
</span><span class="cx">                         status = SWITCH_STATUS_SUCCESS;
</span><span class="cx">
</span><ins>+                        switch_ivr_bridge_display(originator_session, originatee_session);
+
</ins><span class="cx">                         /* release the read locks we have on the channels */
</span><span class="cx">                         switch_core_session_rwunlock(originator_session);
</span><span class="cx">                         switch_core_session_rwunlock(originatee_session);
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>