[Serusers] configuring ser.cfg for ip addresses

Jan Janak jan at iptel.org
Tue May 18 13:02:36 CEST 2004


It depends where do you put it. Some commands in the configuration file
expect a normal string -- in this case you don't have to escape dots,
for example: listen="domain.com"

Some commands expect the string to be a regular expression, in that case
you have to escape dots as well, for example:
if (uri =~ "sip:john\.doe at domain\.com")

Note:
if (uri == "sip:john.doe at domain.com")

(== means literal comparison and the 2nd argument is a literal. On the
other hand =~ means regular expression matching and the 2nd argument is
a regular expression).

  Jan.

On 17-05 03:37, Amen Holmes wrote:
> Thanks - that makes sense.
> If I am using a url instead of defining the ip address, e.g. iptel.org, why don't I need to put in the backslash to escape the . character?
> 
> Jan Janak <jan at iptel.org> wrote:
> On 14-05 07:47, Amen Holmes wrote:
> > I am a newbie to ser and am trying to get ser.cfg working for a specific ip address.
> > 
> > I am trying to get ser.cfg to pick up a specific ip address. Do I need anything special when defining the ip address (like \ characters)?
> > 
> > Any help would be greatly appreciated.
> > 
> > e.g.
> > route{
> > 
> > if (uri=~"^sip:[09][0-9]*@194.xxx.xxx.xxx") {
> > ........}
> 
> Yes, =~ means "match using regular expression" and the string between
> quotes is supposed to be a regular expressions. Therefore you have to
> escape . characters with backslash:
> 
> if (uri=~"^sip:[09][0-9]*@194\.xxx\.xxx\.xxx") {
> 
> Jan.
> 		
> ---------------------------------
> Do you Yahoo!?
> SBC Yahoo! - Internet access at a great low price.




More information about the sr-users mailing list