Allow secure digest auth to be requested for outgoing call legs by AGI.

This commit is contained in:
Maxim Sobolev 2006-12-03 23:33:38 +00:00
parent a8d7b6b38e
commit ee5293d4fe
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=178775
10 changed files with 115 additions and 65 deletions

View file

@ -3,7 +3,6 @@
# PROVIDE: asterisk
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable asterisk:
#

View file

@ -1,9 +1,6 @@
$FreeBSD$
--- channels/chan_sip.c.orig Tue Jan 24 16:25:53 2006
+++ channels/chan_sip.c Tue Jan 24 16:30:44 2006
@@ -337,7 +337,7 @@ static char global_vmexten[AST_MAX_EXTEN
--- channels/chan_sip.c.orig Fri Nov 17 15:51:56 2006
+++ channels/chan_sip.c Fri Nov 17 15:53:30 2006
@@ -340,7 +340,7 @@ static char global_vmexten[AST_MAX_EXTEN
static char default_language[MAX_LANGUAGE] = "";
@ -12,7 +9,7 @@ $FreeBSD$
static char default_callerid[AST_MAX_EXTENSION] = DEFAULT_CALLERID;
static char default_fromdomain[AST_MAX_EXTENSION] = "";
@@ -475,6 +475,7 @@ struct sip_invite_param {
@@ -483,6 +483,7 @@ struct sip_invite_param {
struct sip_route {
struct sip_route *next;
@ -20,7 +17,7 @@ $FreeBSD$
char hop[0];
};
@@ -6015,6 +6016,7 @@ static void build_route(struct sip_pvt *
@@ -6222,6 +6223,7 @@ static void build_route(struct sip_pvt *
/* Make a struct route */
thishop = malloc(sizeof(*thishop) + len);
if (thishop) {
@ -28,7 +25,7 @@ $FreeBSD$
ast_copy_string(thishop->hop, rr, len);
ast_log(LOG_DEBUG, "build_route: Record-Route hop: <%s>\n", thishop->hop);
/* Link in */
@@ -6040,31 +6042,41 @@ static void build_route(struct sip_pvt *
@@ -6247,31 +6249,41 @@ static void build_route(struct sip_pvt *
/* Only append the contact if we are dealing with a strict router */
if (!head || (!ast_strlen_zero(head->hop) && strstr(head->hop,";lr") == NULL) ) {
@ -94,7 +91,21 @@ $FreeBSD$
}
}
}
@@ -10352,7 +10364,11 @@ static int handle_request_invite(struct
@@ -9248,6 +9260,13 @@ static int build_reply_digest(struct sip
secret = p->peersecret;
md5secret = p->peermd5secret;
}
+ /* No authentication. Try to get auth info from channel vars */
+ if (ast_strlen_zero(username))
+ {
+ username = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_NAME");
+ secret = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_SECRET");
+ md5secret = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_MD5SECRET");
+ }
if (ast_strlen_zero(username)) /* We have no authentication */
return -1;
@@ -10621,7 +10640,11 @@ static int handle_request_invite(struct
gotdest = get_destination(p, NULL);
get_rdnis(p, NULL);
@ -107,7 +118,7 @@ $FreeBSD$
build_contact(p);
if (gotdest) {
@@ -10380,7 +10396,6 @@ static int handle_request_invite(struct
@@ -10649,7 +10672,6 @@ static int handle_request_invite(struct
c = sip_new(p, AST_STATE_DOWN, ast_strlen_zero(p->username) ? NULL : p->username );
*recount = 1;
/* Save Record-Route for any later requests we make on this dialogue */
@ -115,7 +126,7 @@ $FreeBSD$
if (c) {
/* Pre-lock the call */
ast_mutex_lock(&c->lock);
@@ -10466,7 +10481,12 @@ static int handle_request_invite(struct
@@ -10735,7 +10757,12 @@ static int handle_request_invite(struct
transmit_response(p, "180 Ringing", req);
break;
case AST_STATE_UP:

View file

@ -3,7 +3,6 @@
# PROVIDE: asterisk
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable asterisk:
#

View file

@ -1,9 +1,6 @@
$FreeBSD$
--- channels/chan_sip.c.orig Tue Jan 24 16:25:53 2006
+++ channels/chan_sip.c Tue Jan 24 16:30:44 2006
@@ -337,7 +337,7 @@ static char global_vmexten[AST_MAX_EXTEN
--- channels/chan_sip.c.orig Fri Nov 17 15:51:56 2006
+++ channels/chan_sip.c Fri Nov 17 15:53:30 2006
@@ -340,7 +340,7 @@ static char global_vmexten[AST_MAX_EXTEN
static char default_language[MAX_LANGUAGE] = "";
@ -12,7 +9,7 @@ $FreeBSD$
static char default_callerid[AST_MAX_EXTENSION] = DEFAULT_CALLERID;
static char default_fromdomain[AST_MAX_EXTENSION] = "";
@@ -475,6 +475,7 @@ struct sip_invite_param {
@@ -483,6 +483,7 @@ struct sip_invite_param {
struct sip_route {
struct sip_route *next;
@ -20,7 +17,7 @@ $FreeBSD$
char hop[0];
};
@@ -6015,6 +6016,7 @@ static void build_route(struct sip_pvt *
@@ -6222,6 +6223,7 @@ static void build_route(struct sip_pvt *
/* Make a struct route */
thishop = malloc(sizeof(*thishop) + len);
if (thishop) {
@ -28,7 +25,7 @@ $FreeBSD$
ast_copy_string(thishop->hop, rr, len);
ast_log(LOG_DEBUG, "build_route: Record-Route hop: <%s>\n", thishop->hop);
/* Link in */
@@ -6040,31 +6042,41 @@ static void build_route(struct sip_pvt *
@@ -6247,31 +6249,41 @@ static void build_route(struct sip_pvt *
/* Only append the contact if we are dealing with a strict router */
if (!head || (!ast_strlen_zero(head->hop) && strstr(head->hop,";lr") == NULL) ) {
@ -94,7 +91,21 @@ $FreeBSD$
}
}
}
@@ -10352,7 +10364,11 @@ static int handle_request_invite(struct
@@ -9248,6 +9260,13 @@ static int build_reply_digest(struct sip
secret = p->peersecret;
md5secret = p->peermd5secret;
}
+ /* No authentication. Try to get auth info from channel vars */
+ if (ast_strlen_zero(username))
+ {
+ username = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_NAME");
+ secret = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_SECRET");
+ md5secret = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_MD5SECRET");
+ }
if (ast_strlen_zero(username)) /* We have no authentication */
return -1;
@@ -10621,7 +10640,11 @@ static int handle_request_invite(struct
gotdest = get_destination(p, NULL);
get_rdnis(p, NULL);
@ -107,7 +118,7 @@ $FreeBSD$
build_contact(p);
if (gotdest) {
@@ -10380,7 +10396,6 @@ static int handle_request_invite(struct
@@ -10649,7 +10672,6 @@ static int handle_request_invite(struct
c = sip_new(p, AST_STATE_DOWN, ast_strlen_zero(p->username) ? NULL : p->username );
*recount = 1;
/* Save Record-Route for any later requests we make on this dialogue */
@ -115,7 +126,7 @@ $FreeBSD$
if (c) {
/* Pre-lock the call */
ast_mutex_lock(&c->lock);
@@ -10466,7 +10481,12 @@ static int handle_request_invite(struct
@@ -10735,7 +10757,12 @@ static int handle_request_invite(struct
transmit_response(p, "180 Ringing", req);
break;
case AST_STATE_UP:

View file

@ -3,7 +3,6 @@
# PROVIDE: asterisk
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable asterisk:
#

View file

@ -1,9 +1,6 @@
$FreeBSD$
--- channels/chan_sip.c.orig Tue Jan 24 16:25:53 2006
+++ channels/chan_sip.c Tue Jan 24 16:30:44 2006
@@ -337,7 +337,7 @@ static char global_vmexten[AST_MAX_EXTEN
--- channels/chan_sip.c.orig Fri Nov 17 15:51:56 2006
+++ channels/chan_sip.c Fri Nov 17 15:53:30 2006
@@ -340,7 +340,7 @@ static char global_vmexten[AST_MAX_EXTEN
static char default_language[MAX_LANGUAGE] = "";
@ -12,7 +9,7 @@ $FreeBSD$
static char default_callerid[AST_MAX_EXTENSION] = DEFAULT_CALLERID;
static char default_fromdomain[AST_MAX_EXTENSION] = "";
@@ -475,6 +475,7 @@ struct sip_invite_param {
@@ -483,6 +483,7 @@ struct sip_invite_param {
struct sip_route {
struct sip_route *next;
@ -20,7 +17,7 @@ $FreeBSD$
char hop[0];
};
@@ -6015,6 +6016,7 @@ static void build_route(struct sip_pvt *
@@ -6222,6 +6223,7 @@ static void build_route(struct sip_pvt *
/* Make a struct route */
thishop = malloc(sizeof(*thishop) + len);
if (thishop) {
@ -28,7 +25,7 @@ $FreeBSD$
ast_copy_string(thishop->hop, rr, len);
ast_log(LOG_DEBUG, "build_route: Record-Route hop: <%s>\n", thishop->hop);
/* Link in */
@@ -6040,31 +6042,41 @@ static void build_route(struct sip_pvt *
@@ -6247,31 +6249,41 @@ static void build_route(struct sip_pvt *
/* Only append the contact if we are dealing with a strict router */
if (!head || (!ast_strlen_zero(head->hop) && strstr(head->hop,";lr") == NULL) ) {
@ -94,7 +91,21 @@ $FreeBSD$
}
}
}
@@ -10352,7 +10364,11 @@ static int handle_request_invite(struct
@@ -9248,6 +9260,13 @@ static int build_reply_digest(struct sip
secret = p->peersecret;
md5secret = p->peermd5secret;
}
+ /* No authentication. Try to get auth info from channel vars */
+ if (ast_strlen_zero(username))
+ {
+ username = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_NAME");
+ secret = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_SECRET");
+ md5secret = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_MD5SECRET");
+ }
if (ast_strlen_zero(username)) /* We have no authentication */
return -1;
@@ -10621,7 +10640,11 @@ static int handle_request_invite(struct
gotdest = get_destination(p, NULL);
get_rdnis(p, NULL);
@ -107,7 +118,7 @@ $FreeBSD$
build_contact(p);
if (gotdest) {
@@ -10380,7 +10396,6 @@ static int handle_request_invite(struct
@@ -10649,7 +10672,6 @@ static int handle_request_invite(struct
c = sip_new(p, AST_STATE_DOWN, ast_strlen_zero(p->username) ? NULL : p->username );
*recount = 1;
/* Save Record-Route for any later requests we make on this dialogue */
@ -115,7 +126,7 @@ $FreeBSD$
if (c) {
/* Pre-lock the call */
ast_mutex_lock(&c->lock);
@@ -10466,7 +10481,12 @@ static int handle_request_invite(struct
@@ -10735,7 +10757,12 @@ static int handle_request_invite(struct
transmit_response(p, "180 Ringing", req);
break;
case AST_STATE_UP:

View file

@ -3,7 +3,6 @@
# PROVIDE: asterisk
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable asterisk:
#

View file

@ -1,9 +1,6 @@
$FreeBSD$
--- channels/chan_sip.c.orig Tue Jan 24 16:25:53 2006
+++ channels/chan_sip.c Tue Jan 24 16:30:44 2006
@@ -337,7 +337,7 @@ static char global_vmexten[AST_MAX_EXTEN
--- channels/chan_sip.c.orig Fri Nov 17 15:51:56 2006
+++ channels/chan_sip.c Fri Nov 17 15:53:30 2006
@@ -340,7 +340,7 @@ static char global_vmexten[AST_MAX_EXTEN
static char default_language[MAX_LANGUAGE] = "";
@ -12,7 +9,7 @@ $FreeBSD$
static char default_callerid[AST_MAX_EXTENSION] = DEFAULT_CALLERID;
static char default_fromdomain[AST_MAX_EXTENSION] = "";
@@ -475,6 +475,7 @@ struct sip_invite_param {
@@ -483,6 +483,7 @@ struct sip_invite_param {
struct sip_route {
struct sip_route *next;
@ -20,7 +17,7 @@ $FreeBSD$
char hop[0];
};
@@ -6015,6 +6016,7 @@ static void build_route(struct sip_pvt *
@@ -6222,6 +6223,7 @@ static void build_route(struct sip_pvt *
/* Make a struct route */
thishop = malloc(sizeof(*thishop) + len);
if (thishop) {
@ -28,7 +25,7 @@ $FreeBSD$
ast_copy_string(thishop->hop, rr, len);
ast_log(LOG_DEBUG, "build_route: Record-Route hop: <%s>\n", thishop->hop);
/* Link in */
@@ -6040,31 +6042,41 @@ static void build_route(struct sip_pvt *
@@ -6247,31 +6249,41 @@ static void build_route(struct sip_pvt *
/* Only append the contact if we are dealing with a strict router */
if (!head || (!ast_strlen_zero(head->hop) && strstr(head->hop,";lr") == NULL) ) {
@ -94,7 +91,21 @@ $FreeBSD$
}
}
}
@@ -10352,7 +10364,11 @@ static int handle_request_invite(struct
@@ -9248,6 +9260,13 @@ static int build_reply_digest(struct sip
secret = p->peersecret;
md5secret = p->peermd5secret;
}
+ /* No authentication. Try to get auth info from channel vars */
+ if (ast_strlen_zero(username))
+ {
+ username = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_NAME");
+ secret = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_SECRET");
+ md5secret = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_MD5SECRET");
+ }
if (ast_strlen_zero(username)) /* We have no authentication */
return -1;
@@ -10621,7 +10640,11 @@ static int handle_request_invite(struct
gotdest = get_destination(p, NULL);
get_rdnis(p, NULL);
@ -107,7 +118,7 @@ $FreeBSD$
build_contact(p);
if (gotdest) {
@@ -10380,7 +10396,6 @@ static int handle_request_invite(struct
@@ -10649,7 +10672,6 @@ static int handle_request_invite(struct
c = sip_new(p, AST_STATE_DOWN, ast_strlen_zero(p->username) ? NULL : p->username );
*recount = 1;
/* Save Record-Route for any later requests we make on this dialogue */
@ -115,7 +126,7 @@ $FreeBSD$
if (c) {
/* Pre-lock the call */
ast_mutex_lock(&c->lock);
@@ -10466,7 +10481,12 @@ static int handle_request_invite(struct
@@ -10735,7 +10757,12 @@ static int handle_request_invite(struct
transmit_response(p, "180 Ringing", req);
break;
case AST_STATE_UP:

View file

@ -3,7 +3,6 @@
# PROVIDE: asterisk
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable asterisk:
#

View file

@ -1,9 +1,6 @@
$FreeBSD$
--- channels/chan_sip.c.orig Tue Jan 24 16:25:53 2006
+++ channels/chan_sip.c Tue Jan 24 16:30:44 2006
@@ -337,7 +337,7 @@ static char global_vmexten[AST_MAX_EXTEN
--- channels/chan_sip.c.orig Fri Nov 17 15:51:56 2006
+++ channels/chan_sip.c Fri Nov 17 15:53:30 2006
@@ -340,7 +340,7 @@ static char global_vmexten[AST_MAX_EXTEN
static char default_language[MAX_LANGUAGE] = "";
@ -12,7 +9,7 @@ $FreeBSD$
static char default_callerid[AST_MAX_EXTENSION] = DEFAULT_CALLERID;
static char default_fromdomain[AST_MAX_EXTENSION] = "";
@@ -475,6 +475,7 @@ struct sip_invite_param {
@@ -483,6 +483,7 @@ struct sip_invite_param {
struct sip_route {
struct sip_route *next;
@ -20,7 +17,7 @@ $FreeBSD$
char hop[0];
};
@@ -6015,6 +6016,7 @@ static void build_route(struct sip_pvt *
@@ -6222,6 +6223,7 @@ static void build_route(struct sip_pvt *
/* Make a struct route */
thishop = malloc(sizeof(*thishop) + len);
if (thishop) {
@ -28,7 +25,7 @@ $FreeBSD$
ast_copy_string(thishop->hop, rr, len);
ast_log(LOG_DEBUG, "build_route: Record-Route hop: <%s>\n", thishop->hop);
/* Link in */
@@ -6040,31 +6042,41 @@ static void build_route(struct sip_pvt *
@@ -6247,31 +6249,41 @@ static void build_route(struct sip_pvt *
/* Only append the contact if we are dealing with a strict router */
if (!head || (!ast_strlen_zero(head->hop) && strstr(head->hop,";lr") == NULL) ) {
@ -94,7 +91,21 @@ $FreeBSD$
}
}
}
@@ -10352,7 +10364,11 @@ static int handle_request_invite(struct
@@ -9248,6 +9260,13 @@ static int build_reply_digest(struct sip
secret = p->peersecret;
md5secret = p->peermd5secret;
}
+ /* No authentication. Try to get auth info from channel vars */
+ if (ast_strlen_zero(username))
+ {
+ username = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_NAME");
+ secret = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_SECRET");
+ md5secret = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_MD5SECRET");
+ }
if (ast_strlen_zero(username)) /* We have no authentication */
return -1;
@@ -10621,7 +10640,11 @@ static int handle_request_invite(struct
gotdest = get_destination(p, NULL);
get_rdnis(p, NULL);
@ -107,7 +118,7 @@ $FreeBSD$
build_contact(p);
if (gotdest) {
@@ -10380,7 +10396,6 @@ static int handle_request_invite(struct
@@ -10649,7 +10672,6 @@ static int handle_request_invite(struct
c = sip_new(p, AST_STATE_DOWN, ast_strlen_zero(p->username) ? NULL : p->username );
*recount = 1;
/* Save Record-Route for any later requests we make on this dialogue */
@ -115,7 +126,7 @@ $FreeBSD$
if (c) {
/* Pre-lock the call */
ast_mutex_lock(&c->lock);
@@ -10466,7 +10481,12 @@ static int handle_request_invite(struct
@@ -10735,7 +10757,12 @@ static int handle_request_invite(struct
transmit_response(p, "180 Ringing", req);
break;
case AST_STATE_UP: