当前位置: 首页>>代码示例>>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;未经允许,请勿转载。