[asterisk-commits] oej: trunk r172234 - /trunk/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jan 29 05:19:29 CST 2009
Author: oej
Date: Thu Jan 29 05:19:29 2009
New Revision: 172234
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=172234
Log:
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
Modified:
trunk/channels/chan_sip.c
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=172234&r1=172233&r2=172234
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Jan 29 05:19:29 2009
@@ -6880,7 +6880,6 @@
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;
@@ -6888,6 +6887,16 @@
return -1;
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);
@@ -6917,25 +6926,6 @@
if ((secret) && (ast_strlen_zero(secret)))
secret = NULL;
- /* 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;
More information about the asterisk-commits
mailing list