Skip to content

Commit

Permalink
Support for agi_network and agi_network_script variables
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasvargiu committed Sep 8, 2017
1 parent 3d0ae75 commit ab0890a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/PAGI/ChannelVariables/IChannelVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,18 @@ public function getDirectoryKey();
* @return string
*/
public function getDirectoryRun();

/**
* Returns agi_network_script.
*
* @return string
*/
public function getNetworkScript();

/**
* Returns agi_network.
*
* @return string
*/
public function getNetwork();
}
18 changes: 18 additions & 0 deletions src/PAGI/ChannelVariables/Impl/ChannelVariablesFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,4 +394,22 @@ public function __construct(array $variables, array $arguments)
$this->variables = $variables;
$this->arguments = $arguments;
}

/**
* (non-PHPdoc)
* @see PAGI\ChannelVariables.IChannelVariables::getNetworkScript()
*/
public function getNetworkScript()
{
return $this->getAGIVariable('network_script');
}

/**
* (non-PHPdoc)
* @see PAGI\ChannelVariables.IChannelVariables::getNetwork()
*/
public function getNetwork()
{
return $this->getAGIVariable('network');
}
}
2 changes: 2 additions & 0 deletions test/channelvars/Test_ChannelVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ public function can_get_agi_variables()
$vars->getArguments()
);
$this->assertFalse($vars->getArgument(4));
$this->assertEquals($vars->getNetwork(), 'yes');
$this->assertEquals($vars->getNetworkScript(), 'ScriptName');
$refObject = new \ReflectionObject($vars);
$refMethod = $refObject->getMethod('getAGIVariable');
$refMethod->setAccessible(true);
Expand Down
2 changes: 2 additions & 0 deletions test/client/Test_Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
'agi_enhanced:0.0',
'agi_accountcode:123',
'agi_threadid:1105672528',
'agi_network:yes',
'agi_network_script:ScriptName',
''
);

Expand Down

0 comments on commit ab0890a

Please sign in to comment.