Beispiel #1
0
function recvsmsd()
{
    global $core_config;
    $core_config['recvsmsd_limit'] = (int) $core_config['recvsmsd_limit'] ? (int) $core_config['recvsmsd_limit'] : 200;
    $list = dba_search(_DB_PREF_ . '_tblRecvSMS', '*', array('flag_processed' => 1), '', array('LIMIT' => $core_config['recvsmsd_limit']));
    $j = 0;
    for ($j = 0; $j < count($list); $j++) {
        if ($id = $list[$j]['id']) {
            $sms_datetime = $list[$j]['sms_datetime'];
            $sms_sender = $list[$j]['sms_sender'];
            $message = $list[$j]['message'];
            $sms_receiver = $list[$j]['sms_receiver'];
            $smsc = $list[$j]['smsc'];
            if (dba_update(_DB_PREF_ . '_tblRecvSMS', array('flag_processed' => 2), array('id' => $id))) {
                logger_print("id:" . $id . " dt:" . core_display_datetime($sms_datetime) . " sender:" . $sms_sender . " m:" . $message . " receiver:" . $sms_receiver . " smsc:" . $smsc, 3, "recvsmsd");
                recvsms_process(core_display_datetime($sms_datetime), $sms_sender, $message, $sms_receiver, $smsc);
            }
        }
    }
}
Beispiel #2
0
$cb_charge = $_REQUEST['charge'];
$cb_apimsgid = $_REQUEST['apiMsgId'];
$cb_smsc = $_REQUEST['smsc'];
/*
 * $fc = "from: $cb_from - to: $cb_to - timestamp: $cb_timestamp - text: $cb_text - status: $cb_status - charge: $cb_charge - apimsgid: $cb_apimsgid\n"; $fn = "/tmp/infobip_callback"; umask(0); $fd = fopen($fn,"a+"); fputs($fd,$fc); fclose($fd); die();
 */
if ($cb_timestamp && $cb_from && $cb_text) {
    $cb_datetime = date($datetime_format, $cb_timestamp);
    $sms_datetime = trim($cb_datetime);
    $sms_sender = trim($cb_from);
    $message = trim(htmlspecialchars_decode($cb_text));
    $sms_receiver = trim($cb_to);
    logger_print("sender:" . $sms_sender . " receiver:" . $sms_receiver . " dt:" . $sms_datetime . " msg:" . $message, 3, "infobip incoming");
    // collected:
    // $sms_datetime, $sms_sender, $message, $sms_receiver
    recvsms_process($sms_datetime, $sms_sender, $message, $sms_receiver, $cb_smsc);
}
if ($cb_status && $cb_apimsgid) {
    $db_query = "\n\tSELECT " . _DB_PREF_ . "_tblSMSOutgoing.smslog_id AS smslog_id," . _DB_PREF_ . "_tblSMSOutgoing.uid AS uid\n\tFROM " . _DB_PREF_ . "_tblSMSOutgoing," . _DB_PREF_ . "_gatewayInfobip_apidata\n\tWHERE\n\t    " . _DB_PREF_ . "_tblSMSOutgoing.smslog_id=" . _DB_PREF_ . "_gatewayInfobip_apidata.smslog_id AND\n\t    " . _DB_PREF_ . "_gatewayInfobip_apidata.apimsgid='{$cb_apimsgid}'\n    ";
    $db_result = dba_query($db_query);
    $db_row = dba_fetch_array($db_result);
    $uid = $db_row['uid'];
    $smslog_id = $db_row['smslog_id'];
    if ($uid && $smslog_id) {
        $c_sms_status = 0;
        switch ($cb_status) {
            case "001":
            case "002":
            case "011":
                $c_sms_status = 0;
                break;