[OpenSIPS-Users] Message body modification

Filippo Zangheri filippo.zangheri at yahoo.it
Mon Sep 22 18:51:07 CEST 2008


Hi everybody,

I have the need to deeply modify the body of a message and a couple
of headers, or add them if they are not present in the original
message.

I'm doing this in a module for opensips-1.4.2-notls.

What is the preferred way to accomplish this without losing important
information (i.e., lumps, etc.)?

Currently, I'm implementing it this way:

 1. fill a fresh new buffer;
 2. pkg_malloc() a new struct sip_msg;
 3. pkg_free() the old message;
 4. assign the new buffer to the new message;
 5. parse() the message.


This allows for the preservation of all data present in the raw message
buffer, but makes me lose the lumps. To overcome this issue i've moved
the related script code at the beginning of the route{} script in
opensips.cfg. But that's just a workaround which will not work when the
operations performed by my code become more time-consuming, because the
SIP UA who sent the message will not receive the "100/Trying" reply for
a while and it will be retransmitting its INVITE multiple times.

Any hints?

Thanks.
Best regards.

-- 
Filippo Zangheri

GPG key ID: 0x6C1F2F2F

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.opensips.org/pipermail/users/attachments/20080922/f3f82935/attachment.pgp 


More information about the Users mailing list