Launch gateway/device logic All the gateway/device logic is broken into include files that are only loaded into the particular worker fork which is using that gateway. If we can't load it for some reason we should fail with an error to all the apps. */ if (!$config[$section]["gw_type"]) { $log->error_fatal("There is no gateway set! Unable to proceed!"); } $gatewayfile = realpath(dirname(__FILE__)) . "/include/gateways/" . $config[$section]["gw_type"] . ".php"; if (!file_exists($gatewayfile)) { $log->error_fatal("The gateway include {$gatewayfile} could not be located - is this the correct gateway name?"); } include $gatewayfile; $gateway = new device_gateway(); if (!$gateway->set_path($config[$section]["gw_path"])) { $log->error("Invalid syntax for gw_path option! Please check your configuration"); } /* Start Message Processer */ // track whom we are chatting with $current_chat = null; $current_status = null; // generate a message type ID we can use to listen on $msg_mylistener = intval(base_convert(hash("crc32", $section, false), 16, 10)); // handle posix signals in a sane way pcntl_signal(SIGTERM, "sig_handler_child"); pcntl_signal(SIGHUP, "sig_handler_child"); pcntl_signal(SIGINT, "sig_handler_child"); pcntl_signal(SIGUSR1, "sig_handler_child");