Re: [asterisk-users] Matching "+" at the beginning of the line

2007-05-25 Thread Tim Panton


On 25 May 2007, at 16:44, Eugen Rogoza wrote:


On Fri, 2007-05-25 at 08:14 -0700, Steve Langstaff wrote:
I came across an issue where the user interface I was using  
(FreePBX?) to enter expressions was silently swallowing backslash  
characters (this wasn't regexp, but my dialplan had to add a SIP  
header with a semicolon in - that was falling foul of the comment  
character matching for the user interface, so I had to escape it,  
but that was being stripped elsewere!)


So I wanted the following in the dial plan:

Blah;blah

But I had to enter:

Blah\\;blah

And when this was displayed on the user interface it was shown as:

Blah\;blah

Just a thought.



You are right, it looks like the backslashes are being silently
swallowed, but adding extra ones doesn't help either :-)

It cannot even match the backslash itself (\\). By the way, using your
suggestions, one should type "\\\" to match a backslash :-)


I had to do something messy to get this to work in the dialplan:

exten => 1,n,Set(PLUS=\\+)
exten => 1,n,set(INNAT=${REGEX("^${PLUS}" ${ATELNO})})
exten => 1,n,gotoif($[${INNAT}] ?visint)

Now admittedly I had a whole lot of other things going on that
probably made it harder than it had to be.



Tim Panton

www.mexuar.net
www.westhawk.co.uk/



___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


RE: [asterisk-users] Matching "+" at the beginning of the line

2007-05-25 Thread Eugen Rogoza
On Fri, 2007-05-25 at 08:14 -0700, Steve Langstaff wrote:
> I came across an issue where the user interface I was using (FreePBX?) to 
> enter expressions was silently swallowing backslash characters (this wasn't 
> regexp, but my dialplan had to add a SIP header with a semicolon in - that 
> was falling foul of the comment character matching for the user interface, so 
> I had to escape it, but that was being stripped elsewere!)
> 
> So I wanted the following in the dial plan:
> 
> Blah;blah
> 
> But I had to enter:
> 
> Blah\\;blah
> 
> And when this was displayed on the user interface it was shown as:
> 
> Blah\;blah
> 
> Just a thought.
> 

You are right, it looks like the backslashes are being silently
swallowed, but adding extra ones doesn't help either :-)

It cannot even match the backslash itself (\\). By the way, using your
suggestions, one should type "\\\" to match a backslash :-)

Eugen

___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


RE: [asterisk-users] Matching "+" at the beginning of the line

2007-05-25 Thread Steve Langstaff
I came across an issue where the user interface I was using (FreePBX?) to enter 
expressions was silently swallowing backslash characters (this wasn't regexp, 
but my dialplan had to add a SIP header with a semicolon in - that was falling 
foul of the comment character matching for the user interface, so I had to 
escape it, but that was being stripped elsewere!)

So I wanted the following in the dial plan:

Blah;blah

But I had to enter:

Blah\\;blah

And when this was displayed on the user interface it was shown as:

Blah\;blah

Just a thought.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Eugen Rogoza
> Sent: 25 May 2007 15:30
> To: Anthony Francis; asterisk-users@lists.digium.com
> Subject: Re: [asterisk-users] Matching "+" at the beginning 
> of the line
> 
> On Fri, 2007-05-25 at 08:22 -0600, Anthony Francis wrote:
> > Eugen Rogoza wrote:
> > > Hello,
> > >
> > > I'm trying to match a number in international format, 
> like +49...
> > >
> > > The regexp string "^\+49" doesn't work. Both in $["+49..." : 
> > > "^\+49"] and ${REGEX("^\+49" ${NUMBER})}.
> > >
> > > The error is:  WARNING[12486]: func_strings.c:138 regex: 
> Malformed 
> > > input
> > > REGEX(): Invalid preceding regular expression.
> > >
> > > The regexp expression "^49\+" works. Does Asterisk have problems 
> > > matching the plus at the beginning of the string, or am I 
> escaping 
> > > something incorrectly?
> > >
> > > Eugene
> > >
> > >
> > >
> > >
> > >   
> > That's because you don't dial a + you dial 011 here in 
> America, the + 
> > is meta for insert you international dialing prefix here.
> 
> When receiving calls, I have a number in RURI and "From" 
> field exactly in this international format (with plus) and 
> have to transform it to the usual 0049... That's why I have 
> to match the plus.
> 
> 
> --
> Eugen Rogoza
> VoIP Services
> --
> --
> Telefon:  +  49  (0) 431  90 20 648
> Telefax:  +  49  (0) 431  90 20 559
> E-Mail:[EMAIL PROTECTED]
> Website: http://www.freenet-ag.de
> --
> --
> freenet Cityline GmbH
> Ein Unternehmen der freenet AG
> Hamburger Chaussee 2-4
> 24114 Kiel
> --
> --
> Geschäftsführer: Eckhard Spoerr, Axel Krieger Amtsgericht 
> Kiel, HRB 6202
> 
> ___
> --Bandwidth and Colocation provided by Easynews.com --
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>http://lists.digium.com/mailman/listinfo/asterisk-users
> 
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Matching "+" at the beginning of the line

2007-05-25 Thread SIP

Anthony Francis wrote:

Eugen Rogoza wrote:

Hello,

I'm trying to match a number in international format, like +49...

The regexp string "^\+49" doesn't work. Both in $["+49..." : "^\+49"]
and ${REGEX("^\+49" ${NUMBER})}.

The error is:  WARNING[12486]: func_strings.c:138 regex: Malformed input
REGEX(): Invalid preceding regular expression.

The regexp expression "^49\+" works. Does Asterisk have problems
matching the plus at the beginning of the string, or am I escaping
something incorrectly?

Eugene




  
That's because you don't dial a + you dial 011 here in America, the + 
is meta for insert you international dialing prefix here.


That doesn't much explain why the regexp doesn't work.  If you're 
dialing from a softphone, for instance, and dial a +, it comes through 
as a +. It's up for the server to decide what to do with it. If you 
can't match it and therefore convert it to the appropriate international 
dialing prefix, that's a problem.


Think globally. :) Not everyone wants to require their customers to all 
dial 011, or 00, or 001, or any number of alternate international prefixes.

___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Matching "+" at the beginning of the line

2007-05-25 Thread Eugen Rogoza
On Fri, 2007-05-25 at 08:22 -0600, Anthony Francis wrote:
> Eugen Rogoza wrote:
> > Hello,
> >
> > I'm trying to match a number in international format, like +49...
> >
> > The regexp string "^\+49" doesn't work. Both in $["+49..." : "^\+49"]
> > and ${REGEX("^\+49" ${NUMBER})}.
> >
> > The error is:  WARNING[12486]: func_strings.c:138 regex: Malformed input
> > REGEX(): Invalid preceding regular expression.
> >
> > The regexp expression "^49\+" works. Does Asterisk have problems
> > matching the plus at the beginning of the string, or am I escaping
> > something incorrectly?
> >
> > Eugene
> >
> >
> >
> >
> >   
> That's because you don't dial a + you dial 011 here in America, the + is 
> meta for insert you international dialing prefix here.

When receiving calls, I have a number in RURI and "From" field exactly
in this international format (with plus) and have to transform it to the
usual 0049... That's why I have to match the plus.


-- 
Eugen Rogoza
VoIP Services

Telefon:  +  49  (0) 431  90 20 648
Telefax:  +  49  (0) 431  90 20 559
E-Mail:[EMAIL PROTECTED]
Website: http://www.freenet-ag.de

freenet Cityline GmbH
Ein Unternehmen der freenet AG
Hamburger Chaussee 2-4
24114 Kiel

Geschäftsführer: Eckhard Spoerr, Axel Krieger
Amtsgericht Kiel, HRB 6202

___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Matching "+" at the beginning of the line

2007-05-25 Thread Anthony Francis

Eugen Rogoza wrote:

Hello,

I'm trying to match a number in international format, like +49...

The regexp string "^\+49" doesn't work. Both in $["+49..." : "^\+49"]
and ${REGEX("^\+49" ${NUMBER})}.

The error is:  WARNING[12486]: func_strings.c:138 regex: Malformed input
REGEX(): Invalid preceding regular expression.

The regexp expression "^49\+" works. Does Asterisk have problems
matching the plus at the beginning of the string, or am I escaping
something incorrectly?

Eugene




  
That's because you don't dial a + you dial 011 here in America, the + is 
meta for insert you international dialing prefix here.

___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users