Hello,
I am attempting to change the Message Body of an SIP message using replace_body_all; I want to replace all attributes that start with rtcp. Here is my code =>
replace_body_all("rtcp:{1}[0-9]{5,}", newstring), and I call msg_apply_changes() after this call. Note that I verified that the regex is working using search.
The problem is that nothing gets changed. However, what I do get is a new string at the bottom of the Message Body with my newstring concatenated three times, which happens to be the number of times that rtcp occurs in the Message Body.
Note, I am doing this so that I can add the IP address to the rtcp attribute because this is required by a Provider.
Any ideas?
Thank you, -Steve
I've never used replace_body_all but I've done something similar using subt_body. One of the issues I've encountered is that you need to explicitly match line feed characters \n. Also in your replacement you need to include a carriage return and a new line at the end \r\n or they'll end up on one line like you're seeing.
replace_body_all may behave differently so this advice might not apply.
Hello,
On 01.12.18 18:27, Wilkins, Steve wrote:
Hello,
I am attempting to change the Message Body of an SIP message using replace_body_all; I want to replace all attributes that start with rtcp.
Here is my code =>
*replace_body_all(“rtcp:{1}[0-9]{5,}”, newstring), *and I call msg_apply_changes() after this call. Note that I verified that the regex is working using *search.*
*The problem* is that nothing gets changed. However, what I do get is a new string at the bottom of the Message Body with my *newstring* concatenated three times, which happens to be the number of times that rtcp occurs in the Message Body.
Note, I am doing this so that I can add the IP address to the rtcp attribute because this is required by a Provider.
Any ideas?
can you provide a sample INVITE message that exposes the issue? I would like to try to reproduce and fix if there is any issue in the function, but it happens that none of the phones I have around send such a= lines...
Cheers, Daniel