diff options
-rw-r--r-- | include/AastraAsterisk.class.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/include/AastraAsterisk.class.php b/include/AastraAsterisk.class.php index cba4b4f..1cdad38 100644 --- a/include/AastraAsterisk.class.php +++ b/include/AastraAsterisk.class.php @@ -121,15 +121,15 @@ class AGI_AsteriskManager while($buffer != '') { $a = strpos($buffer, ':'); - if($a) + if($a) { if(!count($parameters)) // first line in a response? { + $parameters['data'] = ''; $type=strtolower(substr($buffer, 0, $a)); if(substr($buffer,$a+2)=='Follows') { # A follows response means there is a multiline field that follows. - $parameters['data'] = ''; $buff=fgets($this->socket, 4096); while(substr($buff, 0, 6) != '--END ') { @@ -140,7 +140,12 @@ class AGI_AsteriskManager } # Store parameter in $parameters - $parameters[substr($buffer,0,$a)]=substr($buffer,$a+2); + $key = substr($buffer, 0, $a); + $value = substr($buffer, $a+2); + if ($key == 'Output') { + $parameters['data'] .= $value."\n"; + } + $parameters[$key]=$value; } $buffer=trim(fgets($this->socket,4096)); } @@ -157,7 +162,7 @@ class AGI_AsteriskManager case 'response': break; default: - $this->log('Unhandled response packet from Manager: '.$type); + error_log('Unhandled response packet from Manager: '.$type); break; } } while($type!='response' && !$timeout); |