Skip to content

Commit

Permalink
Add wait, background methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Kasatkin committed Jan 24, 2017
1 parent 7ec551e commit b0c3a29
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/AGI/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ public function verbose($message, $level = 1)
*
* @link http://www.voip-info.org/wiki-wait+for+digit
* @param integer $timeout in millisecons. Use -1 for the timeout value if you want the call to wait indefinitely.
* @return int Digit received
* @return null|string Digit received
* @throws Exception
*/
public function waitForDigit($timeout = -1)
Expand All @@ -700,6 +700,31 @@ public function waitForDigit($timeout = -1)
return chr($result['result']);
}

public function wait($sec)
{
return $this->exec('wait', $sec);
}

/**
* @param string $sound
* @return null|string
* @throws Exception
*/
public function background($sound)
{
$result = $this->exec('background', $sound);

if ($result['code'] != '200') {
throw new Exception('Error while executing BACKGROUND cmd');
}

if ($result['result'] == '0') {
return null;
}

return chr($result['result']);
}

/**
* Set absolute maximum time of call.
*
Expand Down

0 comments on commit b0c3a29

Please sign in to comment.