Thank you everyone for the feedback. I realized my initial post was
bereft of details. I'm not at liberty to share the entire script, but
I will try to distill it. The original INVITE is sent to our internal
STI-VS which returns a 302. Kamilio handles that locally and then
sends the INVITE back to itself for further processing. I'm not sure
what context that put me in with regards to
request/reply/failure/branch.

Here are some of the pieces:

failure_route[RTF_DISPATCH] {
...
    # handle internal redirects ourselves instead of passing back to client
    if (t_check_status("3[0-9][0-9]")) {
        get_redirects("1:1");
        xlog("L_INFO", "|        |        |(RESP) ($ci) redirect
branches: $bR \n");
        # see if the first redirect branch is local
        if (is_ip_rfc1918($(br{uri.domain}))) {
            xlog("L_INFO", "|        |        |(RESP) ($ci) Handling
internal redirect to $br \n");
            t_on_failure("RTF_DISPATCH");
            route(RELAY);
            exit;
        }
    }
...

route[RELAY] {

    if (!has_totag()) {
        dlg_manage();
    }

    # enable additional event routes for forwarded requests
    # - serial forking, RTP relaying handling, a.s.o.
    if (is_method("INVITE|NOTIFY|REFER|BYE|PRACK")) {

        if (is_method("BYE")) {
            route(TUI_CALL_REDUNDANCY_CLEAR);
        }

        t_on_branch("MANAGE_BRANCH");
        t_on_reply("MANAGE_REPLY");
    }

    if (is_method("ACK")) {
        xlog("L_INFO", "$var(logPrefixIn2) Forwarding ACK\n");
        # forward the ACK statelessly
        route(NATMANAGE);
        forward();
    } else {
        if (!t_relay()) {
            xlog("L_ERROR", "$var(logPrefixCall) Failed to relay request\n");
            sl_reply_error();
        } else if (is_method("NOTIFY")) {
            xlog("L_INFO", "$var(logPrefixIn2) Relaying notify request
with SipFrag($rb)\n");
        } else {
            xlog("L_INFO", "$var(logPrefixIn2) Relaying request\n");
        }
    }
    exit;
}

On Mon, Mar 11, 2024 at 7:28 AM Ben Kaufman via sr-users
<sr-users@lists.kamailio.org> wrote:
>
> There's also the question of when the header was appended as well, right?  
> Calling append_hf() after creating a transaction will only apply that header 
> to the current branch, not to subsequent branches.
>
>
> -----Original Message-----
> From: James Browne via sr-users <sr-users@lists.kamailio.org>
> Sent: Monday, March 11, 2024 7:03 AM
> To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
> Cc: James Browne <ja...@frideo.com>
> Subject: [SR-Users] Re: append_hf not working
>
> 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.
>
>
> One pitfall would be to think that this function would add this header field 
> to any reply that kamailio would send. This append_hf() function should add a 
> header field to a SIP request that it *relays*, but would not add it to a 
> response that kamailio *generates* (for that, you would use the 
> append_to_reply() function).
>
> James
>
> On Mon, 11 Mar 2024 at 11:26, Alex Balashov via sr-users 
> <sr-users@lists.kamailio.org> wrote:
> >
> > Indeed, it has become a bit of a cliché that msg_apply_changes() should be 
> > called after append_hf(), uac_replace_from(), etc.
> >
> > This should be dispelled. In the vast majority of use-cases, it is not only 
> > unnecessary, but highly undesirable.
> >
> > -- Alex
> >
> > > On 11 Mar 2024, at 06:45, Henning Westerholt via sr-users 
> > > <sr-users@lists.kamailio.org> wrote:
> > >
> > > Hello,
> > >  the usage of msg_apply_changes is not necessary (not even recommended) 
> > > for append_hf (and other functions) to work. The OP was talking about a 
> > > packet capture, so I assume that he got the capture after the proxy send 
> > > out the message.
> > >  Cheers,
> > >  Henning
> > >   -- Henning Westerholt -
> > > https://sk/
> > > alatan.de%2Fblog%2F&data=05%7C02%7Cbkaufman%40bcmone.com%7Cb9eabef23
> > > 1974f061db008dc41c47c6b%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7
> > > C638457559371077852%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQ
> > > IjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=IUKBac
> > > HQspO1gtJ5B3ZULUOt6oAJKaTMBWM6R%2FDiq1Y%3D&reserved=0
> > > Kamailio services - https://gilawa.com/
> > >   From: Unai Rodriguez via sr-users <sr-users@lists.kamailio.org>
> > > Sent: Montag, 11. März 2024 09:33
> > > To: Calvin E. via sr-users <sr-users@lists.kamailio.org>; Kamailio
> > > (SER) - Users Mailing List <sr-users@lists.kamailio.org>
> > > Cc: Unai Rodriguez <u...@rodr.org>
> > > Subject: [SR-Users] Re: append_hf not working  Using
> > > https://kamailio.org/docs/modules/stable/modules/textopsx.html#textopsx.f.msg_apply_changes
> > >  might be relevant in your case...
> > >  With best wishes, Unai Rodriguez
> > > On 11 Mar 2024 at 09:22 +0100, Benoit Panizzon via sr-users 
> > > <sr-users@lists.kamailio.org>, wrote:
> > >
> > > Hi Calvin
> > >
> > >
> > > I'm trying to add something simple like the following:
> > >
> > > append_hf("X-testheader: True\r\n", "From");
> > >
> > > However, I don't see my X-testheader in a packet capture. Are there
> > > any common pitfalls that would prevent append_hf from working as
> > > expected?
> > >
> > > Weird, I use this a lot and it always works. But I never attempted
> > > to specify the header after which it should be appended. Does it
> > > work if you don't specifiy "From"?
> > >
> > > Mit freundlichen Grüssen
> > >
> > > -Benoît Panizzon-
> > > --
> > > I m p r o W a r e A G - Leiter Commerce Kunden
> > > ______________________________________________________
> > >
> > > Zurlindenstrasse 29 Tel +41 61 826 93 00
> > > CH-4133 Pratteln Fax +41 61 826 93 01 Schweiz Web
> > > http://www/
> > > .imp.ch%2F&data=05%7C02%7Cbkaufman%40bcmone.com%7Cb9eabef231974f061d
> > > b008dc41c47c6b%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C63845755
> > > 9371097127%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luM
> > > zIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=fOFt%2BsXu%2FDg
> > > 3EeKqhoRlybWURiVXfz%2B0Di8aSYFWxvQ%3D&reserved=0
> > > ______________________________________________________
> > > __________________________________________________________
> > > Kamailio - Users Mailing List - Non Commercial Discussions To
> > > unsubscribe send an email to sr-users-le...@lists.kamailio.org
> > > Important: keep the mailing list in the recipients, do not reply only to 
> > > the sender!
> > > Edit mailing list options or unsubscribe:
> > > __________________________________________________________
> > > Kamailio - Users Mailing List - Non Commercial Discussions To
> > > unsubscribe send an email to sr-users-le...@lists.kamailio.org
> > > Important: keep the mailing list in the recipients, do not reply only to 
> > > the sender!
> > > Edit mailing list options or unsubscribe:
> >
> >
> > --
> > Alex Balashov
> > Principal Consultant
> > Evariste Systems LLC
> > Web:
> > https://evar/
> > istesys.com%2F&data=05%7C02%7Cbkaufman%40bcmone.com%7Cb9eabef231974f06
> > 1db008dc41c47c6b%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C63845755
> > 9371101627%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzI
> > iLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=YfdvEmQ5OWU4MOZ6dcj
> > rEP657%2FZ5A0ZA4lDz%2FeWSU2Q%3D&reserved=0
> > Tel: +1-706-510-6800
> >
> > __________________________________________________________
> > Kamailio - Users Mailing List - Non Commercial Discussions To
> > unsubscribe send an email to sr-users-le...@lists.kamailio.org
> > Important: keep the mailing list in the recipients, do not reply only to 
> > the sender!
> > Edit mailing list options or unsubscribe:
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe 
> send an email to sr-users-le...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
> Edit mailing list options or unsubscribe:
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
> To unsubscribe send an email to sr-users-le...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
> Edit mailing list options or unsubscribe:
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:

Reply via email to