Greetings!
I have a system with FreePBX 16.0.40.7 and Asterisk 20.5.2.
I’m originating an AMI call with PHP via sockets, but it seems both macro-dialout-trunk-predial-hook (which is supposed to be called by FreePBX core automatically?) and the Asterisk AMI Originate parameter PreDialGoSub are failing to execute. We are using SIP (yes, I know it should be PJSIP and we’ll get around to that soon.)
Here is the core of the PHP:
fwrite($socket, "Action: Originate\r\n");
fwrite($socket, "Channel: SIP/telnyx-out/$did\r\n");
fwrite($socket, "Exten: $ext\r\n");
fwrite($socket, "Context: from-internal\r\n");
fwrite($socket, "Priority: 1\r\n");
fwrite($socket, "Variable: XDID=$did\r\n");
fwrite($socket, "Variable: AGENT=$ext\r\n");
fwrite($socket, "CallerID: $cid\r\n");
fwrite($socket, "Account: Outbound\r\n");
fwrite($socket, "PreDialGoSub: dialouttrunkpredialhook,s,1\r\n");
fwrite($socket, "Async: true\r\n\r\n");
I have confirmed all variables a populated correctly. Here is the sub dialouttrunkpredialhook which is just renamed from [macro-dialout-trunk-predial-hook] and modified to be a sub routine:
[dialouttrunkpredialhook]
exten => s,1,NoOp(CUSTOM: Outbound ${EXTEN} ${CALLERID(num)})
exten => s,n,AGI(cid-did-outbound.php)
exten => s,n,Return()
With AGI debug on in the CLI and verbosity at 30 I do not see the NoOp or the AGI script being called. The call goes through with no issues. Can someone tell me what I am doing wrong?
3 posts - 3 participants