[asterisk-commits] kharwell: branch certified-1.8.15 r402470 - in /certified/branches/1.8.15: ./...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 5 09:16:23 CST 2013


Author: kharwell
Date: Tue Nov  5 09:16:21 2013
New Revision: 402470

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402470
Log:
chan_sip: notify dialog info ignores presentation indicator in callerid

The presentation indicator in a callerid (e.g. set by dialplan function
Set(CALLERID(name-pres)= ...)) is not checked when SIP Dialog Info Notifies
are generated during extension monitoring.  Added a check to make sure the
name and/or number presentations on the callee (remote identity) are set to
allow.  If they are restricted then "anonymous" is used instead.

(closes issue AST-1175)
Reported by: Thomas Arimont
Review: https://reviewboard.asterisk.org/r/2976/
........

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

Modified:
    certified/branches/1.8.15/   (props changed)
    certified/branches/1.8.15/channels/chan_sip.c

Propchange: certified/branches/1.8.15/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: certified/branches/1.8.15/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/1.8.15/channels/chan_sip.c?view=diff&rev=402470&r1=402469&r2=402470
==============================================================================
--- certified/branches/1.8.15/channels/chan_sip.c (original)
+++ certified/branches/1.8.15/channels/chan_sip.c Tue Nov  5 09:16:21 2013
@@ -5473,6 +5473,7 @@
 	dialog->chanvars = copy_vars(peer->chanvars);
 	if (peer->fromdomainport)
 		dialog->fromdomainport = peer->fromdomainport;
+	dialog->callingpres = peer->callingpres;
 
 	return 0;
 }
@@ -12877,29 +12878,51 @@
 				struct ast_channel *caller;
 
 				if ((caller = ast_channel_callback(find_calling_channel, NULL, p, 0))) {
+					static char *anonymous = "anonymous";
+					static char *invalid = "anonymous.invalid";
 					char *cid_num;
 					char *connected_num;
 					int need;
+					int cid_num_restricted, connected_num_restricted;
 
 					ast_channel_lock(caller);
+
+					cid_num_restricted = (caller->caller.id.number.presentation &
+								   AST_PRES_RESTRICTION) == AST_PRES_RESTRICTED;
 					cid_num = S_COR(caller->caller.id.number.valid,
-						caller->caller.id.number.str, "");
-					need = strlen(cid_num) + strlen(p->fromdomain) + sizeof("sip:@");
+							S_COR(cid_num_restricted, anonymous,
+							      caller->caller.id.number.str), "");
+
+					need = strlen(cid_num) + (cid_num_restricted ? strlen(invalid) :
+								  strlen(p->fromdomain)) + sizeof("sip:@");
+
 					remote_target = alloca(need);
-					snprintf(remote_target, need, "sip:%s@%s", cid_num, p->fromdomain);
+					snprintf(remote_target, need, "sip:%s@%s", cid_num,
+						 cid_num_restricted ? invalid : p->fromdomain);
 
 					ast_xml_escape(S_COR(caller->caller.id.name.valid,
-							     caller->caller.id.name.str, ""),
+							     S_COR((caller->caller.id.name.presentation &
+								     AST_PRES_RESTRICTION) == AST_PRES_RESTRICTED, anonymous,
+								   caller->caller.id.name.str), ""),
 						       remote_display, sizeof(remote_display));
 
+					connected_num_restricted = (caller->connected.id.number.presentation &
+								    AST_PRES_RESTRICTION) == AST_PRES_RESTRICTED;
 					connected_num = S_COR(caller->connected.id.number.valid,
-						caller->connected.id.number.str, "");
-					need = strlen(connected_num) + strlen(p->fromdomain) + sizeof("sip:@");
+							      S_COR(connected_num_restricted, anonymous,
+								    caller->connected.id.number.str), "");
+
+					need = strlen(connected_num) + (connected_num_restricted ? strlen(invalid) :
+									strlen(p->fromdomain)) + sizeof("sip:@");
 					local_target = alloca(need);
-					snprintf(local_target, need, "sip:%s@%s", connected_num, p->fromdomain);
+
+					snprintf(local_target, need, "sip:%s@%s", connected_num,
+						 connected_num_restricted ? invalid : p->fromdomain);
 
 					ast_xml_escape(S_COR(caller->connected.id.name.valid,
-							     caller->connected.id.name.str, ""),
+							     S_COR((caller->connected.id.name.presentation &
+								     AST_PRES_RESTRICTION) == AST_PRES_RESTRICTED, anonymous,
+								    caller->connected.id.name.str), ""),
 						       local_display, sizeof(local_display));
 
 					ast_channel_unlock(caller);




More information about the asterisk-commits mailing list