Skip to content

Commit

Permalink
Set redirect extra options, add new support languages
Browse files Browse the repository at this point in the history
  • Loading branch information
2m3j committed Sep 14, 2022
1 parent 23badf5 commit b8184d1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/Webhook/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Request

public static function getSupportedLanguages()
{
return ['ru', 'ua', 'en', 'es', 'pl'];
return ['ru', 'ua', 'en', 'es', 'pl', 'fr', 'de'];
}

public function setIvrPlay($id)
Expand Down Expand Up @@ -49,10 +49,17 @@ public function setWaitDtmf($timeout, $attempts, $maxdigits, $name, $default)
return $this;
}

public function setRedirect($redirect, $returnTimeout)
public function setRedirect($redirect, $returnTimeout, array $extraOptions = [])
{
$this->data['redirect'] = $redirect;
$this->data['return_timeout'] = (int)$returnTimeout;
if (!empty($extraOptions['rewrite_forward_number'])) {
$number = (string)$extraOptions['rewrite_forward_number'];
if (!preg_match('/^(\+*\d{5,})$/', $number)) {
throw new \BadMethodCallException("Wrong 'rewrite_forward_number' extra option value.");
}
$this->data['rewrite_forward_number'] = $number;
}
return $this;
}

Expand Down

0 comments on commit b8184d1

Please sign in to comment.