Also, t_relay_to_tcp() is not necessarily the way forward. Be mindful of the possibility of manipulating $fs to select an outgoing (TCP) listener socket, and of the need to add or strip ;transport=tcp R-URI attributes depending on whether the request is going to a TCP destination.
Putting it all together:
route[ANI_ATTESTATION_QUERY] { t_on_branch('ANI_ATTESTATION_QUERY_BRANCH'); t_on_failure('ANI_ATTESTATION_QUERY_CATCH');
if(!t_relay()) sl_reply_error();
exit; }
branch_route[ANI_ATTESTATION_QUERY_BRANCH] { uac_replace_from("", "sip:$avp(trans_ani)@$fd"); $ru = 'sip:' + $rU + '@' + ANI_ATTESTATION_GW; }
failure_route[ANI_ATTESTATION_QUERY_CATCH] { if(t_is_canceled()) { #xlog(...) exit; }
if(t_branch_timeout()) { #xlog(...) route(OUTBOUND_ROUTE_CONTINUE); # Proceed as normal, w/o Identity header. exit; }
# Received response, but not 302. if($T_rpl($rs) != 302) { #xlog(...) - unexpected reply route(OUTBOUND_ROUTE_CONTINUE); exit; }
# Received 302, but no Identity header. if($T_rpl($hdr(Identity)) == $null) { route(OUTBOUND_ROUTE_CONTINUE); exit; }
# Intermediate storage required because $hdr(...) value is not # constant. $avp(attest_hdr) = "Identity: " + $T_rpl($hdr(Identity));
route(OUTBOUND_ROUTE_CONTINUE); # t_relay() etc. }
On May 19, 2025, at 4:11 PM, Alex Balashov abalashov@evaristesys.com wrote:
Since the redirect response is 3xx+, you should catch it in a failure_route[], which is armed with t_on_failure().
In the failure_route, you can check if the failure_route was invoked because of a timeout with if(t_branch_timeout()), and if it was not, extract the reply code with $T_rpl($rs).
Then, you modify the R-URI ($ru) to proceed to the original destination and call t_relay() again.
-- Alex
On May 19, 2025, at 3:45 PM, JR Richardson via sr-users sr-users@lists.kamailio.org wrote:
Hey Folks,
I'm integrating STIR/SHAKEN using kamailio, but not using self hosted certs with the secsipid module, just using a redirect from clearip on the SIP Calls. I've got the basic connection to clearip using t_relay_to_tcp for testing, but I'm struggling with the checks and timeouts. I have call progress past the initial request where I need to wait for a response. Should I put the clearip invite in its own route block use return? Has anyone successfully integrated the redirect method with kamailio to clearip and can give me some example route checks in the kamailio configs?
Thanks. JR
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!
-- Alex Balashov Principal Consultant Evariste Systems LLC Web: https://evaristesys.com Tel: +1-706-510-6800