Hi team
How to access all branches in the failure_route?
··· SIP/2.0 480 Temporarily Unavailable Via: SIP/2.0/UDP 220.231.180.131:12290;branch=z9hG4bK7699.12bab93a2131301bddba965165d7b8a4.0 Via: SIP/2.0/UDP 192.168.99.203:5090;received=192.168.99.203;rport=5090;branch=z9hG4bKeS4Hy8evHZa4N To: sip:1001@192.168.99.203:12290;tag=a8016513 From: sip:9196@192.168.99.203:12290;tag=rQSg2p11ptytp Call-ID: d25b05e3-3fb6-123f-0ba6-000c29943390 ···
failure_route[MANAGE_FAILURE] { xlog("$sel(via[1].branch) + $T_branch_idx\n"); }
The obtained value is z9hG4bKeS4Hy8evHZa4N, which is the branch generated by UAC.
But I also want to obtain the branch automatically generated by Kamailio.
How can I do this?
Thanks!
aren't multiple SIP headers of the same type index based? Like $sel(via[0].branch) ?
Atenciosamente / Kind Regards / Cordialement / Un saludo,
*Sérgio Charrua*
*www.kahea.ai http://www.kahea.ai / www.voip.pt http://www.voip.pt*
*OpenTelecom* - Consulting for Telecoms, Lda Tel.: +351 callto:+351+91+104+12+6691 631 11 44
Email : *sergio.charrua@voip.pt sergio.charrua@voip.pt*
This message and any files or documents attached are strictly confidential or otherwise legally protected.
It is intended only for the individual or entity named. If you are not the named addressee or have received this email in error, please inform the sender immediately, delete it from your system and do not copy or disclose it or its contents or use it for any purpose. Please also note that transmission cannot be guaranteed to be secure or error-free.
On Wed, Nov 19, 2025 at 8:14 AM 13715209697--- via sr-users < sr-users@lists.kamailio.org> wrote:
Hi team
How to access all branches in the failure_route?
··· SIP/2.0 480 Temporarily Unavailable Via: SIP/2.0/UDP 220.231.180.131:12290 ;branch=z9hG4bK7699.12bab93a2131301bddba965165d7b8a4.0 Via: SIP/2.0/UDP 192.168.99.203:5090 ;received=192.168.99.203;rport=5090;branch=z9hG4bKeS4Hy8evHZa4N To: sip:1001@192.168.99.203:12290;tag=a8016513 From: sip:9196@192.168.99.203:12290;tag=rQSg2p11ptytp Call-ID: d25b05e3-3fb6-123f-0ba6-000c29943390 ···
failure_route[MANAGE_FAILURE] { xlog("$sel(via[1].branch) + $T_branch_idx\n"); }
The obtained value is z9hG4bKeS4Hy8evHZa4N, which is the branch generated by UAC.
But I also want to obtain the branch automatically generated by Kamailio.
How can I do this?
Thanks! __________________________________________________________ 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!
you might also want to try the $hdr PV :
xlog("L_INFO", "Via 0 host: $(hdr(Via)[0]{param.value,branch})\n");
if ($(hdr(Via)[1]) != $null) { xlog("L_INFO", "Via 1 received IP: $(hdr(Via)[1]{param.value,branch} )\n"); }
# Access the last Via header if ($(hdr(Via)[-1]) != $null) { xlog("L_INFO", "Last Via header branch: $(hdr(Via)[-1]{param.value,branch})\n"); }
I'm writing the code by heart, didn't tested it, but I think this works too!
Atenciosamente / Kind Regards / Cordialement / Un saludo,
*Sérgio Charrua*
*www.kahea.ai http://www.kahea.ai / www.voip.pt http://www.voip.pt*
*OpenTelecom* - Consulting for Telecoms, Lda Tel.: +351 callto:+351+91+104+12+6691 631 11 44
Email : *sergio.charrua@voip.pt sergio.charrua@voip.pt*
This message and any files or documents attached are strictly confidential or otherwise legally protected.
It is intended only for the individual or entity named. If you are not the named addressee or have received this email in error, please inform the sender immediately, delete it from your system and do not copy or disclose it or its contents or use it for any purpose. Please also note that transmission cannot be guaranteed to be secure or error-free.
On Wed, Nov 19, 2025 at 8:45 AM Sergio Charrua sergio.charrua@voip.pt wrote:
aren't multiple SIP headers of the same type index based? Like $sel(via[0].branch) ?
Atenciosamente / Kind Regards / Cordialement / Un saludo,
*Sérgio Charrua*
*www.kahea.ai http://www.kahea.ai / www.voip.pt http://www.voip.pt*
*OpenTelecom* - Consulting for Telecoms, Lda Tel.: +351 callto:+351+91+104+12+6691 631 11 44
Email : *sergio.charrua@voip.pt sergio.charrua@voip.pt*
This message and any files or documents attached are strictly confidential or otherwise legally protected.
It is intended only for the individual or entity named. If you are not the named addressee or have received this email in error, please inform the sender immediately, delete it from your system and do not copy or disclose it or its contents or use it for any purpose. Please also note that transmission cannot be guaranteed to be secure or error-free.
On Wed, Nov 19, 2025 at 8:14 AM 13715209697--- via sr-users < sr-users@lists.kamailio.org> wrote:
Hi team
How to access all branches in the failure_route?
··· SIP/2.0 480 Temporarily Unavailable Via: SIP/2.0/UDP 220.231.180.131:12290 ;branch=z9hG4bK7699.12bab93a2131301bddba965165d7b8a4.0 Via: SIP/2.0/UDP 192.168.99.203:5090 ;received=192.168.99.203;rport=5090;branch=z9hG4bKeS4Hy8evHZa4N To: sip:1001@192.168.99.203:12290;tag=a8016513 From: sip:9196@192.168.99.203:12290;tag=rQSg2p11ptytp Call-ID: d25b05e3-3fb6-123f-0ba6-000c29943390 ···
failure_route[MANAGE_FAILURE] { xlog("$sel(via[1].branch) + $T_branch_idx\n"); }
The obtained value is z9hG4bKeS4Hy8evHZa4N, which is the branch generated by UAC.
But I also want to obtain the branch automatically generated by Kamailio.
How can I do this?
Thanks! __________________________________________________________ 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!
onreply_route[MANAGE_REPLY] { xlog("$sel(via[0].branch)\n"); # working well xlog("$sel(via[1].branch)\n"); }
failure_route[MANAGE_FAILURE] { xlog("$sel(via[0].branch)\n"); # <null> xlog("$sel(via[1].branch)\n"); }
The following route is now working:
··· failure_route[MANAGE_FAILURE] { xlog("L_INFO", "Failure\n"); xlog("branch0=$(T_rpl($(hdr(via)[0])){re.subst,/(.*);branch=(.*)/\2/})\n"); xlog("branch1=$(T_rpl($(hdr(via)[1])){re.subst,/(.*);branch=(.*)/\2/})\n"); } ···
Are there any better way?