Skip to content

Instantly share code, notes, and snippets.

@ambiorixg12
Created December 7, 2019 01:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ambiorixg12/4906f3653feb6de6f26089e6973642a0 to your computer and use it in GitHub Desktop.
Save ambiorixg12/4906f3653feb6de6f26089e6973642a0 to your computer and use it in GitHub Desktop.
FreePBX queue gosub and agi
/etc/asterisk/globals_custom.conf
QAGI=/var/www/html/sound.php
QGOSUB=subCreateTicket,s,1
/*AGI - Will setup an AGI script to be executed on the calling party's channel once they are connected to a queue member. */
#!/usr/bin/php -q
<?php
include ("/var/www/html/phpagi-2.20/phpagi.php");
$agi = new AGI();
$agi->answer();
//$agi->stream_file("im-sorry");
$dstatus=$agi->get_variable("EXTEN");
$agent=$agi->get_variable("MEMBERINTERFACE");
$agi->verbose($dstatus['data']);
$agent= str_replace('/','',stristr(stristr($agent['data'], '@', true),'/'));
$agi->verbose($agent);
$agi->exec("sayalpha","$agent");
?>
/* macro - Will run a macro on the called party's channel (the queue member) once the parties are connected. */
[subCreateTicket]
exten=>s,1,Wait(1)
same=>n,Noop(${MEMBERINTERFACE}/ ${QAGENT})
same=>n,Playback(demo-thanks)
same =>n,Return()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment