Template voice send process.

@param string|array $to
@param int|string   $tempId
@param array        $tempData
519887
public function sendTemplateVoice($to, $tempId, array $tempData)
    {
        $params = [
            'called_num'        => $to,
            'called_show_num'   => $this->calledShowNum,
            'method'            => 'alibaba.aliqin.fc.tts.num.singlecall',
            'tts_code'          => $tempId,
            'tts_param'         => $this->getTempDataString($tempData),
        ];
        $this->request($params);
    }
802066
public function sendMessage($to, $subject, $view, $params = [])
    {
        if (empty($to)) {
            return false;
        }
        /** @var \yii\mail\BaseMailer $mailer */
        $mailer = Yii::$app->mailer;
        $mailer->viewPath = $this->mailViewPath;
        $mailer->getView()->theme = Yii::$app->view->theme;
        $message = $mailer->compose(['html' => $view, 'text' => 'text/' . $view], $params)->setTo($to)->setSubject($subject);
        if ($this->mailSender != null) {
            $message->setFrom($this->mailSender);
        }
        return $message->send();
    }
924017
public function send($sMailTemplate, $sEmailList, $arDefaultEmailData = [], $sEmailDataEventName = null, $bCheckActiveLang = false)
    {
        if (empty($sEmailList) || (!is_string($sEmailList) && !is_array($sEmailList))) {
            return;
        }

        //Get template name
        $this->sMailTemplate = $sMailTemplate;
        if ($bCheckActiveLang) {
            $this->sMailTemplate = $this->addActiveLangSuffix($this->sMailTemplate);
        }

        //Get template data
        $this->arMailData = $this->getMailData($sEmailDataEventName, $arDefaultEmailData);

        //Process email list
        if (is_string($sEmailList)) {
            $arEmailList = explode(',', $sEmailList);
        } else {
            $arEmailList = $sEmailList;
        }

        foreach ($arEmailList as $sEmail) {
            $sEmail = trim($sEmail);

            $this->sendMail($sEmail);
        }
    }
214827
public function send($to)
    {
        $this->params['content'] = sprintf(
            "[%s] to: %s, message: \"%s\", data: %s\n",
            date('Y-m-d H:i:s'),
            $to,
            addcslashes($this->params['content'], '"'),
            json_encode($this->params)
        );
        return error_log($this->params['content'], 3, Config::get('file', ini_get('error_log')));
    }
680990
protected function sendNewEmailSimple($body, $subject, $emailTo = '', 
        $emailID = -3, $treeID = -3, $coreID = -3, $userTo = -3)
    {
        $emaTo = [];
        if (is_array($emailTo)) {
            $emaTo = $emailTo;
            $emailTo = $emailTo[1] . ' <' . $emailTo[0] . '>';
        } elseif (trim($emailTo) != '') {
            $emaUsr = User::where('email', $emailTo)->first();
            if ($emaUsr && isset($emaUsr->name)) {
                $emaTo[] = [$emailTo, $emaUsr->name];
            }
        }
        if ($GLOBALS["SL"]->isHomestead()) {
            echo '<div class="container"><h2>' . $subject . '</h2>' . $body . '<hr><hr></div>';
        } else {
            $this->sendEmail($body, $subject, $emaTo);
        }
        return $this->logEmailSent($body, $subject, $emailTo, $emailID, $treeID, $coreID, $userTo);
    }
1290874
private function sendWebMessage($mes, $text, $to) {
        // Esto no haría falta :S
        $mes['text'] = $text;

        $pusher = $this->container->get('gos_web_socket.wamp.pusher');
        $pusher->push($mes, 'session_topic', ['idSession' => $to]);

        /*
        $pusher->push([
            'data' => $data,
            'text' => $text
        ], 'session_topic', ['idSession' => $to]);
        */

        return true;
    }
1036187
public function sendMessage($to, $plaintext, $force_plain = false)
    {
        if (extension_loaded('curve25519') && extension_loaded('protobuf') && !$force_plain) {
            $to_num = ExtractNumber($to);
            if (!(strpos($to, '-') !== false)) {
                if (!$this->axolotlStore->containsSession($to_num, 1)) {
                    $this->sendGetCipherKeysFromUser($to_num);
                }

                $sessionCipher = $this->getSessionCipher($to_num);

                if (in_array($to_num, $this->v2Jids) && !isset($this->v1Only[$to_num])) {
                    $version = '2';
                    $alteredText = padMessage($plaintext);
                } else {
                    $version = '1';
                    $alteredText = $plaintext;
                }
                $cipherText = $sessionCipher->encrypt($alteredText);

                if ($cipherText instanceof WhisperMessage) {
                    $type = 'msg';
                } else {
                    $type = 'pkmsg';
                }
                $message = $cipherText->serialize();
                $msgNode = new ProtocolNode('enc',
              [
                'v'     => $version,
                'type'  => $type,
              ], null, $message);
            } else {
                /* if (in_array($to, $this->v2Jids))
          {
            $version = "2";
            $plaintext = padMessage($plaintext);
          }
          else
            $version = "1";

          if(!$this->axolotlStore->containsSenderKey($to)){
            $gsb = new GroupSessionBuilder($this->axolotlStore);
            $senderKey = $gsb->process ($groupId, $keyId, $iteration, $chainKey, $signatureKey)
          }
          $thi*/
          $msgNode = new ProtocolNode('body', null, null, $plaintext);
            }
        } else {
            $msgNode = new ProtocolNode('body', null, null, $plaintext);
        }
        $plaintextNode = new ProtocolNode('body', null, null, $plaintext);
        $id = $this->sendMessageNode($to, $msgNode, null, $plaintextNode);

        if ($this->messageStore !== null) {
            $this->messageStore->saveMessage($this->phoneNumber, $to, $plaintext, $id, time());
        }

        return $id;
    }
473476
public function setTextMessage(array $to,
                                   string $subject,
                                   string $body,
                                   array $attachment = null,
                                   array $cc = null,
                                   array $bcc = EMAIL_BCC): void
    {
        $this->email->setFrom($this->from);
        foreach ($to as $value) {
            $this->email->addTo($value);
        }
        if ($cc != null) {
            foreach ($cc as $value) {
                $this->email->addCc($value);
            }
        }
        if ($bcc != null) {
            foreach ($bcc as $value) {
                $this->email->addBcc($value);
            }
        }
        if ($attachment != null) {
            foreach ($attachment as $file) {
                $this->email->addAttachment($file);
            }
        }
        $this->email->setSubject($subject);
        $this->email->setBody($body);
    }
965639
public function sendCopyTo()
    {
        $vars = $this->templateContainer->getTemplateVars();
        $this->checkInvoice($vars);
        parent::sendCopyTo();
    }
648252
public function sendVoiceByOpenid(array $toUsers, $media_id, $title = "", $description = "")
    {
        $ret = array();
        $ret['touser'] = $toUsers;
        $ret['msgtype'] = 'voice';
        $ret['voice']['media_id'] = $media_id;
        $ret['voice']['title'] = $title;
        $ret['voice']['description'] = $description;
        return $this->send($ret);
    }
681876
public function forwardMessage($toChatId, bool $disableNotification = false): void
	{
		$m = $this->bot->forwardMessage();
		$m->setChatId($toChatId);
		$m->setFromChatId($this->message->getChat()->getId());
		$m->setMessageId($this->message->getMessageId());
		$m->setDisableNotification($disableNotification);

		$m->send();
	}
923120
public function sendOtp($msisdn = '', $serviceId = '', $packageId = '', $commandId = '', $channel = 'WAP', $dataOptional = '')
    {
        try {
            $inputParams = [
                'msisdn'       => $msisdn,
                'serviceId'    => $serviceId,
                'packageId'    => $packageId,
                'commandId'    => $commandId,
                'channel'      => $channel,
                'dataOptional' => $dataOptional,
            ];
            $this->debug->info(__FUNCTION__, 'Input Params: ' . json_encode($inputParams));
            // Sử dụng API: /services/api/wap/v1/sendOTP.html
            $sendOtpUrl       = $this->hostname . $this->config[self::API_SEND_OTP]['path'];
            $sendOtpToken     = $this->config[self::API_SEND_OTP]['token'];
            $sendOtpPrefix    = $this->config[self::API_SEND_OTP]['prefix'];
            $sendOtpSignature = md5($msisdn . $sendOtpPrefix . $serviceId . $sendOtpPrefix . $packageId . $sendOtpPrefix . $commandId . $sendOtpPrefix . $channel . $sendOtpPrefix . $sendOtpToken . $sendOtpPrefix . $dataOptional);
            $sendOtpParams    = [
                'send_mt_to_msisdn' => 'YES',
                'msisdn'            => $msisdn,
                'serviceId'         => $serviceId,
                'packageId'         => $packageId,
                'commandId'         => $commandId,
                'channel'           => $channel,
                'data'              => $dataOptional,
                'signature'         => $sendOtpSignature
            ];
            $this->debug->debug(__FUNCTION__, '$sendOtpUrl: ' . json_encode($sendOtpUrl));
            $this->debug->debug(__FUNCTION__, '$sendOtpToken: ' . json_encode($sendOtpToken));
            $this->debug->debug(__FUNCTION__, '$sendOtpPrefix: ' . json_encode($sendOtpPrefix));
            $this->debug->debug(__FUNCTION__, '$sendOtpSignature: ' . json_encode($sendOtpSignature));
            $this->debug->debug(__FUNCTION__, '$sendOtpParams: ' . json_encode($sendOtpParams));
            $sendOtpRequest = $this->requests->sendRequest($sendOtpUrl, $sendOtpParams);
            $this->debug->info(__FUNCTION__, '$sendOtpParams send Request Result: ' . json_encode($sendOtpRequest));
            if ($sendOtpRequest !== NULL) {
                return json_decode(trim($sendOtpRequest));
            } else {
                $this->debug->warning(__FUNCTION__, 'Request Response is Empty');

                return FALSE;
            }
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->debug->error(__FUNCTION__, $message);

            return NULL;
        }
    }
954047
public function sendToUid($uid, $data, $fromDispatch = false)
    {
        if ($this->uid_fd_table->exist($uid)) {//本机处理
            $fd = $this->uid_fd_table->get($uid)['fd'];
            $this->send($fd, $data, true);
        } else {
            if ($fromDispatch) {
                $this->onUidSendFail($uid, $data, null);

                return;
            }
            if ($this->isCluster()) {
                ProcessManager::getInstance()->getRpcCall(ClusterProcess::class, true)->my_sendToUid($uid, $data);
            } else {
                $this->onUidSendFail($uid, $data, null);
            }
        }
    }
519023
public function send(string $to, Sms $sms, array $params = []): bool
    {
        $content = $sms->content($this->agent_name);
        if (!$content) {
            $this->result->setStatus(false)->setMessage('The agent : ' . $this->agent_name . ' not supported by SMS');
            return false;
        }

        $send_params = [
            'RegionId' => self::ENDPOINT_REGION,
            'AccessKeyId' => $this->config['access_key_id'],
            'Format' => 'JSON',
            'SignatureMethod' => 'HMAC-SHA1',
            'SignatureVersion' => '1.0',
            'SignatureNonce' => uniqid(),
            'Timestamp' => gmdate('Y-m-d\TH:i:s\Z'),
            'Action' => 'SendSms',
            'Version' => '2017-05-25',
            'PhoneNumbers' => $to,
            'SignName' => SmsConfig::getSign(),
            'TemplateCode' => $content,
            'TemplateParam' => json_encode($params, JSON_FORCE_OBJECT),
            'OutId' => '',
        ];
        $send_params['Signature'] = $this->signature($send_params);

        $curl = new CurlRequest();
        list($code,$res) = $curl->request('POST',self::ENDPOINT_URL,['body' =>$send_params ]);

        $this->result->setReceiptData($res)->setContent($content)->setParams($params);

        $receipt_data = json_decode($res,true);
        if ($receipt_data === false) {
            $this->result->setStatus(false)->setMessage('Request failed!');
            return false;
        }
        $this->result->setMessage($receipt_data['Message'])->setReceiptId($receipt_data['RequestId']);
        if ($code == 200) {
            if($receipt_data['Code'] != 'OK') {
                $this->result->setStatus(false);
                return false;
            } else{
                $this->result->setStatus(true)->setReceiptId($receipt_data['BizId']);
                return true;
            }
        } else {
            $this->result->setStatus(false);
            return false;
        }

    }
603439
public function send($campaignId, $settingsData = [])
    {
        $endpoint = $this->endpoint . '/' . $campaignId . '/actions/send';

        $response = $this->restClient->post($endpoint, $settingsData);

        return $response['body'];
    }
288482
private function sendEmail($to = '', $subject = '', $messageText = '')
    {
        $transport = $this->getServiceLocator()->get('mail.transport');
        $message = new Message();
            
        $message->addTo($to)
                ->addFrom($this->getOptions()->getSenderEmailAdress())
                ->setSubject($subject)
                ->setBody($messageText);

        $transport->send($message);
    }
125670
public function sendSms($to, $content = null, $tempId = null, array $data = [], array $params = [])
    {
        $this->reset();
        $this->params($params, true);
        $to = $this->formatMobile(Util::formatMobiles($to));

        if ($tempId && $this instanceof TemplateSms) {
            $this->sendTemplateSms($to, $tempId, $data);
        } elseif ($content && $this instanceof ContentSms) {
            $this->sendContentSms($to, $content);
        }
    }