[OpenSIPS-Users] TEXTOPS module

Denis Putyato denis7979 at mail.ru
Tue Dec 21 11:50:20 CET 2010


Thank you Bogdan, that is working

-----Original Message-----
From: users-bounces at lists.opensips.org [mailto:users-bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei Iancu
Sent: Monday, December 20, 2010 5:27 PM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] TEXTOPS module

Hi Denis,

the best way to do it is via branch_route 
(http://www.opensips.org/Resources/DocsCoreRoutes16#toc2) . Whatever 
changes you do there will be applied only for that particular branch and 
not for all branches. When you do changes in the request route, the 
changes will be applied to all future branches !

So, do something like this:

- in request route (first time) put the RPID, PAI and FROM (new vals ) 
in 2 different AVPS (according to the first selected GW)
- arm a branch route and failure route
- do t_relay() -> this will trigger the branch route and you can do the 
changes to the messages ( as you do it now)
- if you end up in failure route -> set new values for the 3 AVPs, 
reflecting the new destination
- do t_relay() -> triggers branch route, etc..

Regards,
Bogdan


Denis Putyato wrote:
> Thank you Bogdan for your answer. Now I understood that apply changes is a bad idea.
> But during process a call I have to make some changes to INVITE message. 
> For example,
> I need to add Remote-Party-ID (RPI) and/or P-Asserted-ID (PAI) and make uac_replace_from(). If I make it for the first time everything fine. 
> But if I need then change these fields (via subst or uac_replace_from() again)(for example, some gateways fails and cannot accepts call, I use use_next_gw() of d_routing module and MUST change callerid information) then my tests show that during, for example, second time call of uac_replace_from() there are two uri in From: header field (as you understand that is wrong), or if I make subst() of RPI or PAI then second header RPI and PAI appear in addition of first headers which I added (or subst) before. 

>
> And to avoid this I make signaling loop. New INVITE process as a new message with modified early headers, so I can change it again.   
>
> -----Original Message-----
> From: users-bounces at lists.opensips.org [mailto:users-bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei Iancu
> Sent: Monday, December 20, 2010 4:07 PM
> To: OpenSIPS users mailling list
> Subject: Re: [OpenSIPS-Users] TEXTOPS module
>
> Hello Denis,
>
> So far there is no good arguments for such a function, but there are a 
> lot of performance penalties while using such a function.
>
> Basically, to apply the change to a message, opensips/kamilio has to 1) 
> take the received buffer and the changes and to generate a new buffer 
> with the whole message (including the changes) and to 2) take the newly 
> generate buffer and to parse it as a SIP content in order to be able to 
> use internally it.
> Bottom line, each time you use such a function you double the processing 
> effort for parsing and generating SIP messages. And if you check the 
> code profiling we did (see 
> http://www.opensips.org/Resources/TestsProfiling), these operations are 
> ~50% from the total CPU usage (cumulate the PARSE and BUILD times).
>
> Now, in most of the cases (99% of the case) you do not really need to 
> apply changes in realtime - there are a lot of simple tricks to avoid 
> it. If you describe the problem you have, I can help you in putting some 
> extra logic in the script to avoid the need to apply changes.
>
> Using a smart approach is more efficient than a brute force approach - 
> the idea is that you are aware of the changes you do in script and you 
> remember (in script) these changes, so you can take them into account in 
> your later processing even if they are not actually applied on the SIPS 
> message.
>
> Regards,
> Bogdan
>
> Denis Putyato wrote:
>   
>> Hello!
>>
>> In kamailio project there is a function |msg_apply_changes() ||in 
>> textops module for applying changes (for example add or subst some 
>> header field) in SIP messages. Is there some way on opensips for doing 
>> such operation? Now I need make signaling “loop” for change header 
>> fields which I, for example, add during call process.|
>>
>> | |
>>
>> |Opensips 1.6.3|
>>
>> | |
>>
>> |Thank you || |
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>   
>>     
>
>
>   


-- 
Bogdan-Andrei Iancu
OpenSIPS Event - expo, conf, social, bootcamp
2 - 4 February 2011, ITExpo, Miami,  USA
www.voice-system.ro


_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




More information about the Users mailing list