@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | |
340 | 340 | // login |
341 | 341 | $res = $this->send_request('login', ['Username' => $username, |
342 | - 'Secret' => $secret]); |
|
342 | + 'Secret' => $secret]); |
|
343 | 343 | if ($res['Response'] != 'Success') { |
344 | 344 | $this->_logged_in = false; |
345 | 345 | $this->log("Failed to login."); |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | */ |
381 | 381 | function AbsoluteTimeout(string $channel, int $timeout): array { |
382 | 382 | return $this->send_request('AbsoluteTimeout', ['Channel' => $channel, |
383 | - 'Timeout' => $timeout]); |
|
383 | + 'Timeout' => $timeout]); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | */ |
395 | 395 | function ChangeMonitor(string $channel, string $file): array { |
396 | 396 | return $this->send_request('ChangeMonitor', ['Channel' => $channel, |
397 | - 'File' => $file]); |
|
397 | + 'File' => $file]); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | /** |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | */ |
449 | 449 | function DBGet(string $family, string $key, $actionid = null): string { |
450 | 450 | $parameters = ['Family' => $family, |
451 | - 'Key' => $key]; |
|
451 | + 'Key' => $key]; |
|
452 | 452 | if ($actionid == null) { |
453 | 453 | $actionid = $this->ActionID(); |
454 | 454 | } |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | */ |
474 | 474 | function ExtensionState(string $exten, string $context, $actionid = null): array { |
475 | 475 | $parameters = ['Exten' => $exten, |
476 | - 'Context' => $context]; |
|
476 | + 'Context' => $context]; |
|
477 | 477 | if ($actionid) { |
478 | 478 | $parameters['ActionID'] = $actionid; |
479 | 479 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | */ |
494 | 494 | function GetVar(string $channel, string $variable, $actionid = null): array { |
495 | 495 | $parameters = ['Channel' => $channel, |
496 | - 'Variable' => $variable]; |
|
496 | + 'Variable' => $variable]; |
|
497 | 497 | if ($actionid) { |
498 | 498 | $parameters['ActionID'] = $actionid; |
499 | 499 | } |
@@ -634,9 +634,9 @@ discard block |
||
634 | 634 | * @throws Exception |
635 | 635 | */ |
636 | 636 | function Originate(string $channel, |
637 | - $exten = null, $context = null, $priority = null, |
|
638 | - $application = null, $data = null, |
|
639 | - $timeout = null, $callerid = null, $variable = null, $account = null, $async = null, $actionid = null): array { |
|
637 | + $exten = null, $context = null, $priority = null, |
|
638 | + $application = null, $data = null, |
|
639 | + $timeout = null, $callerid = null, $variable = null, $account = null, $async = null, $actionid = null): array { |
|
640 | 640 | $parameters = ['Channel' => $channel]; |
641 | 641 | |
642 | 642 | if ($exten) { |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | */ |
714 | 714 | function QueueAdd(string $queue, string $interface, int $penalty = 0, $memberName = false): array { |
715 | 715 | $parameters = ['Queue' => $queue, |
716 | - 'Interface' => $interface]; |
|
716 | + 'Interface' => $interface]; |
|
717 | 717 | if ($penalty) { |
718 | 718 | $parameters['Penalty'] = $penalty; |
719 | 719 | } |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | */ |
735 | 735 | function QueueRemove(string $queue, string $interface): array { |
736 | 736 | return $this->send_request('QueueRemove', ['Queue' => $queue, |
737 | - 'Interface' => $interface]); |
|
737 | + 'Interface' => $interface]); |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | /** |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | */ |
815 | 815 | function SetCDRUserField(string $userfield, string $channel, $append = null): array { |
816 | 816 | $parameters = ['UserField' => $userfield, |
817 | - 'Channel' => $channel]; |
|
817 | + 'Channel' => $channel]; |
|
818 | 818 | if ($append) { |
819 | 819 | $parameters['Append'] = $append; |
820 | 820 | } |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | "tempdir" => AST_TMP_DIR]; |
142 | 142 | |
143 | 143 | /** |
144 | - * Constructor |
|
145 | - * |
|
146 | - * @param string $config is the name of the config file to parse |
|
147 | - * @param array $optconfig is an array of configuration vars and values, stuffed into $this->config['phpagi'] |
|
148 | - */ |
|
144 | + * Constructor |
|
145 | + * |
|
146 | + * @param string $config is the name of the config file to parse |
|
147 | + * @param array $optconfig is an array of configuration vars and values, stuffed into $this->config['phpagi'] |
|
148 | + */ |
|
149 | 149 | function __construct($config = null, array $optconfig = []) { |
150 | 150 | // load config |
151 | 151 | if (!is_null($config) && file_exists($config)) { |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | * DTMF tone. Use chr() to convert to ASCII. |
524 | 524 | */ |
525 | 525 | function record_file(string $file, string $format, string $escape_digits = '', int $timeout = -1, |
526 | - $offset = null, bool $beep = false, $silence = null): array { |
|
526 | + $offset = null, bool $beep = false, $silence = null): array { |
|
527 | 527 | $cmd = trim("RECORD FILE $file $format \"$escape_digits\" $timeout $offset"); |
528 | 528 | if ($beep) { |
529 | 529 | $cmd .= ' BEEP'; |
@@ -1413,39 +1413,39 @@ discard block |
||
1413 | 1413 | 'k9999' => 'Z', |
1414 | 1414 | 'k99999' => '9']; |
1415 | 1415 | $symbol = ['k0' => '=', |
1416 | - 'k1' => '<', |
|
1417 | - 'k11' => '(', |
|
1418 | - 'k111' => '[', |
|
1419 | - 'k1111' => '{', |
|
1420 | - 'k11111' => '1', |
|
1421 | - 'k2' => '@', |
|
1422 | - 'k22' => '$', |
|
1423 | - 'k222' => '&', |
|
1424 | - 'k2222' => '%', |
|
1425 | - 'k22222' => '2', |
|
1426 | - 'k3' => '>', |
|
1427 | - 'k33' => ')', |
|
1428 | - 'k333' => ']', |
|
1429 | - 'k3333' => '}', |
|
1430 | - 'k33333' => '3', |
|
1431 | - 'k4' => '+', |
|
1432 | - 'k44' => '-', |
|
1433 | - 'k444' => '*', |
|
1434 | - 'k4444' => '/', |
|
1435 | - 'k44444' => '4', |
|
1436 | - 'k5' => "'", |
|
1437 | - 'k55' => '`', |
|
1438 | - 'k555' => '5', |
|
1439 | - 'k6' => '"', |
|
1440 | - 'k66' => '6', |
|
1441 | - 'k7' => '^', |
|
1442 | - 'k77' => '7', |
|
1443 | - 'k8' => "\\", |
|
1444 | - 'k88' => '|', |
|
1445 | - 'k888' => '8', |
|
1446 | - 'k9' => '_', |
|
1447 | - 'k99' => '~', |
|
1448 | - 'k999' => '9']; |
|
1416 | + 'k1' => '<', |
|
1417 | + 'k11' => '(', |
|
1418 | + 'k111' => '[', |
|
1419 | + 'k1111' => '{', |
|
1420 | + 'k11111' => '1', |
|
1421 | + 'k2' => '@', |
|
1422 | + 'k22' => '$', |
|
1423 | + 'k222' => '&', |
|
1424 | + 'k2222' => '%', |
|
1425 | + 'k22222' => '2', |
|
1426 | + 'k3' => '>', |
|
1427 | + 'k33' => ')', |
|
1428 | + 'k333' => ']', |
|
1429 | + 'k3333' => '}', |
|
1430 | + 'k33333' => '3', |
|
1431 | + 'k4' => '+', |
|
1432 | + 'k44' => '-', |
|
1433 | + 'k444' => '*', |
|
1434 | + 'k4444' => '/', |
|
1435 | + 'k44444' => '4', |
|
1436 | + 'k5' => "'", |
|
1437 | + 'k55' => '`', |
|
1438 | + 'k555' => '5', |
|
1439 | + 'k6' => '"', |
|
1440 | + 'k66' => '6', |
|
1441 | + 'k7' => '^', |
|
1442 | + 'k77' => '7', |
|
1443 | + 'k8' => "\\", |
|
1444 | + 'k88' => '|', |
|
1445 | + 'k888' => '8', |
|
1446 | + 'k9' => '_', |
|
1447 | + 'k99' => '~', |
|
1448 | + 'k999' => '9']; |
|
1449 | 1449 | $text = ''; |
1450 | 1450 | do { |
1451 | 1451 | $command = false; |
@@ -1638,8 +1638,8 @@ discard block |
||
1638 | 1638 | */ |
1639 | 1639 | private function evaluate(string $command): array { |
1640 | 1640 | $broken = ['code' => 500, |
1641 | - 'result' => -1, |
|
1642 | - 'data' => '']; |
|
1641 | + 'result' => -1, |
|
1642 | + 'data' => '']; |
|
1643 | 1643 | |
1644 | 1644 | // write command |
1645 | 1645 | if (!@fwrite($this->out, trim($command) . "\n")) { |
@@ -1619,7 +1619,7 @@ |
||
1619 | 1619 | function &new_AsteriskManager(): AGI_AsteriskManager { |
1620 | 1620 | $this->asm = new AGI_AsteriskManager(null, $this->config['asmanager']); |
1621 | 1621 | $this->asm->setPagi($this); |
1622 | - $this->config['asmanager'] =& $this->asm->config['asmanager']; |
|
1622 | + $this->config['asmanager'] = & $this->asm->config['asmanager']; |
|
1623 | 1623 | return $this->asm; |
1624 | 1624 | } |
1625 | 1625 |
@@ -1293,9 +1293,10 @@ discard block |
||
1293 | 1293 | |
1294 | 1294 | // clean up old files |
1295 | 1295 | $delete = time() - 2592000; // 1 month |
1296 | - foreach (glob($this->config['phpagi']['tempdir'] . DIRECTORY_SEPARATOR . 'text2wav_*') as $file) |
|
1297 | - if (filemtime($file) < $delete) { |
|
1296 | + foreach (glob($this->config['phpagi']['tempdir'] . DIRECTORY_SEPARATOR . 'text2wav_*') as $file) { |
|
1297 | + if (filemtime($file) < $delete) { |
|
1298 | 1298 | unlink($file); |
1299 | + } |
|
1299 | 1300 | } |
1300 | 1301 | |
1301 | 1302 | return $ret; |
@@ -1344,9 +1345,10 @@ discard block |
||
1344 | 1345 | |
1345 | 1346 | // clean up old files |
1346 | 1347 | $delete = time() - 2592000; // 1 month |
1347 | - foreach (glob($this->config['phpagi']['tempdir'] . DIRECTORY_SEPARATOR . 'swift_*') as $file) |
|
1348 | - if (filemtime($file) < $delete) { |
|
1348 | + foreach (glob($this->config['phpagi']['tempdir'] . DIRECTORY_SEPARATOR . 'swift_*') as $file) { |
|
1349 | + if (filemtime($file) < $delete) { |
|
1349 | 1350 | unlink($file); |
1351 | + } |
|
1350 | 1352 | } |
1351 | 1353 | |
1352 | 1354 | return $ret; |
@@ -1666,9 +1668,11 @@ discard block |
||
1666 | 1668 | $ret['code'] = substr($str, 0, 3); |
1667 | 1669 | $str = trim(substr($str, 3)); |
1668 | 1670 | |
1669 | - if ($str[0] == '-') // we have a multiline response! |
|
1671 | + if ($str[0] == '-') { |
|
1672 | + // we have a multiline response! |
|
1670 | 1673 | { |
1671 | 1674 | $count = 0; |
1675 | + } |
|
1672 | 1676 | $str = substr($str, 1) . "\n"; |
1673 | 1677 | $line = fgets($this->in, 4096); |
1674 | 1678 | while (substr($line, 0, 3) != $ret['code'] && $count < 5) { |
@@ -1684,9 +1688,11 @@ discard block |
||
1684 | 1688 | |
1685 | 1689 | $ret['result'] = null; |
1686 | 1690 | $ret['data'] = ''; |
1687 | - if ($ret['code'] != AGIRES_OK) // some sort of error |
|
1691 | + if ($ret['code'] != AGIRES_OK) { |
|
1692 | + // some sort of error |
|
1688 | 1693 | { |
1689 | 1694 | $ret['data'] = $str; |
1695 | + } |
|
1690 | 1696 | $this->conlog(print_r($ret, true)); |
1691 | 1697 | } else { // normal AGIRES_OK response |
1692 | 1698 | $parse = explode(' ', trim($str)); |