Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/SmscRuChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
50 changes: 50 additions & 0 deletions src/SmscRuMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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;
}
}