Skip to content
Snippets Groups Projects
Commit f4fe6744 authored by Olle Johansson's avatar Olle Johansson
Browse files

Add authentication options to the SIP dialstring.

Documentation follows separately

(issue #11587)
Reported by: sobomax
Patches: 
      chan_sip.c-trunk.diff uploaded by sobomax (license 359)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@99521 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent c85b71bf
Branches
Tags
No related merge requests found
...@@ -18716,6 +18716,9 @@ static struct ast_channel *sip_request_call(const char *type, int format, void * ...@@ -18716,6 +18716,9 @@ static struct ast_channel *sip_request_call(const char *type, int format, void *
char tmp[256]; char tmp[256];
char *dest = data; char *dest = data;
char *dnid; char *dnid;
char *secret = NULL;
char *md5secret = NULL;
char *authname = NULL;
int oldformat = format; int oldformat = format;
   
/* mask request with some set of allowed formats. /* mask request with some set of allowed formats.
...@@ -18764,6 +18767,17 @@ static struct ast_channel *sip_request_call(const char *type, int format, void * ...@@ -18764,6 +18767,17 @@ static struct ast_channel *sip_request_call(const char *type, int format, void *
if (host) { if (host) {
*host++ = '\0'; *host++ = '\0';
ext = tmp; ext = tmp;
secret = strchr(ext, ':');
if (secret) {
*secret++ = '\0';
md5secret = strchr(secret, ':');
if (md5secret) {
*md5secret++ = '\0';
authname = strchr(md5secret, ':');
if (authname)
*authname++ = '\0';
}
}
} else { } else {
ext = strchr(tmp, '/'); ext = strchr(tmp, '/');
if (ext) if (ext)
...@@ -18798,6 +18812,14 @@ static struct ast_channel *sip_request_call(const char *type, int format, void * ...@@ -18798,6 +18812,14 @@ static struct ast_channel *sip_request_call(const char *type, int format, void *
ast_string_field_set(p, username, ext); ast_string_field_set(p, username, ext);
ast_string_field_set(p, fullcontact, NULL); ast_string_field_set(p, fullcontact, NULL);
} }
if (secret && !ast_strlen_zero(secret))
ast_string_field_set(p, peersecret, secret);
if (md5secret && !ast_strlen_zero(md5secret))
ast_string_field_set(p, peermd5secret, md5secret);
if (authname && !ast_strlen_zero(authname))
ast_string_field_set(p, authname, authname);
#if 0 #if 0
printf("Setting up to call extension '%s' at '%s'\n", ext ? ext : "<none>", host); printf("Setting up to call extension '%s' at '%s'\n", ext ? ext : "<none>", host);
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment