本文整理汇总了PHP中outbound_route_to_bridge函数的典型用法代码示例。如果您正苦于以下问题:PHP outbound_route_to_bridge函数的具体用法?PHP outbound_route_to_bridge怎么用?PHP outbound_route_to_bridge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了outbound_route_to_bridge函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explode
//used for debug
echo "pdf file is {$pdf_file}\n";
//forward the fax
if (file_exists($fax_file)) {
if (strpos($fax_file_name, '#') !== false) {
$tmp = explode("#", $fax_file_name);
$fax_forward_number = $tmp[0];
}
echo "fax_forward_number is {$fax_forward_number}\n";
if (strlen($fax_forward_number) > 0) {
fax_split_dtmf($fax_forward_number, $fax_dtmf);
$fax_send_mode = $_SESSION['fax']['send_mode']['text'];
if (strlen($fax_send_mode) == 0) {
$fax_send_mode = 'direct';
}
$route_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $fax_forward_number);
if (count($route_array) == 0) {
//send the internal call to the registered extension
$fax_uri = "user/" . $fax_forward_number . "@" . $domain_name;
$t38 = "";
} else {
//send the external call
$fax_uri = $route_array[0];
$t38 = "fax_enable_t38=true,fax_enable_t38_request=true";
}
$common_dial_string = "absolute_codec_string='PCMU,PCMA',";
$common_dial_string .= "accountcode='" . $fax_accountcode . "',";
$common_dial_string .= "sip_h_X-accountcode='" . $fax_accountcode . "',";
$common_dial_string .= "domain_uuid=" . $_SESSION["domain_uuid"] . ",";
$common_dial_string .= "domain_name=" . $_SESSION["domain_name"] . ",";
$common_dial_string .= "origination_caller_id_name='" . $fax_caller_id_name . "',";
示例2: foreach
$fax_file = $dir_fax_temp . "/" . $fax_instance_uuid . ".tif";
$common_dial_string = "for_fax=1,";
$common_dial_string .= "accountcode='" . $fax_accountcode . "',";
$common_dial_string .= "sip_h_X-accountcode='" . $fax_accountcode . "',";
$common_dial_string .= "domain_uuid=" . $_SESSION["domain_uuid"] . ",";
$common_dial_string .= "domain_name=" . $_SESSION["domain_name"] . ",";
$common_dial_string .= "origination_caller_id_name='" . $fax_caller_id_name . "',";
$common_dial_string .= "origination_caller_id_number='" . $fax_caller_id_number . "',";
$common_dial_string .= "fax_ident='" . $fax_caller_id_number . "',";
$common_dial_string .= "fax_header='" . $fax_caller_id_name . "',";
$common_dial_string .= "fax_file='" . $fax_file . "',";
foreach ($fax_numbers as $fax_number) {
$dial_string = $common_dial_string;
fax_split_dtmf($fax_number, $fax_dtmf);
//prepare the fax command
$route_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $fax_prefix . $fax_number);
if (count($route_array) == 0) {
//send the internal call to the registered extension
$fax_uri = "user/" . $fax_number . "@" . $_SESSION['domain_name'];
$t38 = "";
} else {
//send the external call
$fax_uri = $route_array[0];
$t38 = "fax_enable_t38=true,fax_enable_t38_request=true,";
}
if ($fax_send_mode != 'queue') {
$dial_string .= $t38;
$dial_string .= "mailto_address='" . $mailto_address . "',";
$dial_string .= "mailfrom_address='" . $mailfrom_address . "',";
$dial_string .= "fax_uri=" . $fax_uri . ",";
$dial_string .= "fax_retry_attempts=1" . ",";
示例3: set
//.........这里部分代码省略.........
} else {
$dial_string .= ",origination_caller_id_name={$dial_string_caller_id_name}";
}
if (strlen($this->cid_number_prefix) > 0) {
//$dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix."";
$dial_string .= ",origination_caller_id_number=" . $this->cid_number_prefix . "#dial_string_caller_id_number";
} else {
$dial_string .= ",origination_caller_id_number={$dial_string_caller_id_number}";
}
if (strlen($this->accountcode) > 0) {
$dial_string .= ",sip_h_X-accountcode=" . $this->accountcode;
$dial_string .= ",accountcode=" . $this->accountcode;
}
$dial_string .= "}";
$x = 0;
foreach ($result as &$row) {
if ($x > 0) {
$dial_string .= ",";
}
if (extension_exists($row["follow_me_destination"])) {
//set the dial string
if (strlen($_SESSION['domain']['dial_string']['text']) == 0) {
$dial_string .= "[";
$dial_string .= "outbound_caller_id_number={$dial_string_caller_id_number},";
$dial_string .= "presence_id=" . $row["follow_me_destination"] . "@" . $_SESSION['domain_name'] . ",";
if ($row["follow_me_prompt"] == "1") {
$dial_string .= "group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
}
$dial_string .= "leg_delay_start=" . $row["follow_me_delay"] . ",";
$dial_string .= "leg_timeout=" . $row["follow_me_timeout"] . "]";
$dial_string .= "\${sofia_contact(" . $row["follow_me_destination"] . "@" . $_SESSION['domain_name'] . ")}";
} else {
$replace_value = $row["follow_me_destination"];
if ($row["follow_me_prompt"] == "1") {
$replace_value .= "[group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true]";
}
$local_dial_string = $_SESSION['domain']['dial_string']['text'];
$local_dial_string = str_replace("\${dialed_user}", $replace_value, $local_dial_string);
$local_dial_string = str_replace("\${dialed_domain}", $_SESSION['domain_name'], $local_dial_string);
$local_dial_string = str_replace("\${call_timeout}", $row["follow_me_timeout"], $local_dial_string);
$local_dial_string = str_replace("\${leg_timeout}", $row["follow_me_timeout"], $local_dial_string);
$dial_string .= $local_dial_string;
}
} else {
$dial_string .= "[";
if ($_SESSION['cdr']['follow_me_fix']['boolean'] == "true") {
$dial_string .= "outbound_caller_id_name=" . $this->outbound_caller_id_name;
$dial_string .= ",outbound_caller_id_number=" . $this->outbound_caller_id_number;
$dial_string .= ",origination_caller_id_name=" . $this->outbound_caller_id_name;
$dial_string .= ",origination_caller_id_number=" . $this->outbound_caller_id_number;
} else {
$dial_string .= "outbound_caller_id_number={$dial_string_caller_id_number}";
}
$dial_string .= ",presence_id=" . $this->extension . "@" . $_SESSION['domain_name'];
if ($row["follow_me_prompt"] == "1") {
$dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
}
$dial_string .= ",leg_delay_start=" . $row["follow_me_delay"];
$dial_string .= ",leg_timeout=" . $row["follow_me_timeout"] . "]";
if (is_numeric($row["follow_me_destination"])) {
if ($_SESSION['domain']['bridge']['text'] == "outbound" || $_SESSION['domain']['bridge']['text'] == "bridge") {
$bridge = outbound_route_to_bridge($_SESSION['domain_uuid'], $row["follow_me_destination"]);
$dial_string .= $bridge[0] . ",";
} elseif ($_SESSION['domain']['bridge']['text'] == "loopback") {
$dial_string .= "loopback/" . $row["follow_me_destination"] . "/" . $_SESSION['domain_name'];
} elseif ($_SESSION['domain']['bridge']['text'] == "lcr") {
$dial_string .= "lcr/" . $_SESSION['lcr']['profile']['text'] . "/" . $_SESSION['domain_name'] . "/" . $row["follow_me_destination"];
} else {
$dial_string .= "loopback/" . $row["follow_me_destination"] . "/" . $_SESSION['domain_name'];
}
} else {
$dial_string .= $row["follow_me_destination"];
}
}
$x++;
}
$this->dial_string = $dial_string;
} else {
$this->dial_string = '';
}
$sql = "update v_follow_me set ";
$sql .= "dial_string = '" . $this->dial_string . "' ";
$sql .= "where domain_uuid = '" . $this->domain_uuid . "' ";
$sql .= "and follow_me_uuid = '" . $this->follow_me_uuid . "' ";
if ($this->debug) {
echo $sql . "<br />";
}
$db->exec($sql);
unset($sql);
$sql = "update v_extensions set ";
$sql .= "dial_string = '" . $this->dial_string . "', ";
$sql .= "dial_domain = '" . $_SESSION['domain_name'] . "' ";
$sql .= "where domain_uuid = '" . $this->domain_uuid . "' ";
$sql .= "and follow_me_uuid = '" . $this->follow_me_uuid . "' ";
if ($this->debug) {
echo $sql . "<br />";
}
$db->exec($sql);
unset($sql);
}
示例4: foreach
$sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '" . $_SESSION['domain_uuid'] . "' ";
$sql .= "and extension = '{$src}' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$dest_cid_name = $row["outbound_caller_id_name"];
$dest_cid_number = $row["outbound_caller_id_number"];
break;
//limit to 1 row
}
unset($prep_statement);
}
}
$bridge_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $dest);
$destination = "{origination_caller_id_name='{$dest_cid_name}',origination_caller_id_number={$dest_cid_number}}" . $bridge_array[0];
if (permission_exists('click_to_call_call')) {
if (strpbrk($dest, '@') != FALSE) {
//call a sip uri
//echo "Found an @ 4, do nothing for now<br><br>";
$switch_cmd = "api originate {$source} &bridge({origination_caller_id_name='{$dest_cid_name}',origination_caller_id_number={$dest_cid_number},call_direction=outbound}sofia/external/{$dest})";
//echo "<br>SWITCH-CMD: $switch_cmd<br>";
} else {
//regular call
$switch_cmd = "api originate {$source} &bridge({$destination})";
}
}
}
//display the last command
echo "<div align='center'>\n";
示例5: set
public function set()
{
//set the global variable
global $db;
//determine whether to update the dial string
$sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '" . $this->domain_uuid . "' ";
$sql .= "and extension_uuid = '" . $this->extension_uuid . "' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) > 0) {
foreach ($result as &$row) {
$this->extension = $row["extension"];
$this->number_alias = $row["number_alias"];
$this->accountcode = $row["accountcode"];
$this->toll_allow = $row["toll_allow"];
$this->outbound_caller_id_name = $row["outbound_caller_id_name"];
$this->outbound_caller_id_number = $row["outbound_caller_id_number"];
}
}
unset($prep_statement);
//set the dial string
if ($this->forward_all_enabled == "true") {
$dial_string = "{presence_id=" . $this->forward_all_destination . "@" . $_SESSION['domain_name'];
$dial_string .= ",instant_ringback=true";
$dial_string .= ",domain_uuid=" . $_SESSION['domain_uuid'];
$dial_string .= ",sip_invite_domain=" . $_SESSION['domain_name'];
$dial_string .= ",domain_name=" . $_SESSION['domain_name'];
$dial_string .= ",domain=" . $_SESSION['domain_name'];
$dial_string .= ",extension_uuid=" . $this->extension_uuid;
$dial_string .= ",toll_allow='" . $this->toll_allow . "'";
if (strlen($this->accountcode) > 0) {
$dial_string .= ",sip_h_X-accountcode=" . $this->accountcode;
$dial_string .= ",accountcode=" . $this->accountcode;
}
if (strlen($this->forward_caller_id_uuid) > 0) {
$sql_caller = "select destination_number, destination_description from v_destinations where domain_uuid = '{$this->domain_uuid}' and destination_type = 'inbound' and destination_uuid = '{$this->forward_caller_id_uuid}'";
$prep_statement_caller = $db->prepare($sql_caller);
if ($prep_statement_caller) {
$prep_statement_caller->execute();
$row_caller = $prep_statement_caller->fetch(PDO::FETCH_ASSOC);
if (strlen($row_caller['destination_description']) > 0) {
$dial_string_caller_id_name = $row_caller['destination_description'];
$dial_string .= ",origination_caller_id_name={$dial_string_caller_id_name}";
}
if (strlen($row_caller['destination_number']) > 0) {
$dial_string_caller_id_number = $row_caller['destination_number'];
$dial_string .= ",origination_caller_id_number={$dial_string_caller_id_number}";
$dial_string .= ",outbound_caller_id_number={$dial_string_caller_id_number}";
}
}
} else {
if ($_SESSION['cdr']['call_forward_fix']['boolean'] == "true") {
$dial_string .= ",outbound_caller_id_name=" . $this->outbound_caller_id_name;
$dial_string .= ",outbound_caller_id_number=" . $this->outbound_caller_id_number;
$dial_string .= ",origination_caller_id_name=" . $this->outbound_caller_id_name;
$dial_string .= ",origination_caller_id_number=" . $this->outbound_caller_id_number;
}
}
$dial_string .= "}";
if (extension_exists($this->forward_all_destination)) {
$dial_string .= "user/" . $this->forward_all_destination . "@" . $_SESSION['domain_name'];
} else {
if ($_SESSION['domain']['bridge']['text'] == "outbound" || $_SESSION['domain']['bridge']['text'] == "bridge") {
$bridge = outbound_route_to_bridge($_SESSION['domain_uuid'], $this->forward_all_destination);
$dial_string .= $bridge[0];
} elseif ($_SESSION['domain']['bridge']['text'] == "lcr") {
$dial_string .= "lcr/" . $_SESSION['lcr']['profile']['text'] . "/" . $_SESSION['domain_name'] . "/" . $this->forward_all_destination;
} elseif ($_SESSION['domain']['bridge']['text'] === "loopback") {
$dial_string .= "loopback/" . $this->forward_all_destination;
} else {
$dial_string .= "loopback/" . $this->forward_all_destination;
}
}
$this->dial_string = $dial_string;
} else {
$this->dial_string = '';
}
//update the extension
$sql = "update v_extensions set ";
if (strlen($this->forward_all_destination) == 0 || $this->forward_all_enabled == "false") {
if (strlen($this->forward_all_destination) == 0) {
$sql .= "forward_all_destination = null, ";
}
$sql .= "dial_string = null, ";
$sql .= "forward_all_enabled = 'false' ";
} else {
$sql .= "forward_all_destination = '{$this->forward_all_destination}', ";
$sql .= "dial_string = '" . check_str($this->dial_string) . "', ";
$sql .= "forward_all_enabled = 'true' ";
}
$sql .= "where domain_uuid = '{$this->domain_uuid}' ";
$sql .= "and extension_uuid = '{$this->extension_uuid}' ";
if ($this->debug) {
echo $sql;
}
$db->exec(check_sql($sql));
unset($sql);
//delete extension from memcache
//.........这里部分代码省略.........
示例6: save_hunt_group
//.........这里部分代码省略.........
$destination_timeout = '30';
} else {
$destination_timeout = $row['hunt_group_timeout'];
}
}
//set the default profile
if (strlen($ent['destination_data']) == 0) {
$ent['destination_data'] = "internal";
}
if ($ent['destination_type'] == "extension") {
//$tmp .= " sofia_contact_".$ent['destination_data']." = \"\${sofia_contact(".$ent['destination_profile']."/".$ent['destination_data']."@\"..domain_name..\")}\";\n";
$tmp_sub_array["application"] = "bridge";
$tmp_sub_array["type"] = "extension";
$tmp_sub_array["extension"] = $ent['destination_data'];
//$tmp_sub_array["data"] = "\"[leg_timeout=$destination_timeout]\"..sofia_contact_".$ent['destination_data'];
$tmp_sub_array["data"] = "\"[leg_timeout={$destination_timeout},origination_caller_id_name='" . $hunt_group_cid_name_prefix . "\"..caller_id_name..\"',origination_caller_id_number=\"..caller_id_number..\"]user/" . $ent['destination_data'] . "@\"..domain_name";
$tmp_array[$i] = $tmp_sub_array;
unset($tmp_sub_array);
}
if ($ent['destination_type'] == "voicemail") {
$tmp_sub_array["application"] = "voicemail";
$tmp_sub_array["type"] = "voicemail";
$tmp .= "\tsession:answer();\n";
$tmp .= "\tsession:execute(\"transfer\", \"*99" . $ent['destination_data'] . " XML " . $_SESSION["context"] . " \");\n";
//$tmp_sub_array["application"] = "voicemail";
//$tmp_sub_array["data"] = "default \${domain_name} ".$ent['destination_data'];
//$tmp_array[$i] = $tmp_sub_array;
unset($tmp_sub_array);
}
if ($ent['destination_type'] == "sip uri") {
$tmp_sub_array["application"] = "bridge";
$tmp_sub_array["type"] = "sip uri";
//$destination_data = "{user=foo}loopback/".$ent['destination_data']."/default/XML";
$bridge_array = outbound_route_to_bridge($domain_uuid, $ent['destination_data']);
$destination_data = $bridge_array[0];
$tmp_sub_array["application"] = "bridge";
$tmp_sub_array["data"] = "\"[leg_timeout={$destination_timeout},origination_caller_id_name='" . $hunt_group_cid_name_prefix . "\"..caller_id_name..\"',origination_caller_id_number=\"..caller_id_number..\"]" . $destination_data . "\"";
$tmp_array[$i] = $tmp_sub_array;
unset($tmp_sub_array);
unset($destination_data);
}
$i++;
}
//end while
unset($sql, $prep_statement_2);
unset($i, $ent);
$i = 0;
if (count($tmp_array) > 0) {
foreach ($tmp_array as $ent) {
$tmpdata = $ent["data"];
if ($ent["application"] == "voicemail") {
$tmpdata = "*99" . $tmpdata;
}
if ($i < 1) {
$tmp_buffer = $tmpdata;
} else {
$tmp_buffer .= "..\",\".." . $tmpdata;
}
$i++;
}
}
unset($i);
$tmp_application = $tmp_array[0]["application"];
if ($row['hunt_group_type'] == "simultaneous" || $row['hunt_group_type'] == "follow_me_simultaneous" || $row['hunt_group_type'] == "call_forward") {
$tmp_switch = "simultaneous";
}