[OpenSIPS-Users] [Release] Planing 1.8.1 minor release
Saúl Ibarra Corretgé
saul at ag-projects.com
Tue Aug 14 15:21:53 CEST 2012
Hi Bogdan,
On Aug 14, 2012, at 2:05 PM, Bogdan-Andrei Iancu wrote:
> Hi Saul,
>
> The idea with the "apply_changes" is not the most fortunate, I would say - mainly as it is difficult to use and needs scripting. Why difficult? basically you should keep track of changes over the body and decide when to call it from script. Like in your case you should call it before call it before the strip_body() - to be sure you strip all previous changes too - and once again after - so future functions will see the actual strip.
> Now considering that you may have 3-4 functions changing the body (codec ops, removing/adding body, media relay, etc), the whole scripting integration will become a nightmare - or to be on the safe side, you should call it all the time before body related functions. But not even this should cover all cases - think about body changes you are not aware from script (via callbacks when using rtpproxy or mediaproxy).....
>
> What I would rather explore is : making the lump mechanism to automatically discard all changes over a msg chunk that is to be deleted. This will simply solve the problem. Whatever the order of ops (change versus delete), at the end you will see that there is a change inside a delete part, so simply drop the change.
>
> What do you think ?
>
I do like your proposal. I'm not sure how complex it would be since the lumps system is a bit of a black-box to me, but it would indeed solve the problem :-)
However, that approach is only fixing the case when the body is removed, while having the ability to apply the changes at any time would also help in other cases when dealing with adding and removing headers, for example. Yes, I know it can always be workarounded by deferring stuff until the last moment, but when your config gets huge following the code becomes tricky. Moreover, the fact that changes are not visible immediately is not very natural.
All in all, the way I see it, both approaches seem to solve the problem. Having the ability to apply changes to a message can also be useful, not only for this case. So, how about having both? Your proposed fix would work in case the body is being deleted and the apply_changes proposal also helps in other cases.
KInd regards,
--
Saúl Ibarra Corretgé
AG Projects
More information about the Users
mailing list