Random caller ID from a list on outbound calls

I have a client which is in need of using a random caller ID from a list of caller IDs. I found an article here vicidial-tutorials-and-self-help-articles/set-random-caller-id-in-vicidial-and-goautodial/

But I can’t seem to get it to work on FreePBX. I don’t mess with the contexts.

I tried the following in the extensions_custom.conf
[macro-dialout-trunk-predial-hook]
exten => s,1,AGI(randomcid1.php)
exten => s,2,Dial(PJSIP/voiptrunk/${EXTEN:1})
exten => s,3,Hangup

My trunk name is voiptrunk. But the caller ID never gets changed. The calls come up as private number. In the logs, here is a snippet.

– Executing [s@macro-dialout-trunk-predial-hook:1] AGI(“PJSIP/100-00000015”, “randomcid1.php”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/randomcid1.php
– <PJSIP/100-00000015>AGI Script randomcid1.php completed, returning 0
– Executing [s@macro-dialout-trunk-predial-hook:2] Dial(“PJSIP/100-00000015”, “PJSIP/”) in new stack
[2018-07-10 15:49:52] WARNING[30383][C-0000000b]: app_dial.c:2467 dial_exec_full: Dial argument takes format (technology/resource)
== Spawn extension (macro-dialout-trunk-predial-hook, s, 2) exited non-zero on ‘PJSIP/100-00000015’ in macro ‘dialout-trunk-predial-hook’
== Spawn extension (macro-dialout-trunk, s, 18) exited non-zero on ‘PJSIP/100-00000015’ in macro ‘dialout-trunk’
== Spawn extension (from-internal, 14014377851, 6) exited non-zero on ‘PJSIP/100-00000015’
– Executing [h@from-internal:1] Macro(“PJSIP/100-00000015”, “hangupcall”) in new stack

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