Can't match incoming DID calls

Hi,
I have 2 sip trunk from the same provider. I would like to send all calls
dial to 070YYYYYYY to a ringroup and all calls directed to 070XXXXXXX to an
extension. But it doesn’t work.

This is my sip.conf file:
[general]
context = default ; Default context for incoming calls
allowguest=yes ; Allow or reject guest calls (default is yes)
allowoverlap = no ; Disable overlap dialing support. (Default is yes)
bindport = 5060 ; UDP Port to bind to (SIP standard port is 5060)
bindaddr = 0.0.0.0 ; IP address to bind to (0.0.0.0 binds to all)
srvlookup = yes ; Enable DNS SRV lookups on outbound calls
allowexternaldomains = no
allowexternalinvites = no
allowguest = yes
allowsubscribe = no
allowtransfer = yes
alwaysauthreject = no
autodomain = no
callevents = no
compactheaders = no
dumphistory = no
g726nonstandard = no
ignoreregexpire = no
jbenable = no
jbforce = no
jblog = no
maxcallbitrate = 384
maxexpiry = 3600
minexpiry = 60
nat = yes
notifyringing = no
pedantic = no
promiscredir = no
recordhistory = no
relaxdtmf = no
rtcachefriends = no
rtsavesysname = no
rtupdate = no
sendrpid = no
sipdebug = no
t1min = 100
t38pt_udptl = yes
localnet = 169.254.0.0/255.255.0.0
progressinband = no
trustrpid = no
usereqphone = no
videosupport = no
allow = ulaw,g729,alaw
disallow = gsm,ilbc,speex,g726,adpcm,lpc10
externip = XX.XXX.XX.XX (this is the IP of my dedicated remote server behind
firewall)

and this my extensions.conf:
[macro-trunkdial]
exten = s,1,set(CALLERID(all)=${IF($[${LEN(${CALLERID(num)})} >
6]?${CALLERID(all)}:${ARG2})})
exten = s,n,Dial(${ARG1})
exten = s,n,Goto(s-${DIALSTATUS},1)
exten = s-NOANSWER,1,Hangup
exten = s-BUSY,1,Hangup
exten = _s-.,1,NoOp

[DID_trunk_1]
include = default
exten = _070YYYYYYY,1,Goto(ringroups-custom-1,s,1)

[DID_trunk_1]

[numberplan-custom-1]
plancomment = Default DialPlan
include = default
include = parkedcalls
exten = _XX.,1,Macro(trunkdial,${trunk_1}/${EXTEN:0},${trunk_1_cid})
comment = _XX.,1,ALL,custom

[ringroups-custom-1]
gui_ring_groupname = home
exten = s,1,NoOp(RINGGROUP)
exten = s,n,Dial(SIP/101&SIP/102,40)
exten = s,n,Voicemail(102,b)

[DID_trunk_2]
include = default
include = default
exten = _070XXXXXXX,1,Goto(default|100|1)

[DID_trunk_2]

post your sip debug showing incoming calls from each provider

You mean this?
(070777777 is an example number)

<------------->
— (10 headers 0 lines) —
Sending to 62.10.198.16 : 5060 (NAT)
s301086*CLI>
<— Transmitting (NAT) to 62.10.198.16:5060 —>
SIP/2.0 489 Bad event
Via: SIP/2.0/UDP 192.168.1.3:5060;branch=z9hG4bK-d70b980;received=62.10.198.16;rport=5060
From: 070777777 sip:101@91.121.68.82;tag=57e06e9f2002fda4o0
To: sip:91.121.68.82;tag=as31869107
Call-ID: fa0d8ccb-59069568@192.168.1.3
CSeq: 1666 NOTIFY
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Length: 0

<------------>
s301086*CLI>
<— SIP read from 62.10.198.16:5060 —>
NOTIFY sip:91.121.68.82 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.3:5060;branch=z9hG4bK-bb9623fe;rport
From: 070777777 sip:101@91.121.68.82;tag=57e06e9f2002fda4o0
To: sip:91.121.68.82
Call-ID: fa0d8ccb-59069568@192.168.1.3
CSeq: 1667 NOTIFY
Max-Forwards: 70
Event: keep-alive
User-Agent: Linksys/PAP2-3.1.22(LS)
Content-Length: 0

<------------->
— (10 headers 0 lines) —
Sending to 62.10.198.16 : 5060 (NAT)
s301086*CLI>
<— Transmitting (NAT) to 62.10.198.16:5060 —>
SIP/2.0 489 Bad event
Via: SIP/2.0/UDP 192.168.1.3:5060;branch=z9hG4bK-bb9623fe;received=62.10.198.16;rport=5060
From: 070777777 sip:101@91.121.68.82;tag=57e06e9f2002fda4o0
To: sip:91.121.68.82;tag=as0e437276
Call-ID: fa0d8ccb-59069568@192.168.1.3
CSeq: 1667 NOTIFY
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Length: 0

<------------>
Really destroying SIP dialog '1116f5414fae42f31c270e802531e394@voip.eutelia.it’ Method: ACK
s301086*CLI>
<— SIP read from 62.10.198.16:5060 —>
NOTIFY sip:91.121.68.82 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.3:5060;branch=z9hG4bK-b714917c;rport
From: 070777777 sip:101@91.121.68.82;tag=57e06e9f2002fda4o0
To: sip:91.121.68.82
Call-ID: fa0d8ccb-59069568@192.168.1.3
CSeq: 1668 NOTIFY
Max-Forwards: 70
Event: keep-alive
User-Agent: Linksys/PAP2-3.1.22(LS)
Content-Length: 0

<------------->
— (10 headers 0 lines) —
Sending to 62.10.198.16 : 5060 (NAT)
s301086*CLI>
<— Transmitting (NAT) to 62.10.198.16:5060 —>
SIP/2.0 489 Bad event
Via: SIP/2.0/UDP 192.168.1.3:5060;branch=z9hG4bK-b714917c;received=62.10.198.16;rport=5060
From: 070777777 sip:101@91.121.68.82;tag=57e06e9f2002fda4o0
To: sip:91.121.68.82;tag=as5abfe346
Call-ID: fa0d8ccb-59069568@192.168.1.3
CSeq: 1668 NOTIFY
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Length: 0

[quote=“dpctech”]You mean this?
[/quote]

No.

Need sip debug showing incoming calls on both trunks.
You should post at least two SIP INVITE messages.

<------------>
Scheduling destruction of SIP dialog '348a33e6415a7ef24d7f77a977037f0d@voip.eutelia.it’ in 32000 ms (Method: INVITE)
s301086*CLI>
<— SIP read from 83.211.227.21:5060 —>
ACK sip:s@91.121.68.82 SIP/2.0
Max-Forwards: 15
Record-Route: sip:83.211.227.21;ftag=as5f42a6e8;lr=on
Via: SIP/2.0/UDP 83.211.227.21;branch=0
Via: SIP/2.0/UDP 83.211.227.14;branch=z9hG4bK0f46.67af94d.0
From: “Alek Corona” sip:0706666666@voip.eutelia.it;tag=as5f42a6e8
Call-ID: 348a33e6415a7ef24d7f77a977037f0d@voip.eutelia.it
To: sip:0707777777@voip.eutelia.it;tag=as0a427d85
CSeq: 105 ACK
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog '50d1a3835bcdffbb5ba88d442c421025@voip.eutelia.it’ in 32000 ms (Method: INVITE)
s301086*CLI>
<— SIP read from 83.211.227.21:5060 —>
ACK sip:s@91.121.68.82 SIP/2.0
Max-Forwards: 15
Record-Route: sip:83.211.227.21;ftag=as782f6b48;lr=on
Via: SIP/2.0/UDP 83.211.227.21;branch=0
Via: SIP/2.0/UDP 83.211.227.14;branch=z9hG4bKa48c.b1636754.0
From: “Alek Corona” sip:0706666666@voip.eutelia.it;tag=as782f6b48
Call-ID: 50d1a3835bcdffbb5ba88d442c421025@voip.eutelia.it
To: sip:0708888888@voip.eutelia.it;tag=as01d113ad
CSeq: 105 ACK
Content-Length: 0

Like this?
0706666666 = calling number
0707777777 = trunk 1
0708888888 = trunk 2

[quote=“dpctech”]
Like this?[/quote]

No.

Again - You should post at least two SIP INVITE messages. You posted 2 ACK messages.

The answer on your question is here forums.digium.com/viewtopic.php?t=10734
You do not need 2 different contexts (or context per trunk).

My current setup:

exten => s,1,Set(DN=${SIP_HEADER(TO)})
exten => s,n,Set(DN=${CUT(DN,@,1):-7:7})
exten => s,n,NoOp(Incoming call to ${DN})
exten => s,n,GotoIf($["${DN}" = "4733600"]?4733600,1)
exten => s,n,GotoIf($["${DN}" = "4733601"]?4733601,1)
exten => s,n,Goto(default,${DESK},1)
;
exten => 4733600,1,Goto(default,10,1)
exten => 4733601,1,Goto(default,11,1)

I’m using Asterisk official GUI so everything it’s a little bit different there.
I don’t think 2 trunks from the same provider is a problem. Until now we’ve used pbxes.org with 4 trunks perfectly matched from the same provider.

I don’t know how to give you the sip invite message.

Maybe my problem is a firewall problem but in this way I can’t check it.

double post sorry

Hi

Lets go back to the start

“It doesnt work” is not a description of a problem its what my 3 year old says when the TV is turned off.

What exactly doesnt work… Neither number just one number? Describe the problem in depth.

Ian

You’re right, ok.

Let’s start saying this:
I got 2 trunk from the same provider. Asterisk’s GUI put trunk in the users.conf file in this way:

[trunk_1]
allow = all
context = DID_trunk_1
dialformat = ${EXTEN:1}
canreinvite = no
hasexten = no
hasiax = no
hassip = yes
host = voip.eutelia.it
port = 5060
registeriax = no
registersip = yes
secret = 212121
trunkname = Custom - skypho_it
trunkstyle = customvoip
username = 0708888888
fromdomain = voip.eutelia.it
fromuser = 0708888888
insecure = port,invite

[trunk_2]
allow = all
context = DID_trunk_2
dialformat = ${EXTEN:1}
canreinvite = no
hasexten = no
hasiax = no
hassip = yes
host = voip.eutelia.it
port = 5060
registeriax = no
registersip = yes
secret = 363636
trunkname = Custom - work_it
trunkstyle = customvoip
username = 0707777777

incoming rules in the file extensions.conf are:

[DID_trunk_1]
include = default
exten = _0708888888,1,Goto(ringroups-custom-1,s,1)

[DID_trunk_2]
include = default
exten = _0707777777,1,Goto(default|100|1)

The problem is: when I call one number or the other I receive this vocal message: all circuits are busy now, please try your call again later

and in the asterisk’s CLI I got nothing at all.

In my sip.conf I got:
bindport = 5060 ; UDP Port to bind to (SIP standard port is 5060)
bindaddr = 0.0.0.0 ; IP address to bind to (0.0.0.0 binds to all)
localnet = 169.254.0.0/255.255.0.0
externip = 91.121.68.82 (the IP of my remote dedicated server)

Hi what is the context set in the general section of the sip.conf ?

Ian

This is my sip.conf file:

[general]
context = default ; Default context for incoming calls
allowguest = yes ; Allow or reject guest calls (default is yes)
allowoverlap = no ; Disable overlap dialing support. (Default is yes)
bindport = 5060 ; UDP Port to bind to (SIP standard port is 5060)
bindaddr = 0.0.0.0 ; IP address to bind to (0.0.0.0 binds to all)
srvlookup = yes ; Enable DNS SRV lookups on outbound calls
allowexternaldomains = no
allowexternalinvites = no
allowguest = yes
allowsubscribe = no
allowtransfer = yes
alwaysauthreject = no
autodomain = no
callevents = no
compactheaders = no
dumphistory = no
g726nonstandard = no
ignoreregexpire = no
jbenable = no
jbforce = no
jblog = no
maxcallbitrate = 384
maxexpiry = 3600
minexpiry = 60
nat = yes
notifyringing = no
pedantic = no
promiscredir = no
recordhistory = no
relaxdtmf = no
rtcachefriends = no
rtsavesysname = no
rtupdate = no
sendrpid = no
sipdebug = no
t1min = 100
t38pt_udptl = yes
progressinband = no
trustrpid = no
usereqphone = no
videosupport = no
disallow = all
allow = ulaw,g729,alaw
localnet = 192.168.0.0/255.255.0.0

maybe the right forum is the Asterisk’s now one? As I am using the Asterisk’s GUI?

if the answer is yes please some moderator move this thread.

tnx

Hi

This is the problem with guis they are designed for 90% of situations , once you step outside that 90% you sometimes have to get your hands dirty.

Asterisk is Asterisk , Asterisk now is Asterisk with a Gui.

Your problem is to do with contexts.

basicly having default as your landing place for sip calls isnt good. now in default you could include the DID in contexts then it may well work fine.
But the cli verbose and debug output will normally give you a good clue as to whats happening , the sip debug will just give you a 404 or the like.

set the verbose and debug to 99 then fire a call in and see what you get

Ian

[quote=“ianplain”]
set the verbose and debug to 99 then fire a call in and see what you get

Ian[/quote]

How can I do this?

I’ve put this: sipdebug = yes
but in the CLI I got many messages.

Hi set that to no for now

you need to connect to the console screen and enter “set verbose 99” and “set debug 99”

Then you should get what is needed

Ian

ok done now what?
Where I can see the log you need?

[quote=“ianplain”]Hi set that to no for now

you need to connect to the console screen and enter “set verbose 99” and “set debug 99”

Then you should get what is needed

Ian[/quote]

Ian,
all the information was already posted.
All the incoming invites are sent to s@91.121.68.82 but dpctech is trying to catch some patterns like _0707777777 and this is obviously should not work.

No solution then? I only need to send calls directed to one trunk in one extension matching the trunk.

Hi

Until you can post the console output, then no

As to calls being sent from an ITSP to the “s” extension, I have never seen any do this, they may send it just to the IP address but the “s” is unique to Asterisk.

Either post console output of a full sip debug of a call from another phone IE mobile to the number , As many ITSPs dont allow hairpin calls.

Ian