[OpenSIPS-Users] Adding ptime to SDP

solarmon solarmon at one-n.co.uk
Tue Dec 8 15:47:16 EST 2020


Hi Donat,

Thank you for your reply.

I did also go through the sipmsgops and textops functions and came to the
same conclusion/solution as you!

I eventually used the following:

search_append_body("^a=.+$","\na=ptime:20");

So, slightly different from yours in terms of the carriage returns. I only
needed a single '\n' at the start of the replacement text.

It would have been nice for a function to append the end end of the SDP
attributes, but I'm hoping this is a good enough workaround for now.

Thank you once again!

On Tue, 8 Dec 2020 at 15:25, Donat Zenichev <donat.zenichev at gmail.com>
wrote:

> Good day Solarmon,
> if to take a look at sipmsgops.so documentation here:
> https://opensips.org/html/docs/modules/2.4.x/sipmsgops#func_add_body_part
> (I just picked out the first appeared branch, which was 2.4, you can pick
> out either 3.0 or one you need).
>
> The quotation here:
> "This function can be used to add a new body part to the message body. If
> another part already exists, the body of the message will be converted to a
> multi-part body automatically."
> It looks like this definition clears out your question well. If not,
> please let me know what is not clear for you here.
>
> The same module (sipmsgops.so) has another functionality for SIP headers
> insertions instead.
> For an insertion of SIP headers, please refer to "insert_hf()" :
> https://opensips.org/html/docs/modules/2.4.x/sipmsgops.html#func_insert_hf
> (same function exists for 3.0 branch as well)
>
> For an insertion of SDP headers, you might try to use
> "search_append_body()" of textops.so:
> https://opensips.org/html/docs/modules/2.4.x/textops.html#func_search_append_body
> (same function exists for 3.0 branch as well)
>
> For your case, I would try to use something like this:
> "search_append_body("^a=.+$", "a=ptime:20\r\n");"
>
> Otherwise, I don't see any function that could just simply insert one more
> SDP header,
> without pointing out - after which particular SDP header, your new header,
> should be thrown in. Might be a case for a feature request.
> I might be mistaken here. Please correct me, if I'm wrong.
>
>
> On Tue, Dec 8, 2020 at 1:08 PM solarmon <solarmon at one-n.co.uk> wrote:
>
>> Hi,
>>
>> How can I add/append a ptime value in the SDP packet?
>>
>> I've tried using:
>>
>> add_body_part("a=ptime:20", "application/sdp");
>>
>> However, this just creates an additional "application/sdp" section rather
>> than add/append to the existing one.
>>
>> Is there not a sipmsgops or textops function to process the SDP
>> headers/atttibutes?
>>
>> Thank you.
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>
>
> --
>
> Best regards,
> Donat Zenichev
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20201208/9828c9ef/attachment.html>


More information about the Users mailing list