[call_flow] Adjust lamp on web changes (#6519)

Trigger event on status change from WebUI
This commit is contained in:
yois615 2022-12-31 13:49:33 -05:00 committed by GitHub
parent 21dfbc2d61
commit cb1777c794
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 0 deletions

View File

@ -245,6 +245,31 @@
$p->delete("dialplan_add", "temp");
$p->delete("dialplan_edit", "temp");
// Update subscribed endpoints
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
//send the event
$event = "sendevent PRESENCE_IN\n";
$event .= "proto: flow\n";
$event .= "event_type: presence\n";
$event .= "alt_event_type: dialog\n";
$event .= "Presence-Call-Direction: outbound\n";
$event .= "state: Active (1 waiting)\n";
$event .= "from: flow+".$call_flow_feature_code."@".$_SESSION['domain_name']."\n";
$event .= "login: flow+".$call_flow_feature_code."@".$_SESSION['domain_name']."\n";
$event .= "unique-id: ".$call_flow_uuid."\n";
if ($call_flow_status == "true") {
$event .= "answer-state: confirmed\n";
} else {
$event .= "answer-state: terminated\n";
}
event_socket_request($fp, $event);
//echo $event."<br />";
fclose($fp);
}
//debug info
//echo "<pre>";
//print_r($message);