[OpenSIPS-Users] textops replace and variables ..

Binan AL Halabi binanalhalabi at yahoo.com
Fri Aug 24 09:46:28 CEST 2012


Hi Sindrek,
look to this example from opensips documentation :# replace the uri in to: with the value of avp sip_address subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1$avp(sip_address)\2/ig') 
regards//Binan
--- On Mon, 8/20/12, sindrek <rauskjegg at gmail.com> wrote:

From: sindrek <rauskjegg at gmail.com>
Subject: [OpenSIPS-Users] textops replace and variables ..
To: users at lists.opensips.org
Date: Monday, August 20, 2012, 4:07 AM

Hi,

I'm stuck with an idiotic thing her .. probably an easy thing which I can
not see ..

I want to add "something" in front of a register contact uri.

This static way works:

if(is_method("REGISTER")){  
                replace("Contact: <sip:", "Contact: <sip:something");
        };

This dynamic way does not:

if(is_method("REGISTER")){
   $var(contact) = "something";
  
   replace("Contact: <sip:", "Contact: <sip:"+$var(contact));
                                         #or this:
   replace("Contact: <sip:", "Contact: <sip: $var(contact)"); #does not get
the variable content, just it's name
};

I guess the replace method in the textops module does see the variable as
text/string? It migth need somethings like a .toString?

/BR
Sindre






--
View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/textops-replace-and-variables-tp7581301.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.

_______________________________________________
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/20120824/fccd4962/attachment.htm>


More information about the Users mailing list