Asterisk EAGI

From voipsupport
Jump to navigation Jump to search

FreePBX Patch needed to be able to use EAGI

--- extensions.class.original.php	2016-06-18 19:23:14.009320154 +0200
+++ extensions.class.php	2016-06-18 15:54:11.273444005 +0200
@@ -1251,6 +1251,11 @@
 		return "AGI(".$this->data.")";
 	}
 }
+class ext_eagi extends extension {
+	function output() {
+		return "EAGI(".$this->data.")";
+	}
+}
 class ext_deadagi extends extension {
 	function output() {
 		return "DeadAGI(".$this->data.")";

PHPAGI patch to the version distributed in FreePBX to be able to open EAGI audio stream

--- phpagi.dist.php	2016-06-19 09:07:55.475372158 +0200
+++ phpagi.php	2016-06-19 09:46:12.734317454 +0200
@@ -173,10 +173,10 @@
       // open audio if eagi detected
       if($this->request['agi_enhanced'] == '1.0')
       {
-        if(file_exists('/proc/' . getmypid() . '/fd/3'))
+	if (array_search('php',stream_get_wrappers())!==FALSE)
         {
           // this should work on linux
-          $this->audio = fopen('/proc/' . getmypid() . '/fd/3', 'r');
+          $this->audio = fopen('php://fd/' . AUDIO_FILENO, 'r');
         }
         elseif(file_exists('/dev/fd/3'))
         {

Asterisk patch to configure EAGI audio stream format

With this patch, use the following in the dialplan prior to calling an EAGI script. The following example shows how to set 48kHz LPCM single channel 16 bit signed audio:

set(EAGI_AUDIO_FORMAT=sln48)