diff --git a/src/SmscRuChannel.php b/src/SmscRuChannel.php index dcfd14f..a7bd3b7 100644 --- a/src/SmscRuChannel.php +++ b/src/SmscRuChannel.php @@ -75,6 +75,14 @@ protected function sendMessage($recipients, SmscRuMessage $message) $params['time'] = '0'.$message->sendAt->getTimestamp(); } + if ($message->call) { + $params['call'] = $message->call ? 1 : 0; + } + + if ($message->voice) { + $params['voice'] = $message->voice; + } + return $this->smsc->send($params); } } diff --git a/src/SmscRuMessage.php b/src/SmscRuMessage.php index a0c6153..8c98e9d 100644 --- a/src/SmscRuMessage.php +++ b/src/SmscRuMessage.php @@ -25,6 +25,28 @@ class SmscRuMessage */ public $sendAt; + /** + * Sign of a voice message. + * When forming a voice message, you can transfer both text and attach files. + * Files added to the message must be transferred using the POST method in the body of the http request. + * 0 (default) is a regular message. + * 1 - voice message. + * + * @var bool + */ + public $call; + + /** + * Voice used to read text (for voice messages only). + * m (default) - male voice. + * m2 is a male alternative voice. + * w is a female voice. + * w2 is a female alternative voice. + * + * @var string + */ + public $voice; + /** * Create a new message instance. * @@ -86,4 +108,32 @@ public function sendAt(\DateTimeInterface $sendAt = null) return $this; } + + /** + * Set the sign of a voice message. + * + * @param bool|null $call + * + * @return $this + */ + public function call($call = null) + { + $this->call = filter_var($call, FILTER_VALIDATE_BOOLEAN); + + return $this; + } + + /** + * Set the voice used to read text (for voice messages only). + * + * @param string $call + * + * @return $this + */ + public function voice($voice = null) + { + $this->voice = $voice; + + return $this; + } }