Seriously stuck with incoming call rules

I’ve been sitting on this for about 2 days, looking up and trying every article I could possibly find, and I’ve finally thrown the towel in to the point where I need your help (I know you can do it, I’ve heard great comments about you.).

I have two trunks supplied by the same provider, each with a different demographic telephone number.
For this example, Trunk 1 & Trunk 2.

Trunk 1 starts 00448
Trunk 2 starts 00442

I’ve tried setting up call rules based on the originating number, such as _00448! _00448.! etc etc (all potential combinations) and this failed, every call that came in was trying to route to ‘s’ because it couldn’t find the destination. At this stage, I tried simply editing extensions/user/sip to redirect the trunk directly to an IVR voice menu, this also failed. Both numbers currently redirect to the same menu, ignoring the settings in extensions.conf.

Can anyone put me out of my misery?

Current Setup: Example for Trunk 2, Redirect to Voice Menu 2
This fails, and still ends up going to voice menu 1.

include = DID_trunk_2_timeinterval_All,${timeinterval_All}
include = DID_trunk_2_default
exten = s,1,Goto(voicemenu-custom-2,s,1)

I don’t understand very well, do you want to make inbound or outbound rules?

For inbound rules you need to setup the DID trunk in the context where you define your trunk, i.e:
If your context of your trunk1(00448) is default, in your dialplan you must set:

exten => 00448,1,your application

The same thing for your Trunk2 for the context defined in your trunk2 settings

If you don’t want to set different application for each trunk just use:

exten => XXXX.,goto(s,1)
exten => s,1,your application.

For outbound rules just in your outbound context:

Hope that helps

I’m simply trying to direct each trunk to the suitable voice menu, trunk1 = menu1, trunk2 = menu2.
I want to filter this either based upon the destination number (ie To: or some other form of trunk detection.

In the above example, with number 1234567890, I’ve tried setting this, which fails:
Call from 'XXXX to extension ‘s’ rejected because extension not found in context ‘DID_trunk_3’.
exten = 1234567890,1,Goto(voicemenu-custom-2,s,1)

Is there not a simple way of just setting up inbound call rules, and saying 'catch all calls on trunk 1 = menu1, and catch all calls on trunk 2 = menu2"? Seems overly complicated for something so basic.

exten => 1000,1,Goto(default,s,1)
In the above, is the extension we’re looking for the public telephone number?

Firstly, you don’t have DID, if it is complaining about extension “s”.

If the two trunks are identifiable (that typically means they have different origin IP addresses), simply define a different context for each one, and route s in each context appropriately.

If they are not identifiable, you will need to either make them identifiable or get the SIP provider to make them true DID trunks, so that you can route based on the digits dialed by the caller.


This may help…

If you have two registrations from two SIP trunks coming from the same service provider / SIP registrar host / IP…they will always (at least with 1.4) end up in the context specified in the last sip trunk in your sip.conf file

Secondly the register commend works sort of like this:

register =>
So, if you have two services with the same ITSP that you want each number to go to a different extension, your sip.conf would look a little like this:

; general stuff ....
; registrations
register =>
register =>

; First trunk 9009998888
; other sip stuff here, codecs etc...

; other sip stuff here, codecs etc...

And your extensions would sort of look like this


exten => 8888,1,NoOp(Trunk 1 - 900 999 8888)
exten => 8888,n,Dial(SIP/201)

exten => 9999,1,NoOp(Trunk 1 - 900 888 9999)
exten => 9999,n,Dial(SIP/202)

exten => s,1,NoOp(we should go here unless its an anonymous call)
exten => s,n,Playback(tt-somthingwrong)
exten => s,n,HangUp()

Calls to trunk 1 will ring on 201. Calls to trunk 2 will ring on 202 and calls that come in directly will get dumped

The above is only true when you have 1 registration per inbound number.

Now, if you have a number of indials numbers attached created on a sinlge SIP registration, you’ll have to have a look at the SIP headers to work out which trunk they are calling on using the SIPHeadder(TO) and/or SIPHeadder(DIVERSION) depending on which SIP agent that they are using to route the calls to you. That info you’ll need to find out from the ITSP.

Hope this helps clear things up a little