From: David Vossel Date: Fri, 9 Oct 2009 17:52:35 +0000 (+0000) Subject: fixes sip registration using authuser in user.conf X-Git-Tag: 1.4.27-rc3~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6e33cd544714e303200ef7786d3eb863b28560e;p=thirdparty%2Fasterisk.git fixes sip registration using authuser in user.conf (closes issue #14954) Reported by: tornblad Tested by: mmichelson, tornblad, dvossel git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@223205 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 47b1f95085..15e00ba64b 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -18518,6 +18518,7 @@ static int reload_config(enum channelreloadreason reason) const char *username = ast_variable_retrieve(ucfg, cat, "username"); const char *secret = ast_variable_retrieve(ucfg, cat, "secret"); const char *contact = ast_variable_retrieve(ucfg, cat, "contact"); + const char *authuser = ast_variable_retrieve(ucfg, cat, "authuser"); if (!host) host = ast_variable_retrieve(ucfg, "general", "host"); if (!username) @@ -18527,10 +18528,17 @@ static int reload_config(enum channelreloadreason reason) if (!contact) contact = "s"; if (!ast_strlen_zero(username) && !ast_strlen_zero(host)) { - if (!ast_strlen_zero(secret)) - snprintf(tmp, sizeof(tmp), "%s:%s@%s/%s", username, secret, host, contact); - else + if (!ast_strlen_zero(secret)) { + if (!ast_strlen_zero(authuser)) { + snprintf(tmp, sizeof(tmp), "%s:%s:%s@%s/%s", username, secret, authuser, host, contact); + } else { + snprintf(tmp, sizeof(tmp), "%s:%s@%s/%s", username, secret, host, contact); + } + } else if (!ast_strlen_zero(authuser)) { + snprintf(tmp, sizeof(tmp), "%s::%s@%s/%s", username, authuser, host, contact); + } else { snprintf(tmp, sizeof(tmp), "%s@%s/%s", username, host, contact); + } if (sip_register(tmp, 0) == 0) registry_count++; }