Macro-dialout-trunk-predial-hook not executing

Using FreePBX
The main function is: calls obtained through a GSM gateway (GoIP) are directed to Time Conditions (and from there to a trunk) or directly to a SIP trunk using Inbound Route(s). Simple as that. Using chan_sip.
The trunk provider needs a specific Diversion header for one of its features.
I just need to add a header to the outbound calls through this sip trunk.
Everything I can find on the internet involves the use of a (deprecated?!) macro which just plain doesn’t work.
When I add anything in the following context in extensions_custom.conf, it doesn’t seem to get executed when I test and call the GSM GW:
exten => s,1,Noop(Entering user defined context macro-dialout-trunk-predial-hook)
;exten => s,1,SipAddHeader(Testhdr: testvalue)
exten => s,n,MacroExit()

Nothing shows up in the (full) log, no header is set when I uncomment the SipAddHeader line.
I use sngrep to monitor SIP communication.
Is there anything I miss here?

After editing *.conf files you must reload the dialplan. Either using the red apply config button, or by doing

fwconsole reload
1 Like

I’m aware of reloading the dialplan, also I edit the file in the GUI - Admin-Config edit, and Apply the changes anyway.
In the meantime after continuous reading and testing I solved the case. It seems this [macro-dialout…] context thing no longer works, I couldn’t make it execute.
The solution was to set an overriden dial string in the GUI for the trunk in the form Ttb(custom-privacy-header^s^1), then for this context in the parentheses I set the SipAddHeader thing in extenstions_custom.conf and it worked.

News to me. I use it pretty much every single week, and have for years. I’m aware of no version of core where it doesn’t work.

That is a shame, as we use this function. I know @lgaetz mentioned depreciated macros will eventually go away. What version of FreePBX/Asterisk are you running?

It’s very possible I was missing something else so it didn’t work for me. But I dug over the internet for this and everywhere in thousands of threads/forums I read all the same - the [macro-…] context/thing should execute when dialing out through a trunk (SIP/Chan_sip). It didn’t. Not in the FULL log, neither in outbound headers I could see any header I was “adding”.
The version is mentioned in the first post - Asterisk was the newest possible when I installed FPBX half a year ago, maybe v15 or so.

Not sure what you did wrong, but error must be on your part. The Core module controls this, and on a current 15 system (core ver we can see the dialplan which I’ve pasted here

Line 33 calls the macro. When populated and dialplan reloaded, an outbound call will have lines like these:

[2020-06-01 18:05:25] VERBOSE[8282][C-00000016] pbx.c: Executing [[email protected]:1] NoOp("PJSIP/6013-0000000b", "Entering user defined context macro-dialout-trunk-predial-hook in extensions_custom.conf") in new stack
[2020-06-01 18:05:25] VERBOSE[8282][C-00000016] pbx.c: Executing [[email protected]:2] AGI("PJSIP/6013-0000000b", "lgaetz-didloopback.php,<redacted>,verbose") in new stack
    .... lines removed ...
[2020-06-01 18:05:25] VERBOSE[8282][C-00000016] pbx.c: Executing [[email protected]:3] GotoIf("PJSIP/6013-0000000b", "0?redirect") in new stack
[2020-06-01 18:05:25] VERBOSE[8282][C-00000016] pbx.c: Executing [[email protected]:4] MacroExit("PJSIP/6013-0000000b", "") in new stack

Me neither. I have no customizations, I’m not proficient in telephony and used only the GUI to setup a relatively simple system that takes calls from a GSM gateway, records and logs them and directs them out to an other trunk. I use two time conditions with a simple IVR to avoid midnight calls.
It only worked after I added and overriden Asterisk Trunk Dial Options string in the GUI (Ttb(…)) and used the context in the parentheses for my “code” (which I collected from numerous threads online and tested in many many combinations).

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