[asterisk-commits] mmichelson: trunk r360872 - in /trunk: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 29 18:22:06 CDT 2012


Author: mmichelson
Date: Thu Mar 29 18:22:01 2012
New Revision: 360872

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=360872
Log:
Improve accuracy of identifying information sent in dialog-info SIP NOTIFY requests.

This change makes use of connected party information in addition to caller ID in order
to populate local and remote XML elements in the dialog-info NOTIFYs.

(closes issue ASTERISK-16735)
Reported by: Maciej Krajewski
Tested by: Maciej Krajewski
Patches:
    local_remote_hint2.diff uploaded by Mark Michelson (license 5049)
........

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

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

Modified:
    trunk/   (props changed)
    trunk/channels/chan_sip.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=360872&r1=360871&r2=360872
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Mar 29 18:22:01 2012
@@ -13081,6 +13081,8 @@
 		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
@@ -13090,16 +13092,28 @@
 
 				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", cid_num, p->fromdomain);
-					local_display = ast_strdupa(S_COR(ast_channel_caller(caller)->id.name.valid,
-						ast_channel_caller(caller)->id.name.str, ""));
+					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, ""));
+
 					ast_channel_unlock(caller);
 					caller = ast_channel_unref(caller);
 				}
@@ -13121,10 +13135,10 @@
 						"<target uri=\"%s\"/>\n"
 						"</remote>\n"
 						"<local>\n"
-						"<identity>%s</identity>\n"
+						"<identity display=\"%s\">%s</identity>\n"
 						"<target uri=\"%s\"/>\n"
 						"</local>\n",
-						local_display, local_target, local_target, mto, mto);
+						remote_display, remote_target, remote_target, local_display, local_target, local_target);
 			} else {
 				ast_str_append(tmp, 0, "<dialog id=\"%s\" direction=\"recipient\">\n", exten);
 			}




More information about the asterisk-commits mailing list