Can't receive inbound calls

I’m having a problem with my freepbx system. I’m using an isdn card, and when I’m calling my sytem, the call simply gets rejected, with the following message:

[code:1]-- Extension ‘1’ in context ‘from-zaptel’ from ‘(number I’m calling from)’ does not exist. Rejecting call on channel 0/1, span 1
Apparently the isdn line sends only the last digit of the phone number, and freepbx doesn’t know what to do with it, so it simply rejects the call.
Outbound calls work fine, and I can manually route inbound calls through, so I guess it’s a problem with FreePBX.

the from-zaptel context from extensions.conf:

exten => _X.,1,Set(DID=${EXTEN})
exten => _X.,n,Goto(s,1)
exten => s,1,NoOp(Entering from-zaptel with DID == ${DID})
; Some trunks require a RINGING be sent before an Answer.
exten => s,n,Ringing()
; If ($did == “”) { $did = “s”; }
exten => s,n,Set(DID=${IF($["${DID}"= “”]?s:${DID})})
exten => s,n,NoOp(DID is now ${DID})
exten => s,n,GotoIf($["${CHANNEL:0:3}"=“Zap”]?zapok:notzap)
exten => s,n(notzap),Goto(from-pstn,${DID},1) ;Manual Edit
; If there’s no ext-did,s,1, that means there’s not a no did/no cid route. Hangup.
exten => s,n,Macro(hangup)
exten => s,n(zapok),NoOp(Is a Zaptel Channel)
exten => s,n,Set(CHAN=${CHANNEL:4})
exten => s,n,Set(CHAN=${CUT(CHAN,-,1)})
exten => s,n,Macro(from-zaptel-${CHAN},${DID},1)
; If nothing there, then treat it as a DID
exten => s,n,NoOp(Returned from Macro from-zaptel-${CHAN})
exten => s,n,Goto(from-pstn,${DID},1)
exten => fax,1,Goto(ext-fax,in_fax,1)[/code:1]

the isdn card should send the whole number - something must be misconfigured to only send a single digit. The format of the code, _X. for the pattern match must match at least 2 digits if I’m not mistaken - thus the reason for the error. You should investigate why you are only getting a single digit. If this really is proper you will have to make some custom changes in order to handle the single digit (_X with no . could be added, I wouldn’t replace what was there though).