diff --git a/src/PAGI/Client/AbstractClient.php b/src/PAGI/Client/AbstractClient.php index ec1d1e9..8092b47 100644 --- a/src/PAGI/Client/AbstractClient.php +++ b/src/PAGI/Client/AbstractClient.php @@ -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 { diff --git a/test/channelvars/Test_ChannelVariables.php b/test/channelvars/Test_ChannelVariables.php index 3429634..79ed1f6 100644 --- a/test/channelvars/Test_ChannelVariables.php +++ b/test/channelvars/Test_ChannelVariables.php @@ -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); diff --git a/test/client/Test_Client.php b/test/client/Test_Client.php index 81a9d12..5bacb1a 100644 --- a/test/client/Test_Client.php +++ b/test/client/Test_Client.php @@ -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',