Need to email the INBOUND DID of a TRUNK on Voicemail

We need the INBOUND DID of the TRUNK available when a calls comes in on when a voicemail is emailed to a user. THis will be helpful especially because we have lots of inbound DIDs going to a dropbox and it would be nice to know which call came in from where without having to add PREPENDED data to the callerid for each one.

I assume you mean a direct in dialing number on an ITSP’s system. How do they signal it you.

Yes the inbound DID that is in an incoming route. That needs to be in a variable so it can be used in emails.

CAn this be implemented please?

THanks leon

Please answer the question as to how it is signalled from the ITSP to you.

If is not, there is nothing you can do.

If it is in the request URI, it is trivial.

If it is in the To header, you need to parse it out yourelf.

If it is somewhere else, you need to provide details.

the INCOMING ROUTE defines the DID that comes in that is being provided by my gateway. The inbound route comes in off a TRUNK. it is NOT being signaled any other way that I am aware of. The provider routes various DIDs that I own to the pbx.

I can’t explain it any simpler.


posting a SIP trace for an inconmig call will allow us to determine if the information you need it is available on the incoming INVITE request

These are not Asterisk terms.

If you mean the sip.conf entry, you don’t really have direct in dialling and you can obtain the information from the ${CHANNEL()} function. I think you want “sippeer”. Change details appropriately for pjsip.
(DID traditionally means direct in dialling, where part of the original number is forwarded to the PBX. As such we were assuming that you wanted to recover that number. In the VoIP world, it is often mis-used to refer to the case where a single number in a DID on the ITSP is forwarded to their customer, and has come to refer to any remote PSTN to SIP incoming gateway.)

Also the fact that you are not using Asterisk terms may mean that you are constrained by a third party (typically FrrePBX) dialplan, and you will have to ask its supplier as to where you can modify it to access this sort of information.

I am currently using freepbx on top of Asterisk yes.
I will see what I can get from a sip debug

The freepbx folks told me to talk to the asterisk folks on this and if this is resolved by you then they will look at it again.

Thanks leon

To ask us, you need to pose the question in Asterisk terms, and you need to be clear exactly what you mean by DID. (I’m not sure that DID is even a FreePBX term. It’s certainly not a concept that Asterisk has any innate knowledge about.)

Asterisk doesn’t have a concept of a trunk, for inbound calls, as it handles them the same way as if they were calls arriving from a single, local, phone.

same problem here i need number of phone
did means ${from_did}
i found
for me it will be
exten => *999,1,Set(CALLERID(name)=${FROM_DID})
but i don`t know where to put it
pls help

After FROM_DID Is set. Asterisk doesn’t set it, so you will have to ask the person who wrote the dialplan that did set it.

Support on customising FreePBX should be addressed to their paid support or to

1 Like