textops and Variable

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

textops and Variable

Marco Colombo
Hi All,
i'm trying with Textops to do codec substitution in a call with re-invite.
I'm trying to do this, with this command :

replace_body_all("m=audio 7078 RTP/AVP 8 18 0 2 100 99", "m=audio 7078 RTP/AVP 8 18 101");

but when this line "m=audio 7078 RTP/AVP 8 18 0 2 100 99" does not match perfectly, such as : "m=audio 7078 RTP/AVP 0 2 100" ecc
This substitution does not work.
It's possible to do, something like this :

replace_body_all("m=audio 7078 RTP/AVP * ", "m=audio 7078 RTP/AVP 8 18 101");
I would to replace any codec with this "8 18 101"

Anybody can help me?

Thanks for all
Best Regards
Marco

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: textops and Variable

Spady#7
Hi, i really suppose you should use REGEX.
As per manual:

1.3.8.  replace_body_all(re, txt)

Replaces all occurrence of re in the body of the message with txt. Matching is done on a per-line basis.

Meaning of the parameters is as follows:

re - Regular expression.

txt - String.

Regards

Reply | Threaded
Open this post in threaded view
|

Re: textops and Variable

Bogdan-Andrei Iancu-2
In reply to this post by Marco Colombo
Hi Marco,

Your approach is (1) buggy as you do not delete the eventual rtpmap line
and (2) will work only once (as you cannot change twice the same part of
a message).

What I suggest is to try to use the dedicated functions for codec
manipulation from the sipmsgops module:
         
http://www.opensips.org/html/docs/modules/1.8.x/sipmsgops.html#id293156

Regards,

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


On 11/08/2012 11:30 AM, Marco Colombo wrote:

> Hi All,
> i'm trying with Textops to do codec substitution in a call with re-invite.
> I'm trying to do this, with this command :
>
> replace_body_all("m=audio 7078 RTP/AVP 8 18 0 2 100 99", "m=audio 7078 RTP/AVP 8 18 101");
>
> but when this line "m=audio 7078 RTP/AVP 8 18 0 2 100 99" does not match perfectly, such as : "m=audio 7078 RTP/AVP 0 2 100" ecc
> This substitution does not work.
> It's possible to do, something like this :
>
> replace_body_all("m=audio 7078 RTP/AVP * ", "m=audio 7078 RTP/AVP 8 18 101");
> I would to replace any codec with this "8 18 101"
>
> Anybody can help me?
>
> Thanks for all
> Best Regards
> Marco
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>

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