[SR-Users] How to do replace_body_all with Kemi python version kamailio 5.0.x

Daniel-Constantin Mierla miconda at gmail.com
Wed Sep 27 11:05:55 CEST 2017


Hello,

the version 5.0 doesn't have too many exports to kemi. In master branch
there is already subst_body():

  -
https://github.com/kamailio/kamailio/blob/master/src/modules/textops/textops.c#L3541

I will add more as I get time before 5.1 release.

Anyhow, even in 5.0 is a generic kemi function that allows executing any
kamailio.cfg function, respectively:

KSR.x.modf(func, param1, ...)

In your case, try:

KSR.x.modf("replace_body_all", "a=sendonly", "a=sendrecv")

You should be careful with KSR.x.modf(...), because is some cases it may
result in pkg leak due to cfg param fixup. So, do some tests and be sure
that pkg memory stats are not indicating a leak.

Cheers,
Daniel

On 26.09.17 10:48, Muhammad Zaka wrote:
>
> Hi
>
>  
>
> We are experiencing issue with python script KSR.
> textops.replace_body_all using branch 5.0.2: -
>
>  
>
> Example Code:
>
> KSR.textops.replace_body_all("a=sendonly", "a=sendrecv")
>
>  
>
> It looks like that the module textops and textopsx are not available.
> Using $rb or $msg(body) pseudo variables isn’t working as they are
> readonly.
>
>  
>
> Is there any other way to replace the body?
>
>  
>
> Many Thanks
>
>  
>
> Regards
>
>  
>
> Muhammad Zaka
>
>  
>
>  
>
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - www.asipto.com
Kamailio World Conference - www.kamailioworld.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20170927/f8880402/attachment.html>


More information about the sr-users mailing list