Revert revision 360862.
authorMark Michelson <mmichelson@digium.com>
Mon, 30 Apr 2012 19:51:55 +0000 (19:51 +0000)
committerMark Michelson <mmichelson@digium.com>
Mon, 30 Apr 2012 19:51:55 +0000 (19:51 +0000)
Revision 360862 was intended to improve identities sent in dialog-info
NOTIFY requests. Some users reported that hint became broken once this
was done. It's not clear exactly what part of the patch has caused this
regression, but broken hints are bad.

For now, this revision is being reverted so that the next releases of
Asterisk do not have bad behavior in them. The original reported issue
will have to be fixed differently in the next version of Asterisk.

(issue ASTERISK-16735)
........

Merged revisions 364706 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 364707 from http://svn.asterisk.org/svn/asterisk/branches/10

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364708 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index ac0c29d..ba0cde2 100644 (file)
@@ -13098,8 +13098,6 @@ static void state_notify_build_xml(int state, int full, const char *exten, const
                if ((state & AST_EXTENSION_RINGING) && sip_cfg.notifyringing) {
                        const char *local_display = exten;
                        char *local_target = ast_strdupa(mto);
-                       const char *remote_display = exten;
-                       char *remote_target = ast_strdupa(mfrom);
 
                        /* There are some limitations to how this works.  The primary one is that the
                           callee must be dialing the same extension that is being monitored.  Simply dialing
@@ -13109,28 +13107,16 @@ static void state_notify_build_xml(int state, int full, const char *exten, const
 
                                if ((caller = ast_channel_callback(find_calling_channel, NULL, p, 0))) {
                                        char *cid_num;
-                                       char *connected_num;
                                        int need;
 
                                        ast_channel_lock(caller);
                                        cid_num = S_COR(ast_channel_caller(caller)->id.number.valid,
                                                ast_channel_caller(caller)->id.number.str, "");
                                        need = strlen(cid_num) + strlen(p->fromdomain) + sizeof("sip:@");
-                                       remote_target = alloca(need);
-                                       snprintf(remote_target, need, "sip:%s@%s", cid_num, p->fromdomain);
-
-                                       remote_display = ast_strdupa(S_COR(ast_channel_caller(caller)->id.name.valid,
-                                               ast_channel_caller(caller)->id.name.str, ""));
-
-                                       connected_num = S_COR(ast_channel_connected(caller)->id.number.valid,
-                                               ast_channel_connected(caller)->id.number.str, "");
-                                       need = strlen(connected_num) + strlen(p->fromdomain) + sizeof("sip:@");
                                        local_target = alloca(need);
-                                       snprintf(local_target, need, "sip:%s@%s", connected_num, p->fromdomain);
-
-                                       local_display = ast_strdupa(S_COR(ast_channel_connected(caller)->id.name.valid,
-                                               ast_channel_connected(caller)->id.name.str, ""));
-
+                                       snprintf(local_target, need, "sip:%s@%s", cid_num, p->fromdomain);
+                                       local_display = ast_strdupa(S_COR(ast_channel_caller(caller)->id.name.valid,
+                                               ast_channel_caller(caller)->id.name.str, ""));
                                        ast_channel_unlock(caller);
                                        caller = ast_channel_unref(caller);
                                }
@@ -13152,10 +13138,10 @@ static void state_notify_build_xml(int state, int full, const char *exten, const
                                                "<target uri=\"%s\"/>\n"
                                                "</remote>\n"
                                                "<local>\n"
-                                               "<identity display=\"%s\">%s</identity>\n"
+                                               "<identity>%s</identity>\n"
                                                "<target uri=\"%s\"/>\n"
                                                "</local>\n",
-                                               remote_display, remote_target, remote_target, local_display, local_target, local_target);
+                                               local_display, local_target, local_target, mto, mto);
                        } else {
                                ast_str_append(tmp, 0, "<dialog id=\"%s\" direction=\"recipient\">\n", exten);
                        }