public static function getApacheThreadId($org_id, $user_id, $type, $action) { $sql = "SELECT performance_logs.performancelog WHERE org_id={$org_id}\n \tAND user_id={$user_id} AND type={$type}\n \tAND action={$action} order by id desc"; $dbconn = new Dbase('users'); $res = $dbconn->query_firstrow($sql); return $res; }
/** * Creates a message object that NSADmin accepts * @param $priority enum ('DEFAULT', 'HIGH'); */ function getMessageDistribution($to, $from_org_id, $message, $priority = 'DEFAULT', $tags = array(), $campaign_id = -1) { $db = new Dbase('users'); $sql = "SELECT * FROM custom_sender WHERE org_id = '{$from_org_id}'"; $row = $db->query_firstrow($sql); $gsm = Util::valueOrDefault($row['sender_gsm'], "CAPILLARY"); $cdma = Util::valueOrDefault($row['sender_cdma'], "919874400500"); $m = $this->createMessageObject('SMS', $to, $message, $from_org_id, $priority, $gsm, $cdma, false, $scheduled_time, '', '', '', '', '', '', '', $tags, $campaign_id); try { # Send using NSADMIN $this->logger->debug("starting distribution"); $this->transport->open(); $ret = $this->client->chooseGateways($m); $this->logger->debug("*** return: " . print_r($ret, true)); $this->transport->close(); } catch (TException $te) { $this->logger->error("NSAdmin Exception: " . $te->getMessage()); throw new Exception("Error in NSAdmin: " . $te->getMessage(), -500); } catch (Exception $e) { $this->logger->error("NSAdmin Exception: " . $e->getMessage()); try { $this->transport->close(); } catch (Exception $e) { //do nothing } return false; } return $ret; }