Asterisk EAGI: Difference between revisions

From voipsupport
Jump to navigation Jump to search
No edit summary
No edit summary
Line 16: Line 16:
  return "DeadAGI(".$this->data.")";</pre>
  return "DeadAGI(".$this->data.")";</pre>


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


<pre>--- phpagi.dist.php 2016-06-19 09:07:55.475372158 +0200
<pre>--- phpagi.dist.php 2016-06-19 09:07:55.475372158 +0200
Line 33: Line 33:
         elseif(file_exists('/dev/fd/3'))
         elseif(file_exists('/dev/fd/3'))
         {</pre>
         {</pre>
==Asterisk patch to configure EAGI audio stream==
Use the following in the dialplan to set to 48Khz LPCM 16 bit signed audio:
<pre>set(EAGI_AUDIO_FORMAT=sln48)</pre>

Revision as of 18:44, 19 June 2016

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

Use the following in the dialplan to set to 48Khz LPCM 16 bit signed audio:

set(EAGI_AUDIO_FORMAT=sln48)