Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelog committed Mar 28, 2016
1 parent 9a88e0a commit 2482ed7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/PAGI/Client/AbstractClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -721,10 +721,7 @@ protected function isEndOfEnvironmentVariables($line)
*/
protected function readEnvironmentVariable($line)
{
$variableName = explode(':', substr($line, 4));
$key = trim($variableName[0]);
unset($variableName[0]);
$value = trim(implode('', $variableName));
list($key, $value) = explode(':', substr($line, 4), 2);
if (strncmp($key, 'arg_', 4) === 0) {
$this->arguments[substr($key, 4)] = $value;
} else {
Expand Down
14 changes: 11 additions & 3 deletions test/channelvars/Test_ChannelVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,19 @@ public function can_get_agi_variables()
$this->assertEquals($vars->getAccountCode(), '123');
$this->assertEquals($vars->getEnhanced(), '0.0');
$this->assertEquals($vars->getPriority(), '1');
$this->assertEquals($vars->getTotalArguments(), 2);
$this->assertEquals($vars->getTotalArguments(), 3);
$this->assertEquals($vars->getArgument(1), 'arg1');
$this->assertEquals($vars->getArgument(2), 'arg2');
$this->assertEquals(array(1 => 'arg1', 2 => 'arg2'), $vars->getArguments());
$this->assertFalse($vars->getArgument(3));
$this->assertEquals($vars->getArgument(3), 'http://www.someurl.com:1234');
$this->assertEquals(
array(
1 => 'arg1',
2 => 'arg2',
3 => 'http://www.someurl.com:1234'
),
$vars->getArguments()
);
$this->assertFalse($vars->getArgument(4));
$refObject = new \ReflectionObject($vars);
$refMethod = $refObject->getMethod('getAGIVariable');
$refMethod->setAccessible(true);
Expand Down
1 change: 1 addition & 0 deletions test/client/Test_Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
$standardAGIStart = array(
'agi_arg_1:arg1',
'agi_arg_2:arg2',
'agi_arg_3:http://www.someurl.com:1234',
'agi_request:anagi.php',
'agi_channel:SIP/jondoe-7026f150',
'agi_language:ar',
Expand Down

0 comments on commit 2482ed7

Please sign in to comment.