Skip to content
Snippets Groups Projects
Commit f4237076 authored by Joshua Colp's avatar Joshua Colp
Browse files

Add support for specifying the registration expiry on a per registration basis...

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)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114912 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent e37dafdd
No related branches found
No related tags found
No related merge requests found
...@@ -63,6 +63,8 @@ SIP Changes ...@@ -63,6 +63,8 @@ SIP Changes
and restore this performance improvement. Astobj2 refcounting is now used and restore this performance improvement. Astobj2 refcounting is now used
for users, peers, and dialogs. Users are encouraged to assist in regression for users, peers, and dialogs. Users are encouraged to assist in regression
testing and problem reporting! testing and problem reporting!
* Added ability to specify registration expiry time on a per registration basis in
the register line.
IAX Changes IAX Changes
----------- -----------
......
...@@ -6294,7 +6294,7 @@ static int sip_register(const char *value, int lineno) ...@@ -6294,7 +6294,7 @@ static int sip_register(const char *value, int lineno)
enum sip_transport transport = SIP_TRANSPORT_UDP; enum sip_transport transport = SIP_TRANSPORT_UDP;
char buf[256] = ""; char buf[256] = "";
char *username = NULL; char *username = NULL;
char *hostname=NULL, *secret=NULL, *authuser=NULL; char *hostname=NULL, *secret=NULL, *authuser=NULL, *expiry=NULL;
char *porta=NULL; char *porta=NULL;
char *callback=NULL; char *callback=NULL;
char *trans=NULL; char *trans=NULL;
...@@ -6330,7 +6330,7 @@ static int sip_register(const char *value, int lineno) ...@@ -6330,7 +6330,7 @@ static int sip_register(const char *value, int lineno)
if (hostname) if (hostname)
*hostname++ = '\0'; *hostname++ = '\0';
if (ast_strlen_zero(username) || ast_strlen_zero(hostname)) { 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; return -1;
} }
/* split user[:secret[:authuser]] */ /* split user[:secret[:authuser]] */
...@@ -6342,6 +6342,9 @@ static int sip_register(const char *value, int lineno) ...@@ -6342,6 +6342,9 @@ static int sip_register(const char *value, int lineno)
*authuser++ = '\0'; *authuser++ = '\0';
} }
/* split host[:port][/contact] */ /* split host[:port][/contact] */
expiry = strchr(hostname, '~');
if (expiry)
*expiry++ = '\0';
callback = strchr(hostname, '/'); callback = strchr(hostname, '/');
if (callback) if (callback)
*callback++ = '\0'; *callback++ = '\0';
...@@ -6380,9 +6383,9 @@ static int sip_register(const char *value, int lineno) ...@@ -6380,9 +6383,9 @@ static int sip_register(const char *value, int lineno)
ast_string_field_set(reg, secret, secret); ast_string_field_set(reg, secret, secret);
reg->transport = transport; reg->transport = transport;
reg->expire = -1; reg->expire = -1;
reg->expiry = default_expiry; reg->expiry = (expiry ? atoi(expiry) : default_expiry);
reg->timeout = -1; reg->timeout = -1;
reg->refresh = default_expiry; reg->refresh = reg->expiry;
reg->portno = portnum; reg->portno = portnum;
reg->callid_valid = FALSE; reg->callid_valid = FALSE;
reg->ocseq = INITIAL_CSEQ; reg->ocseq = INITIAL_CSEQ;
......
...@@ -390,7 +390,7 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ...@@ -390,7 +390,7 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls
;----------------------------------------- OUTBOUND SIP REGISTRATIONS ------------------------ ;----------------------------------------- OUTBOUND SIP REGISTRATIONS ------------------------
; Asterisk can register as a SIP user agent to a SIP proxy (provider) ; Asterisk can register as a SIP user agent to a SIP proxy (provider)
; Format for the register statement is: ; Format for the register statement is:
; register => [transport://]user[:secret[:authuser]]@host[:port][/extension] ; register => [transport://]user[:secret[:authuser]]@host[:port][/extension][~expiry]
; ;
; ;
; ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment