[svn-commits] oej: trunk r46489 - in /trunk: channels/chan_sip.c configs/sip.conf.sample

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Oct 30 12:56:14 MST 2006


Author: oej
Date: Mon Oct 30 13:56:14 2006
New Revision: 46489

URL: http://svn.digium.com/view/asterisk?rev=46489&view=rev
Log:
Change name of "contact" setting to "callback" which better reflects what it
is to the person that configures asterisk. That we use it internally in the
contact header is a totally different story.

Still not convinced this is a good option.

Modified:
    trunk/channels/chan_sip.c
    trunk/configs/sip.conf.sample

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=46489&r1=46488&r2=46489&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Oct 30 13:56:14 2006
@@ -1125,7 +1125,7 @@
 		AST_STRING_FIELD(hostname);	/*!< Domain or host we register to */
 		AST_STRING_FIELD(secret);	/*!< Password in clear text */	
 		AST_STRING_FIELD(md5secret);	/*!< Password in md5 */
-		AST_STRING_FIELD(contact);	/*!< Contact extension */
+		AST_STRING_FIELD(callback);	/*!< Contact extension */
 		AST_STRING_FIELD(random);
 	);
 	int portno;			/*!<  Optional port override */
@@ -4413,7 +4413,7 @@
 	char username[256] = "";
 	char *hostname=NULL, *secret=NULL, *authuser=NULL;
 	char *porta=NULL;
-	char *contact=NULL;
+	char *callback=NULL;
 
 	if (!value)
 		return -1;
@@ -4435,11 +4435,11 @@
 			*authuser++ = '\0';
 	}
 	/* split host[:port][/contact] */
-	contact = strchr(hostname, '/');
-	if (contact)
-		*contact++ = '\0';
-	if (ast_strlen_zero(contact))
-		contact = "s";
+	callback = strchr(hostname, '/');
+	if (callback)
+		*callback++ = '\0';
+	if (ast_strlen_zero(callback))
+		callback = "s";
 	porta = strchr(hostname, ':');
 	if (porta) {
 		*porta++ = '\0';
@@ -4462,7 +4462,7 @@
 
 	regobjs++;
 	ASTOBJ_INIT(reg);
-	ast_string_field_set(reg, contact, contact);
+	ast_string_field_set(reg, callback, callback);
 	if (username)
 		ast_string_field_set(reg, username, username);
 	if (hostname)
@@ -7156,7 +7156,8 @@
 		if (!ast_strlen_zero(r->username))
 			ast_string_field_set(p, username, r->username);
 		/* Save extension in packet */
-		ast_string_field_set(p, exten, r->contact);
+		if (!ast_strlen_zero(r->callback))
+			ast_string_field_set(p, exten, r->callback);
 
 		/*
 		  check which address we should use in our contact header 
@@ -15643,7 +15644,7 @@
 	time_t regseconds = 0;
 	struct ast_flags peerflags[2] = {{(0)}};
 	struct ast_flags mask[2] = {{(0)}};
-	char contact[256] = "";
+	char callback[256] = "";
 
 
 	if (!realtime)
@@ -15779,8 +15780,8 @@
 			ast_copy_string(peer->language, v->value, sizeof(peer->language));
 		} else if (!strcasecmp(v->name, "regexten")) {
 			ast_copy_string(peer->regexten, v->value, sizeof(peer->regexten));
-		} else if (!strcasecmp(v->name, "contact")) {
-			ast_copy_string(contact, v->value, sizeof(contact));
+		} else if (!strcasecmp(v->name, "callbackextension")) {
+			ast_copy_string(callback, v->value, sizeof(callback));
 		} else if (!strcasecmp(v->name, "call-limit")) {
 			peer->call_limit = atoi(v->value);
 			if (peer->call_limit < 0)
@@ -15873,10 +15874,10 @@
 		reg_source_db(peer);
 	ASTOBJ_UNMARK(peer);
 	ast_free_ha(oldha);
-	if (!ast_strlen_zero(contact)) { /* build string from peer info */
+	if (!ast_strlen_zero(callback)) { /* build string from peer info */
 		char *reg_string;
 
-		asprintf(&reg_string, "%s:%s@%s/%s", peer->username, peer->secret, peer->tohost, contact);
+		asprintf(&reg_string, "%s:%s@%s/%s", peer->username, peer->secret, peer->tohost, callback);
 		if (reg_string) {
 			sip_register(reg_string, 0); /* XXX TODO: count in registry_count */
 			free(reg_string);

Modified: trunk/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/sip.conf.sample?rev=46489&r1=46488&r2=46489&view=diff
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Mon Oct 30 13:56:14 2006
@@ -192,10 +192,10 @@
 ; host is either a host name defined in DNS or the name of a section defined
 ; below.
 ;
-; A similar effect can be achieved by adding a "contact" option in a peer section.
+; A similar effect can be achieved by adding a "callbackextension" option in a peer section.
 ; this is equivalent to having the following line in the general section:
 ;
-;	register => username:secret at host/contact
+;	register => username:secret at host/callbackextension
 ;
 ; and more readable because you don't have to write the parameters in two places
 ; (note that the "port" is ignored - this is a bug that should be fixed).
@@ -450,7 +450,7 @@
 ;                             sendrpid
 ;                             outboundproxy
 ;                             rfc2833compensate
-;                             contact
+;                             callbackextension
 
 ;[sip_proxy]
 ; For incoming calls only. Example: FWD (Free World Dialup)
@@ -479,7 +479,7 @@
 ;host=sip.provider1.com
 ;username=4015552299		; how your provider knows you
 ;secret=youwillneverguessit
-;contact=123			; tell asterisk to register as username:secret at host/contact
+;callbackextension=123		; Register with this server and require calls coming back to this extension
 
 ;------------------------------------------------------------------------------
 ; Definitions of locally connected SIP devices



More information about the svn-commits mailing list