[SR-Users] Remove and Re add FROM in 200 OK sl reply

Lewis Hutchinson lewis.hutchinson at missionlabs.co.uk
Tue Aug 16 10:03:11 CEST 2022


Hi Daniel

It was a very long day so apologies for making an already confusing question more confusing but the answer you provided was what I was looking for.

The issue is the below:

(Handset) SUBSCRIBE ( No To-Tag / $ft From-Tag) ------> SBC ------> Kamailio -------> API Post

Kamailio (SL 200 OK To-Tag $ltt(s) / $ft From-Tag) ------> SBC ------> (Handset) SUBSCRIBE

NOTIFY ------>  Kamailio ( To-Tag = $ft from SUBSCRIBE / $ft From-Tag is a new from tag for the NOTIFY ) ------> SBC ------> (Handset) SUBSCRIBE



The SBC does not like the change of tag between 200OK and NOTIFY Forking but we are doing this in accordance with the RFC 3265 around Forking

I was asking the question to able to have options for testing in a Lab Environment so I can use the $ltt(s) provided in the 200 OK and work it into the NOTIFY coming form a 3rd Party.

I just couldn't see if for looking despite me being in the right place, so thanks for pointing it out


Lewis

From: Daniel-Constantin Mierla <miconda at gmail.com>
Sent: 15 August 2022 18:08
To: Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>; Lewis Hutchinson <lewis.hutchinson at missionlabs.co.uk>
Subject: Re: [SR-Users] Remove and Re add FROM in 200 OK sl reply


Hello,

not sure I really understood what you want to do, so some generic remarks:

  - From header for generated replies is taken from request. If you want a different one, change it for request, then do msg_apply_changes() and then generate the reply

  - the To-tag set by Kamailio in generated replies should be available via:

    * https://www.kamailio.org/wikidocs/cookbooks/5.6.x/pseudovariables/#lttkey-local-to-tag<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fwikidocs%2Fcookbooks%2F5.6.x%2Fpseudovariables%2F%23lttkey-local-to-tag&data=05%7C01%7Clewis.hutchinson%40missionlabs.co.uk%7C54499c43bd84439292b608da7ee0a835%7C97c26f550a7a4661bd8f7b43b50d3f2b%7C0%7C0%7C637961800600598054%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=9RdXwQxY6lRcpHeFB0lOan624tnKGsnb3Rl1V0q24Do%3D&reserved=0>

Cheers,
Daniel
On 11.08.22 17:19, Lewis Hutchinson wrote:
Apologies for the confusion I am actually trying to access to To tag in the sl reply and fix that to what I want (i.e the $ft of the SUBSCRIBE plus i.e -1234) to test





Lewis

From: Lewis Hutchinson
Sent: 11 August 2022 14:59
To: sr-users at lists.kamailio.org<mailto:sr-users at lists.kamailio.org>
Subject: Remove and Re add FROM in 200 OK sl reply

Hello All
kamailio 5.5.3
KEMI Python
Lab environemnt

Is there a reason why this does not work?

Lines 2 and 3 work but the removal of the initial From is not working on Line 1


1.                           KSR.hdr.remove("From")
2.                           KSR.hdr.append_to_reply("From: " +KSR.pv.gete("$fn") + " <"+KSR.pv.gete("$fu") + ">" + ";tag=" +KSR.pv.gete("$ft") + "--1234" + "\r\n")
3.                           KSR.sl.sl_send_reply(200, "OK")


In a SUBSCRIBE/NOTIFY scenario I am trying to control the From Tag returned in the 200OK so I can use the same one in subsequent NOTIFY messages generated outside of Kamailio, my theory is use the From tag in the Subscribe and append it on the reply with -1234 for example (this is only in a Lab at this stage, any other options please let me know)

Whenever I do this I end up with 2 From headers (see below)


SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.67:5060;branch=z9hG4bK-f710a11a;rport=46404;received=xx.yy.xx.yy
From: " testuser" sip:limeant30 at sip.viazeta.com;tag=bf8745def06c7b12
To: <sip: testuser at sip.viazeta.com>;tag=47969b75f14e6954812863912d1cf21c.b5f3318f<mailto:testuser at sip.viazeta.com%3e;tag=47969b75f14e6954812863912d1cf21c.b5f3318f>
Call-ID: b21ba770-9b5836aa at 192.168.1.67<mailto:b21ba770-9b5836aa at 192.168.1.67>
CSeq: 18137 SUBSCRIBE
Contact: "testuser" <sip:testuser@ xx.yy.xx.yy:46404<sip:testuser@%20xx.yy.xx.yy:46404>>
Expires: 3600
From: "testuser" sip:testuser at testbed.com;tag=bf8745def06c7b12--1234
Content-Length: 0

I have tried many many variations but the original From header always persists I have checked the debug logs and it says it has been removed

Anyone know what I am missing? And how to get KSR.hdr.remove("From") to work. Looking in a debug log the header is removed.



Lewis



__________________________________________________________

Kamailio - Users Mailing List - Non Commercial Discussions

  * sr-users at lists.kamailio.org<mailto:sr-users at lists.kamailio.org>

Important: keep the mailing list in the recipients, do not reply only to the sender!

Edit mailing list options or unsubscribe:

  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=05%7C01%7Clewis.hutchinson%40missionlabs.co.uk%7C54499c43bd84439292b608da7ee0a835%7C97c26f550a7a4661bd8f7b43b50d3f2b%7C0%7C0%7C637961800600598054%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=JFJOMnXDeBLNt4eb1xaTE4aezFS1iUEl1ShdWE4LWC0%3D&reserved=0>

--

Daniel-Constantin Mierla -- www.asipto.com<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=05%7C01%7Clewis.hutchinson%40missionlabs.co.uk%7C54499c43bd84439292b608da7ee0a835%7C97c26f550a7a4661bd8f7b43b50d3f2b%7C0%7C0%7C637961800600598054%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=b9NuYYIgFT2mfUqmbtQmHSVUrVrvCWkRhgIhlTEGb84%3D&reserved=0>

www.twitter.com/miconda<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=05%7C01%7Clewis.hutchinson%40missionlabs.co.uk%7C54499c43bd84439292b608da7ee0a835%7C97c26f550a7a4661bd8f7b43b50d3f2b%7C0%7C0%7C637961800600598054%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=5VdyX%2BUjP6Vg4Z37k9yOTpFSkpv4ZK5%2B9YQ%2FoMXwIWk%3D&reserved=0> -- www.linkedin.com/in/miconda<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=05%7C01%7Clewis.hutchinson%40missionlabs.co.uk%7C54499c43bd84439292b608da7ee0a835%7C97c26f550a7a4661bd8f7b43b50d3f2b%7C0%7C0%7C637961800600598054%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=io8VPRw%2BJk%2BWBK4SzbNfRcrA10EaQYw%2BJoM0datotew%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220816/5f91c074/attachment.htm>


More information about the sr-users mailing list