Thank you Henning for this information:

 

I found in our cfg there is no set_contact_alias() but a add_contact_alias() function called for INVITE|SUBSCRIBE|UPDATE|REGISTER messages. According to:

https://kamailio.org/docs/modules/5.5.x/modules/nathelper.html#nathelper.f.add_contact_alias, it is for add alias src ip/port/transport to the end of Contact URI line

I tried comment it out and I don’t see the bad ;alias be fore TO: any more. However, it caused some other issue I’m now have an incomplete Contact URI line. And caused some further issue.

 

So I guess my original issue was after I add ;transport=tcp at the end of the Contac URI line the add_contact_alias() function can’t find the correct line to append the alias parameter, and simply added to before the To: line. Do you know where does this add_contact_alias function actually been defined? Maybe I take a look at it and see if I can find some hint there.

 

BR,

 

Weiqi

 

From: Henning Westerholt <hw@gilawa.com>
Sent: Wednesday, March 30, 2022 2:48 AM
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Cc: Weiqi Yao <wyao@omniprophis.com>
Subject: RE: Kamailio PCSCF route logic

 

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

 

Hello,

 

check out the different functions in this module: https://kamailio.org/docs/modules/5.5.x/modules/nathelper.html#nathelper.set_contact_alias

 

Cheers,

 

Henning

 

--

Henning Westerholt – https://skalatan.de/blog/

Kamailio services – https://gilawa.com

 

From: sr-users <sr-users-bounces@lists.kamailio.org> On Behalf Of Weiqi Yao
Sent: Tuesday, March 29, 2022 8:10 PM
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Subject: [SR-Users] Kamailio PCSCF route logic

 

Hello community,

 

We made some modifications to Kamailio PCSCF sample cfg file, so when PCSCF receiving an tcp SUBSCRIBE message it add ;transport=tcp to the end of Contact URI. Below is what we added the route block right after if (is_method("INVITE|SUBSCRIBE”)) logic

 

         if (is_method("SUBSCRIBE") && proto=='tcp') {

            $var(original_contact_header) = $ct;

            $var(new_contact_header) = $(var(original_contact_header){re.subst,/(.*:.*)(>);/\1;transport=tcp>/g});

            remove_hf("Contact");

            append_hf("Contact: $var(new_contact_header)\r\n");

            msg_apply_changes();

         }

 

We did see the ;transport=tcp been added but we also seeing a bad line ;alias=[…] is added before the To: line

 

Does anyone know what function might cause this ;alias been added before To: line?

 

BR,

 

Weiqi