Question about patterning match


#1

hi,
I want to match the extensions begining with 1,3 to 9 except 2, so I write a dialplan like this:
exten => _[13-9].,1,Playback(vm-hello)
but it seems didn’t work, what’s problem?
Any suggestions would be very appreciated.


#2

exten => _[13-9].,1,Playback(vm-hello)

should look like

exten => _[1,3-9].,1,Playback(vm-hello)


#3

Hi Ian,
I’m sorry about my late response,
I have tried the dialplan:
“exten => _[1,3-9].,1,Playback(vm-hello)”,
but it still doesn’t work! By the way, I’m having Asterisk 1.2.4 and CentOS 4.2 with kernel 2.6.9-22.

Thanks,


#4

With No debug or verbose output or even a clue to what happens, Its not possible to say whats going on…


#5

did you try _[13456789]X (or how ever many X’s to match you extension size)? I do a match on _2[012]X for extensoins 200-229 which works. So if your’s doesn’t work, either it doesn’t like _[ format for some reason, it isn’t happy with the range or it doesn’t like ]. format for some reason…

p


#6

Ok, I set verbosity to 10 and debug level to 10, then placing a call and trying it again. Got the following debuging messages which I copied from /var/log/asterisk/full. (not anything in the CLI OUTPUT)

Apr 19 08:53:19 DEBUG[3117] chan_sip.c: Allocating new SIP dialog for EwKkJFO7yaQWHYYt@192.168.8.17 - INVITE (With RTP)
Apr 19 08:53:19 DEBUG[3117] chan_sip.c: **** Received INVITE (5) - Command in SIP INVITE
Apr 19 08:53:19 DEBUG[3117] chan_sip.c: * SIP extension value: 3 for call EwKkJFO7yaQWHYYt@192.168.8.17
Apr 19 08:53:19 DEBUG[3117] chan_sip.c: Setting NAT on RTP to 0
Apr 19 08:53:19 DEBUG[3117] chan_sip.c: = Found Their Call ID: EwKkJFO7yaQWHYYt@192.168.8.17 Their Tag jBdv5FusGFUd9ziz Our tag: as715ce068
Apr 19 08:53:19 DEBUG[3117] chan_sip.c: **** Received ACK (6) - Command in SIP ACK
Apr 19 08:53:19 DEBUG[3117] chan_sip.c: Stopping retransmission on 'EwKkJFO7yaQWHYYt@192.168.8.17' of Response 1: Match Found
Apr 19 08:53:19 DEBUG[3117] chan_sip.c: = Found Their Call ID: EwKkJFO7yaQWHYYt@192.168.8.17 Their Tag jBdv5FusGFUd9ziz Our tag: as715ce068
Apr 19 08:53:19 DEBUG[3117] chan_sip.c: **** Received INVITE (5) - Command in SIP INVITE
Apr 19 08:53:19 DEBUG[3117] chan_sip.c: Setting NAT on RTP to 0
Apr 19 08:53:19 DEBUG[3117] chan_sip.c: Checking SIP call limits for device 202
Apr 19 08:53:19 DEBUG[3117] chan_sip.c: Updating call counter for incoming call
Apr 19 08:53:19 WARNING[3117] pbx.c: Wrong usage of [] in the extension
Apr 19 08:53:19 WARNING[3117] pbx.c: Wrong usage of [] in the extension
Apr 19 08:53:19 WARNING[3117] pbx.c: Wrong usage of [] in the extension
Apr 19 08:53:19 DEBUG[3117] chan_sip.c: Updating call counter for incoming call
Apr 19 08:53:19 DEBUG[3117] chan_sip.c: = Found Their Call ID: EwKkJFO7yaQWHYYt@192.168.8.17 Their Tag jBdv5FusGFUd9ziz Our tag: as715ce068
Apr 19 08:53:19 DEBUG[3117] chan_sip.c: **** Received ACK (6) - Command in SIP ACK
Apr 19 08:53:19 DEBUG[3117] chan_sip.c: Stopping retransmission on 'EwKkJFO7yaQWHYYt@192.168.8.17' of Response 2: Match Found
Apr 19 08:53:25 VERBOSE[3184] logger.c:     -- Remote UNIX connection disconnected

Yes, I notice that there are some warnings, but I don’t know what’s that mean. maybe it’s a syntax error in the dialplan?
Here’s the incoming context I have set up in extensions.conf,

[from-internal]
exten => _[1,3-9].,1,Macro(localoutbound)

[macro-localoutbound]
exten => s,1,NoOp(local district outbound ${MACRO_EXTEN})
exten => s,2,ChanIsAvail(Zap/1-1&Zap/1-2&Zap/1-3)
exten => s,3,NoOp(avaliable channel ${AVAILORIGCHAN})
exten => s,4,Dial(${AVAILORIGCHAN}/${MACRO_EXTEN},${RINGTIMER})
exten => s,5,NoOp(local distinct outbound is completed with ${DIALSTATUS})
exten => s,6,hangup

thank you for help!


#7

Hi p,
I tried the way you tought me, and my dialplans like this,

exten => _[13456789].,1,Macro(localoutbound)

and It really works!

:astonished:
Thanks again to all