Skip to content

Commit b0c3a29

Browse files
author
Sergey Kasatkin
committed
Add wait, background methods
1 parent 7ec551e commit b0c3a29

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

src/AGI/Handler.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ public function verbose($message, $level = 1)
683683
*
684684
* @link http://www.voip-info.org/wiki-wait+for+digit
685685
* @param integer $timeout in millisecons. Use -1 for the timeout value if you want the call to wait indefinitely.
686-
* @return int Digit received
686+
* @return null|string Digit received
687687
* @throws Exception
688688
*/
689689
public function waitForDigit($timeout = -1)
@@ -700,6 +700,31 @@ public function waitForDigit($timeout = -1)
700700
return chr($result['result']);
701701
}
702702

703+
public function wait($sec)
704+
{
705+
return $this->exec('wait', $sec);
706+
}
707+
708+
/**
709+
* @param string $sound
710+
* @return null|string
711+
* @throws Exception
712+
*/
713+
public function background($sound)
714+
{
715+
$result = $this->exec('background', $sound);
716+
717+
if ($result['code'] != '200') {
718+
throw new Exception('Error while executing BACKGROUND cmd');
719+
}
720+
721+
if ($result['result'] == '0') {
722+
return null;
723+
}
724+
725+
return chr($result['result']);
726+
}
727+
703728
/**
704729
* Set absolute maximum time of call.
705730
*

0 commit comments

Comments
 (0)