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+66>91 631 11 44

Email : *[email protected] <[email protected]>*

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 <[email protected]>
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+66>91 631 11 44
>
> Email : *[email protected] <[email protected]>*
>
> 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 <
> [email protected]> 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:[email protected]:12290>;tag=a8016513
>> From: <sip:[email protected]: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 --
>> [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!
>>
>
__________________________________________________________
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!

Reply via email to