Solved

Telephony regular expression question

Posted on 2011-09-23
11
277 Views
Last Modified: 2012-06-27
In the voice translation-rule below - what is the difference between rule 1 and rule 2?
Is it that rule 1 will match 1919678 and rule 2 would not?  And a related question - would 919678 (with no leading digit) also match rule 1 (making rule 2 superfluous?)  This is on a Cisco 3845 voice gateway and I'm trying to free up some space in the translation rule.  Thanks!

voice translation-rule 10
 rule 1 /^\+919678/ //
 rule 2 /^919678/ //
0
Comment
Question by:amigan_99
  • 4
  • 3
  • 3
  • +1
11 Comments
 
LVL 15

Expert Comment

by:sr75
ID: 36592645
You can teat your translation rules.  

Test voice translation rule 10 (any number)


But to answer you question.  the  ^ means begins with so rule 2 would not match as it begins with 9.
0
 
LVL 1

Author Comment

by:amigan_99
ID: 36592734
What does the \+ mean?  I understand the \ escapes the following character to it means literally "+".  But there is no "+" key on a telephone.  So when would that ever be found in a dial string?
0
 
LVL 15

Expert Comment

by:deepdraw
ID: 36592739
Well i would say test it to make sure. But i think your are right.
so remove it from the config and test using.

test voice translation-rule 10 919678


Use the link below for reference on translation rules.
http://www.cisco.com/en/US/tech/tk652/tk90/technologies_tech_note09186a0080325e8e.shtml

Greg
0
 
LVL 15

Accepted Solution

by:
deepdraw earned 500 total points
ID: 36592751
Sorry was in the kitchen and did not see any of the above comments
From the link above.

. Any single digit
0 to 9,*,# Any specific character
[0-9] Any range or sequence of characters
* Modifier—match none or more occurrences
+ Modifier—match one or more occurrences
? Modifier—match none or one occurrence


Greg
0
 
LVL 1

Author Closing Comment

by:amigan_99
ID: 36592805
Thanks much!
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 19

Expert Comment

by:feptias
ID: 36592815
Telephone keypads may not have a + key (although some do on the zero button), but SIP gateways and equipment used by telephone service providers may insert the + character as a prefix because it is defined in the ITU's E.164 standard for international numbering plans and is a valid prefix in the North American Numbering Plan.
http://en.wikipedia.org/wiki/E.164
http://en.wikipedia.org/wiki/North_American_Numbering_Plan

(How did we all manage before Wikipedia?)

In your regular expression it is a literal + and is not being used to mean "match one or more occurences"
0
 
LVL 1

Author Comment

by:amigan_99
ID: 36592830
Thank you feptias.  I was thinking that likely the \ was stripping the + of its magic powers.  Appreciate the confirmation.  I need to check with my carriers if they are every likely to pass me a +.
0
 
LVL 15

Expert Comment

by:deepdraw
ID: 36592956
E.164 numbers can have a maximum of fifteen digits and are usually written with a + prefix. To actually dial such numbers from a normal fixed line phone, the appropriate international call prefix must be used.


from the website http://en.wikipedia.org/wiki/E.164.

It says you dont ever dial a +
and if you could it would not be recognised by the cisco equipement or any other AFAIK.
Greg
0
 
LVL 19

Expert Comment

by:feptias
ID: 36595721
> "It says you don't ever dial a +"
I could not see that quoted anywhere in the wiki article.

A google search on "plus dialing" returns various results discussing the benefits of dialing + as a prefix for international calls. For example:
http://www.messagingnews.com/onmessage/ben-gross/using-plus-simplify-international-dialing
http://www.howtocallabroad.com/qa/plus-sign.html
Also, as I mentioned earlier, the + symbol is printed on the zero key of some mobile phones.

> "...if you could it would not be recognised by the cisco equipment"
But isn't that why the Cisco 3845 mentioned in the question already had a regular expression specifically to recognise the prefix?
0
 
LVL 15

Expert Comment

by:deepdraw
ID: 36595777
rule 1 /^\+919678/ //
 rule 2 /^919678/ //


the + is to include numbers like 1919678 or 11919678 in fact any number infront of 919678

Greg
0
 
LVL 19

Expert Comment

by:feptias
ID: 36595956
I don't pretend to be an expert on regular expressions, but I thought \+ would be interpreted as a literal plus sign. However, it does seem an extremely unlikely dial string in this particular context and your interpretation would make more sense.

Please see the section "Escaped" characters literals in the following link (approx two thirds of the way down the the whole article):
http://gnosis.cx/publish/programming/regular_expressions.html
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The point of this post is to give you a copy/paste installation solution to setting up Asterisk 1.6 on Ubuntu 9.04 (or similar) server. # Setup the system apt-get install subversion apt-get install make apt-get install linux-source kernel-p…
Almost all Internet protocol telephones have built-in switches at the back that allow you to connect your personal computer to one port and use the other port to connect your phone to to a Cisco switch.   Why we need to connect the PC to the pho…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now