Inbound call route based on number dialed. Is it possible?


I have 4 different phone numbers forwarding to one softphone account with vonage…

I would like to have a inbound call rule that when someone dials this 800 number it gets a specific route…

I tried just putting the DID number in the route… but that did not seem to work…

I can see in the sip debug that the number being forwarded is getting its number passed along however I don’t know how to have asterisk forward based on that…

Thanks for any input.


could you please post the sample debug messages here


    -- Executing Set("SIP/1248XXXXX-XXXX", "LOOPCOUNT=0") in new stack
    -- Executing Set("SIP/124823XXX-XXXXX", "__DIR-CONTEXT=default") in new stack
    -- Executing Answer("SIP/1248XXXX-XXX", "") in new stack
We're at port 18732
Adding codec 0x100 (g729) to SDP
Adding codec 0x4 (ulaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to
SIP/2.0 200 OK
Via: SIP/2.0/UDP;received=
Via: SIP/2.0/UDP
Via: SIP/2.0/UDP
Via: SIP/2.0/UDP
Via: SIP/2.0/UDP
Via: SIP/2.0/UDP;branch=z9hG4bK-45ad5e67-148acf03-3b11
From: "248-2XX-XXXX" <;user=phone>;tag=1909094917;natted=
To: <;user=phone>;tag=as2bc6884e
Call-ID: 9452d4d0-30353-1168989798-20678473-128603326500362700000000-0@
User-Agent: Asterisk PBX
Contact: <sip:1248XXXXX@XXXXXX>
Content-Type: application/sdp
Content-Length: 259

it seems I’m missing something… :unamused:

What is the number you want to route on ?
Do you have 4 numbers like ‘1877NUMHERE’ ?

I have 1 toll free number it is not actually THENUMBER…;user=phone;

That toll free number is forwarded to a vonage softphone account…

From there I want calls that come in from customer dialing that number to be routed to a extension…

But the softphone SIP account is actually 1248 something…

But when the calls come in I can see that the to: is correctly showing the toll free number…

But when I try to create a inbound route for that number it just gets routed as if it was the 1248 number… or the account number for the softphone trunk.

Sorry if I am not explaining clearly…

if I understood you correctly you may use the following example