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

SIP sip at arcdiv.com
Fri May 25 07:41:25 MST 2007


Anthony Francis wrote:
> Eugen Rogoza wrote:
>> Hello,
>>
>> I'm trying to match a number in international format, like +49XXXX...
>>
>> 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.


More information about the asterisk-users mailing list