On Jan 20, 2019, at 2:22 PM, Brandon Armstead
<brandon(a)cryy.com> wrote:
I suspect you could check $rd or $du ? Although I don’t quite understand why you won’t
know the realm to begin with based on the selection?
On Sun, Jan 20, 2019 at 03:59 Mack Hendricks
<mack(a)dopensource.com> wrote:
Hey All,
So, I want to use the UAC module to handle Digest Auth to upstream carriers. But, I
don’t know which carrier will be selected until another module (dRouting in this case)
tells the logic which carrier to use.
I can see in the logs that the uac_auth function can capture the Auth Realm. But, I need
to access it from the Kamailio script so that I can lookup the credentials for that realm
and then call uac_auth. I’ve tried getting the info from $ar, but that gives me the realm
of the inbound request versus the realm of the upstream carrier. Also, I’ve tried using
$T_rpl($ar), but that returns 0. Here’s my logic from the Kamailio file:
if(t_check_status("401|407")) {
$var(reply_realm) = $T_rpl($ar);
$var(query)="select auth_username,auth_password from uacreg where
realm='" + $var(reply_realm) + "'";
sql_xquery("cb","$var(query)","rb");
xlog("L_DEBUG","[MANAGE_FAILURE: Proxy Auth]: The query is
$var(query) auth realm is $var(reply_realm) and the user name is
$xavp(rb=>auth_username)");
$avp(auser) = $xavp(rb=>auth_username);
$avp(apass) = $xavp(rb=>auth_password);
uac_auth();
t_relay();
exit;`
}
A snippet of the log file is below:
Jan 20 10:05:58 dsiprouter /usr/sbin/kamailio[2871]: exec: ***
cfgtrace:failure_route=[DEFAULT_ROUTE] c=[/etc/kamailio/kamailio.cfg] l=1616 a=63
n=assign
Jan 20 10:05:58 dsiprouter /usr/sbin/kamailio[2871]: exec: ***
cfgtrace:failure_route=[DEFAULT_ROUTE] c=[/etc/kamailio/kamailio.cfg] l=1617 a=63
n=assign
Jan 20 10:05:58 dsiprouter /usr/sbin/kamailio[2871]: exec: ***
cfgtrace:failure_route=[DEFAULT_ROUTE] c=[/etc/kamailio/kamailio.cfg] l=1618 a=24
n=uac_auth
Jan 20 10:05:58 dsiprouter /usr/sbin/kamailio[2871]: DEBUG: uac [auth.c:409]: uac_auth():
picked reply is 0x7f900cb7eaf0, code 407
Jan 20 10:05:58 dsiprouter /usr/sbin/kamailio[2871]: DEBUG: uac [auth.c:225]:
get_autenticate_hdr(): looking for header "Proxy-Authenticate"
Jan 20 10:05:58 dsiprouter /usr/sbin/kamailio[2871]: DEBUG: uac [auth.c:429]: uac_auth():
header found; body=<Digest realm="sip.flowroute.com",
nonce="XERJMlxESAbDNCK3INmBfoET1GGxpcyr", qop="auth">
Jan 20 10:05:58 dsiprouter /usr/sbin/kamailio[2871]: DEBUG: uac [auth_hdr.c:209]:
parse_authenticate_body(): <realm>="sip.flowroute.com" state=2
Jan 20 10:05:58 dsiprouter /usr/sbin/kamailio[2871]: DEBUG: uac [auth_hdr.c:209]:
parse_authenticate_body(): <nonce>="XERJMlxESAbDNCK3INmBfoET1GGxpcyr"
state=3
Jan 20 10:05:58 dsiprouter /usr/sbin/kamailio[2871]: DEBUG: uac [auth_hdr.c:209]:
parse_authenticate_body(): <qop>="auth" state=1
Jan 20 10:05:58 dsiprouter /usr/sbin/kamailio[2871]: DEBUG: uac [auth.c:449]: uac_auth():
no credential for realm "sip.flowroute.com"
Jan 20 10:05:58 dsiprouter /usr/sbin/kamailio[2871]: exec: ***
cfgtrace:failure_route=[DEFAULT_ROUTE] c=[/etc/kamailio/kamailio.cfg] l=1619 a=24
n=t_relay
Thanks in advance for any help
Mack Hendricks
dSIPRouter
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users --
Sent from Gmail Mobile
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org