Exchange Inbound Caller ID name & number

Good Afternoon Colleagues
I hope you are doing good and safe.

I have successfully configure E1 gateway to FreePBX V15 . Calls successfully received through this gateway as expected.

This gateway has strange behavior . It exchange incoming Caller ID name and number . I can successfully solve this issue in 3CX phone system by instructing 3CX to get CallerID number from CallerID name (or Display name) .

How can i do the above in FreePBX ?

Best Regards

If the CallerID number is set as the CallerID name you could send the calls from that trunk to a custom context and set up a custom configuration in /etc/asterisk/extensions_custom.conf

exten => _.,1,Set(CALLERID(num)=${CALLERID(name)})
exten => _.,n,Goto(from-trunk,${DID},1)

Good Morning AdFun
Thx for your replay . May i know how to send calls from that trunk to custom context ?

Also may i know if i should add the DID of that trunk anywhere in the custom configuration you shared before copy it to " /etc/asterisk/extensions_custom.conf" ?

Thx in advance

The same way as you originally sent them to the standard, context, which the responder has assumed was “from-trunk”.

They have used the wildcard, “_.” to match the DID. That is adequate here, but you could replace it with the DID, if you prefer.

This is a a reply, not a replay.

Good Afternoon David
Thx for your replay . Below is snapshot from PJSIP settings of the trunk where the default of context is “from-pstn” . What i understand that i need to change it to “from-pstn-custom” . Is that true ?

Also may i know if context “from-pstn-custom” is already created by default in FreePBX or have to be created ?

Thx for your patience as i have no experience with context.

Thx in advance

Correction, you can’t use from-pstn-custom for this purpose, it’s a reserved context name, and will probably cause the dialplan to loop.

exten => _.,1,Set(CALLERID(num)=${CALLERID(name)})
exten => _.,n,Goto(from-trunk,${DID},1)

Then update the trunk context to match:


Shouldn’t the Goto be to from-pstn?

They’re the same context, you can use them interchangeably:

*CLI> dialplan show from-trunk
[ Context 'from-trunk' created by 'pbx_config' ]
  Include =>        'from-pstn'                                   [pbx_config]

Good Afternoon Lorne
Thx for your replay . I should use this code with the below dialplan already added to “extensions_custom.conf” file.

So can i add the code you shared at the end of the current “extensions_custom.conf” file which already includes dialplan by pitzkey ?

Best Regards

You can combine the two in either order as they don’t have any contexts in common.

I’d also suggest that you step back a bit and do some background reading on how Asterisk configuration files and dialplans work, as, with your combining multiple customisations, you really want to be in a position where you understand how they work, and don’t just cut and paste them.

Good Morning Lorne
Thx for your support . It works as expected.

Best Regards

1 Like

Thx David for your confirmation and for your valuable suggestion.

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