[asterisk-commits] file: trunk r114912 - in /trunk: ./ channels/ configs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 30 15:51:18 CDT 2008


Author: file
Date: Wed Apr 30 15:51:17 2008
New Revision: 114912

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114912
Log:
Add support for specifying the registration expiry on a per registration basis in the register line. This comes from a Switchvox patch. (issue AST-24)

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

Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=114912&r1=114911&r2=114912
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Wed Apr 30 15:51:17 2008
@@ -63,6 +63,8 @@
    and restore this performance improvement. Astobj2 refcounting is now used
    for users, peers, and dialogs.  Users are encouraged to assist in regression
    testing and problem reporting!
+ * Added ability to specify registration expiry time on a per registration basis in
+   the register line.
 
 IAX Changes
 -----------

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=114912&r1=114911&r2=114912
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed Apr 30 15:51:17 2008
@@ -6294,7 +6294,7 @@
 	enum sip_transport transport = SIP_TRANSPORT_UDP;
 	char buf[256] = "";
 	char *username = NULL;
-	char *hostname=NULL, *secret=NULL, *authuser=NULL;
+	char *hostname=NULL, *secret=NULL, *authuser=NULL, *expiry=NULL;
 	char *porta=NULL;
 	char *callback=NULL;
 	char *trans=NULL;
@@ -6330,7 +6330,7 @@
 	if (hostname)
 		*hostname++ = '\0';
 	if (ast_strlen_zero(username) || ast_strlen_zero(hostname)) {
-		ast_log(LOG_WARNING, "Format for registration is user[:secret[:authuser]]@host[:port][/contact] at line %d\n", lineno);
+		ast_log(LOG_WARNING, "Format for registration is user[:secret[:authuser]]@host[:port][/contact][~expiry] at line %d\n", lineno);
 		return -1;
 	}
 	/* split user[:secret[:authuser]] */
@@ -6342,6 +6342,9 @@
 			*authuser++ = '\0';
 	}
 	/* split host[:port][/contact] */
+	expiry = strchr(hostname, '~');
+	if (expiry)
+		*expiry++ = '\0';
 	callback = strchr(hostname, '/');
 	if (callback)
 		*callback++ = '\0';
@@ -6380,9 +6383,9 @@
 		ast_string_field_set(reg, secret, secret);
 	reg->transport = transport;
 	reg->expire = -1;
-	reg->expiry = default_expiry;
+	reg->expiry = (expiry ? atoi(expiry) : default_expiry);
 	reg->timeout =  -1;
-	reg->refresh = default_expiry;
+	reg->refresh = reg->expiry;
 	reg->portno = portnum;
 	reg->callid_valid = FALSE;
 	reg->ocseq = INITIAL_CSEQ;

Modified: trunk/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/sip.conf.sample?view=diff&rev=114912&r1=114911&r2=114912
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Wed Apr 30 15:51:17 2008
@@ -390,7 +390,7 @@
 ;----------------------------------------- OUTBOUND SIP REGISTRATIONS  ------------------------
 ; Asterisk can register as a SIP user agent to a SIP proxy (provider)
 ; Format for the register statement is:
-;       register => [transport://]user[:secret[:authuser]]@host[:port][/extension]
+;       register => [transport://]user[:secret[:authuser]]@host[:port][/extension][~expiry]
 ;
 ; 
 ;




More information about the asterisk-commits mailing list