Audio Stream To Another Application With EAGI

ı want to develop a audio stream from live call to another application via tcp. I’m using Asterisk 13.26.0 and phpagi for agi library. When asterisk receives a call, I’m sending it to agi with EAGI(eagi_test.php) command in dialplan. After this, I couldn’t figure out how to get live audio from channel.

When I check the phpagi file, I found a property named audio but, When I get the dump of the property, It returns false. Here is an example of my agi code and the cli result;

eagi_test.php

#!/usr/bin/php -q
<?php
require 'phpagi.php';

$agi = new AGI();
$agi->Answer();
$agi->verbose("PID: ".getmypid());
$agi->verbose("AUDIO: ".json_encode([$agi->audio]));
$agi->Hangup();

Asterisk CLI

-- Launched AGI Script /var/lib/asterisk/agi-bin/eagi_test.php
 eagi_test.php: PID: 688052
 eagi_test.php: AUDIO: [false]

Note: I’ve also tried to get audio with fread and fgets but, When I’ve done that, agi keeps runing and fread or fgets returns nothing.

I don’t speak PHP, but the audio itself goes over file descriptor 3.

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