[Asterisk-cvs] asterisk/channels chan_sip.c,1.510.2.7,1.510.2.8

russell at lists.digium.com russell at lists.digium.com
Thu Oct 14 19:07:44 CDT 2004


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

Modified Files:
      Tag: v1-0
	chan_sip.c 
Log Message:
Forget fullcontact when specific number is dialed (bug #2620)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.510.2.7
retrieving revision 1.510.2.8
diff -u -d -r1.510.2.7 -r1.510.2.8
--- chan_sip.c	12 Oct 2004 02:16:04 -0000	1.510.2.7
+++ chan_sip.c	14 Oct 2004 23:08:03 -0000	1.510.2.8
@@ -2017,6 +2017,7 @@
 {
 	struct ast_channel *tmp;
 	int fmt;
+
 	ast_mutex_unlock(&i->lock);
 	/* Don't hold a sip pvt lock while we allocate a channel */
 	tmp = ast_channel_alloc(1);
@@ -3722,9 +3723,11 @@
 	else
 		snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s>;tag=as%08x", n, l, ast_strlen_zero(p->fromdomain) ? ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip) : p->fromdomain, p->tag);
 
+	/* If we're calling a registred SIP peer, use the fullcontact to dial to the peer */
 	if (!ast_strlen_zero(p->fullcontact)) {
 		/* If we have full contact, trust it */
 		strncpy(invite, p->fullcontact, sizeof(invite) - 1);
+	/* Otherwise, use the username while waiting for registration */
 	} else if (!ast_strlen_zero(p->username)) {
 		if (ntohs(p->sa.sin_port) != DEFAULT_SIP_PORT) {
 			snprintf(invite, sizeof(invite), "sip:%s@%s:%d",p->username, p->tohost, ntohs(p->sa.sin_port));
@@ -8048,8 +8051,15 @@
 	else /* UNIDEN bug */
 		snprintf(p->via, sizeof(p->via), "SIP/2.0/UDP %s:%d;branch=z9hG4bK%08x", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip), ourport, p->branch);
 	build_callid(p->callid, sizeof(p->callid), p->ourip, p->fromdomain);
-	if (ext)
+	
+	/* We have an extension to call, don't use the full contact here */
+	/* This to enable dialling registred peers with extension dialling,
+	   like SIP/peername/extension 	
+	   SIP/peername will still use the full contact */
+	if (ext) {
 		strncpy(p->username, ext, sizeof(p->username) - 1);
+		p->fullcontact[0] = 0;	
+	}
 #if 0
 	printf("Setting up to call extension '%s' at '%s'\n", ext ? ext : "<none>", host);
 #endif




More information about the svn-commits mailing list