Pass DID to SIP tie trunk

Hey there. I’ve got a FreePBX machine setup with external Vitelity trunks, and another SIP tie trunk to my ShoreTel PBX. Any incoming PSTN call is automatically routed to a custom destination, which dials out to the ShoreTel. It works great, calls to my DID’s immediately ring the ShoreTel system, but they aren’t passing DID info, so the ShoreTel is routing all calls to the same failover destination. ShoreTel just reports the incoming DID as “s”.

I specifically wrote the custom destination to send DID, so I’m hoping someone can tell me what’s missing. Here’s my setup:

Tie trunk to ShoreTel
Outgoing
Trunk Name: ShoreTel
host=10.0.1.105
port=5060
type=peer
disallow=all
allow=ulaw
dtmfmode=rfc2833
canreinvite=no
trunk=no
qualify=yes
context=from-trunk

Incoming
User Context: from-internal
Context=from-internal
nat=no

Custom Destination*
[custom-RouteToShoretel]
exten => s,1,Macro(dialout-trunk,4,${FROM_DID},)
exten => s,2,Macro(outisbusy)

Thanks!

What kind of trunk is the inbound call to FreePBX using, is the DID provided by the trunk? Probably need the sanitized lines from the asterisk log during a call to determine if/why the FROM_DID variable is not being set.

The incoming trunks are SIP as well and are providing DID. I’ve tested to make sure. Here’s an example of a call, you can see it specifically sending “s” as the DID number. I’ve purposely inserted X’s in some areas to hide my cell phone number.

[2015-12-19 12:15:25] VERBOSE[1583] netsock2.c: == Using SIP RTP TOS bits 184
[2015-12-19 12:15:25] VERBOSE[1583] netsock2.c: == Using SIP RTP CoS mark 5
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [314XXXXXXXXXX@from-pstn:1] NoOp("SIP/vite-inbound-00000075", "Catch-All DID Match - Found 314XXXXXXX - You probably want a DID for this.") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [314XXXXXXXXXX@from-pstn:2] Goto("SIP/vite-inbound-00000075", "ext-did,s,1") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Goto (ext-did,s,1)
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@ext-did:1] ExecIf("SIP/vite-inbound-00000075", "1?Set(__FROM_DID=s)") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@ext-did:2] Gosub("SIP/vite-inbound-00000075", "app-blacklist-check,s,1()") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@app-blacklist-check:1] GotoIf("SIP/vite-inbound-00000075", "0?blacklisted") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@app-blacklist-check:2] Set("SIP/vite-inbound-00000075", "CALLED_BLACKLIST=1") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@app-blacklist-check:3] Return("SIP/vite-inbound-00000075", "") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@ext-did:3] Set("SIP/vite-inbound-00000075", "CDR(did)=s") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@ext-did:4] ExecIf("SIP/vite-inbound-00000075", "0 ?Set(CALLERID(name)=314XXXXXXX)") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@ext-did:5] Set("SIP/vite-inbound-00000075", "CHANNEL(musicclass)=ShoreTel") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@ext-did:6] Set("SIP/vite-inbound-00000075", "__MOHCLASS=ShoreTel") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@ext-did:7] Set("SIP/vite-inbound-00000075", "__CALLINGPRES_SV=allowed_not_screened") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@ext-did:8] Set("SIP/vite-inbound-00000075", "CALLERPRES()=allowed_not_screened") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@ext-did:9] Goto("SIP/vite-inbound-00000075", "custom-RouteToShoretel,s,1") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Goto (custom-RouteToShoretel,s,1)
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@custom-RouteToShoretel:1] Macro("SIP/vite-inbound-00000075", "dialout-trunk,4,s,,") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:1] Set("SIP/vite-inbound-00000075", "DIAL_TRUNK=4") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:2] GosubIf("SIP/vite-inbound-00000075", "0?sub-pincheck,s,1()") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/vite-inbound-00000075", "0?disabletrunk,1") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:4] Set("SIP/vite-inbound-00000075", "DIAL_NUMBER=s") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:5] Set("SIP/vite-inbound-00000075", "DIAL_TRUNK_OPTIONS=tr") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:6] Set("SIP/vite-inbound-00000075", "OUTBOUND_GROUP=OUT_4") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/vite-inbound-00000075", "1?nomax") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Goto (macro-dialout-trunk,s,9)
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/vite-inbound-00000075", "0?skipoutcid") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:10] Set("SIP/vite-inbound-00000075", "DIAL_TRUNK_OPTIONS=") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:11] Macro("SIP/vite-inbound-00000075", "outbound-callerid,4") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-outbound-callerid:1] ExecIf("SIP/vite-inbound-00000075", "1?Set(CALLERPRES()=allowed_not_screened)") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-outbound-callerid:2] ExecIf("SIP/vite-inbound-00000075", "1?Set(REALCALLERIDNUM=314XXXXXXX)") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-outbound-callerid:3] GotoIf("SIP/vite-inbound-00000075", "1?normcid") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Goto (macro-outbound-callerid,s,6)
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-outbound-callerid:6] Set("SIP/vite-inbound-00000075", "USEROUTCID=") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-outbound-callerid:7] Set("SIP/vite-inbound-00000075", "EMERGENCYCID=") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-outbound-callerid:8] Set("SIP/vite-inbound-00000075", "TRUNKOUTCID=") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-outbound-callerid:9] GotoIf("SIP/vite-inbound-00000075", "1?trunkcid") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Goto (macro-outbound-callerid,s,12)
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-outbound-callerid:12] ExecIf("SIP/vite-inbound-00000075", "0?Set(CALLERID(all)=)") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-outbound-callerid:13] ExecIf("SIP/vite-inbound-00000075", "0?Set(CALLERID(all)=)") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-outbound-callerid:14] ExecIf("SIP/vite-inbound-00000075", "0?Set(CALLERID(all)=)") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-outbound-callerid:15] ExecIf("SIP/vite-inbound-00000075", "0?Set(CALLERPRES()=prohib_passed_screen)") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:12] GosubIf("SIP/vite-inbound-00000075", "0?sub-flp-4,s,1()") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:13] Set("SIP/vite-inbound-00000075", "OUTNUM=s") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:14] Set("SIP/vite-inbound-00000075", "custom=SIP/ShoreTel") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:15] ExecIf("SIP/vite-inbound-00000075", "1?Set(DIAL_TRUNK_OPTIONS=M(setmusic^ShoreTel))") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:16] ExecIf("SIP/vite-inbound-00000075", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^ShoreTel)M(confirm))") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:17] Macro("SIP/vite-inbound-00000075", "dialout-trunk-predial-hook,") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("SIP/vite-inbound-00000075", "") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/vite-inbound-00000075", "0?bypass,1") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:19] ExecIf("SIP/vite-inbound-00000075", "0?Set(CONNECTEDLINE(num,i)=s)") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:20] ExecIf("SIP/vite-inbound-00000075", "0?Set(CONNECTEDLINE(name,i)=CID:3144064709)") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:21] GotoIf("SIP/vite-inbound-00000075", "0?customtrunk") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-dialout-trunk:22] Dial("SIP/vite-inbound-00000075", "SIP/ShoreTel/s,300,M(setmusic^ShoreTel)") in new stack
[2015-12-19 12:15:25] VERBOSE[9190] netsock2.c: == Using SIP RTP TOS bits 184
[2015-12-19 12:15:25] VERBOSE[9190] netsock2.c: == Using SIP RTP CoS mark 5
[2015-12-19 12:15:25] VERBOSE[9190] app_dial.c: -- Called SIP/ShoreTel/s
[2015-12-19 12:15:25] VERBOSE[9190] app_dial.c: -- SIP/ShoreTel-00000076 answered SIP/vite-inbound-00000075
[2015-12-19 12:15:25] VERBOSE[9190] pbx.c: -- Executing [s@macro-setmusic:1] Set("SIP/ShoreTel-00000076", "CHANNEL(musicclass)=ShoreTel") in new stack
[2015-12-19 12:15:31] VERBOSE[9190] pbx.c: -- Executing [h@macro-dialout-trunk:1] Macro("SIP/vite-inbound-00000075", "hangupcall,") in new stack
[2015-12-19 12:15:31] VERBOSE[9190] pbx.c: -- Executing [s@macro-hangupcall:1] GotoIf("SIP/vite-inbound-00000075", "1?theend") in new stack
[2015-12-19 12:15:31] VERBOSE[9190] pbx.c: -- Goto (macro-hangupcall,s,3)
[2015-12-19 12:15:31] VERBOSE[9190] pbx.c: -- Executing [s@macro-hangupcall:3] ExecIf("SIP/vite-inbound-00000075", "0?Set(CDR(recordingfile)=)") in new stack
[2015-12-19 12:15:31] VERBOSE[9190] pbx.c: -- Executing [s@macro-hangupcall:4] Hangup("SIP/vite-inbound-00000075", "") in new stack
[2015-12-19 12:15:31] VERBOSE[9190] app_macro.c: == Spawn extension (macro-hangupcall, s, 4) exited non-zero on 'SIP/vite-inbound-00000075' in macro 'hangupcall'
[2015-12-19 12:15:31] VERBOSE[9190] features.c: == Spawn extension (macro-dialout-trunk, h, 1) exited non-zero on 'SIP/vite-inbound-00000075'
[2015-12-19 12:15:31] VERBOSE[9190] app_macro.c: == Spawn extension (macro-dialout-trunk, s, 22) exited non-zero on 'SIP/vite-inbound-00000075' in macro 'dialout-trunk'
[2015-12-19 12:15:31] VERBOSE[9190] pbx.c: == Spawn extension (custom-RouteToShoretel, s, 1) exited non-zero on 'SIP/vite-inbound-00000075'

FreePBX version?

(padding)

I would suggest you might add

exten => s,1,dumpchan()

before

I tried this and just got all circuits are busy.

2.10. Old, I know. It’s on purpose. I tried the latest version and it did not play nicely with my SIP provider.

did you increment s,1 and s,2 to s,2 and s,3 in your macro ? Use s,1 then s,n . . . . Did you you look at your logfiles/console?

Hi!

You mentioned Vitelity as being your provider in another thread and there are people using that provider with FreePBX 13 here so it’s definitely possible to get it to work with the latest version…

Good luck and have a nice day

Nick

I did forget to increment. Fixed it, calls now route, but still sending “s” as the DID.

[2015-12-19 15:28:36] VERBOSE[1931] pbx.c: – Executing [s@custom-RouteToShoretel:2] Macro(“SIP/vite-inbound-00000008”, “dialout-trunk,4,s,”) in new stack

So. . . what did the dumpchan() function call produce in your logfile/console output ?

Weird…the DNID digits are all correct, but I just don’t get why it’s then setting the DID as “s”

Info:
Name= SIP/vite-inbound-0000000f
Type= SIP
UniqueID= 1450561054.15
LinkedID= 1450561054.15
CallerIDNum= 314XXXXXXX
CallerIDName= ANDY
ConnectedLineIDNum= (N/A)
ConnectedLineIDName=(N/A)
DNIDDigits= 314XXXXXXX
RDNIS= (N/A)
Parkinglot= default
Language= en
State= Ring (4)
Rings= 0
NativeFormat= 0x4 (ulaw)
WriteFormat= 0x4 (ulaw)
ReadFormat= 0x4 (ulaw)
RawWriteFormat= 0x4 (ulaw)
RawReadFormat= 0x4 (ulaw)
WriteTranscode= No
ReadTranscode= No
1stFileDescriptor= 21
Framesin= 0
Framesout= 0
TimetoHangup= 0
ElapsedTime= 0h0m0s
DirectBridge=
IndirectBridge=
Context= custom-RouteToShoretel
Extension= s
Priority= 1
CallGroup=
PickupGroup=
Application= DumpChan
Data= (Empty)
Blocking_in= (Not Blocking)

Variables:
CALLINGPRES_SV=allowed_not_screened
MOHCLASS=ShoreTel
GOSUB_RETVAL=
CALLED_BLACKLIST=1
FROM_DID=s
[email protected]
SIPDOMAIN=10.0.1.7
SIPURI=sip:[email protected]:5060

Then use the

CallerIDNum= 314XXXXXXX

if 314XXXXXXX makes sense, to set the CallerID(num) before bridging to the tie-line, also IMHO macros should be replaced with gosubs or just simple gotos if possible in your custom context

I’m sorry but I don’t quite follow. I’m not so much concerned about Caller ID as I am what number the caller dialed. Both the called number and the number I called from are in the 314 area code, but they are different numbers. Sorry if the X’s made that unclear.

Then you will need to specify that particular DID as a landing point for your inbound calls or the catchall inbound route will use the “start” extension , namely s. Call it entropy at work :wink:

So literally just create an inbound route for each individual DID, instead of any DID?

Holy crap that worked. I’ve spent hours on this!

Thans for your help!

Did you read the Wiki yet? :slight_smile:

No comment…:blush: