Incoming Call Rules not working

Hello,

I am fairly new to Asterisk, but I have a mostly functioning setup at the moment with both SIP and Analog lines.

My Question is that it appears that only the default catch all incoming rule is being used. I went into the extensions.conf and after messing things up horribly a few times I found that it is only following the s extension.

Here is a copy of the relevant section.

[DID_trunk_1]
include = default
exten = _X.,1,Goto(default|1500|1)
exten = s,1,Goto(default|1500|1)
exten = _1403.,1,Goto(default|1501|1)

Now to my understanding, it should look for calls that have 1403 in the number (So any local calls for me) and then pass them to extention 1501 rather then 1500. Unfortunately for me right now it only gets as far as the s extension (exten = s,1,Goto(default|1500|1)), and it just follows that rule.

Am I doing something wrong? Is their somewhere else I need to do something? Does anyone have any ideas?

Thank you for your time.

extension s is the default extension. What happens is that there isn’t time for the user to enter an extension because you have the default extension go to default,1500,1. You may want something like this:

[DID_trunk_1]
Exten => s,1,Answer ; Answers the Call
exten => s,2,Background(enter-exten) ; Asks the user to enter an extension. You may need to record this file.
exten => 1403,1,Goto(default,1501,1) ; If they press 1403 then it goes to your exten.
exten => _X.,1,Goto(default,1500,1) ; If they enter anything else then go to default,1500,1
include => default

Thanks Dovid.

Do you know how to do pattern matches for incoming calls?

What I am trying to make it do is that if lets say I call from the number 1 403 555 1234 it sends me to a different extension then if someone calls from say 1 306 555 3214.

We have a buzzer box in our building that calls a phone to let people into the building, and we want to have an automated message rather then answer the phone every time.

Bump.

If someone could post one of their Incoming call rules it would be appreciated so I can see if I am doing something wrong.

Several ways to do this. The simplest is

[DID_trunk_1] exten => s/14035551234,1,Dial(5678) exten => s/14035553214,1,Dial(6789)

The function CALLERID allows you to check caller ID, the application GotoIf allows you to branch according to conditions. These are more sophisticated tools.

Thank you very much Valley. The method that you posted here worked BEAUTIFULLY.

I just had to add a _ before the phone number in order to use patterns.

Thank you for your help.

Why would you want to block NPA-555-xxxx calls? The 555 Exchange is not a pay-per-call exchange per se nor a designated high volume exchange (see www.nanpa.com).