Hi, I am trying to develop module for Kamailio and I am wondering how to change some of SDP fields.
I have function where I cast `sip_msg`'s `body` to `sdp_info` structure and within this function I am changing some fields in `sessions` and `streams` list.
I am able to see changes when I am printing them after message leaves the function but Kamailio sends the original message not the changed one. Do I need somehow let the Kamailio know that the message was changed and it should rebuild `buf` field? Or I need to change directly `buf` field within `sip_msg`?
If you need some more details to be able to help me with my problem please ask freely. Or maybe if I need to rephrase my problem just let me know.
Thanks in advance
Cockhootec Yahrabee cockootec@gmail.com:
I have function where I cast `sip_msg`'s `body` to `sdp_info` structure and within this function I am changing some fields in `sessions` and `streams` list.
I am able to see changes when I am printing them after message leaves the function but Kamailio sends the original message not the changed one. Do I need somehow let the Kamailio know that the message was changed and it should rebuild `buf` field? Or I need to change directly `buf` field within `sip_msg`?
You need to handle message modifications as data lumps. Have a look at Kamailio development guide: http://www.asipto.com/pub/kamailio-devel-guide/#c14datalump
Also, look if you can extend sdpops module instead of baking new one: http://kamailio.org/docs/modules/devel/modules/sdpops.html
Hope this helps :)
Thank you, Mikko,
I need to perform this actions inside my module (I don't want to use config files and config functions to perform this actions) because the module performs more actions than that ;-) Also this means that it is not possible for me to just work on top of the sdpops.
But thanks I will look at data lumps. It's shame that all useful functions such as `msg_apply_changes()` ( https://github.com/kamailio/kamailio/blob/fcdf5f9cfff634ebfa736d7084d5e5483a...) are static so it means that I need to copy&paste them when I want to use them within module.
Also it is even possible to add SDP attribute by adding new data_lump? Isn't data_lumps dedicated to manage SIP message headers?
I just need a solid answer for question: "Is the adding attribute to SDP body implemented in Kamailio? If yes where can I find it and how can I use it?" If it is not implemented yet how can I contribute? It is easy as modifying `buf` of `sip_msg`?
I am sorry maybe the subject of this email is not clear enough. I mentioned changing SIP message but not SDP body.
On Wed, Apr 29, 2015 at 9:00 AM, Mikko Lehto mslehto@iki.fi wrote:
Cockhootec Yahrabee cockootec@gmail.com:
I have function where I cast `sip_msg`'s `body` to `sdp_info` structure
and
within this function I am changing some fields in `sessions` and
`streams`
list.
I am able to see changes when I am printing them after message leaves the function but Kamailio sends the original message not the changed one. Do
I
need somehow let the Kamailio know that the message was changed and it should rebuild `buf` field? Or I need to change directly `buf` field
within
`sip_msg`?
You need to handle message modifications as data lumps. Have a look at Kamailio development guide: http://www.asipto.com/pub/kamailio-devel-guide/#c14datalump
Also, look if you can extend sdpops module instead of baking new one: http://kamailio.org/docs/modules/devel/modules/sdpops.html
Hope this helps :)
-- Mikko Lehto
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Cockhootec Yahrabee cockootec@gmail.com:
Also it is even possible to add SDP attribute by adding new data_lump? Isn't data_lumps dedicated to manage SIP message headers?
Lumps work also for message bodies.
Have a look at modules/nathelper/nathelper.c -> fix_nated_sdp_f() There is example of insert_new_lump_after() where stuff is added to body.
I have not personally written code that adds lumps to messages, but removing from body works perfectly with data lumps i.e. sdpops/sdp_remove_line_by_prefix().
I just need a solid answer for question: "Is the adding attribute to SDP body implemented in Kamailio? If yes where can I find it and how can I use it?"
In core there seem to be only SDP attribute get functions (/parser/sdp). Examples of body modification can be found from different modules (sdpops, nathelper, rtpengine, mangler).
If it is not implemented yet how can I contribute? It is easy as modifying `buf` of `sip_msg`?
I think core committers can comment more on this, but in my view contributions to sdpops -module would be great. For script writer or C module functions.