[Home]

Summary:ASTERISK-07326: Regexp for sip addresses containing other characters than digits
Reporter:Mats Karlsson (matsk)Labels:
Date Opened:2006-07-12 04:47:55Date Closed:2011-06-07 14:07:55
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/Configuration
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:extension.conf

Goal: Pattern matching for sip uri's example: john.smith@foo.org

When using direct matching, example:
exten => john.smith,1,Dial(SIP/12345@outbound,,ro)
works.

exten => _.,1,Dial(SIP/12345@outbound,,ro)
doesn't work.

exten => _!,1,Dial(SIP/12345@outbound,,ro)
doesn't work.

It seems that other characters than digit's doesn't get a match.

And from what I can see in the documentation is it just mentioned characters not digits se ref below.

From the documentation:
.  wildcard, matches one or more characters

And I realy hope that the bug correction isn't to change the documentation !


****** ADDITIONAL INFORMATION ******

This is impacting on the usage of sip addresses that looks like email adr.
Comments:By: Mats Karlsson (matsk) 2006-07-12 07:06:04

Hmm, this bug should have been under the dialplan project, but it seems that I cant move it myself.... So could someone with propper rights move it ?

TIA
Mats

By: Serge Vecher (serge-v) 2006-07-12 08:36:23

I don't believe Asterisk core is designed to support URIs in the Dialplan directly. But I think you can just use dialplan functions for your purpose.

By: Serge Vecher (serge-v) 2006-07-12 09:31:02

how will things work, if the username part does not contain a '.' (dot)?

By: Mats Karlsson (matsk) 2006-07-12 11:12:32

OK, I will try to elaborate.

The thing that doesn't work is when I use "exten => _" and then a regexp like the . or !.

When using "exten => " without regexp WORKS OK, example "exten => john.smith,1,Dial(SIP/12345@outbound,,ro)" or for that matter "exten => john,1,Dial(SIP/12345@outbound,,ro)"

So the problem is to get a match after _ when you have incoming URI's with letters.

By: Serge Vecher (serge-v) 2006-07-12 12:39:38

based on further discussions on #asterisk-bugs, this seems to be more related to extension parsing mechanisms in pbx.c. Matsk will try the rewriten code in trunk and report back here.

By: Mats Karlsson (matsk) 2006-07-20 15:03:33

Hasn't had time to check this with the current svn but got the impression after reading the source that it's the case that it doesn't match other chars than numbers.

By: Tilghman Lesher (tilghman) 2006-07-21 01:04:05

You really should never use _. as an extension, because it literally matches anything -- even special case extensions like i and h.

And . in a dialplan extension is a short-circuit -- if the matcher encounters a period, it short-circuits the matching and returns true.

By: Mats Karlsson (matsk) 2006-07-21 02:39:47

Corydon76, The intention wasn't to use _. but to find out a way to get regular expressions on letters in the diaplan.

Im aware that _. is BAD ! So lets put that aside and focus on the goal instead.

By: Tilghman Lesher (tilghman) 2006-07-23 04:02:53

I think what you mean to say is if you do a pattern match like "_john.", it doesn't work, and you're correct, but for a reason that you don't realize:

The problem is that the letter n, by itself, means the digits 2-9.  In order to get the literal letter n in a pattern match, you have to put it in a character class, like this:  "_joh[n]."

By: Mats Karlsson (matsk) 2006-07-24 21:45:30

have you tried if [n] works ?

By: Tilghman Lesher (tilghman) 2006-08-08 23:22:22

I haven't tried that case specifically, but I have used the dial expression "_e[x]t.".