Pattern Dialing in extensions realtime

I am using Asterisk Realtime for my extensions.conf and it is working fine. However, when I try to add a pattern (i.e. _2XXX, _NXXXXXX) to the exten field in the database it does not work in the dialplan. It works fine if I define the number but will not work as a pattern. Patterns work fine when they are spelled out in the extensions.conf file but not in realtime database.
Any Ideas would be greatly appreciated.

I am using MSSQL to store the records

can you copy paste ur respective pattern match & dail out context to check


MSSQL table extensions_conf
id | context | exten | priority | app | appdata |
1 | default | _2XXX | 1 | Dial | SIP/${EXTEN}|14|r |
2 | default | 3102 | 1 | Dial | SIP/3102|14|r |
3 | default | _NXXXXXX | 1 | Dial | ZAP/r1/${EXTEN} |

In the above table I have the default context and the exten field with _2XXX which does not work and the 3102 which does work. Also have the outgoing dial _NXXXXXX which does not work. No pattern dialing in realtime is working for me.

Here is the extensions.conf file on my server:
exten => 3102,1,Dial(SIP/3102,14,r)
exten => _2XXX,1,Dial(SIP/${EXTEN},14,r)
exten => _NXXXXXX,1,Dial(ZAP/r1/${EXTEN})

These are just a few samples of my complete dialplan. Using the extensions.conf on the server with patterns it works fine.

Any Ideas?

table format is right
but in Asterisk real time you never use _2xxxx or_nxxxxx extension . u have to mention each & evry extension in full format like 9201. 3201 or 7000…
pattern match u can define on asterisk extension.conf as you mentioned like exten => _2xxxx,1,Dial(…)
as you mentioed in Asterisk -mysql DN is wrong. mainly PATERN MATCINing you can use with extension ,conf dail plan for OUT BOUND CALLS when any user or extension dail such number.
so my advice is clear dont use such in mysql table specfify each & complete extension like 2001,2002…
this is my suggestion may be help you.


It looks like the example on shows that pattern dialing works on SQL Realtime. Could someone please help me get extensions.conf working in realtime.

I have been using pattern matching with realtime and have never had a problem. I have used the MySql drivers in asterisk-addons before, but now use ODBC drivers since I also use ODBC voicemail storage as well as realtime static for most of my configuration files. It should not matter. The following is an example of a phpMyAdmin insert that I use to route outbound local calls, deleting the “9” prefix.

(1231, ‘from-sip’, ‘_9NXXXXXX’, 2, ‘Dial’, ‘Zap/G1/${EXTEN:1}|30’),
(1232, ‘from-sip’, ‘_9NXXXXXX’, 3, ‘GoToIf’, ‘$[${DIALSTATUS}=CHANUNAVAIL]?${EXTEN}|100’),
(1233, ‘from-sip’, ‘_9NXXXXXX’, 100, ‘Dial’, ‘IAX2/${VOICEPULSE_GATEWAY_OUT_A}/1636${EXTEN:1}’),

Works great. Hope it helps.