[Asterisk-cvs] asterisk/channels chan_iax2.c, 1.193, 1.194 chan_sip.c, 1.515, 1.516

markster at lists.digium.com markster at lists.digium.com
Sun Oct 3 10:55:17 CDT 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv22107/channels

Modified Files:
	chan_iax2.c chan_sip.c 
Log Message:
Fix potential callerid snafu's in iax and sip (based on 2562)


Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.193
retrieving revision 1.194
diff -u -d -r1.193 -r1.194
--- chan_iax2.c	3 Oct 2004 04:19:58 -0000	1.193
+++ chan_iax2.c	3 Oct 2004 14:57:01 -0000	1.194
@@ -3604,8 +3604,10 @@
 		return res;
 	if (ies->called_number)
 		strncpy(iaxs[callno]->exten, ies->called_number, sizeof(iaxs[callno]->exten) - 1);
-	if (ies->calling_number) 
+	if (ies->calling_number) {
+		ast_shrink_phone_number(ies->calling_number);
 		strncpy(iaxs[callno]->cid_num, ies->calling_number, sizeof(iaxs[callno]->cid_num) - 1);
+	}
 	if (ies->calling_name)
 		strncpy(iaxs[callno]->cid_name, ies->calling_name, sizeof(iaxs[callno]->cid_name) - 1);
 	if (ies->calling_ani)

Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.515
retrieving revision 1.516
diff -u -d -r1.515 -r1.516
--- chan_sip.c	3 Oct 2004 04:19:58 -0000	1.515
+++ chan_sip.c	3 Oct 2004 14:57:01 -0000	1.516
@@ -2090,7 +2090,7 @@
 		ast_mutex_unlock(&usecnt_lock);
 		strncpy(tmp->context, i->context, sizeof(tmp->context)-1);
 		strncpy(tmp->exten, i->exten, sizeof(tmp->exten)-1);
-		if (!ast_strlen_zero(i->cid_num))
+		if (!ast_strlen_zero(i->cid_num)) 
 			tmp->cid.cid_num = strdup(i->cid_num);
 		if (!ast_strlen_zero(i->cid_name))
 			tmp->cid.cid_name = strdup(i->cid_name);
@@ -5361,6 +5361,7 @@
 	if ((c = strchr(of, ':')))
 		*c = '\0';
 	strncpy(p->cid_num, of, sizeof(p->cid_num) - 1);
+	ast_shrink_phone_number(p->cid_num);
 	if (*calleridname)
 		strncpy(p->cid_name, calleridname, sizeof(p->cid_name) - 1);
 	if (ast_strlen_zero(of))
@@ -5380,6 +5381,7 @@
 		  if (*calleridname)
 		  	strncpy(p->cid_name, calleridname, sizeof(p->cid_name) - 1);
 		  strncpy(p->cid_num, rpid_num, sizeof(p->cid_num) - 1);
+		  ast_shrink_phone_number(p->cid_num);
 		}
 
 		if (p->rtp) {
@@ -5394,8 +5396,10 @@
 			sip_cancel_destroy(p);
 			if (!ast_strlen_zero(user->context))
 				strncpy(p->context, user->context, sizeof(p->context) - 1);
-			if (!ast_strlen_zero(user->cid_num) && !ast_strlen_zero(p->cid_num)) 
+			if (!ast_strlen_zero(user->cid_num) && !ast_strlen_zero(p->cid_num))  {
 				strncpy(p->cid_num, user->cid_num, sizeof(p->cid_num) - 1);
+				ast_shrink_phone_number(p->cid_num);
+			}
 			if (!ast_strlen_zero(user->cid_name) && !ast_strlen_zero(p->cid_name)) 
 				strncpy(p->cid_name, user->cid_name, sizeof(p->cid_name) - 1);
 			strncpy(p->username, user->name, sizeof(p->username) - 1);
@@ -5454,6 +5458,7 @@
 			  if (*calleridname)
 			  	strncpy(p->cid_name, calleridname, sizeof(p->cid_name) - 1);
 			  strncpy(p->cid_num, rpid_num, sizeof(p->cid_num) - 1);
+			  ast_shrink_phone_number(p->cid_num);
 			}
 #ifdef OSP_SUPPORT
 			p->ospauth = peer->ospauth;




More information about the svn-commits mailing list