diff options
author | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-01-29 11:24:30 +0000 |
---|---|---|
committer | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-01-29 11:24:30 +0000 |
commit | 127241b84ade7c1fe85bc46b69ab159565a73c4a (patch) | |
tree | 53976575b02007a03024dafde7813fcd5f54bc63 /channels | |
parent | 98cfac8c50734555e53b42797b3aa9963acedfcc (diff) |
Merged revisions 172234 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r172234 | oej | 2009-01-29 12:19:29 +0100 (Tor, 29 Jan 2009) | 7 lines
Make sure register= line supports both port and expiry at the same time.
(closes issue #14185)
Reported by: Nick_Lewis
Patches:
chan_sip.c-expiryrequest6.patch uploaded by Nick (license 657)
Tested by: Nick_Lewis
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@172235 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index c58fd9344..38fd597d5 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -6476,7 +6476,6 @@ static int sip_register(const char *value, int lineno) enum sip_transport transport = SIP_TRANSPORT_UDP; char buf[256] = ""; char *username = NULL; - char *port = NULL; char *hostname=NULL, *secret=NULL, *authuser=NULL, *expire=NULL; char *callback=NULL; @@ -6485,6 +6484,16 @@ static int sip_register(const char *value, int lineno) ast_copy_string(buf, value, sizeof(buf)); + /* split [/contact][~expiry] */ + expire = strchr(buf, '~'); + if (expire) + *expire++ = '\0'; + callback = strchr(buf, '/'); + if (callback) + *callback++ = '\0'; + if (ast_strlen_zero(callback)) + callback = "s"; + sip_parse_host(buf, lineno, &username, &portnum, &transport); /* First split around the last '@' then parse the two components. */ @@ -6504,25 +6513,6 @@ static int sip_register(const char *value, int lineno) *authuser++ = '\0'; } - /* split host[:port][/contact] */ - expire = strchr(hostname, '~'); - if (expire) - *expire++ = '\0'; - callback = strchr(hostname, '/'); - if (callback) - *callback++ = '\0'; - if (ast_strlen_zero(callback)) - callback = "s"; - /* Separate host from port when checking for reserved characters - */ - if ((port = strchr(hostname, ':'))) { - *port = '\0'; - } - /* And then re-merge the host and port so they are stored correctly - */ - if (port) { - *port = ':'; - } if (!(reg = ast_calloc(1, sizeof(*reg)))) { ast_log(LOG_ERROR, "Out of memory. Can't allocate SIP registry entry\n"); return -1; |