當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PhoneNumber::normalizePhoneNumberToE164方法代碼示例

本文整理匯總了PHP中PhoneNumber::normalizePhoneNumberToE164方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhoneNumber::normalizePhoneNumberToE164方法的具體用法?PHP PhoneNumber::normalizePhoneNumberToE164怎麽用?PHP PhoneNumber::normalizePhoneNumberToE164使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PhoneNumber的用法示例。


在下文中一共展示了PhoneNumber::normalizePhoneNumberToE164方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: send_message

 function send_message($from, $to, $message)
 {
     $from = PhoneNumber::normalizePhoneNumberToE164($from);
     $to = PhoneNumber::normalizePhoneNumberToE164($to);
     try {
         $account = OpenVBX::getAccount();
         $response = $account->messages->sendMessage($from, $to, $message);
     } catch (Exception $e) {
         throw new VBX_Sms_messageException($e->getMessage());
     }
     if (!in_array($response->status, array('sent', 'queued'))) {
         throw new VBX_Sms_messageException('SMS delivery failed. An unknown error occurred' . ' during delivery.');
     }
 }
開發者ID:tjoozey,項目名稱:openvbx,代碼行數:14,代碼來源:vbx_sms_message.php

示例2: send_message

 function send_message($from, $to, $message)
 {
     $from = PhoneNumber::normalizePhoneNumberToE164($from);
     $to = PhoneNumber::normalizePhoneNumberToE164($to);
     $twilio = new TwilioRestClient($this->twilio_sid, $this->twilio_token, $this->twilio_endpoint);
     error_log("Sending sms from {$from} to {$to} with content: {$message}");
     $response = $twilio->request("Accounts/{$this->twilio_sid}/SMS/Messages", 'POST', array("From" => $from, "To" => $to, "Body" => $message));
     $status = isset($response->ResponseXml) ? $response->ResponseXml->SMSMessage->Status : 'failed';
     if ($response->IsError || $status != 'sent' && $status != 'queued') {
         error_log("SMS not sent - Error Occurred");
         error_log($response->ErrorMessage);
         throw new VBX_Sms_messageException($response->ErrorMessage);
     }
 }
開發者ID:JeffaCubed,項目名稱:OpenVBX,代碼行數:14,代碼來源:vbx_sms_message.php

示例3: make_call_path

 function make_call_path($to, $callerid, $path, $rest_access)
 {
     $twilio = new TwilioRestClient($this->twilio_sid, $this->twilio_token);
     $recording_url = site_url("twiml/redirect/{$path}/{$rest_access}");
     $response = $twilio->request("Accounts/{$this->twilio_sid}/Calls", 'POST', array("Caller" => PhoneNumber::normalizePhoneNumberToE164($callerid), "Called" => PhoneNumber::normalizePhoneNumberToE164($to), "Url" => $recording_url));
     if ($response->IsError) {
         error_log($from);
         error_log(var_export($response, true));
         throw new VBX_CallException($response->ErrorMessage);
     }
 }
開發者ID:JeffaCubed,項目名稱:OpenVBX,代碼行數:11,代碼來源:vbx_call.php

示例4: make_call

 /**
  * Start an outbound call
  *
  * @param string $from - the user making the call, this is the device that'll be called first
  * @param string $to - the call destination
  * @param string $callerid - the number to use as the caller id
  * @param string $rest_access - token to authenticate the twiml request
  * @return void
  */
 public function make_call($from, $to, $callerid, $rest_access)
 {
     try {
         PhoneNumber::validatePhoneNumber($from);
         // handle being passed an email address for calls to browser clients
         if (!filter_var($to, FILTER_VALIDATE_EMAIL)) {
             PhoneNumber::validatePhoneNumber($to);
         }
     } catch (PhoneNumberException $e) {
         throw new VBX_CallException($e->getMessage());
     }
     // don't normalize email addresses that are used to identify browser clients
     if (!filter_var($to, FILTER_VALIDATE_EMAIL)) {
         $to = PhoneNumber::normalizePhoneNumberToE164($to);
     }
     $callerid = PhoneNumber::normalizePhoneNumberToE164($callerid);
     $from = PhoneNumber::normalizePhoneNumberToE164($from);
     $twiml_url = site_url("twiml/dial") . '?' . http_build_query(compact('callerid', 'to', 'rest_access'));
     try {
         $account = OpenVBX::getAccount();
         $account->calls->create($callerid, $from, $twiml_url);
     } catch (Exception $e) {
         throw new VBX_CallException($e->getMessage());
     }
 }
開發者ID:hharrysidhu,項目名稱:OpenVBX,代碼行數:34,代碼來源:vbx_call.php


注:本文中的PhoneNumber::normalizePhoneNumberToE164方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。