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 ?

Regards,
Bogdan

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com


On 08/14/2012 11:29 AM, Saúl Ibarra Corretgé wrote:
Hi guys,

On Aug 13, 2012, at 9:55 PM, Saúl Ibarra Corretgé wrote:

Hi Rudy,

On Aug 13, 2012, at 8:19 PM, Rudy wrote:

Bogdan,

Great work on all the improvements. There is a patch I submitted a
while back for media proxy. I explained this to Vlad that there could
be other scripts / modules effected. Basically, once you call
strip_body() on a message, internally you are still able to access
that body (in some cases an SDP). The get_body() function should not
return anything if strip_body() was called. My patch fixes this
problem only in mediaproxy by checking lumps for deleted body. A more
elegant solution would be to fix opensips internally as described
above (ie: get_body() should fail after strip_body() being called) .

https://sourceforge.net/tracker/?func=detail&aid=3530859&group_id=232389&atid=1086412

It would be great if we can get this fix, or a more proper one into 1.8.1 .

I talked about this with Vlad at ClueCon and there doesn't seem to be a better 
approach given the limitations of the lump system. I think we can get this into 
1.8.1 after a final look.

After sleeping over it, I don't think this is such a good idea, because it 
doesn't work in all cases. If you use the separated functions like this it will 
not work:

use_media_proxy();
....
strip_body();

Any other module that also operates on the message body suffers from this, and 
I'd rather not add tens of workarounds here-and-there.

The proper solution would of course be to get rid of the lumps :-), but since 
that is unlikely to happen soon, I suggest we reconsider having a 
apply_message_changes function, which would apply all the lumps immediately, so 
the next function that operates on the message would find it changed already. 
Example:

strip_body();
apply_message_changes();
...
use_media_proxy();

This function is already implemented in Kamailio and a while ago I started 
porting it but I didn't finish it. It should be pretty straightforward to 
finish it, so if we settle on this approach I could finish it. However, being a 
new feature it would only make it to 1.9 version.


Regards,

--
Saúl Ibarra Corretgé
AG Projects




_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to