Hi Henning,

Thanks a lot for the suggestion, it helped me to fix my issue. I used the 
replace function and it worked perfectly for my use-case!

4.7.  replace(re, txt)
Replaces the first occurrence of re with txt.
Meaning of the parameters is as follows:

  *
re - Regular expression.
  *
txt - String.

This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, 
BRANCH_ROUTE.
Example 1.7. replace usage

...
replace("server", "Kamailio SIP Proxy");
...



Regards,
Shah Hussain
________________________________
From: Henning Westerholt <h...@gilawa.com>
Sent: Thursday, May 9, 2024 5:36 PM
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Cc: Shah Hussain Khattak <shahhus...@msn.com>
Subject: RE: Is there any way to modify the Refer-To header username?


Hello,



there are other functions in textops module, e.g. subst(..) that can be used to 
do replacements.



Have a look to this module for more details and examples. The approach of 
deleting and adding it new works as well, of course.



Cheers,



Henning



--

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

Kamailio services – https://gilawa.com<https://gilawa.com/>





From: Shah Hussain Khattak via sr-users <sr-users@lists.kamailio.org>
Sent: Donnerstag, 9. Mai 2024 08:16
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Cc: Shah Hussain Khattak <shahhus...@msn.com>
Subject: [SR-Users] Is there any way to modify the Refer-To header username?



Hello Experts,



I wanted to check, is there any way to modify the username part of the Refer-To 
header in Kamailio? For example, I am getting the following header:



REFER-TO: <sip:sip.abc.domain.com:5061;transport=tls; ..... ; .... ; 
...<sip:sip.abc.domain.com:5061;transport=tls;%20.....%20;%20....%20;%20...>>



the username part is missing.



Can I add a username inside it? For example, change it to



REFER-TO: <sip:1...@sip.abc.domain.com:5061;transport=tls; ..... ; .... ; 
...<sip:1...@sip.abc.domain.com:5061;transport=tls;%20.....%20;%20....%20;%20...>>

REFER-TO: <sip:test-...@sip.abc.domain.com:5061;transport=tls; ..... ; .... ; 
...<sip:test-...@sip.abc.domain.com:5061;transport=tls;%20.....%20;%20....%20;%20...>>



I could not find any solution in the mailing list, the only way was to remove 
the header and then re-add it.



Thank you!



Regards,

Shah Hussain










__________________________________________________________
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