Example #1
0
     if (!$current_chat) {
         $current_chat = $message["phone"];
     } else {
         if ($current_chat != $message["phone"]) {
             $conn->message($config[$section]["xmpp_reciever"], $body = "Chat target has changed, you are now talking to {$message["phone_human"]}, all unaddressed replies will go to this recipient.", $subject = $message["phone_human"]);
             $current_chat = $message["phone"];
         }
     }
     $conn->message($config[$section]["xmpp_reciever"], $body = "{$message["phone_human"]}: {$message["body"]}", $subject = $message["phone_human"]);
     /*
     	Do we need to use any of the extra info, such as IP?
     */
     if ($config[$section]["gw_path"] == "auto" || $config[$section]["gw_path"] == "dynamic") {
         // we are using dynamic/auto configuration, we should set the IP of the gateway
         // to the one provided.
         $gateway->set_address($message["device_ip"]);
         // force health check
         $current_status = null;
     }
 }
 /*
 	Check for control messages
 	(ie shutdown)
 */
 $message = null;
 $message_type = null;
 if (msg_receive($msg_queue, MESSAGE_CTRL, $message_type, MESSAGE_MAX_SIZE, $message, TRUE, MSG_IPC_NOWAIT)) {
     switch ($message) {
         case "shutdown":
             $log->info("[{$section}] Shutdown command recieved!");
             $log->debug("[{$section}] Peak memory usage of " . memory_get_peak_usage() . " bytes");