-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsip_settings.phtml
120 lines (103 loc) · 3.33 KB
/
sip_settings.phtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/**
* Copyright (c) 2022 AG Projects
* https://ag-projects.com
*
* This page provides functions for management of
* SIP account settings on a remote NGNPro server
*
*/
Header('Content-Type: text/html; charset=utf-8');
require '/etc/cdrtool/global.inc';
require '/etc/cdrtool/ngnpro_engines.inc';
require 'sip_settings.php';
if ($_REQUEST['action'] == 'get_location') {
$location = get_location($_SERVER['REMOTE_ADDR']);
print $location;
exit;
}
if (strlen($_REQUEST['reseller'] || strlen($_REQUEST['customer']))) {
page_open(
array(
"sess" => "CDRTool_Session",
"auth" => "CDRTool_Auth",
"perm" => "CDRTool_Perm"
)
);
$account = $_REQUEST['account'];
$reseller = $_REQUEST['reseller'];
$customer = $_REQUEST['customer'];
$sip_engine = $_REQUEST['sip_engine'];
if ($reseller && !$customer) {
$customer = $reseller;
} elseif ($customer && !$reseller) {
$reseller = $customer;
}
$perm->check("provisioning");
global $CDRTool;
if ($CDRTool['impersonate']) {
if (preg_match("/^([1-9][0-9]*)\.([1-9][0-9]*)$/", $CDRTool['impersonate'], $m)) {
$_customer = $m[1];
$_reseller = $m[2];
if ($_customer == $_reseller) {
$login_type = 'reseller';
} else {
$login_type = 'customer';
}
$login_credentials=array(
'customer' => $_customer,
'reseller' => $_reseller,
'login_type' => $login_type
);
} elseif ($CDRTool['impersonate'] == '0' || $CDRTool['impersonate'] = '0.0') {
$login_credentials = array(
'customer' => $customer,
'reseller' => $reseller,
'login_type' => 'admin'
);
} else {
page_close();
printf("Error: Invalid impersonate value %s", $CDRTool['impersonate']);
exit;
}
} else {
page_close();
printf("Error: Missing impersonate setting");
exit;
}
} else {
page_open(
array(
"sess" => "SIP_Subscriber_Session",
"auth" => "SIP_Subscriber_Auth"
)
);
$account = $SIP['account'];
$reseller = $SIP['reseller'];
$customer = $SIP['customer'];
$sip_engine = $SIP['engine'];
$login_type = "subscriber";
$login_credentials = array(
'login_type' => $login_type,
'customer' => $customer,
'reseller' => $reseller,
'sip_engine' => $sip_engine
);
}
$_class = 'SipSettings';
$_reseller_class = $_class.$reseller;
if (class_exists($_reseller_class)) {
$SipSettings_class = $_reseller_class;
} else {
$SipSettings_class = $_class;
}
if ($resellerFilters[$login_credentials['reseller']]['sip_engine']) {
$login_credentials['sip_engine'] = $resellerFilters[$login_credentials['reseller']]['sip_engine'];
} elseif ($_REQUEST['sip_engine']) {
$login_credentials['sip_engine'] = $_REQUEST['sip_engine'];
} elseif ($resellerFilters['default']['sip_engine']) {
$login_credentials['sip_engine'] = $resellerFilters['default']['sip_engine'];
}
renderUI($SipSettings_class, $account, $login_credentials, $soapEngines);
page_close();
?>