I have two numbers: 800 and 801 -> 801 has CFU on my mobile (051654321), and I can lookup in the asterisk DB, what this CFU number is.
So when 800 calls 801 - the call if forwarded to my mobile number. Now, I’m trying to change the callerid for the call to my mobile number -> But here is the problem, if I lookup in the database what my mobile number is - I cannot, because the callerid is set to 800, and not 801.
This is my dialplan (extension_custom.conf):
[macro-dialout-trunk-predial-hook]
Does FreePBX know that when you put into extension-custom.conf this macro ([macro-dialout-trunk-predial-hook]) - that it will call it when an outbound call will be made?
And one more thing - can I specify to which trunk this macro will go (let’s say I have multiple trunks (1x SIP, 2x ISDN…), and I only want this macro to go via SIP trunk)?
It is up to you to add any logic that checks which trunk and decides what to do.
However, see my response to you other post. And in general, there is no harm that will be done if you add a Diversion Header even on a trunk where it is not necessary, though you obviously want to confirm that with some testing.
you can have RPID created by setting sendrpid=yes for the trunk configuration.
As far as the privacy=full, you would need a hook similar to Peter and then you could use the CALLERPRES() function to set it to the desired setting that achieve this.
Of course, what peter suggested works perfectly fine as well.
My config excerpt above was built from my deconstructed Diversion Header config. I’ll put my full macro below while only obscuring the NPA of each number. It handles multiple SIP trunks as well as PRI trunks in the logic – though, as Philippe noted, extra SIP headers won’t hurt a call that ends up using a DAHDI trunk.
I do it for outbound calls on my SIP trunks. In my /etc/asterisk/extensions_custom.conf file I implemented a macro for dialout-trunk-predial-hook like: