select($sql, $parameters, 'all'); unset($parameters); //view_array($results); foreach($results as $row) { //build the event $cmd = "sendevent PRESENCE_IN\n"; $cmd .= "proto: sip\n"; $cmd .= "login: ".$row['extension']."@".$row['domain_name']."\n"; $cmd .= "from: ".$row['extension']."@".$row['domain_name']."\n"; $cmd .= "status: Active (1 waiting)\n"; $cmd .= "rpid: unknown\n"; $cmd .= "event_type: presence\n"; $cmd .= "alt_event_type: dialog\n"; $cmd .= "event_count: 1\n"; $cmd .= "unique-id: ".uuid()."\n"; $cmd .= "Presence-Call-Direction: outbound\n"; $cmd .= "answer-state: confirmed\n"; //$cmd .= "answer-state: early\n"; //$cmd .= "answer-state: terminated\n"; //send message to the console if (isset($debug)) { echo "\n"; echo "[presence] dnd ".$row['extension']."@".$row['domain_name']."\n"; } //send the event $result = event_socket_request($fp, $cmd); if (isset($debug)) { print_r($result, false); } } /* * * * * * cd /var/www/fusionpbx && php /var/www/fusionpbx/app/call_forward/resources/jobs/dnd.php */ ?>