Using Kamailio v5.3, based on the example for scscf found here: https://github.com/kamailio/kamailio/blob/master/misc/examples/ims/scscf/kam... 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:432710000010044@ims.mnc071.mcc432.3gppnetwork.org (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:432710000010044@ims.mnc071.mcc432.3gppnetwork.org (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:432710000010044@ims.mnc071.mcc432.3gppnetwork.org / IMPI 432710000010044@ims.mnc071.mcc432.3gppnetwork.org (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
Hello,
the 5.3.x release is long end of life. You should update to a maintained version, e.g. the latest 5.8.x or 6.0.x to check if the bug was fixed already.
Please note that also the IMS examples were updated in the release 6.0, so they might not fully be synchronized with this old release.
Cheers,
Henning
-----Original Message----- From: stinktohighheaven--- via sr-users sr-users@lists.kamailio.org Sent: Mittwoch, 19. Februar 2025 10:26 To: sr-users@lists.kamailio.org Cc: stinktohighheaven@gmail.com Subject: [SR-Users] REG_MAR_REPLY never get executed
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:432710000010044@ims.mnc071.mcc432.3gppnetwork.org (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:432710000010044@ims.mnc071.mcc432.3gppnetwork.org (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:432710000010044@ims.mnc071.mcc432.3gppnetwork.org / IMPI 432710000010044@ims.mnc071.mcc432.3gppnetwork.org (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 -- sr- users@lists.kamailio.org To unsubscribe send an email to sr-users- leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
Thanks
Unfortunately I can't move a to a different version because we're using version 5.3 in production server. I just wanted to define a custom metric to count the number of successful/unsuccessful MAR requests just like what I already did for SAR/UAR/LIR requests.
It's probably a good idea to test the config in a test environment with the current software version for the purpose of problem isolation. If the problem doesn't occur in the latest version, then you can itemize it as something that will be fixed when your production environment is updated and something that you're probably powerless to address until that time. If the problem does persist, then you know that either it's a bug that will require a software fix and that rushing to update your production environment immediately won't yield a tangible result, OR that it's not a software issue and is a config issue, and that any config resolution can probably be addressed on your current version, and you'll have an easier time getting help here.
Regards, Kaufman
________________________________ From: James Morrison via sr-users sr-users@lists.kamailio.org Sent: Wednesday, February 19, 2025 9:39 AM To: sr-users@lists.kamailio.org sr-users@lists.kamailio.org Cc: James Morrison stinktohighheaven@gmail.com Subject: [SR-Users] Re: REG_MAR_REPLY never get executed
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Thanks
Unfortunately I can't move a to a different version because we're using version 5.3 in production server. I just wanted to define a custom metric to count the number of successful/unsuccessful MAR requests just like what I already did for SAR/UAR/LIR requests. __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
Hello,
sure - understand. You could check the commit history for the ims_auth module in branch 6.0 and see if there is a specific bugfix that points into this direction. Then you can backport it to your version.
Cheers,
Henning
-----Original Message----- From: James Morrison via sr-users sr-users@lists.kamailio.org Sent: Mittwoch, 19. Februar 2025 16:39 To: sr-users@lists.kamailio.org Cc: James Morrison stinktohighheaven@gmail.com Subject: [SR-Users] Re: REG_MAR_REPLY never get executed
Thanks
Unfortunately I can't move a to a different version because we're using version 5.3 in production server. I just wanted to define a custom metric to count the number of successful/unsuccessful MAR requests just like what I already did for SAR/UAR/LIR requests. __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- sr- users@lists.kamailio.org To unsubscribe send an email to sr-users- leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!