[asterisk-commits] oej: branch oej/fixtoheader-1.2 r50494 - /team/oej/fixtoheader-1.2/channels/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jan 11 02:32:09 MST 2007


Author: oej
Date: Thu Jan 11 03:32:00 2007
New Revision: 50494

URL: http://svn.digium.com/view/asterisk?view=rev&rev=50494
Log:
Someone told me that crashes are not really features, but bugs

Modified:
    team/oej/fixtoheader-1.2/channels/chan_sip.c

Modified: team/oej/fixtoheader-1.2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/channels/chan_sip.c?view=diff&rev=50494&r1=50493&r2=50494
==============================================================================
--- team/oej/fixtoheader-1.2/channels/chan_sip.c (original)
+++ team/oej/fixtoheader-1.2/channels/chan_sip.c Thu Jan 11 03:32:00 2007
@@ -5018,9 +5018,9 @@
 	if (!ast_strlen_zero(p->todnid)) {
 		if (!strchr(p->todnid, '@')) {
 			/* We have no domain in the dnid */
-			snprintf(to, sizeof(to), "<sip:%s@%s>;tag=%s", p->todnid, p->tohost, p->theirtag);
+			snprintf(to, sizeof(to), "<sip:%s@%s>%s%s", p->todnid, p->tohost, ast_strlen_zero(p->theirtag) ? "" : ";tag=", p->theirtag);
 		} else {
-			snprintf(to, sizeof(to), "<sip:%s>;tag=%s", p->todnid, p->theirtag);
+			snprintf(to, sizeof(to), "<sip:%s>%s%s", p->todnid, ast_strlen_zero(p->theirtag) ? "" : ";tag=", p->theirtag);
 		}
 	} else {
 		if (sipmethod == SIP_NOTIFY && !ast_strlen_zero(p->theirtag)) { 
@@ -11901,6 +11901,13 @@
 	/* Save the destination, the SIP dial string */
 	ast_copy_string(tmp, dest, sizeof(tmp));
 
+	/* Find DNID and take it away */
+	dnid = strchr(tmp, '!');
+	if (dnid != NULL) {
+		*dnid++ = '\0';
+		ast_copy_string(p->todnid, dnid, sizeof(p->todnid));
+	}
+
 	/* Find at-sign @ */
 	host = strchr(tmp, '@');	/* Host can be peer name or DNS host name or DNS domain (srv enabled) */
 	/* Old Syntax: SIP/exten at host */
@@ -11909,10 +11916,6 @@
 		*host = '\0';
 		host++;
 		ext = tmp;
-		dnid = strchr(tmp, '!');
-		if (dnid) {
-			*dnid++ = '\0';
-		}
 	} else {
 		/* Old Syntax: SIP/host/exten */
 		/* New Syntax: SIP/host/exten!dnid */
@@ -11926,11 +11929,6 @@
 			host = tmp;
 			ext = NULL;
 		}
-		/* Find DNID */
-		dnid = strchr(ext ? ext : host, '!');
-		if (dnid) {
-			*dnid++ = '\0';
-		}
 	}
 
 
@@ -11939,7 +11937,6 @@
 		ext = extension (user part of URI)
 		dnid = destination of the call (applies to the To: header)
 	*/
-	ast_copy_string(p->todnid, dnid, sizeof(p->todnid));
 	if (create_addr(p, host)) {
 		*cause = AST_CAUSE_UNREGISTERED;
 		sip_destroy(p);



More information about the asterisk-commits mailing list