Can I set SIP volume in PHP AGI?

I knew I can set the volume in dialplan but since I’m using AGI to control the call flow, can i use agi->set() to achieve, if yes, what’s the correct syntax? Thank you.

You can set dialplan functions from there. The name would be VOLUME(rx) for example and the value would be what you would want.

I’m not sure that volume control is supported for SIP. If it is, it will disable direct media. It used only to be supported for DAHDI.

I also cannot imagine how volume might technically be controlled in SIP even if direct media is disabled.
SDP does have a field for setting volume level, but it is applicable only for telephone-events (e.g. DTMF), not for ordinary RTP.
Or am I missing something?

The func_volume dialplan function[1] works on any channel and manipulates the audio stream.


i’m using direct media and try


but the agi.php can’t run porperly. Is above correct?

I don’t know PHP or the library you are using so I have no idea. Someone else may be able to answer that.

i tried


and it’s executable. will make tests to verify if it works

What PHP library are you using, because if is PHPAGI class it wont work

yes, I’m using PHPAGI and it seems not working. do you have any suggestion?

Use AMI Setvar action to set the desired volume for the channel in conjunction with volume function

Thanks for your advise. As long as phpagi provides AsteriskManager, wondering if i can use the same SetVar to set the volume.

if(!class_exists(‘AGI_AsteriskManager’)) {
require_once(dirname(FILE) . DIRECTORY_SEPARATOR . ‘phpagi-asmanager.php’);
if(!class_exists(‘AGI’)) {
require_once(dirname(FILE) . DIRECTORY_SEPARATOR . ‘phpagi.php’);
$asm = new AGI_AsteriskManager();
$agi = new AGI();
$channel = $agi->request[‘agi_channel’];
if($asm->connect()) {

but it’s not running. Any advise? Thank you.

Are you trying to do third party control of a bridged channel?

Given that VOLUME() presumably inserts an audio-hook, and could need to generate re-invites, It wouldn’t surprise me if it didn’t fully work when issued asynchronously on an already bridged channel.

I’ not saying those cases haven’t been considered, but they are the sort of edge case that may have been overlooked.