本文整理匯總了PHP中setsmsdeliverystatus函數的典型用法代碼示例。如果您正苦於以下問題:PHP setsmsdeliverystatus函數的具體用法?PHP setsmsdeliverystatus怎麽用?PHP setsmsdeliverystatus使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了setsmsdeliverystatus函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: infobip_hook_getsmsstatus
function infobip_hook_getsmsstatus($gpid = 0, $uid = "", $smslog_id = "", $p_datetime = "", $p_update = "")
{
global $plugin_config;
list($c_sms_credit, $c_sms_status) = infobip_getsmsstatus($smslog_id);
// pending
$p_status = 0;
if ($c_sms_status) {
$p_status = $c_sms_status;
}
setsmsdeliverystatus($smslog_id, $uid, $p_status);
}
示例2: messagemedia_hook_sendsms
function messagemedia_hook_sendsms($mobile_sender, $sms_sender, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $messagemedia_param;
global $gateway_number;
// Message media
require_once "SmsInterface.inc";
//logger_print("Messagemedia: Message sent to".$sms_to);
logger_print($messagemedia_param['username']);
logger_print($messagemedia_param['password']);
$si = new SmsInterface(false, false);
/*
$si->addMessage (
$phone, // String
$messageText, // String
$messageID, // Integer, optional, default = 0
$delay, // Integer, optional, default = 0
$validityPeriod, // Integer, optional, default = 169
$deliveryReport // Boolean, optional, default = false
);
*/
$si->addMessage($sms_to, $sms_msg, $smslog_id, 0, 169, true);
$ok = false;
// failed
$p_status = 2;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
// API ID = SMS log ID - No return ID by Message Media, ID is provided by PlaySMS
$apimsgid = $smslog_id;
messagemedia_setsmsapimsgid($smslog_id, $apimsgid);
if (!$si->connect($messagemedia_param['username'], $messagemedia_param['password'], true, false)) {
//echo "failed. Could not contact server.\n";
logger_print("Messagemedia: failed. Could not contact server.");
} elseif (!$si->sendMessages()) {
//echo "failed. Could not send message to server.\n";
logger_print("Messagemedia: failed. Could not send message to server.");
if ($si->getResponseMessage() !== NULL) {
//echo "<BR>Reason: " . $si->getResponseMessage () . "\n";
logger_print("Messagemedia: Reason: " . $si->getResponseMessage());
}
} else {
//echo "OK.\n";
logger_print("Messagemedia: OK. sent");
// sent
$p_status = 1;
$ok = true;
}
logger_print("smslog_id:" . $smslog_id . " charge:" . $c_sms_credit . " sms_status:" . $p_status . " response:" . $response[0] . " " . $response[1], 3, "messagemedia outgoing");
setsmsdeliverystatus($smslog_id, $uid, $p_status);
return $ok;
}
示例3: dlrd
function dlrd()
{
global $core_config;
$core_config['dlrd_limit'] = (int) $core_config['dlrd_limit'] ? (int) $core_config['dlrd_limit'] : 200;
$list = dba_search(_DB_PREF_ . '_tblDLR', '*', array('flag_processed' => 1), '', array('LIMIT' => $core_config['dlrd_limit']));
$j = 0;
for ($j = 0; $j < count($list); $j++) {
if ($id = $list[$j]['id']) {
$smslog_id = $list[$j]['smslog_id'];
$p_status = $list[$j]['p_status'];
$uid = $list[$j]['uid'];
if (dba_update(_DB_PREF_ . '_tblDLR', array('flag_processed' => 2), array('id' => $id))) {
logger_print("id:" . $id . " smslog_id:" . $smslog_id . " p_status:" . $p_status . " uid:" . $uid, 3, "dlrd");
setsmsdeliverystatus($smslog_id, $uid, $p_status);
}
}
}
}
示例4: gnokii_hook_getsmsstatus
function gnokii_hook_getsmsstatus($gpid = 0, $uid = "", $smslog_id = "", $p_datetime = "", $p_update = "")
{
global $gnokii_param;
// p_status :
// 0 = pending
// 1 = delivered
// 2 = failed
if ($gpid) {
$fn = $gnokii_param['path'] . "/out.{$gpid}.{$uid}.{$smslog_id}";
$efn = $gnokii_param['path'] . "/ERR.out.{$gpid}.{$uid}.{$smslog_id}";
} else {
$fn = $gnokii_param['path'] . "/out.0.{$uid}.{$smslog_id}";
$efn = $gnokii_param['path'] . "/ERR.out.0.{$uid}.{$smslog_id}";
}
// set delivered first
$p_status = 1;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
// and then check if its not delivered
if (file_exists($fn)) {
$p_datetime_stamp = strtotime($p_datetime);
$p_update_stamp = strtotime($p_update);
$p_delay = floor(($p_update_stamp - $p_datetime_stamp) / 86400);
// set pending if its under 2 days
if ($p_delay <= 2) {
$p_status = 0;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
} else {
$p_status = 2;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
@unlink($fn);
@unlink($efn);
}
return;
}
// set if its failed
if (file_exists($efn)) {
$p_status = 2;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
@unlink($fn);
@unlink($efn);
return;
}
return;
}
示例5: gw_send_sms
function gw_send_sms($mobile_sender, $sms_sender, $sms_to, $sms_msg, $gp_code = "", $uid = "", $smslog_id = "", $flash = false)
{
global $kannel_param;
global $gateway_number;
$ok = false;
if ($gateway_number) {
$sms_from = $gateway_number;
} else {
$sms_from = $mobile_sender;
}
if ($sms_sender) {
$sms_msg = $sms_msg . $sms_sender;
}
// set failed first
$p_status = 2;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
$sms_type = 2;
// text
if ($flash) {
$sms_type = 1;
//flash
}
$URL = "/cgi-bin/sendsms?username=" . urlencode($kannel_param['username']) . "&password=" . urlencode($kannel_param['password']);
$URL .= "&from=" . urlencode($sms_from) . "&to=" . urlencode($sms_to) . "&text=" . urlencode($sms_msg);
$URL .= "&dlr-mask=31&dlr-url=" . urlencode($kannel_param['phpgwsms_web'] . "/plugin/gateway/kannel/dlr.php?type=%d&slid={$smslog_id}&uid={$uid}");
$URL .= "&mclass={$sms_type}";
$connection = fsockopen($kannel_param['bearerbox_host'], $kannel_param['sendsms_port'], &$error_number, &$error_description, 60);
if ($connection) {
socket_set_blocking($connection, false);
fputs($connection, "GET {$URL} HTTP/1.0\r\n\r\n");
while (!feof($connection)) {
$myline = fgets($connection, 128);
if ($myline == "Sent.") {
$ok = true;
// set pending
$p_status = 0;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
}
}
}
fclose($connection);
return $ok;
}
示例6: smstools_hook_getsmsstatus
function smstools_hook_getsmsstatus($gpid = 0, $uid = "", $smslog_id = "", $p_datetime = "", $p_update = "")
{
global $smstools_param;
// p_status :
// 0 = pending
// 1 = sent/delivered
// 2 = failed
if ($gpid) {
$fn = $smstools_param['path'] . "/sent/out.{$gpid}.{$uid}.{$smslog_id}";
$efn = $smstools_param['path'] . "/failed/out.{$gpid}.{$uid}.{$smslog_id}";
} else {
$fn = $smstools_param['path'] . "/sent/out.0.{$uid}.{$smslog_id}";
$efn = $smstools_param['path'] . "/failed/out.0.{$uid}.{$smslog_id}";
}
$p_datetime_stamp = strtotime($p_datetime);
$p_update_stamp = strtotime($p_update);
$p_delay = floor(($p_update_stamp - $p_datetime_stamp) / 86400);
// set pending first
$p_status = 0;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
// set failed if its at least 2 days old
if ($p_delay >= 2) {
$p_status = 2;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
}
// set if its sent/delivered
if (file_exists($fn)) {
$p_status = 1;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
}
// set if its failed
if (file_exists($efn)) {
$p_status = 2;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
}
@unlink($fn);
@unlink($efn);
return;
}
示例7: gw_set_delivery_status
function gw_set_delivery_status($gp_code = "", $uid = "", $smslog_id = "", $p_datetime = "", $p_update = "")
{
global $gnokii_param;
if ($gp_code) {
$fn = "{$gnokii_param['path']}/cache/smsd/out.{$gp_code}.{$uid}.{$smslog_id}";
$efn = "{$gnokii_param['path']}/cache/smsd/ERR.out.{$gp_code}.{$uid}.{$smslog_id}";
} else {
$fn = "{$gnokii_param['path']}/cache/smsd/out.PV.{$uid}.{$smslog_id}";
$efn = "{$gnokii_param['path']}/cache/smsd/ERR.out.PV.{$uid}.{$smslog_id}";
}
// set delivered first
setsmsdeliverystatus($smslog_id, $uid, DLR_SENT);
// and then check if its not delivered
if (file_exists($fn)) {
$p_datetime_stamp = strtotime($p_datetime);
$p_update_stamp = strtotime($p_update);
$p_delay = floor(($p_update_stamp - $p_datetime_stamp) / 86400);
// set pending if its under 2 days
if ($p_delay <= 2) {
setsmsdeliverystatus($smslog_id, $uid, DLR_PENDING);
} else {
setsmsdeliverystatus($smslog_id, $uid, DLR_FAILED);
@unlink($fn);
@unlink($efn);
}
return;
}
// set if its failed
if (file_exists($efn)) {
setsmsdeliverystatus($smslog_id, $uid, DLR_FAILED);
@unlink($fn);
@unlink($efn);
return;
}
return;
}
示例8: gammu_hook_getsmsstatus
function gammu_hook_getsmsstatus($gpid = 0, $uid = "", $smslog_id = "", $p_datetime = "", $p_update = "")
{
global $gammu_param;
// p_status :
// 0 = pending
// 1 = sent/delivered
// 2 = failed
// OUT<priority><date>_<time>_<serialno>_<phone_number>_<anything>.<ext><options>
// $fn = 'A'.$date.'_'.$time.'_00_'.$sms_to.'_'.$smslog_id.'10001'.$uid.'10001'.$gpid.'.txtd';
$sms_id = $smslog_id . '10001' . $uid . '10001' . $gpid;
// sent dir
$dir[0] = $gammu_param['path'] . '/sent/';
// error dir
$dir[1] = $gammu_param['path'] . '/error/';
// list all files in sent and error dir
$fn = array();
for ($i = 0; $i < count($dir); $i++) {
$j = 0;
if ($handle = @opendir($dir[$i])) {
while ($file = @readdir($handle)) {
if ($file != "." && $file != "..") {
$fn[$i][$j] = $file;
$j++;
}
}
@closedir($handle);
}
}
// check listed files above againts sms_id
$the_fn = '';
for ($i = 0; $i < count($dir); $i++) {
for ($j = 0; $j < count($fn[$i]); $j++) {
if (preg_match("/" . $sms_id . "/", $fn[$i][$j])) {
$the_fn = $dir[$i] . $fn[$i][$j];
if ($i == 0) {
// sms sent
$p_status = 1;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
} else {
if ($i == 1) {
// failed to sent sms
$p_status = 2;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
}
}
break;
}
}
}
// if file not found
if (!file_exists($the_fn)) {
$p_datetime_stamp = strtotime($p_datetime);
$p_update_stamp = strtotime($p_update);
$p_delay = floor(($p_update_stamp - $p_datetime_stamp) / 86400);
// set failed if its at least 2 days old
if ($p_delay >= 2) {
$p_status = 2;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
}
} else {
// delete the file if exists
logger_print("smslog_id:" . $smslog_id . " unlink the_fn:" . $the_fn . " p_status:" . $p_status, 3, "gammu getsmsstatus");
@unlink($the_fn);
}
return;
}
示例9: smstools_hook_sendsms
function smstools_hook_sendsms($sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $smstools_param;
$sms_id = "{$gpid}.{$uid}.{$smslog_id}";
if (empty($sms_id)) {
$sms_id = mktime();
}
if ($sms_footer) {
$sms_msg = $sms_msg . $sms_footer;
}
$the_msg = "From: {$sms_sender}\n";
$the_msg .= "To: {$sms_to}\n";
$the_msg .= "Report: yes\n";
if ($msg_type == "flash") {
$the_msg .= "Flash: yes\n";
}
if ($unicode) {
if (function_exists('mb_convert_encoding')) {
$the_msg .= "Alphabet: UCS\n";
$sms_msg = mb_convert_encoding($sms_msg, "UCS-2BE", "auto");
}
// $sms_msg = str2hex($sms_msg);
}
$the_msg .= "\n{$sms_msg}";
$fn = $smstools_param['path'] . "/outgoing/out.{$sms_id}";
logger_print("outfile:" . $fn, 3, "smstools outgoing");
umask(0);
$fd = @fopen($fn, "w+");
@fputs($fd, $the_msg);
@fclose($fd);
$ok = false;
if (file_exists($fn)) {
$ok = true;
$p_status = 0;
logger_print("outfile:" . $fn . " saved", 3, "smstools outgoing");
} else {
$p_status = 2;
logger_print("cannot save outfile:" . $fn, 3, "smstools outgoing");
}
setsmsdeliverystatus($smslog_id, $uid, $p_status);
return $ok;
}
示例10: msgtoolbox_hook_sendsms
function msgtoolbox_hook_sendsms($sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
// global $msgtoolbox_param; // global all variables needed, eg: varibles from config.php
// ...
// ...
// return true or false
// return $ok;
global $msgtoolbox_param;
$ok = false;
if ($sms_footer) {
$sms_msg = $sms_msg . $sms_footer;
}
/* not used
$sms_type = 2; // text
if ($msg_type=="flash") {
$sms_type = 1; // flash
}
*/
if ($sms_to && $sms_msg) {
if ($unicode) {
if (function_exists('mb_convert_encoding')) {
// $sms_msg = mb_convert_encoding($sms_msg, "UCS-2BE", "auto");
$sms_msg = mb_convert_encoding($sms_msg, "UCS-2", "auto");
$unicode = "&coding=unicode";
// added at the of query string if unicode
}
}
// fixme anton - from playSMS v0.9.5.1 references to input.php replaced with index.php?app=webservices
// I should add autodetect, if its below v0.9.5.1 should use input.php
$query_string = "username=" . $msgtoolbox_param['username'] . "&password=" . $msgtoolbox_param['password'] . "&to=" . urlencode($sms_to) . "&from=" . urlencode($sms_from) . "&message=" . urlencode($sms_msg) . $unicode . "&route=" . $msgtoolbox_param['route'];
$url = $msgtoolbox_param['url'] . "?" . $query_string;
/* not used
if ($additional_param = $msgtoolbox_param['additional_param']) {
$additional_param = "&".$additional_param;
}
$url .= $additional_param;
$url = str_replace("&&", "&", $url);
*/
logger_print($url, 3, "msgtoolbox outgoing");
$fd = @implode('', file($url));
if ($fd) {
$response = split(",", $fd);
if (trim($response[0]) == "1") {
$remote_slid = trim($response[1]);
if ($remote_slid) {
// this is for callback, if callback not used then the status would be sent or failed only
// local_slid is local SMS log id (local smslog_id)
// remote_slid is remote SMS log id (in API doc its referred to smsid or messageid)
// status=10 delivered to gateway
$db_query = "\n\t\t\t\t\t\tINSERT INTO " . _DB_PREF_ . "_gatewayMsgtoolbox (local_slid,remote_slid,status)\n\t\t\t\t\t\tVALUES ('{$smslog_id}','{$remote_slid}','10')\n\t\t\t\t\t ";
$id = @dba_insert_id($db_query);
if ($id) {
$ok = true;
$p_status = 1;
// sms sent
setsmsdeliverystatus($smslog_id, $uid, $p_status);
}
}
}
logger_print("sent smslog_id:" . $smslog_id . " response:" . $fd, 3, "msgtoolbox outgoing");
} else {
// even when the response is not what we expected we still print it out for debug purposes
$fd = str_replace("\n", " ", $fd);
$fd = str_replace("\r", " ", $fd);
logger_print("failed smslog_id:" . $smslog_id . " response:" . $fd, 3, "msgtoolbox outgoing");
}
}
if (!$ok) {
$p_status = 2;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
}
return $ok;
}
示例11: gw_set_delivery_status
function gw_set_delivery_status($gp_code = "", $uid = "", $smslog_id = "", $p_datetime = "", $p_update = "")
{
// global $uplink_param;
// p_status :
// 0 = pending
// 1 = delivered
// 2 = failed
// setsmsdeliverystatus($smslog_id,$uid,$p_status);
global $uplink_param;
$db_query = "SELECT * FROM phpgw_sms_gwmodUplink WHERE up_status='0' AND up_local_slid='{$smslog_id}'";
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
$local_slid = $db_row[up_local_slid];
$remote_slid = $db_row[up_remote_slid];
$query_string = "ws.php?u=" . $uplink_param[username] . "&p=" . $uplink_param[password] . "&ta=ds&slid=" . $remote_slid;
$url = $uplink_param[master] . "/" . $query_string;
$response = @implode('', file($url));
switch ($response) {
case "1":
$p_status = 1;
setsmsdeliverystatus($local_slid, $uid, $p_status);
$db_query1 = "UPDATE phpgw_sms_gwmodUplink SET up_status='1' WHERE up_remote_slid='{$remote_slid}'";
$db_result1 = dba_query($db_query1);
break;
case "2":
case "ERR 400":
$p_status = 2;
setsmsdeliverystatus($local_slid, $uid, $p_status);
$db_query1 = "UPDATE phpgw_sms_gwmodUplink SET up_status='2' WHERE up_remote_slid='{$remote_slid}'";
$db_result1 = dba_query($db_query1);
break;
}
}
}
示例12: gw_send_sms
function gw_send_sms($mobile_sender, $sms_to, $sms_msg, $gp_code = "", $uid = "", $smslog_id = "", $msg_type = "text", $unicode = "0")
{
global $clktl_param;
global $gateway_number;
if ($gateway_number) {
$sms_from = $gateway_number;
} else {
$sms_from = $mobile_sender;
}
switch ($msg_type) {
case "flash":
$sms_type = "SMS_FLASH";
break;
case "logo":
$sms_type = "SMS_NOKIA_OLOGO";
break;
case "picture":
$sms_type = "SMS_NOKIA_PICTURE";
break;
case "ringtone":
case "rtttl":
$sms_type = "SMS_NOKIA_RTTTL";
break;
case "text":
default:
$sms_type = "SMS_TEXT";
}
// $query_string = "sendmsg?api_id=".$clktl_param[api_id]."&user=".$clktl_param[username]."&password=".$clktl_param[password]."&to=$sms_to&msg_type=$sms_type&text=".rawurlencode($sms_msg)."&deliv_ack=1&callback=3&unicode=$unicode&concat=3&from=".rawurlencode($sms_from);
// no concat
if ($unicode) {
$sms_msg = utf8_to_unicode($sms_msg);
$query_string = "sendmsg?api_id=" . $clktl_param[api_id] . "&user=" . $clktl_param[username] . "&password=" . $clktl_param[password] . "&to={$sms_to}&msg_type={$sms_type}&text={$sms_msg}&deliv_ack=1&callback=3&unicode={$unicode}&from=" . rawurlencode($sms_from);
} else {
$query_string = "sendmsg?api_id=" . $clktl_param[api_id] . "&user=" . $clktl_param[username] . "&password=" . $clktl_param[password] . "&to={$sms_to}&msg_type={$sms_type}&text=" . rawurlencode($sms_msg) . "&deliv_ack=1&callback=3&unicode={$unicode}&from=" . rawurlencode($sms_from);
}
$url = $clktl_param[send_url] . "/" . $query_string;
$fd = file($url);
$ok = false;
$p_status = DLR_FAILED;
if ($fd) {
$response = split(":", $fd);
$err_code = trim($response[1]);
if (strtoupper($response[0]) == "ID") {
if ($apimsgid = trim($response[1])) {
clktl_setsmsapimsgid($smslog_id, $apimsgid);
list($c_sms_credit, $c_sms_status) = clktl_getsmsstatus($smslog_id);
if ($c_sms_status) {
$p_status = $c_sms_status;
} else {
$p_status = DLR_PENDING;
}
} else {
$p_status = DLR_SENT;
}
}
$ok = true;
}
setsmsdeliverystatus($smslog_id, $uid, $p_status);
return $ok;
}
示例13: uplink_hook_getsmsstatus
function uplink_hook_getsmsstatus($gpid = 0, $uid = "", $smslog_id = "", $p_datetime = "", $p_update = "")
{
// global $uplink_param;
// p_status :
// 0 = pending
// 1 = delivered
// 2 = failed
// setsmsdeliverystatus($smslog_id,$uid,$p_status);
global $uplink_param;
$db_query = "SELECT * FROM " . _DB_PREF_ . "_gatewayUplink WHERE up_local_slid='{$smslog_id}'";
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
$local_slid = $db_row['up_local_slid'];
$remote_slid = $db_row['up_remote_slid'];
// fixme anton - from playSMS v0.9.6 references to input.php replaced with index.php?app=webservices
// I should add autodetect, if its below v0.9.6 should use input.php
$query_string = "index.php?app=webservices&u=" . $uplink_param['username'] . "&p=" . $uplink_param['password'] . "&ta=ds&slid=" . $remote_slid;
$url = $uplink_param['master'] . "/" . $query_string;
$response = @implode('', file($url));
switch ($response) {
case "1":
$p_status = 1;
setsmsdeliverystatus($local_slid, $uid, $p_status);
$db_query1 = "UPDATE " . _DB_PREF_ . "_gatewayUplink SET c_timestamp='" . mktime() . "',up_status='1' WHERE up_remote_slid='{$remote_slid}'";
$db_result1 = dba_query($db_query1);
break;
case "3":
$p_status = 3;
setsmsdeliverystatus($local_slid, $uid, $p_status);
$db_query1 = "UPDATE " . _DB_PREF_ . "_gatewayUplink SET c_timestamp='" . mktime() . "',up_status='3' WHERE up_remote_slid='{$remote_slid}'";
$db_result1 = dba_query($db_query1);
break;
case "2":
case "ERR 400":
$p_status = 2;
setsmsdeliverystatus($local_slid, $uid, $p_status);
$db_query1 = "UPDATE " . _DB_PREF_ . "_gatewayUplink SET c_timestamp='" . mktime() . "',up_status='2' WHERE up_remote_slid='{$remote_slid}'";
$db_result1 = dba_query($db_query1);
break;
}
}
}
示例14: clickatell_hook_sendsms
function clickatell_hook_sendsms($mobile_sender, $sms_sender, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $clickatell_param;
global $gateway_number;
if ($clickatell_param['sender']) {
$sms_from = $clickatell_param['sender'];
} else {
if ($gateway_number) {
$sms_from = $gateway_number;
} else {
$sms_from = $mobile_sender;
}
}
if ($sms_sender) {
$sms_msg = $sms_msg . $sms_sender;
}
switch ($sms_type) {
case "flash":
$sms_type = "SMS_FLASH";
break;
case "logo":
$sms_type = "SMS_NOKIA_OLOGO";
break;
case "picture":
$sms_type = "SMS_NOKIA_PICTURE";
break;
case "ringtone":
case "rtttl":
$sms_type = "SMS_NOKIA_RTTTL";
break;
case "text":
default:
$sms_type = "SMS_TEXT";
}
if ($unicode) {
if (function_exists('mb_convert_encoding')) {
$sms_msg = mb_convert_encoding($sms_msg, "UCS-2BE", "auto");
}
$sms_msg = str2hex($sms_msg);
$unicode = 1;
}
// fixme anton - if sms_from is not set in gateway_number and global number, we cannot pass it to clickatell
$set_sms_from = $sms_from == $mobile_sender ? '' : "&from=" . urlencode($sms_from);
$query_string = "sendmsg?api_id=" . $clickatell_param['api_id'] . "&user=" . $clickatell_param['username'] . "&password=" . $clickatell_param['password'] . "&to=" . urlencode($sms_to) . "&msg_type={$sms_type}&text=" . urlencode($sms_msg) . "&unicode=" . $unicode . $set_sms_from;
$url = $clickatell_param['send_url'] . "/" . $query_string;
if ($additional_param = $clickatell_param['additional_param']) {
$additional_param = "&" . $additional_param;
} else {
$additional_param = "&deliv_ack=1&callback=3";
}
$url .= $additional_param;
$url = str_replace("&&", "&", $url);
logger_print("url:" . $url, 3, "clickatell outgoing");
$fd = @implode('', file($url));
$ok = false;
// failed
$p_status = 2;
setsmsdeliverystatus($smslog_id, $uid, $p_status);
if ($fd) {
$response = split(":", $fd);
$err_code = trim($response[1]);
if (strtoupper($response[0]) == "ID") {
if ($apimsgid = trim($response[1])) {
clickatell_setsmsapimsgid($smslog_id, $apimsgid);
list($c_sms_credit, $c_sms_status) = clickatell_getsmsstatus($smslog_id);
// pending
$p_status = 0;
if ($c_sms_status) {
$p_status = $c_sms_status;
}
} else {
// sent
$p_status = 1;
}
logger_print("smslog_id:" . $smslog_id . " charge:" . $c_sms_credit . " sms_status:" . $p_status . " response:" . $response[0] . " " . $response[1], 3, "clickatell outgoing");
setsmsdeliverystatus($smslog_id, $uid, $p_status);
} else {
// even when the response is not what we expected we still print it out for debug purposes
$fd = str_replace("\n", " ", $fd);
$fd = str_replace("\r", " ", $fd);
logger_print("smslog_id:" . $smslog_id . " response:" . $fd, 3, "clickatell outgoing");
}
$ok = true;
}
return $ok;
}
示例15: setsmsdeliverystatus
case 9:
$stat = 4;
break;
// sent
// sent
case 12:
$stat = 4;
break;
// sent
// sent
case 18:
$stat = 5;
break;
// failed
}
$p_status = $stat;
if ($stat) {
$p_status = $stat - 3;
}
setsmsdeliverystatus($slid, $uid, $p_status);
// log dlr
$db_query = "SELECT kannel_dlr_id FROM " . _DB_PREF_ . "_gatewayKannel_dlr WHERE smslog_id='{$slid}'";
$db_result = dba_num_rows($db_query);
if ($db_result > 0) {
$db_query = "UPDATE " . _DB_PREF_ . "_gatewayKannel_dlr SET c_timestamp='" . mktime() . "',kannel_dlr_type='{$type}' WHERE smslog_id='{$slid}'";
$db_result = dba_query($db_query);
} else {
$db_query = "INSERT INTO " . _DB_PREF_ . "_gatewayKannel_dlr (smslog_id,kannel_dlr_type) VALUES ('{$slid}','{$type}')";
$db_result = dba_query($db_query);
}
}