[SR-Users] Removing transport=TLS from the contact header

Rizwan Khan rizkhan at gmail.com
Tue Nov 10 13:14:38 CET 2015


                if( msg_apply_changes())
                {
                        xlog("L_INFO:", "INVITE::: [$ct]\n");
                }

subst("/^Contact:(.*);transport=tls(.*)/Contact:\1;transport=udp\2/i");
                if( msg_apply_changes())
                {

                        xlog("L_INFO:", "INVITE::: [$ct]\n");
                }


causes:
 0(3642) ERROR: <core> [cfg.y:3286]: yyparse(): cfg. parser: failed to find
command msg_apply_changes (params 0)
 0(3642) : <core> [cfg.y:3426]: yyerror_at(): parse error in config file
//etc/kamailio/kamailio.cfg, line 246, column 25: unknown command, missing
loadmodule?

and again

0(3642) ERROR: <core> [cfg.y:3286]: yyparse(): cfg. parser: failed to find
command msg_apply_changes (params 0)
 0(3642) : <core> [cfg.y:3426]: yyerror_at(): parse error in config file
//etc/kamailio/kamailio.cfg, line 251, column 25: unknown command, missing
loadmodule?


while if I do this:
 xlog("L_INFO:", "INVITE::: [$ct]\n");
 msg_apply_changes();
 xlog("L_INFO:", "INVITE::: [$ct]\n");


I get this:
INFO: <script>: INVITE::: [<sip:0514701916 at 10.11.204.81:38614
;transport=TLS>]
Nov 10 17:13:31 k-pxy-2 /usr/sbin/kamailio[3679]: DEBUG: <core> [re.c:469]:
subst_run(): subst_run: matched (243, 59): [Contact:
<sip:0514701916 at 10.11.204.81:38614;transport=TLS>#015]
Nov 10 17:13:31 k-pxy-2 /usr/sbin/kamailio[3679]: DEBUG: textops
[textops.c:695]: subst_f(): textops: replacing at offset 296 [Contact:
<sip:0514701916 at 10.11.204.81:38614;transport=TLS>#015] with [Contact:
<sip:0514701916 at 10.11.204.81:38614;transport=udp>#015]
Nov 10 17:13:31 k-pxy-2 /usr/sbin/kamailio[3679]: INFO: <script>: INVITE:::
[<sip:0514701916 at 10.11.204.81:38614;transport=TLS>]



Rizwan Khan



On Tue, Nov 10, 2015 at 4:41 PM, Daniel-Constantin Mierla <miconda at gmail.com
> wrote:

> Look inside syslog file to see the line where the errors are and
> description of the errors.
>
> Daniel
>
>
> On 10/11/15 12:38, Rizwan Khan wrote:
>
> Doesn't work. Still give the bad config errors.
>
> Rizwan Khan
>
>
>
> On Tue, Nov 10, 2015 at 4:13 PM, Daniel-Constantin Mierla <
> <miconda at gmail.com>miconda at gmail.com> wrote:
>
>> That is conflicting with other changes to the contact header.
>>
>> Try to use msg_apply_changes() before (and after) your subst operation
>> for changing contact.
>>
>> Daniel
>>
>>
>> On 10/11/15 12:00, Rizwan Khan wrote:
>>
>> I have fix_nated_contact() at multiple places :(
>>
>> Rizwan Khan
>>
>>
>>
>> On Tue, Nov 10, 2015 at 3:59 PM, Rizwan Khan < <rizkhan at gmail.com>
>> rizkhan at gmail.com> wrote:
>>
>>> Oh, Yes I do.
>>>
>>> Rizwan Khan
>>>
>>>
>>>
>>> On Tue, Nov 10, 2015 at 3:58 PM, Daniel-Constantin Mierla <
>>> <miconda at gmail.com>miconda at gmail.com> wrote:
>>>
>>>> Do you have set_contact_alias() or fix_nated_contact() in your config
>>>> file?
>>>>
>>>> Cheers,
>>>> Daniel
>>>>
>>>>
>>>> On 10/11/15 11:54, Rizwan Khan wrote:
>>>>
>>>> i am trying it but it doesn't change the string. Do I need to use
>>>> msg_apply_changes() ??
>>>>
>>>> I am trying that but it gives syntax error in the file.
>>>>
>>>> log("L_INFO:", "INVITE::: [$ct]\n");
>>>> subst("/^Contact:(.*);transport=tls(.*)/Contact:\1;transport=udp\2/i");
>>>> if(msg_apply_changes())
>>>> {
>>>>      xlog("L_INFO:", "INVITE::: [$ct]\n");
>>>> }
>>>>
>>>>
>>>> Rizwan Khan
>>>>
>>>>
>>>>
>>>> On Tue, Nov 10, 2015 at 11:45 AM, Koray Vatansever <
>>>> <koray.vatansever at gmail.com>koray.vatansever at gmail.com> wrote:
>>>>
>>>>> Hi Rizwan,
>>>>>
>>>>> You can try the following:
>>>>>
>>>>> subst("/^Contact:(.*);transport=tls(.*)/Contact:\1;transport=udp\2/i
>>>>> ");
>>>>>
>>>>> On the other hand, there should not be any other contact header
>>>>> modification in your script; for example set_contact_alias().
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Nov 10, 2015 at 7:28 AM, Rizwan Khan < <rizkhan at gmail.com>
>>>>> rizkhan at gmail.com> wrote:
>>>>>
>>>>>> Guys,
>>>>>>
>>>>>> Is this a stupid question or this just cannot be done?
>>>>>>
>>>>>> Any help will be highly appreciated.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Rizwan Khan
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Mon, Nov 9, 2015 at 6:53 PM, Rizwan Khan < <rizkhan at gmail.com>
>>>>>> rizkhan at gmail.com> wrote:
>>>>>>
>>>>>>> I want to remove the transport=TLS from the contact header.
>>>>>>>
>>>>>>> How can I do that inside Kamailio?  The flow is an under:
>>>>>>>
>>>>>>>
>>>>>>> Client --------> Kamailio -------------> FS
>>>>>>>            TLS                       UDP
>>>>>>>
>>>>>>>
>>>>>>> Client <-------- Kamailio <------------- FS
>>>>>>>            TLS                       UDP
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> FS gets a request on udp but it complains about TLS profile as the
>>>>>>> contact header has the transport=TLS. Since its receing traffic on UDP, if
>>>>>>> I only get rid of the value from the Contact Header, it would be great.
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>>
>>>>>>> Rizwan Khan
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
>>>>>> list
>>>>>> <sr-users at lists.sip-router.org>sr-users at lists.sip-router.org
>>>>>> <http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users>
>>>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>>>> <sr-users at lists.sip-router.org>sr-users at lists.sip-router.org
>>>>> <http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users>
>>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>>>
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users at lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>>
>>>>
>>>> --
>>>> Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>>> Book: SIP Routing With Kamailio - http://www.asipto.com
>>>> Kamailio Advanced Training, Nov 30-Dec 2, Berlin - http://asipto.com/kat
>>>>
>>>>
>>>> _______________________________________________
>>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>>> sr-users at lists.sip-router.org
>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>>
>>>>
>>>
>>
>> --
>> Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>> Book: SIP Routing With Kamailio - http://www.asipto.com
>> Kamailio Advanced Training, Nov 30-Dec 2, Berlin - http://asipto.com/kat
>>
>>
>
> --
> Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
> Book: SIP Routing With Kamailio - http://www.asipto.com
> Kamailio Advanced Training, Nov 30-Dec 2, Berlin - http://asipto.com/kat
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20151110/953c4aeb/attachment.html>


More information about the sr-users mailing list