瀏覽代碼

Add call flows to the switch_select_destination list.

Mark Crane 13 年之前
父節點
當前提交
5afa056f0d
共有 1 個文件被更改,包括 35 次插入0 次删除
  1. 35 0
      includes/lib_switch.php

+ 35 - 0
includes/lib_switch.php

@@ -524,6 +524,41 @@ function switch_select_destination($select_type, $select_label, $select_name, $s
 		}
 		}
 		unset ($prep_statement);
 		unset ($prep_statement);
 
 
+	//list call flows
+		if ($select_type == "dialplan" || $select_type == "ivr") {
+			$sql = "select * from v_call_flows ";
+			$sql .= "where domain_uuid = '$domain_uuid' ";
+			$sql .= "order by call_flow_extension asc ";
+			$prep_statement = $db->prepare(check_sql($sql));
+			$prep_statement->execute();
+			$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
+			echo "<optgroup label='Call Flows'>\n";
+			foreach ($result as &$row) {
+				$call_flow_name = $row["call_flow_name"];
+				$call_flow_extension = $row["call_flow_extension"];
+				$call_flow_context = $row["call_flow_context"];
+				if ("transfer $call_flow_extension XML ".$call_flow_context == $select_value || "transfer:".$call_flow_extension." XML ".$call_flow_context == $select_value) {
+					if ($select_type == "ivr") {
+						echo "		<option value='menu-exec-app:transfer $call_flow_extension XML ".$call_flow_context."' selected='selected'>".$call_flow_extension." ".$call_flow_name."</option>\n";
+					}
+					if ($select_type == "dialplan") {
+						echo "		<option value='transfer:$call_flow_extension XML ".$call_flow_context."' selected='selected'>".$call_flow_extension." ".$call_flow_name."</option>\n";
+					}
+					$selection_found = true;
+				}
+				else {
+					if ($select_type == "ivr") {
+						echo "		<option value='menu-exec-app:transfer $call_flow_extension XML ".$call_flow_context."'>".$call_flow_extension." ".$call_flow_name."</option>\n";
+					}
+					if ($select_type == "dialplan") {
+						echo "		<option value='transfer:$call_flow_extension XML ".$call_flow_context."'>".$call_flow_extension." ".$call_flow_name."</option>\n";
+					}
+				}
+			}
+			echo "</optgroup>\n";
+			unset ($prep_statement, $call_flow_extension);
+		}
+
 	//list call groups
 	//list call groups
 		$sql = "select distinct(call_group) from v_extensions ";
 		$sql = "select distinct(call_group) from v_extensions ";
 		$sql .= "where domain_uuid = '$domain_uuid' ";
 		$sql .= "where domain_uuid = '$domain_uuid' ";