02-21-2014 04:16 PM - edited 03-16-2019 09:51 PM
Hello All,
I had a problem on my SRST gateway with num-exp insterting a repeating pattern into my 7-digit dialing when in fallback mode.
For a brief example, the 7digit internal dialing is 21621.. or 21622..
The num-exp statement of 'num-exp 2... 2162...' was not allowing me to 7-digit dial directly from one IP phone to another while in fallback mode.
When I dialed 2162154 the 2162 would hit the num-exp and be expended to 2162162.
I have a work around that uses a voice translation-rule, applied to the call-manager-fallback config that will translate a 7-digit dialed string to the 4 digit dialed string which then hits the 4-digit to 7-digit num-exp and it is working fine.
However, I was wondering if there is a way to use regular expressions in num-exp so that perhaps I can skip the intermediate step of using the translation-rule. Based off my existing translation-rules that are working properly, I figured something like this might work for num-exp:
'num-exp /^2\([12]..$\)/ /2162\1/'
But when I try to issue a num-exp with a regular expression I get the following message.
Incorrect format for Number macro pattern
regular expression must be of the form ^((\+)?([0-9#*A-F.]|(\\\*))+(\$)?)$
I have tried a number of different combinations with no success. I always get the same message. The regular expression that I tried first was:
'num-exp ^2... 2162...'
This is when I first saw the "Incorrect format..." message and figured that is must be possible. Is this just a generic warning similar to when you try to use complex regular expressions with the 'translation-rule' command vs. the 'voice translation-rule' command and in reality you cannot use regular expressions in the num-exp command?
Thank you,
Leo
Solved! Go to Solution.
02-22-2014 10:17 AM
Translation rules or dialplan-pattern is what you want to use, I am not aware of any regular expression support with num-exp, why do you insist on using num-exp?
Chris
02-22-2014 10:17 AM
Translation rules or dialplan-pattern is what you want to use, I am not aware of any regular expression support with num-exp, why do you insist on using num-exp?
Chris
02-22-2014 03:12 PM
Hi Chris,
Thank you for taking the time to answer my question. It looks like the answer is no, num-exp does not support regular expressions.
I don't insist on using num-exp for this I was just hoping to kill two birds with one stone and possibly skip the intermediate step of translating the 7-digits dial to 4-digits using a translation-rule just to expand from 4-digit to 7 again. This is only an issue while in SRST if a user tries to dial using 7-digits. We have a 7-digit internal dialing scheme and normally my num-exp is just to expand the 4 digits sent from the telco to our 7-digit internal dialing. The problem is that both our prefix and part of our DID range start with 21 so while in SRST if a user tried to dial a 7-digit DN, say 2162154, after they dialed the 4th digit (2162) that pattern would hit the num-exp and get expanded to 2162162. I was hoping to create a num-exp using a regular expression that would only expand a four digit string that begins with a 2 to seven digits and not any string that begins with a 2. This would 1) expand the four digits sent from the telco and 2) not match a seven digit string that begins with a 2 such as 2162154 which may be dialed by a user.
Again, this is only an issue while in SRST and I have a pretty good work around so I'm fine with not being able to use a regular expression as part of my num-exp config. I just thought it would be a cool application of a regular expression if it was possible.
Thanks again for answering my question.
Leo
02-23-2014 08:45 AM
Leo,
Translation rules are the way to handle this type of scenario, so if that is what you used you've picked the right solution.
HTH,
Chris
11-29-2017 06:38 PM
I usually don't necro thread, but I couldn't find this documented out anywhere else. The above is incorrect about num-exp macros. It does accept a limited subset of wildcards. It will not accept ^ because by default it will only match the front of a number and not the middle unlike translations. It will accept $ at the end which will prevent it from matching partial strings. It will accept . for a single character wildcard. It will accept * for multiple repeats of the previous character. So to solve the original problem you just needed to add a $ at the end of your first number.
num-exp 2...$ 2162...
show dialplan number 2555 will show 2162555
show dialplan number 255567 will show 255567
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide