[svn-commits] oej: branch 1.6.0 r126904 - in /branches/1.6.0: ./ channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jul 1 10:05:20 CDT 2008


Author: oej
Date: Tue Jul  1 10:05:19 2008
New Revision: 126904

URL: http://svn.digium.com/view/asterisk?view=rev&rev=126904
Log:
Merged revisions 126903 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r126903 | oej | 2008-07-01 17:03:59 +0200 (Tis, 01 Jul 2008) | 15 lines

Merged revisions 126902 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r126902 | oej | 2008-07-01 16:59:31 +0200 (Tis, 01 Jul 2008) | 7 lines

Use domain part of SIP uri in register= configuration as fromdomain.

Reported by: one47
Patches: 
      sip-reg-fromdom2.dpatch uploaded by one47 (license 23)
(closes issue #12474)

........

................

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

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_sip.c?view=diff&rev=126904&r1=126903&r2=126904
==============================================================================
--- branches/1.6.0/channels/chan_sip.c (original)
+++ branches/1.6.0/channels/chan_sip.c Tue Jul  1 10:05:19 2008
@@ -9239,6 +9239,7 @@
 	char tmp[80];
 	char addr[80];
 	struct sip_pvt *p;
+	char *fromdomain;
 
 	/* exit if we are already in process with this registrar ?*/
 	if ( r == NULL || ((auth==NULL) && (r->regstate==REG_STATE_REGSENT || r->regstate==REG_STATE_AUTHSENT))) {
@@ -9337,12 +9338,19 @@
 		ast_debug(1, "Scheduled a registration timeout for %s id  #%d \n", r->hostname, r->timeout);
 	}
 
-	if (strchr(r->username, '@')) {
+	if ((fromdomain = strchr(r->username, '@'))) {
+		/* We have a domain in the username for registration */
 		snprintf(from, sizeof(from), "<sip:%s>;tag=%s", r->username, p->tag);
 		if (!ast_strlen_zero(p->theirtag))
 			snprintf(to, sizeof(to), "<sip:%s>;tag=%s", r->username, p->theirtag);
 		else
 			snprintf(to, sizeof(to), "<sip:%s>", r->username);
+
+		/* If the registration username contains '@', then the domain should be used as
+		   the equivalent of "fromdomain" for the registration */
+		if (ast_strlen_zero(p->fromdomain)) {
+			ast_string_field_set(p, fromdomain, ++fromdomain);
+		}
 	} else {
 		snprintf(from, sizeof(from), "<sip:%s@%s>;tag=%s", r->username, p->tohost, p->tag);
 		if (!ast_strlen_zero(p->theirtag))




More information about the svn-commits mailing list