Send DID in to: userpart to Freepbx extension

I’m new to FreePBX and we are using FreePBX 14.0.13.4.

I would like to use a second DID from the inbound trunk out to route to a registered extension and pass the DID in the call information so we can route it on the extension. I’ve spent a few hours looking through documentation and these forums but have not had any luck.

It seems like a pretty standard thing to do and I assumed it could be done by setting the context on the trunk to “from-pstn-toheader” but this has not changed the outbound call details to the extension to send the DID I want. I am now starting to think it could be because we are using the pjsip driver but I’ve posted here for some help.

I’ve changed the numbers and IP addresses for privacy.

The extension is registered as 0261123456 and we have a second inbound route 0261123457 but the DID information is not included in the call to extension despite registering in the CDR reports in DID column.

Does anyone have any advice? Do I need to use a custom extension to get this functionality?

The logs on the receiving device is reporting the following:

Invite-IN Recv Req INVITE from 123.123.123.123:5060 tid=Pj29ce2625-a7f3-4698-8988-1c0dbb5ada3f Call-ID=3765aaed-51c3-4bc6-a1a4-53abff9d3aa2:
INVITE sip:[email protected]:5060;rinstance=dd41e0f3640002fb SIP/2.0
Via: SIP/2.0/UDP 123.123.123.123:5060;rport=5060;branch=z9hG4bKPj29ce2625-a7f3-4698-8988-1c0dbb5ada3f
Max-Forwards: 70
Contact: <sip:[email protected]:5060>
To: <sip:[email protected];rinstance=dd41e0f3640002fb>
From: "0412345678" <sip:[email protected]>;tag=66f658df-916d-4057-811a-bc656e0c2602
Call-ID: 3765aaed-51c3-4bc6-a1a4-53abff9d3aa2
CSeq: 2119 INVITE
Session-Expires: 1800
Min-SE: 90
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Content-Type: application/sdp
Supported: 100rel, timer, replaces, norefersub
User-Agent: FPBX-14.0.13.4(13.22.0)
P-Asserted-Identity: "0412345678" <sip:[email protected]>
Content-Length: 412
v=0
o=- 1437439270 1437439270 IN IP4 123.123.123.123
s=Asterisk
c=IN IP4 123.123.123.123
t=0 0
m=audio 15556 RTP/AVP 107 9 18 0 8 3 101
a=rtpmap:107 opus/48000/2
a=fmtp:107 useinbandfec=1
a=rtpmap:9 G722/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:20
a=sendrecv

I’m sure we do, and I’m sure you won’t need a custom extension, however, having said that, I can’t make heads or tails out of what you are saying. I recognize all of the words, but they just give the request an air of “I saw this in a spy movie” vibe that I just can’t figure out.

It might help to understand that FreePBX (and by extension Asterisk) is a Back to Back User Agent, so all calls logically terminate or originate in the PBX. Every call is actually (at least) two calls one in and at least one out. The calls are “bridged” in Asterisk so they appear to be a single call - even though the are actually separate call legs managed and handled by the PBX.

As an aside, this is why you get a CDR record for every destination in a Ring Group - they are all calls to the extensions in response to an incoming call from outside.

So, a call comes in associated with a DID. This passes the call and the DID to the Inbound Routes list. A route matches your criteria (DID or CID) and the call is processed. You pick a destination in the route for that call. That routes the call.

Setting the context to “from-pstn-toheader” handles pulling the DID into the DID variable from the TO header instead of one of the other ways of getting the DID and allows your Inbound Route to match the DID. The rest is simply call direction and handling by connecting the system’s modules to the route.

Thank you for you clarification as your reply does help, I’ll attempt to explain it again as I am still learning FreePBX and Asterisk.

We want the DID from the incoming call from the trunk to sent to the extension on the second call initiated by FreePBX. This occurs on a trunk in FreePBX but not on extensions. We may have this set up incorrectly and extensions can not provide this capability. In short, we want an extension to have trunk functionality.

Researching more I found this is around the context set on extensions which is from-internal and we are looking for the functionality of from-pstn.

If the called device is another PBX, SIP proxy, SBC, etc., you would normally set it up as a trunk. Why did you choose an extension?

The functionality and integration into our other systems worked better with extensions than creating a trunk.

There is a module that, if you can pass through it, called SetUserID(), which may be useful.

There are also a lot of settings about RPID and other functions and settings that should get you where you want to go.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.