Using Kamailio v5.3, based on the example for scscf found here:
https://github.com/kamailio/kamailio/blob/master/misc/examples/ims/scscf/kamailio.cfg
after calling ims_www_challenge("REG_MAR_REPLY", "$var(realm)", "$var(alg)");
the control never goes to REG_MAR_REPLY route block, but it goes to the start
of the requet_route block. here is the kamailio.cfg script:
request_route {
.......
/* Handle Registrations */
if (is_method("REGISTER")) {
route(REGISTER);
exit;
}
......
}
/**
* Handling of REGISTER requests
*/
route[REGISTER] {
......
#!ifdef WITH_AUTH
if (!ims_www_authenticate("$var(realm)")) {
#!else
if ($var(alg) == "3GPP-Digest" && !ims_www_authenticate("$var(realm)"))
{
#!endif
if ($? == -2) {
send_reply("403", "Authentication Failed");
exit;
} else if ($? == -3) {
send_reply("400", "Bad Request");
exit;
} else if ($? == -9) {
xdbg("Authentication re-sync requested\n");
ims_www_resync_auth("REGISTER_RESYNC_REPLY", "$var(realm)");
exit;
} else {
/* user has not been authenticated. Lets send a challenge via
401 Unauthorized */
xdbg("About to challenge! auth_ims\n");
ims_www_challenge("REG_MAR_REPLY", "$var(realm)", "$var(alg)");
exit;
}
} else {
xdbg("Auth succeeded\n");
/* We need to check if this user is registered or not */
if (!impu_registered("location")) {
save("PRE_REGISTER_SAR_REPLY", "location");
exit;
} else {
isc_match_filter_reg("1", "location");
save("REGISTER_SAR_REPLY", "location");
exit;
}
}
}
}
/**
* Handling of REGISTER MAR replies
*/
route[REG_MAR_REPLY] {
xlog("L_DBG","maa_return code is $avp(s:maa_return_code)\n");
/* this is async so to know status we have to check the reply avp */
switch ($avp(s:maa_return_code)) {
case 1: /* success */
xdbg("MAR success - 401/407 response sent from module\n");
break;
case -1: /* failure */
xerr("MAR failure - error response sent from module\n");
break;
case -2: /* error */
xerr("MAR error - sending error response now\n");
send_reply("503", "MAR failed");
break;
default:
xerr("Unknown return code from MAR, value is
[$avp(s:maa_return_code)]\n");
send_reply("503", "Unknown response code from MAR");
break;
}
exit;
}
and here's the log:
12(18) ERROR: *** cfgtrace:request_route=[REGISTER]
c=[/usr/local/etc/kamailio/kamailio.cfg] l=757 a=27 n=ims_www_challenge
12(18) DEBUG: ims_auth [authorize.c:293]: challenge(): Looking for route block
[REG_MAR_REPLY]
12(18) INFO: ims_auth [cxdx_mar.c:79]: create_return_code(): created AVP
successfully : [maa_return_code] - [-2]
12(18) DEBUG: ims_auth [authorize.c:317]: challenge(): Need to challenge for
realm [ims.mnc071.mcc432.3gppnetwork.org]
12(18) DEBUG: ims_auth [authorize.c:324]: challenge(): Checking if REGISTER is
authorized for realm [ims.mnc071.mcc432.3gppnetwork.org]...
12(18) DEBUG: ims_auth [authorize.c:1449]: get_auth_userdata(): Searching
auth_userdata for IMPU sip:[email protected]
(Hash 425)
12(18) DEBUG: ims_auth [authorize.c:460]: challenge(): Suspending SIP TM
transaction
12(18) DEBUG: ims_auth [authorize.c:1529]: multimedia_auth_request(): Sending
MAR
12(18) DEBUG: ims_auth [cxdx_mar.c:574]: cxdx_send_mar(): Successfully sent
async diameter
70(76) INFO: ims_auth [cxdx_avp.c:137]: cxdx_get_avp():
cxdx_get_experimental_result_code: Failed finding avp (avp_code = 297,
vendor_id = 0)
70(76) DEBUG: ims_auth [authorize.c:1303]: new_auth_vector(): new auth-vector
with ck [d2deb48b5b3b614ba9112396e3c036fe] with status 0
70(76) DEBUG: ims_auth [authorize.c:1560]: pack_challenge(): setting QOP str
used is [, qop="auth"]
70(76) DEBUG: ims_auth [authorize.c:1562]: pack_challenge(): QOP str used is [,
qop="auth"]
70(76) DEBUG: ims_auth [authorize.c:1449]: get_auth_userdata(): Searching
auth_userdata for IMPU sip:[email protected]
(Hash 425)
70(76) DEBUG: ims_auth [authorize.c:1458]: get_auth_userdata(): Found
auth_userdata
70(76) DEBUG: ims_auth [authorize.c:1682]: add_auth_vector(): Adding
auth_vector (status 1) for IMPU
sip:[email protected] / IMPI
[email protected] (Hash 425)
70(76) DEBUG: ims_auth [cxdx_mar.c:486]: async_cdp_callback(): DBG:UAR Async
CDP callback: ... Done resuming transaction
70(76) INFO: ims_auth [cxdx_mar.c:79]: create_return_code(): created AVP
successfully : [maa_return_code] - [1]
70(76) ERROR: tm [t_suspend.c:197]: t_continue_helper(): active transaction not
found
70(76) DEBUG: ims_auth [cxdx_mar.c:87]: free_saved_transaction_data(): Freeing
saved transaction data: async
11(17) ERROR: *** cfgtrace:request_route=[DEFAULT_ROUTE]
c=[/usr/local/etc/kamailio/kamailio.cfg] l=380 a=5 n=route
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions --
[email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the
sender!