Add a missing file sip_profile_copy.php to the dev branch.

This commit is contained in:
Mark Crane
2012-06-04 14:58:40 +00:00
commit af103e9c41
1240 changed files with 164946 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
This Module brought to you by the Letters Ken Rice <krice at tollfreegateway dot com>
See the Wiki for more information.
+142
View File
@@ -0,0 +1,142 @@
<?php
//application details
$apps[$x]['name'] = "XMPP Manager";
$apps[$x]['uuid'] = '740f1c0d-6d82-fcde-3873-0fc9779789ec';
$apps[$x]['category'] = 'Switch';
$apps[$x]['subcategory'] = '';
$apps[$x]['version'] = '';
$apps[$x]['license'] = 'Mozilla Public License 1.1';
$apps[$x]['url'] = 'http://www.fusionpbx.com';
$apps[$x]['description']['en'] = 'Allow User to Open a Flash Phone for his Extension.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'XMPP Manager';
$apps[$x]['menu'][0]['uuid'] = '1808365b-0f7c-7555-89d0-31b3d9a75abb';
$apps[$x]['menu'][0]['parent_uuid'] = 'bc96d773-ee57-0cdd-c3ac-2d91aba61b55';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/xmpp/v_xmpp.php';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'xmpp_view';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'xmpp_add';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'xmpp_edit';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['name'] = 'xmpp_delete';
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
//schema details
$y = 0; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_xmpp';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'xmpp_profile_id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'xmpp_profile_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'profile_name';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'username';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'password';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'context';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'rtp_ip';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'ext_rtp_ip';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'auto_login';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'sasl_type';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'xmpp_server';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'tls_enable';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'usr_rtp_timer';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'default_exten';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'vad';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'in/out/both';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'avatar';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'example: /path/to/tiny.jpg';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'candidate_acl';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'local_network_acl';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'enabled';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'description';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
?>
+53
View File
@@ -0,0 +1,53 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Ken Rice <krice@tollfreegateway.com>
Mark J Crane <markjcrane@fusionpbx.com>
*/
function make_xmpp_xml($input) {
$xml_out .= "<include>\n";
$xml_out .= " <profile type=\"client\">\n";
$xml_out .= sprintf(" <param name=\"name\" value=\"%s\"/>\n", $input['profile_name']);
$xml_out .= sprintf(" <param name=\"login\" value=\"%s/talk\"/>\n", $input['profile_username']);
$xml_out .= sprintf(" <param name=\"password\" value=\"%s\"/>\n", $input['profile_password']);
$xml_out .= sprintf(" <param name=\"dialplan\" value=\"XML\"/>\n", $input['dialplan']);
$xml_out .= sprintf(" <param name=\"context\" value=\"%s\"/>\n", $input['context']);
$xml_out .= " <param name=\"message\" value=\"Jingle all the way\"/>\n";
$xml_out .= sprintf(" <param name=\"rtp-ip\" value=\"%s\"/>\n", $input['rtp_ip']);
$xml_out .= sprintf(" <param name=\"ext-rtp-ip\" value=\"%s\"/>\n", $input['ext_rtp_ip']);
$xml_out .= sprintf(" <param name=\"auto-login\" value=\"%s\"/>\n", $input['auto_login']);
$xml_out .= sprintf(" <param name=\"sasl\" value=\"%s\"/>\n", $input['sasl_type']);
$xml_out .= sprintf(" <param name=\"server\" value=\"%s\"/>\n", $input['xmpp_server']);
$xml_out .= sprintf(" <param name=\"tls\" value=\"%s\"/>\n", $input['tls_enable']);
$xml_out .= sprintf(" <param name=\"use-rtp-timer\" value=\"%s\"/>\n", $input['use_rtp_timer']);
$xml_out .= sprintf(" <param name=\"exten\" value=\"%s\"/>\n", $input['default_exten']);
$xml_out .= sprintf(" <param name=\"vad\" value=\"%s\"/>\n", $input['vad']);
$xml_out .= sprintf(" <param name=\"candidate-acl\" value=\"%s\"/>\n", $input['candidate_acl']);
$xml_out .= sprintf(" <param name=\"local-network-acl\" value=\"%s\"/>\n", $input['local_network_acl']);
$xml_out .= " </profile>\n";
$xml_out .= "</include>\n";
return $xml_out;
}
?>
+51
View File
@@ -0,0 +1,51 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Ken Rice <krice@tollfreegateway.com>
Mark J Crane <markjcrane@fusionpbx.com>
*/
function sql_tables($db_type) {
$x = 0;
include "app_config.php";
$sql = "";
foreach ($apps[$x]['db'] as $new_db) {
$sql .= "CREATE TABLE " . $new_db['table'] . " (\n";
$fcount = 0;
foreach ($new_db['fields'] as $field) {
if ($fcount > 0 ) { $sql .= ",\n"; }
$sql .= $field['name'] . " ";
if (is_array($field['type'])) {
$sql .= $field['type'][$db_type];
} else {
$sql .= $field['type'];
}
$fcount++;
}
$sql .= ");\n\n";
}
return $sql;
}
?>
+31
View File
@@ -0,0 +1,31 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Ken Rice <krice@tollfreegateway.com>
Mark J Crane <markjcrane@fusionpbx.com>
*/
echo "<div align='center'>\n";
echo "<table><tr><td>\n";
echo $error . "\n";
echo "</td></tr></table>\n";
?>
+286
View File
@@ -0,0 +1,286 @@
<script type="text/javascript" language="JavaScript">
function enable_change(enable_over) {
var endis;
endis = !(document.iform.enable.checked || enable_over);
document.iform.range_from.disabled = endis;
document.iform.range_to.disabled = endis;
}
function show_advanced_config() {
document.getElementById("show_advanced_box").innerHTML='';
aodiv = document.getElementById('show_advanced');
aodiv.style.display = "block";
}
function hide_advanced_config() {
document.getElementById("show_advanced_box").innerHTML='';
aodiv = document.getElementById('show_advanced');
aodiv.style.display = "block";
}
</script>
<div align='center'>
<table width='100%' border='0' cellpadding='0' cellspacing='2'>
<tr class='border'>
<td align=\"left\">
<br>
<form method='post' name='ifrm' action=''>
<div align='center'>
<table width='100%' border='0' cellpadding='6' cellspacing='0'>
<tr>
<td colspan='2'>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align='left' width="50%">
<strong>Profile Edit</strong><br>
</td> <td width='50%' align='right'>
<input type='submit' name='submit' class='btn' value='Save'>
<!-- <input type='button' class='btn' name='' alt='copy' onclick="if (confirm('Do you really want to copy this?')){window.location='v_gateways_copy.php?id=1';}" value='Copy'> -->
<input type='button' class='btn' name='' alt='back' onclick="window.location='v_xmpp.php'" value='Back'>
</td>
</tr>
<tr>
<td align='left' colspan='2'>
Defines a connections to a Jabber, GTalk, or other XMPP Provider server. <br />
</td>
</tr>
</table>
<br />
</td>
</tr>
<tr>
<td width="30%" class='vncellreq' valign='top' align='left' nowrap='nowrap'>
Profile Name:
</td>
<td width="70%" class='vtable' align='left'>
<input class='formfld' type='text' name='profile_name' maxlength='255' value="<?php echo $profile['profile_name']; ?>">
<br />
Enter the profile name here.
</td>
</tr>
<tr>
<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>
Username:
</td>
<td class='vtable' align='left'>
<input class='formfld' type='text' name='profile_username' maxlength='255' value="<?php echo $profile['profile_username'];?>">
<br />
Enter the XMPP username here.
</td>
</tr>
<tr>
<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>
Password:
</td>
<td class='vtable' align='left'>
<input class='formfld' type='profile_password' name='profile_password' id='profile_password' maxlength='50' onfocus="document.getElementById('show_profile_password').innerHTML = 'Password: '+document.getElementById('profile_password').value;" value="<?php echo $profile['profile_password'];?>">
<br />
<span onclick="document.getElementById('show_profile_password').innerHTML = ''">Enter the password here. </span><span id='show_profile_password'></span>
</td>
</tr>
<tr>
<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>
Auto-Login:
</td>
<td class='vtable' align='left'>
<select class='formfld' name='auto_login'>
<option value='true' <?php if($profile['auto_login'] == "true") echo "selected='selected'"; ?>>true</option>
<option value='false' <?php if($profile['auto_login'] == "false") echo "selected='selected'"; ?>>false</option>
</select>
<br />
Choose whether to automatically login.
</td>
</tr>
<tr>
<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>
XMPP Server:
</td>
<td width='70%' class='vtable' align='left'>
<input class='formfld' type='text' name='xmpp_server' maxlength='255' value="<?php echo $profile['xmpp_server'];?>">
<br />
Enter alternate XMPP server if the server is not the same as the one in the Username<br />
Example GoogleTalk is: xmpp-server1.l.google.com
</td>
</tr>
<tr>
<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>
Default Extension:
</td>
<td class='vtable' align='left'>
<input class='formfld' type='text' name='default_exten' maxlength='255' value="<?php echo $profile['default_exten'];?>">
<br />
Default extension (if one cannot be determined)
</td>
</tr>
<tr>
<td style='padding: 0px;' colspan='2' class='' valign='top' align='left' nowrap='nowrap'>
<div id="show_advanced_box">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
<td width="30%" valign="top" class="vncell">Show Advanced</td>
<td width="70%" class="vtable">
<input type="button" onClick="show_advanced_config()" value="Advanced"></input>
</td>
</tr>
</table>
</div>
<div id="show_advanced" style="display:none">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
<?php if (if_group("superadmin")) { ?>
<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>
Context:
</td>
<td class='vtable' align='left'>
<input class='formfld' type='text' name='context' maxlength='255' value="<?php echo $profile['context'];?>">
<br />
Enter the context here.
</td>
</tr>
<?php } ?>
<tr>
<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>
RTP IP:
</td>
<td class='vtable' align='left'>
<input class='formfld' type='text' name='rtp_ip' maxlength='255' value="<?php echo $profile['rtp_ip'];?>">
<br />
IP Address for RTP
</td>
</tr>
<tr>
<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>
Ext RTP IP:
</td>
<td class='vtable' align='left'>
<input class='formfld' type='text' name='ext_rtp_ip' maxlength='255' value="<?php echo $profile['ext_rtp_ip'];?>">
<br />
External IP Address for RTP
</td>
</tr>
<tr>
<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>
SASL Type:
</td>
<td class='vtable' align='left'>
<select class='formfld' name='sasl_type'>
<option value='plain' <?php if($profile['sasl_type'] == "plain") echo "selected='selected'"; ?>>plain</option>
<option value='md5' <?php if($profile['sasl_type'] == "md5") echo "selected='selected'"; ?>>md5</option>
</select>
<br />
Choose SASL Type. Plain or MD5
</td>
</tr>
<tr>
<td class='vncell' valign='top' align='left' nowrap='nowrap'>
Enable TLS:
</td>
<td class='vtable' align='left'>
<select class='formfld' name='tls_enable'>
<option value='true' <?php if($profile['tls_enable'] == "true") echo "selected='selected'"; ?>>true</option>
<option value='false' <?php if($profile['tls_enable'] == "false") echo "selected='selected'"; ?>>false</option>
</select>
<br />
Enable TLS or not
</td>
</tr>
<tr>
<td class='vncell' valign='top' align='left' nowrap='nowrap'>
Use RTP Timer
</td>
<td class='vtable' align='left'>
<select class='formfld' name='use_rtp_timer'>
<option value='true' <?php if($profile['tls_enable'] == "true") echo "selected='selected'"; ?>>true</option>
<option value='false' <?php if($profile['tls_enable'] == "false") echo "selected='selected'"; ?>>false</option>
</select>
<br />
Disable to trade async for more calls
</td>
</tr>
<tr>
<td class='vncell' valign='top' align='left' nowrap='nowrap'>
Voice Activity Detection
</td>
<td class='vtable' align='left'>
<select class='formfld' name='vad'>
<option value='none' <?php if($profile['vad'] == "none") echo "selected='selected'"; ?>>none</option>
<option value='in' <?php if($profile['vad'] == "in") echo "selected='selected'"; ?>>in</option>
<option value='out' <?php if($profile['vad'] == "out") echo "selected='selected'"; ?>>out</option>
<option value='both' <?php if($profile['vad'] == "both") echo "selected='selected'"; ?>>both</option>
</select>
<br />
Which direction are we doing VAD?
</td>
</tr>
<tr>
<td class='vncell' valign='top' align='left' nowrap='nowrap'>
Candidate ACL
</td>
<td class='vtable' align='left'>
<input class='formfld' type='text' name='candidate_acl' maxlength='255' value="<?php echo $profile['candidate_acl'];?>">
<br />
Candidate access control list
</td>
</tr>
<tr>
<td class='vncell' valign='top' align='left' nowrap='nowrap'>
Local Network ACL
</td>
<td class='vtable' align='left'>
<input class='formfld' type='text' name='local_network_acl' maxlength='255' value="<?php echo $profile['local_network_acl'];?>">
<br />
Local network access control list
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>
Enabled:
</td>
<td class='vtable' align='left'>
<select class='formfld' name='enabled'>
<option value='true' <?php if($profile['enabled'] == "true") echo "selected='selected'"; ?>>true</option>
<option value='false' <?php if($profile['enabled'] == "false") echo "selected='selected'"; ?>>false</option>
</select>
<br />
</td>
</tr>
<tr>
<td class='vncell' valign='top' align='left' nowrap='nowrap'>
Profile Description:
</td>
<td class='vtable' align='left'>
<input class='formfld' type='text' name='description' value='<?php echo $profile['description'];?>'>
<br />
Enter the description of the Profile here.
</td>
</tr>
<tr>
<td colspan='2' align='right'>
<input type='hidden' name='profile_id' value='<?php echo $profile['xmpp_profile_uuid']; ?>'>
<input type='submit' name='submit' class='btn' value='Save'>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</div>
+61
View File
@@ -0,0 +1,61 @@
<div align='center'>
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
<td align='left'><b>XMPP Manager</b><br>
Utilizes the Jingle protocol. Jingle is an extension to the Jabber/XMPP protocol.
</td>
</tr>
</table>
<br />
<table width='100%' border='0' cellpadding='0' cellspacing='0'>
<tr>
<th>Profile</th>
<th>Context</th>
<th>Status</th>
<th>Enabled</th>
<th>Description</th>
<td align='right' width='42'>
<?php if (permission_exists('xmpp_add')) { ?>
<a href='v_profile_edit.php' alt='add'><?php echo $v_link_label_add; ?></a>
<?php } ?>
</td>
</tr>
<?php
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
foreach($profiles_array as $profile){
?>
<tr>
<td class='<?php echo $row_style[$c]; ?>'><?php echo $profile['profile_name']; ?>&nbsp;</td>
<td class='<?php echo $row_style[$c]; ?>'><?php echo $profile['context']; ?>&nbsp;</td>
<td class='<?php echo $row_style[$c]; ?>'><?php echo $profile['status']; ?>&nbsp;</td>
<td class='<?php echo $row_style[$c]; ?>'><?php echo $profile['enabled']; ?>&nbsp;</td>
<td class='<?php echo $row_style[$c]; ?>'><?php echo $profile['description']; ?>&nbsp;</td>
<td align='right' width='42'>
<?php if (permission_exists('xmpp_edit')) { ?>
<a href='v_profile_edit.php?id=<?php echo $profile['xmpp_profile_uuid']; ?>' alt='edit'><?php echo $v_link_label_edit; ?></a>
<?php } ?>
<?php if (permission_exists('xmpp_delete')) { ?>
<a href='v_profile_delete.php?id=<?php echo $profile['xmpp_profile_uuid']; ?>' onclick="return confirm('Do you really want to delete this?')"
alt='delete'><?php echo $v_link_label_delete; ?></a>
<?php } ?>
</td>
</tr>
<?php
if ($c==0) { $c=1; } else { $c=0; }
}
?>
<tr>
<td colspan='6' align='right' width='42'>
<?php if (permission_exists('xmpp_add')) { ?>
<a href='v_profile_edit.php' alt='add'><?php echo $v_link_label_add; ?></a>
<?php } ?>
</td>
</tr>
</table>
</div>
+50
View File
@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
if (!defined("PATH_SEPARATOR")) {
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
}
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
// if the project directory exists then add it to the include path otherwise add the document root to the include path
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
}
else {
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
}
?>
+11
View File
@@ -0,0 +1,11 @@
<meta http-equiv="refresh" content="2;url=v_xmpp.php">
<div align='center'>
<?php
if ($action == "add") {
echo "Add Complete\n";
}
if ($action == "update") {
echo "Edit Complete\n";
}
?>
</div>
+95
View File
@@ -0,0 +1,95 @@
<?php
/* $Id$ */
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Ken Rice <krice@tollfreegateway.com>
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('xmpp_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
$domain_name = $_SESSION['domains'][$domain_uuid]['domain_name'];
$profile_id = $_REQUEST['id'];
$sql = "";
$sql .= "select * from v_xmpp ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and xmpp_profile_uuid = '$profile_id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$x = 0;
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$profiles_array[$x] = $row;
$x++;
}
$profile = $profiles_array[0];
unset ($prep_statement);
$sql = "";
$sql .= "delete from v_xmpp ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and xmpp_profile_uuid = '$profile_id' ";
$db->exec(check_sql($sql));
$filename = $_SESSION['switch']['conf']['dir'] . "/jingle_profiles/" . "v_" . $domain_name . "_" .
preg_replace("/[^A-Za-z0-9]/", "", $profile['profile_name']) . "_" . $profile_id . ".xml";
unlink($filename);
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
//reload the XML Configs
$tmp_cmd = 'api reloadxml';
$response = event_socket_request($fp, $tmp_cmd);
unset($tmp_cmd);
//tell mod_dingaling to reload is config
$tmp_cmd = 'api dingaling reload';
$response = event_socket_request($fp, $tmp_cmd);
unset($tmp_cmd);
//close the connection
fclose($fp);
}
include "update_complete.php";
end:
//show the footer
require_once "includes/footer.php";
?>
+245
View File
@@ -0,0 +1,245 @@
<?php
/* $Id$ */
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Ken Rice <krice@tollfreegateway.com>
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('xmpp_add') || permission_exists('xmpp_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
$domain_name = $_SESSION['domains'][$_SESSION['domain_uuid']]['domain_name'];
//add or update the database
if (isset($_REQUEST["id"])) {
$action = "update";
$profile_id = check_str($_REQUEST["id"]);
} else {
$action = "add";
}
if ($action == "update") {
$sql = "";
$sql .= "select * from v_xmpp ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and xmpp_profile_uuid = '$profile_id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$x = 0;
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$profiles_array[$x] = $row;
$x++;
}
$profile = $profiles_array[0];
unset ($prep_statement);
$profile['profile_username'] = $profile['username'];
$profile['profile_password'] = $profile['password'];
} else {
$profile['dialplan'] = "XML";
$profile['context'] = $_SESSION['domain_name'];
$profile['rtp_ip'] = '$${local_ip_v4}';
$profile['ext_rtp_ip'] = '$${external_rtp_ip}';
$profile['auto_login'] = "true";
$profile['sasl_type'] = "md5";
$profile['tls_enable'] = "true";
$profile['usr_rtp_timer'] = "true";
$profile['vad'] = "none";
$profile['candidate_acl'] = "wan.auto";
$profile['local_network_acl'] = "localnet.auto";
}
if ((!isset($_REQUEST['submit'])) || ($_REQUEST['submit'] != 'Save')) {
// If we arent saving a Profile Display the form.
include "profile_edit.php";
goto end;
}
foreach ($_REQUEST as $field => $data){
$request[$field] = check_str($data);
}
// check the data
$error = "";
if (strlen($request['profile_name']) < 1) $error .= "Profile name is a Required Field<br />\n";
if (strlen($request['profile_username']) < 1) $error .= "Username is a Required Field<br />\n";
if (strlen($request['profile_password']) < 1) $error .= "Password is a Required Field<br />\n";
if (strlen($request['default_exten']) < 1) $error .= "Default Extension is a Required Field<br />\n";
if (strlen($error) > 0) {
include "errors.php";
$profile = $request;
include "profile_edit.php";
goto end;
}
// Save New Entry
if ($action == "add" && permission_exists('xmpp_add')) {
$xmpp_profile_uuid = uuid();
$sql = "";
$sql .= "insert into v_xmpp (";
$sql .= "domain_uuid, ";
$sql .= "xmpp_profile_uuid, ";
$sql .= "profile_name, ";
$sql .= "username, ";
$sql .= "password, ";
$sql .= "dialplan, ";
$sql .= "context, ";
$sql .= "rtp_ip, ";
$sql .= "ext_rtp_ip, ";
$sql .= "auto_login, ";
$sql .= "sasl_type, ";
$sql .= "xmpp_server, ";
$sql .= "tls_enable, ";
$sql .= "usr_rtp_timer, ";
$sql .= "default_exten, ";
$sql .= "vad, ";
$sql .= "avatar, ";
$sql .= "candidate_acl, ";
$sql .= "local_network_acl, ";
$sql .= "description, ";
$sql .= "enabled ";
$sql .= ") values (";
$sql .= "'" . $_SESSION['domain_uuid'] . "', ";
$sql .= "'" . $xmpp_profile_uuid . "', ";
$sql .= "'" . $request['profile_name'] . "', ";
$sql .= "'" . $request['profile_username'] . "', ";
$sql .= "'" . $request['profile_password'] . "', ";
$sql .= "'" . $request['dialplan'] . "', ";
if (if_group("superadmin") && $request['context']) {
$sql .= "'" . $request['context'] . "', ";
}
else {
$sql .= "'" . $_SESSION['context'] . "', ";
}
$sql .= "'" . $request['rtp_ip'] . "', ";
$sql .= "'" . $request['ext_rtp_ip'] . "', ";
$sql .= "'" . $request['auto_login'] . "', ";
$sql .= "'" . $request['sasl_type'] . "', ";
$sql .= "'" . $request['xmpp_server'] . "', ";
$sql .= "'" . $request['tls_enable'] . "', ";
$sql .= "'" . $request['usr_rtp_timer'] . "', ";
$sql .= "'" . $request['default_exten'] . "', ";
$sql .= "'" . $request['vad'] . "', ";
$sql .= "'" . $request['avatar'] . "', ";
$sql .= "'" . $request['candidate_acl'] . "', ";
$sql .= "'" . $request['local_network_acl'] . "', ";
$sql .= "'" . $request['description'] . "', ";
$sql .= "'" . $request['enabled'] . "' ";
$sql .= ") ";
$db->exec(check_sql($sql));
goto writeout;
}
elseif ($action == "update" && permission_exists('xmpp_edit')) {
$sql = "";
$sql .= "UPDATE v_xmpp SET ";
$sql .= "profile_name = '" . $request['profile_name'] . "', ";
$sql .= "username = '" . $request['profile_username'] . "', ";
$sql .= "password = '" . $request['profile_password'] . "', ";
$sql .= "dialplan = '" . $request['dialplan'] . "', ";
if (if_group("superadmin") && $request['context']) {
$sql .= "context = '" . $request['context'] . "', ";
}
else {
$sql .= "context = '" . $_SESSION["context"] . "', ";
}
$sql .= "rtp_ip = '" . $request['rtp_ip'] . "', ";
$sql .= "ext_rtp_ip = '" . $request['ext_rtp_ip'] . "', ";
$sql .= "auto_login = '" . $request['auto_login'] . "', ";
$sql .= "sasl_type = '" . $request['sasl_type'] . "', ";
$sql .= "xmpp_server = '" . $request['xmpp_server'] . "', ";
$sql .= "tls_enable = '" . $request['tls_enable'] . "', ";
$sql .= "usr_rtp_timer = '" . $request['usr_rtp_timer'] . "', ";
$sql .= "default_exten = '" . $request['default_exten'] . "', ";
$sql .= "vad = '" . $request['vad'] . "', ";
$sql .= "avatar = '" . $request['avatar'] . "', ";
$sql .= "candidate_acl = '" . $request['candidate_acl'] . "', ";
$sql .= "local_network_acl = '" . $request['local_network_acl'] . "', ";
$sql .= "description = '" . $request['description'] . "', ";
$sql .= "enabled = '" . $request['enabled'] . "' ";
$sql .= "where xmpp_profile_uuid = '" . $request['id'] . "' ";
$db->exec(check_sql($sql));
$xmpp_profile_uuid = $request['id'];
goto writeout;
}
writeout:
//prepare the xmpp files to be written. delete all jingle files that are prefixed with v_ and have a file extension of .xml
$jingle_list = glob($_SESSION['switch']['conf']['dir'] . "/jingle_profiles/*v_*.xml");
foreach($jingle_list as $name => $value) {
unlink($value);
}
if ($request['enabled'] == "true") {
//prepare the xml
include "client_template.php";
$xml = make_xmpp_xml($request);
//write the xml
$filename = $_SESSION['switch']['conf']['dir'] . "/jingle_profiles/" . "v_" . $_SESSION['domain_name'] . "_" . preg_replace("/[^A-Za-z0-9]/", "", $request['profile_name']) . "_" . $xmpp_profile_uuid . ".xml";
$fh = fopen($filename,"w") or die("Unable to open the file");
fwrite($fh, $xml);
unset($file_name);
fclose($fh);
}
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
//reload the XML Configs
$tmp_cmd = 'api reloadxml';
$response = event_socket_request($fp, $tmp_cmd);
unset($tmp_cmd);
//Tell mod_dingaling to reload is config
$tmp_cmd = 'api dingaling reload';
$response = event_socket_request($fp, $tmp_cmd);
unset($tmp_cmd);
//close the connection
fclose($fp);
}
include "update_complete.php";
end:
//show the footer
require_once "includes/footer.php";
?>
+95
View File
@@ -0,0 +1,95 @@
<?php
/* $Id$ */
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Ken Rice <krice@tollfreegateway.com>
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('xmpp_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/paging.php";
//connect to event socket
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
if (strlen($_GET["a"]) > 0) {
if ($_GET["a"] == "reload") {
$cmd = 'api dingaling reload';
$response = trim(event_socket_request($fp, $cmd));
$msg = '<strong>Reload:</strong><pre>'.$response.'</pre>';
}
}
if (!function_exists('switch_dingaling_status')) {
function switch_dingaling_status($profile_username, $result_type = 'xml') {
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
$cmd = 'api dingaling status';
$response = trim(event_socket_request($fp, $cmd));
$response = explode("\n", $response);
$x = 0;
foreach ($response as $row) {
if ($x > 1) {
$dingaling = explode("|", $row);
if ($profile_username == trim($dingaling[0])) {
return trim($dingaling[1]);
}
}
$x++;
}
}
}
}
//get a list of assigned extensions for this user
$sql = "";
$sql .= "select * from v_xmpp ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$x = 0;
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$profiles_array[$x] = $row;
$profiles_array[$x]['status'] = switch_dingaling_status($row['username'].'/talk');
$x++;
}
unset ($prep_statement);
//include the view
include "profile_list.php";
//include the footer
require_once "includes/footer.php";
?>