aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2019-01-19 10:48:42 -0800
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2019-01-19 10:48:42 -0800
commitde6e5c74bf78ee190db28eee14e78746e5856c53 (patch)
treede40a25bca886fa1fc164bbb048ca04ef36a0550
parent82ae648a1fccca9db914e1c0c35aa6679283d902 (diff)
downloadasterisk-aastra-master.tar.gz
New AGI format in asterisk 16HEADmaster
Unlike asterisk 13, asterisk 16 responds with Output: lines rather than Follows: lines, so cope with this addition. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--include/AastraAsterisk.class.php13
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);