Hidden CID

Hi to all,

We have a PRI link with old PABX and route calls from it to ITSP. Some extensions’ CID is hidden, but we have to set CID before sending to ITSP. Because ITSP rejects all Anonymous calls.

We used the Set CallerID, but it doesn’t override cid name press and cid num press, also the set caller id custom context is not usable, because before include there is a Goto() !
We made a custom destination and override name-press and num-press with "“allowed_passed_screen”, but after return to ext-trunk, they will override with prohib_passed_screen.

Do you have any idea how we can change these values before call routing to ITSP?


Hello @psdk,

Try to use the macro macro-dialout-trunk-predial-hook.
Here is an example how to use it:

;Remove spaces or dashes from outboundnumber when calling
exten => s,1,Set(OUTNUM=${FILTER(0123456789*#+,${OUTNUM})})

;Remove Alert Info headers
exten => s,n,SIPRemoveHeader(Alert-Info:)

;Remove Call Info headers
exten => s,n,SIPRemoveHeader(Call-Info:)

exten => s,n,NoOp(The caller id name is: ${CALLERID(name)})
exten => s,n,NoOp(The caller id number is: ${CALLERID(num)})
exten => s,n,NoOp(The ampuser is: ${AMPUSER})
exten => s,n,NoOp(The real caller id is: ${REALCALLERIDNUM})
exten => s,n,NoOp(The outbound cli is: ${DB(AMPUSER/${REALCALLERIDNUM}/outboundcid)})

exten => s,n,MacroExit()

Thank you,

Daniel Friedman
Trixton LTD

thank you @danielf.

We override it, but it’s amazing that no one calls this macro !

comments shows this:
; the macro is called by macro-dialout-trunk just prior to making a Dial() attempt
; to a trunk."

But there isn’t this macro !!

FPBX is v15 and updated.
Please correct me if I made mistake!

I think there is a problem on this version : or 38.

@lgaetz can u confirm that this macro is not available in the new versions?


Cannot confirm, everything works as expected. If this macro was broken, I’m sure there would be howls from every corner of the community

# fwconsole ma list | grep frame
| framework           | | Enabled                           | GPLv2+      |

# tail -f /var/log/asterisk/full | grep hook
[2020-10-27 10:26:22] VERBOSE[22473][C-0000002a] pbx.c: Executing [[email protected]:20] Macro("SIP/6002-00000026", "dialout-trunk-predial-hook,") in new stack
[2020-10-27 10:26:22] VERBOSE[22473][C-0000002a] pbx.c: Executing [[email protected]al-hook:1] MacroExit("SIP/6002-00000026", "") in new stack

I checked again updates. Do you have any idea what is wrong?
I have 2 different systems, and they are same ! 38 and 76.

Don’t see a call trace. Share via pastebin pls:

Hi @psdk,

You need to declare this macro in the Asterisk dialplan.
Put this context in the extensions_custom.conf file and reload the dial plan (rasterisk -x'dialplan reload').

Thank you,

Daniel Friedman
Trixton LTD.

Thanks. But problem is that there isn’t any call for this macro in dialplan! in 2 different minor versions of FPBX 15.
It’s ok in v13 and 14, i checked.
I will share logs here.

Hello @psdk,

Can you paste here your outpur of this command?
rasterisk -x'dialplan show macro-dialout-trunk-predial-hook'

Thank you,

Daniel Friedman
Trixton LTD

@lgaetz please check this : https://pastebin.pl/view/ff0d7e24

I checked again v13 and 14 and it is working !

I think I found the issue.
We are not using any outbound routes ! and this macro is called just in outbound routes.
We are routing calls from DAHDI (from-trunk) via inbound routes to PJSIP trunk. So, there isn’t any call point for this macro.

We used the u() and f() dial options in the pjsip trunk, but they didn’t work.
So, we are thinking about making an ext-trunk-custom and override the num-press variables.

I really appreciate if an expert provide correct solution:

we want to override CALLINGNAMEPRES:
First solution: ext-trunk-custom:
it’s not possible to override tdial!

Second solution: ext-did-0002-custom:
It’s not possible to override, although it uses Goto(ext-trunk,1,1).

Third Solution:
Changing the codes in functions.inc.php and override the CALLINGNAMEPRES values.
It works but you should be worry about system updates!

So what is the correct solution for changing some parts of dialplan??

Can you do what you need to do in a context before the inbound routes? Context for scripts (incoming calls)

1 Like

Yes it’s a good solution. Thanks @lgaetz.
What is your idea about changing a part of dialplan for other cases?

I’m not sure what you mean. What other cases?

For example you need set a variable for a call in the middle of a built-in context, but at the end of the context there is a Goto() and custom context is not helpful.
What you offer for these requirements?

There are essentially 4 main ways to use your own dialplan on FreePBX, each is described here:

If none of those techniques work, then you would have to copy the generated context from extensions_additional to extensions_override_freepbx and make the modifications you want, but you want to avoid that if possible.

1 Like

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