@@ -24,247 +24,247 @@ discard block |
||
24 | 24 | |
25 | 25 | class Freeswitch extends MX_Controller { |
26 | 26 | |
27 | - function Freeswitch() { |
|
28 | - parent::__construct(); |
|
27 | + function Freeswitch() { |
|
28 | + parent::__construct(); |
|
29 | 29 | |
30 | - $this->load->helper('template_inheritance'); |
|
30 | + $this->load->helper('template_inheritance'); |
|
31 | 31 | |
32 | - $this->load->library('session'); |
|
33 | - $this->load->library("freeswitch_form"); |
|
34 | - $this->load->library('astpp/form'); |
|
35 | - $this->load->library('freeswitch_lib'); |
|
36 | - $this->load->model('freeswitch_model'); |
|
32 | + $this->load->library('session'); |
|
33 | + $this->load->library("freeswitch_form"); |
|
34 | + $this->load->library('astpp/form'); |
|
35 | + $this->load->library('freeswitch_lib'); |
|
36 | + $this->load->model('freeswitch_model'); |
|
37 | 37 | |
38 | - if ($this->session->userdata('user_login') == FALSE) |
|
39 | - redirect(base_url() . '/astpp/login'); |
|
40 | - } |
|
38 | + if ($this->session->userdata('user_login') == FALSE) |
|
39 | + redirect(base_url() . '/astpp/login'); |
|
40 | + } |
|
41 | 41 | |
42 | - function fssipdevices_add($type = "") { |
|
43 | - $data['username'] = $this->session->userdata('user_name'); |
|
44 | - $account_data = $this->session->userdata("accountinfo"); |
|
45 | - $data['flag'] = 'create'; |
|
46 | - $data['page_title'] = 'Create SIP Device'; |
|
47 | - if($account_data['type'] == '-1' || $account_data['type'] == '1') |
|
48 | - { |
|
49 | - $data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($type), ''); |
|
50 | - $this->load->view('view_freeswitch_add_edit', $data); |
|
51 | - } else { |
|
52 | - $data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields(), ''); |
|
53 | - $this->load->view('view_freeswitch_customer_add_edit', $data); |
|
54 | - } |
|
55 | - } |
|
56 | - function customer_fssipdevices_add($accountid) { |
|
57 | - $data['username'] = $this->session->userdata('user_name'); |
|
58 | - $account_data = $this->session->userdata("accountinfo"); |
|
59 | - $data['page_title'] = 'Create SIP Device'; |
|
60 | - $data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid),""); |
|
61 | - if($account_data['type'] == '-1' || $account_data['type'] == '1') |
|
62 | - { |
|
63 | - $this->load->view('view_freeswitch_add_edit', $data); |
|
64 | - }else{ |
|
65 | - $this->load->view('view_freeswitch_customer_add_edit', $data); |
|
66 | - } |
|
67 | - } |
|
42 | + function fssipdevices_add($type = "") { |
|
43 | + $data['username'] = $this->session->userdata('user_name'); |
|
44 | + $account_data = $this->session->userdata("accountinfo"); |
|
45 | + $data['flag'] = 'create'; |
|
46 | + $data['page_title'] = 'Create SIP Device'; |
|
47 | + if($account_data['type'] == '-1' || $account_data['type'] == '1') |
|
48 | + { |
|
49 | + $data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($type), ''); |
|
50 | + $this->load->view('view_freeswitch_add_edit', $data); |
|
51 | + } else { |
|
52 | + $data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields(), ''); |
|
53 | + $this->load->view('view_freeswitch_customer_add_edit', $data); |
|
54 | + } |
|
55 | + } |
|
56 | + function customer_fssipdevices_add($accountid) { |
|
57 | + $data['username'] = $this->session->userdata('user_name'); |
|
58 | + $account_data = $this->session->userdata("accountinfo"); |
|
59 | + $data['page_title'] = 'Create SIP Device'; |
|
60 | + $data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid),""); |
|
61 | + if($account_data['type'] == '-1' || $account_data['type'] == '1') |
|
62 | + { |
|
63 | + $this->load->view('view_freeswitch_add_edit', $data); |
|
64 | + }else{ |
|
65 | + $this->load->view('view_freeswitch_customer_add_edit', $data); |
|
66 | + } |
|
67 | + } |
|
68 | 68 | |
69 | - function fssipdevices_edit($edit_id = '') { |
|
70 | - $data['page_title'] = 'Edit SIP Device'; |
|
71 | - $account_data = $this->session->userdata("accountinfo"); |
|
72 | - $where = array('id' => $edit_id); |
|
73 | - $account = $this->freeswitch_model->get_edited_data($edit_id); |
|
74 | - if($account_data['type'] == '-1') |
|
75 | - { |
|
69 | + function fssipdevices_edit($edit_id = '') { |
|
70 | + $data['page_title'] = 'Edit SIP Device'; |
|
71 | + $account_data = $this->session->userdata("accountinfo"); |
|
72 | + $where = array('id' => $edit_id); |
|
73 | + $account = $this->freeswitch_model->get_edited_data($edit_id); |
|
74 | + if($account_data['type'] == '-1') |
|
75 | + { |
|
76 | 76 | $data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields($edit_id), $account); |
77 | 77 | $this->load->view('view_freeswitch_add_edit', $data); |
78 | - }else{ |
|
79 | - $data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields($edit_id), $account); |
|
80 | - $this->load->view('view_freeswitch_customer_add_edit', $data); |
|
81 | - } |
|
82 | - } |
|
78 | + }else{ |
|
79 | + $data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields($edit_id), $account); |
|
80 | + $this->load->view('view_freeswitch_customer_add_edit', $data); |
|
81 | + } |
|
82 | + } |
|
83 | 83 | |
84 | - function customer_fssipdevices_edit($edit_id, $accountid) { |
|
85 | - $data['username'] = $this->session->userdata('user_name'); |
|
86 | - $account_data = $this->session->userdata("accountinfo"); |
|
87 | - $data['page_title'] = 'Edit SIP device'; |
|
88 | - $where = array('id' => $edit_id); |
|
89 | - $account = $this->freeswitch_model->get_edited_data($edit_id); |
|
90 | - if($account_data['type'] == '-1' || $account_data['type'] == '1') |
|
91 | - { |
|
92 | - $data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid,$edit_id), $account); |
|
93 | - $this->load->view('view_freeswitch_add_edit', $data); |
|
94 | - }else{ |
|
84 | + function customer_fssipdevices_edit($edit_id, $accountid) { |
|
85 | + $data['username'] = $this->session->userdata('user_name'); |
|
86 | + $account_data = $this->session->userdata("accountinfo"); |
|
87 | + $data['page_title'] = 'Edit SIP device'; |
|
88 | + $where = array('id' => $edit_id); |
|
89 | + $account = $this->freeswitch_model->get_edited_data($edit_id); |
|
90 | + if($account_data['type'] == '-1' || $account_data['type'] == '1') |
|
91 | + { |
|
92 | + $data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid,$edit_id), $account); |
|
93 | + $this->load->view('view_freeswitch_add_edit', $data); |
|
94 | + }else{ |
|
95 | 95 | |
96 | - $data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid,$edit_id), $account); |
|
97 | - $this->load->view('view_freeswitch_customer_add_edit', $data); |
|
98 | - } |
|
99 | - } |
|
96 | + $data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid,$edit_id), $account); |
|
97 | + $this->load->view('view_freeswitch_customer_add_edit', $data); |
|
98 | + } |
|
99 | + } |
|
100 | 100 | |
101 | - function fsgateway_search() { |
|
102 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
101 | + function fsgateway_search() { |
|
102 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
103 | 103 | |
104 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
105 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
106 | - $action = $this->input->post(); |
|
107 | - unset($action['action']); |
|
108 | - unset($action['advance_search']); |
|
109 | - $this->session->set_userdata('fsgateway_list_search', $action); |
|
110 | - } |
|
111 | - if (@$ajax_search != 1) { |
|
112 | - redirect(base_url() . 'freeswitch/fsgateway/'); |
|
113 | - } |
|
114 | - } |
|
115 | - function fssipprofile_search() { |
|
116 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
104 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
105 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
106 | + $action = $this->input->post(); |
|
107 | + unset($action['action']); |
|
108 | + unset($action['advance_search']); |
|
109 | + $this->session->set_userdata('fsgateway_list_search', $action); |
|
110 | + } |
|
111 | + if (@$ajax_search != 1) { |
|
112 | + redirect(base_url() . 'freeswitch/fsgateway/'); |
|
113 | + } |
|
114 | + } |
|
115 | + function fssipprofile_search() { |
|
116 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
117 | 117 | |
118 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
119 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
120 | - $action = $this->input->post(); |
|
121 | - unset($action['action']); |
|
122 | - unset($action['advance_search']); |
|
123 | - $this->session->set_userdata('fssipprofile_list_search', $action); |
|
124 | - } |
|
125 | - if (@$ajax_search != 1) { |
|
126 | - redirect(base_url() . 'freeswitch/fssipprofile/'); |
|
127 | - } |
|
128 | - } |
|
129 | - function fssipdevices_clearsearchfilter() { |
|
130 | - $this->session->set_userdata('advance_search', 0); |
|
131 | - $this->session->set_userdata('account_search', ""); |
|
132 | - } |
|
133 | - function fsgateway_clearsearchfilter() { |
|
134 | - $this->session->set_userdata('advance_search', 0); |
|
135 | - $this->session->set_userdata('account_search', ""); |
|
136 | - } |
|
137 | - function fssipprofile_clearsearchfilter() { |
|
138 | - $this->session->set_userdata('advance_search', 0); |
|
139 | - $this->session->set_userdata('account_search', ""); |
|
140 | - } |
|
141 | - function fssipdevices_save($user_flg = false) { |
|
142 | - $add_array = $this->input->post(); |
|
143 | - if (!$user_flg) { |
|
144 | - $data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields($add_array['id']), $add_array); |
|
145 | - } else { |
|
146 | - $data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"],$add_array['id']), $add_array); |
|
147 | - } |
|
148 | - if ($add_array['id'] != '') { |
|
149 | - $data['page_title'] = 'Freeswitch SIP Devices'; |
|
150 | - if ($this->form_validation->run() == FALSE) { |
|
151 | - $data['validation_errors'] = validation_errors(); |
|
152 | - echo $data['validation_errors']; |
|
153 | - exit; |
|
154 | - } else { |
|
155 | - $this->freeswitch_model->edit_freeswith($add_array, $add_array['id']); |
|
156 | - echo json_encode(array("SUCCESS"=> "SIP Device Updated Successfully!")); |
|
157 | - exit; |
|
158 | - } |
|
159 | - } else { |
|
160 | - $data['page_title'] = 'Create Freeswitch SIP Devices'; |
|
161 | - if ($this->form_validation->run() == FALSE) { |
|
162 | - $data['validation_errors'] = validation_errors(); |
|
163 | - echo $data['validation_errors']; |
|
164 | - exit; |
|
165 | - } else { |
|
166 | - $this->freeswitch_model->add_freeswith($add_array); |
|
167 | - echo json_encode(array("SUCCESS"=> "SIP Device Added Successfully!")); |
|
168 | - exit; |
|
169 | - } |
|
170 | - } |
|
171 | - } |
|
172 | - function customer_fssipdevices_save($user_flg = false) { |
|
173 | - $add_array = $this->input->post(); |
|
174 | - if (!$user_flg) { |
|
175 | - $data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields(), $add_array); |
|
176 | - } else { |
|
177 | - $data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"],$add_array['id']), $add_array); |
|
178 | - } |
|
179 | - if ($add_array['id'] != '') { |
|
180 | - $data['page_title'] = 'Edit Freeswitch SIP Devices'; |
|
181 | - if ($this->form_validation->run() == FALSE) { |
|
182 | - $data['validation_errors'] = validation_errors(); |
|
183 | - echo $data['validation_errors']; |
|
184 | - exit; |
|
185 | - } else { |
|
186 | - $this->freeswitch_model->edit_freeswith($add_array, $add_array['id']); |
|
187 | - echo json_encode(array("SUCCESS"=> "SIP Device Updated Successfully!")); |
|
188 | - exit; |
|
189 | - } |
|
190 | - } else { |
|
191 | - $data['page_title'] = 'Create Freeswitch SIP Devices'; |
|
192 | - if ($this->form_validation->run() == FALSE) { |
|
193 | - $data['validation_errors'] = validation_errors(); |
|
194 | - echo $data['validation_errors']; |
|
195 | - exit; |
|
196 | - } else { |
|
197 | - $this->freeswitch_model->add_freeswith($add_array); |
|
198 | - echo json_encode(array("SUCCESS"=> "SIP Device Added Successfully!")); |
|
199 | - exit; |
|
200 | - } |
|
201 | - } |
|
202 | - } |
|
203 | - function user_fssipdevices_save($user_flg = false) { |
|
204 | - $add_array = $this->input->post(); |
|
205 | - $data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"],$add_array['id']), $add_array); |
|
206 | - if ($add_array['id'] != '') { |
|
207 | - $data['page_title'] = 'Edit Freeswitch SIP Devices'; |
|
208 | - if ($this->form_validation->run() == FALSE) { |
|
209 | - $data['validation_errors'] = validation_errors(); |
|
210 | - echo $data['validation_errors']; |
|
211 | - exit; |
|
212 | - } else { |
|
213 | - $this->freeswitch_model->edit_freeswith($add_array, $add_array['id']); |
|
214 | - echo json_encode(array("SUCCESS"=> "SIP Device Updated Successfully!")); |
|
215 | - exit; |
|
216 | - } |
|
217 | - }else{ |
|
218 | - $data['page_title'] = 'Create Freeswitch SIP Devices'; |
|
219 | - if ($this->form_validation->run() == FALSE) { |
|
220 | - $data['validation_errors'] = validation_errors(); |
|
221 | - echo $data['validation_errors']; |
|
222 | - exit; |
|
223 | - } else { |
|
118 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
119 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
120 | + $action = $this->input->post(); |
|
121 | + unset($action['action']); |
|
122 | + unset($action['advance_search']); |
|
123 | + $this->session->set_userdata('fssipprofile_list_search', $action); |
|
124 | + } |
|
125 | + if (@$ajax_search != 1) { |
|
126 | + redirect(base_url() . 'freeswitch/fssipprofile/'); |
|
127 | + } |
|
128 | + } |
|
129 | + function fssipdevices_clearsearchfilter() { |
|
130 | + $this->session->set_userdata('advance_search', 0); |
|
131 | + $this->session->set_userdata('account_search', ""); |
|
132 | + } |
|
133 | + function fsgateway_clearsearchfilter() { |
|
134 | + $this->session->set_userdata('advance_search', 0); |
|
135 | + $this->session->set_userdata('account_search', ""); |
|
136 | + } |
|
137 | + function fssipprofile_clearsearchfilter() { |
|
138 | + $this->session->set_userdata('advance_search', 0); |
|
139 | + $this->session->set_userdata('account_search', ""); |
|
140 | + } |
|
141 | + function fssipdevices_save($user_flg = false) { |
|
142 | + $add_array = $this->input->post(); |
|
143 | + if (!$user_flg) { |
|
144 | + $data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields($add_array['id']), $add_array); |
|
145 | + } else { |
|
146 | + $data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"],$add_array['id']), $add_array); |
|
147 | + } |
|
148 | + if ($add_array['id'] != '') { |
|
149 | + $data['page_title'] = 'Freeswitch SIP Devices'; |
|
150 | + if ($this->form_validation->run() == FALSE) { |
|
151 | + $data['validation_errors'] = validation_errors(); |
|
152 | + echo $data['validation_errors']; |
|
153 | + exit; |
|
154 | + } else { |
|
155 | + $this->freeswitch_model->edit_freeswith($add_array, $add_array['id']); |
|
156 | + echo json_encode(array("SUCCESS"=> "SIP Device Updated Successfully!")); |
|
157 | + exit; |
|
158 | + } |
|
159 | + } else { |
|
160 | + $data['page_title'] = 'Create Freeswitch SIP Devices'; |
|
161 | + if ($this->form_validation->run() == FALSE) { |
|
162 | + $data['validation_errors'] = validation_errors(); |
|
163 | + echo $data['validation_errors']; |
|
164 | + exit; |
|
165 | + } else { |
|
166 | + $this->freeswitch_model->add_freeswith($add_array); |
|
167 | + echo json_encode(array("SUCCESS"=> "SIP Device Added Successfully!")); |
|
168 | + exit; |
|
169 | + } |
|
170 | + } |
|
171 | + } |
|
172 | + function customer_fssipdevices_save($user_flg = false) { |
|
173 | + $add_array = $this->input->post(); |
|
174 | + if (!$user_flg) { |
|
175 | + $data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields(), $add_array); |
|
176 | + } else { |
|
177 | + $data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"],$add_array['id']), $add_array); |
|
178 | + } |
|
179 | + if ($add_array['id'] != '') { |
|
180 | + $data['page_title'] = 'Edit Freeswitch SIP Devices'; |
|
181 | + if ($this->form_validation->run() == FALSE) { |
|
182 | + $data['validation_errors'] = validation_errors(); |
|
183 | + echo $data['validation_errors']; |
|
184 | + exit; |
|
185 | + } else { |
|
186 | + $this->freeswitch_model->edit_freeswith($add_array, $add_array['id']); |
|
187 | + echo json_encode(array("SUCCESS"=> "SIP Device Updated Successfully!")); |
|
188 | + exit; |
|
189 | + } |
|
190 | + } else { |
|
191 | + $data['page_title'] = 'Create Freeswitch SIP Devices'; |
|
192 | + if ($this->form_validation->run() == FALSE) { |
|
193 | + $data['validation_errors'] = validation_errors(); |
|
194 | + echo $data['validation_errors']; |
|
195 | + exit; |
|
196 | + } else { |
|
197 | + $this->freeswitch_model->add_freeswith($add_array); |
|
198 | + echo json_encode(array("SUCCESS"=> "SIP Device Added Successfully!")); |
|
199 | + exit; |
|
200 | + } |
|
201 | + } |
|
202 | + } |
|
203 | + function user_fssipdevices_save($user_flg = false) { |
|
204 | + $add_array = $this->input->post(); |
|
205 | + $data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"],$add_array['id']), $add_array); |
|
206 | + if ($add_array['id'] != '') { |
|
207 | + $data['page_title'] = 'Edit Freeswitch SIP Devices'; |
|
208 | + if ($this->form_validation->run() == FALSE) { |
|
209 | + $data['validation_errors'] = validation_errors(); |
|
210 | + echo $data['validation_errors']; |
|
211 | + exit; |
|
212 | + } else { |
|
213 | + $this->freeswitch_model->edit_freeswith($add_array, $add_array['id']); |
|
214 | + echo json_encode(array("SUCCESS"=> "SIP Device Updated Successfully!")); |
|
215 | + exit; |
|
216 | + } |
|
217 | + }else{ |
|
218 | + $data['page_title'] = 'Create Freeswitch SIP Devices'; |
|
219 | + if ($this->form_validation->run() == FALSE) { |
|
220 | + $data['validation_errors'] = validation_errors(); |
|
221 | + echo $data['validation_errors']; |
|
222 | + exit; |
|
223 | + } else { |
|
224 | 224 | $sip_profile_id=$this->common->get_field_name('id','sip_profiles',array('name'=>'default')); |
225 | - $this->freeswitch_model->add_freeswith($add_array); |
|
226 | - echo json_encode(array("SUCCESS"=> "SIP Device Added Successfully!")); |
|
227 | - exit; |
|
228 | - } |
|
229 | - } |
|
230 | - } |
|
225 | + $this->freeswitch_model->add_freeswith($add_array); |
|
226 | + echo json_encode(array("SUCCESS"=> "SIP Device Added Successfully!")); |
|
227 | + exit; |
|
228 | + } |
|
229 | + } |
|
230 | + } |
|
231 | 231 | |
232 | - function fssipdevices_search() { |
|
233 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
234 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
235 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
236 | - $action = $this->input->post(); |
|
237 | - unset($action['action']); |
|
238 | - unset($action['advance_search']); |
|
239 | - $this->session->set_userdata('fssipdevices_list_search', $action); |
|
240 | - } |
|
241 | - if (@$ajax_search != 1) { |
|
242 | - redirect(base_url() . 'freeswitch/fssipdevices/'); |
|
243 | - } |
|
244 | - } |
|
232 | + function fssipdevices_search() { |
|
233 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
234 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
235 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
236 | + $action = $this->input->post(); |
|
237 | + unset($action['action']); |
|
238 | + unset($action['advance_search']); |
|
239 | + $this->session->set_userdata('fssipdevices_list_search', $action); |
|
240 | + } |
|
241 | + if (@$ajax_search != 1) { |
|
242 | + redirect(base_url() . 'freeswitch/fssipdevices/'); |
|
243 | + } |
|
244 | + } |
|
245 | 245 | |
246 | 246 | |
247 | - function fssipdevices() { |
|
248 | - $data['page_title'] = 'SIP Devices'; |
|
249 | - $data['search_flag'] = true; |
|
250 | - $this->session->set_userdata('advance_search', 0); |
|
251 | - $data['grid_fields'] = $this->freeswitch_form->build_system_list_for_admin(); |
|
252 | - $data["grid_buttons"] = $this->freeswitch_form->build_grid_buttons(); |
|
253 | - $data['form_search'] = $this->form->build_serach_form($this->freeswitch_form->get_sipdevice_search_form()); |
|
254 | - $this->load->view('view_freeswitch_sip_devices_list', $data); |
|
255 | - } |
|
247 | + function fssipdevices() { |
|
248 | + $data['page_title'] = 'SIP Devices'; |
|
249 | + $data['search_flag'] = true; |
|
250 | + $this->session->set_userdata('advance_search', 0); |
|
251 | + $data['grid_fields'] = $this->freeswitch_form->build_system_list_for_admin(); |
|
252 | + $data["grid_buttons"] = $this->freeswitch_form->build_grid_buttons(); |
|
253 | + $data['form_search'] = $this->form->build_serach_form($this->freeswitch_form->get_sipdevice_search_form()); |
|
254 | + $this->load->view('view_freeswitch_sip_devices_list', $data); |
|
255 | + } |
|
256 | 256 | |
257 | 257 | /****** |
258 | 258 | ASTPP 3.0 |
259 | 259 | Admin side show voicemail details |
260 | 260 | ******/ |
261 | - function fssipdevices_json() { |
|
262 | - $json_data = array(); |
|
263 | - $count_all = $this->freeswitch_model->fs_retrieve_sip_user(false); |
|
264 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
265 | - $json_data = $paging_data["json_paging"]; |
|
266 | - $query = $this->freeswitch_model->fs_retrieve_sip_user(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
267 | - foreach ($query as $key => $value) { |
|
261 | + function fssipdevices_json() { |
|
262 | + $json_data = array(); |
|
263 | + $count_all = $this->freeswitch_model->fs_retrieve_sip_user(false); |
|
264 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
265 | + $json_data = $paging_data["json_paging"]; |
|
266 | + $query = $this->freeswitch_model->fs_retrieve_sip_user(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
267 | + foreach ($query as $key => $value) { |
|
268 | 268 | $path_true = base_url().'/assets/images/true.png'; |
269 | 269 | $path_false = base_url().'/assets/images/false.png'; |
270 | 270 | if($value['voicemail_enabled'] == 'true'){ |
@@ -272,296 +272,296 @@ discard block |
||
272 | 272 | }else{ |
273 | 273 | $voicemail_enabled ='<img src='.$path_false.' style="height:20px;width:20px;" title="Disable">'; |
274 | 274 | } |
275 | - $json_data['rows'][] = array('cell' => array( |
|
276 | - '<input type="checkbox" name="chkAll" id=' . $value['id'] . ' class="ace chkRefNos" onclick="clickchkbox(' . $value['id'] . ')" value=' . $value['id'] . '><lable class="lbl"></lable>', |
|
277 | - "<a href='/freeswitch/fssipdevices_edit/".$value['id']."' style='cursor:pointer;color:#005298;' rel='facebox_medium' title='username'>".$value['username']."</a>", |
|
275 | + $json_data['rows'][] = array('cell' => array( |
|
276 | + '<input type="checkbox" name="chkAll" id=' . $value['id'] . ' class="ace chkRefNos" onclick="clickchkbox(' . $value['id'] . ')" value=' . $value['id'] . '><lable class="lbl"></lable>', |
|
277 | + "<a href='/freeswitch/fssipdevices_edit/".$value['id']."' style='cursor:pointer;color:#005298;' rel='facebox_medium' title='username'>".$value['username']."</a>", |
|
278 | 278 | /**************************/ |
279 | - $value['password'], |
|
280 | - $this->common->get_field_name('name', '`sip_profiles', array('id' => $value['sip_profile_id'])), |
|
281 | - $this->common->get_field_name_coma_new('first_name,last_name,number', 'accounts', array('0' => $value['accountid'])), |
|
282 | - $value['effective_caller_id_name'], |
|
283 | - $value['effective_caller_id_number'], |
|
284 | - $voicemail_enabled , |
|
285 | - $this->common->get_status('status', 'sip_devices',$value), |
|
286 | - $this->common->convert_GMT_to('','',$value['creation_date']), |
|
287 | - $this->common->convert_GMT_to('','',$value['last_modified_date']), |
|
288 | - $this->get_action_buttons_fssipdevices($value['id']) |
|
289 | - )); |
|
290 | - } |
|
291 | - echo json_encode($json_data); |
|
292 | - } |
|
293 | - function fssipdevices_delete_multiple() { |
|
294 | - $ids = $this->input->post("selected_ids", true); |
|
295 | - $where = "id IN ($ids)"; |
|
296 | - $this->db->where($where); |
|
297 | - echo $this->db->delete("sip_devices"); |
|
298 | - } |
|
279 | + $value['password'], |
|
280 | + $this->common->get_field_name('name', '`sip_profiles', array('id' => $value['sip_profile_id'])), |
|
281 | + $this->common->get_field_name_coma_new('first_name,last_name,number', 'accounts', array('0' => $value['accountid'])), |
|
282 | + $value['effective_caller_id_name'], |
|
283 | + $value['effective_caller_id_number'], |
|
284 | + $voicemail_enabled , |
|
285 | + $this->common->get_status('status', 'sip_devices',$value), |
|
286 | + $this->common->convert_GMT_to('','',$value['creation_date']), |
|
287 | + $this->common->convert_GMT_to('','',$value['last_modified_date']), |
|
288 | + $this->get_action_buttons_fssipdevices($value['id']) |
|
289 | + )); |
|
290 | + } |
|
291 | + echo json_encode($json_data); |
|
292 | + } |
|
293 | + function fssipdevices_delete_multiple() { |
|
294 | + $ids = $this->input->post("selected_ids", true); |
|
295 | + $where = "id IN ($ids)"; |
|
296 | + $this->db->where($where); |
|
297 | + echo $this->db->delete("sip_devices"); |
|
298 | + } |
|
299 | 299 | |
300 | - function user_fssipdevices_delete_multiple() { |
|
301 | - $ids = $this->input->post("selected_ids", true); |
|
302 | - $where = "id IN ($ids)"; |
|
303 | - $this->db->where($where); |
|
304 | - $this->db->delete("sip_devices"); |
|
305 | - echo TRUE; |
|
306 | - } |
|
307 | - function customer_fssipdevices_delete_multiple(){ |
|
308 | - $ids = $this->input->post("selected_ids", true); |
|
309 | - $where = "id IN ($ids)"; |
|
310 | - $this->db->where($where); |
|
311 | - $this->db->delete("sip_devices"); |
|
312 | - echo TRUE; |
|
313 | - } |
|
300 | + function user_fssipdevices_delete_multiple() { |
|
301 | + $ids = $this->input->post("selected_ids", true); |
|
302 | + $where = "id IN ($ids)"; |
|
303 | + $this->db->where($where); |
|
304 | + $this->db->delete("sip_devices"); |
|
305 | + echo TRUE; |
|
306 | + } |
|
307 | + function customer_fssipdevices_delete_multiple(){ |
|
308 | + $ids = $this->input->post("selected_ids", true); |
|
309 | + $where = "id IN ($ids)"; |
|
310 | + $this->db->where($where); |
|
311 | + $this->db->delete("sip_devices"); |
|
312 | + echo TRUE; |
|
313 | + } |
|
314 | 314 | |
315 | 315 | /****** |
316 | 316 | ASTPP 3.0 |
317 | 317 | Customer side show voice mail detials |
318 | 318 | ******/ |
319 | - function customer_fssipdevices_json($accountid,$entity_type='') { |
|
320 | - $json_data = array(); |
|
321 | - $count_all = $this->freeswitch_model->get_sipdevices_list(false, $accountid,$entity_type); |
|
322 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
323 | - $json_data = $paging_data["json_paging"]; |
|
324 | - $devices_result = array(); |
|
325 | - $query = $this->freeswitch_model->get_sipdevices_list(true, $accountid,$entity_type, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
326 | - foreach ($query as $key => $value) { |
|
319 | + function customer_fssipdevices_json($accountid,$entity_type='') { |
|
320 | + $json_data = array(); |
|
321 | + $count_all = $this->freeswitch_model->get_sipdevices_list(false, $accountid,$entity_type); |
|
322 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
323 | + $json_data = $paging_data["json_paging"]; |
|
324 | + $devices_result = array(); |
|
325 | + $query = $this->freeswitch_model->get_sipdevices_list(true, $accountid,$entity_type, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
326 | + foreach ($query as $key => $value) { |
|
327 | 327 | $path_true = base_url().'/assets/images/true.png'; |
328 | 328 | $path_false = base_url().'/assets/images/false.png'; |
329 | 329 | $voicemail_enabled = $value['voicemail_enabled'] == 'true'? '<img src='.$path_true.' style="height:20px;width:20px;" title="Enable">' : '<img src='.$path_false.' style="height:20px;width:20px;" title="Disable">'; |
330 | - $json_data['rows'][] = array('cell' => array( |
|
331 | - '<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value=' .$value['id'].'><lable class="lbl"></lable>', |
|
332 | - $value['username'], |
|
333 | - $value['password'], |
|
334 | - $this->common->get_field_name('name', '`sip_profiles', array('id' => $value['sip_profile_id'])), |
|
335 | - $value['effective_caller_id_name'], |
|
336 | - $value['effective_caller_id_number'], |
|
337 | - $voicemail_enabled, |
|
338 | - $this->common->get_status('status', 'sip_devices',$value), |
|
339 | - $this->common->convert_GMT_to('','',$value['creation_date']), |
|
340 | - $this->common->convert_GMT_to('','',$value['last_modified_date']), |
|
341 | - $this->get_action_fssipdevices_buttons($value['id'], $value['accountid'],$entity_type) |
|
342 | - )); |
|
343 | - }//exit; |
|
344 | - echo json_encode($json_data); |
|
345 | - } |
|
330 | + $json_data['rows'][] = array('cell' => array( |
|
331 | + '<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value=' .$value['id'].'><lable class="lbl"></lable>', |
|
332 | + $value['username'], |
|
333 | + $value['password'], |
|
334 | + $this->common->get_field_name('name', '`sip_profiles', array('id' => $value['sip_profile_id'])), |
|
335 | + $value['effective_caller_id_name'], |
|
336 | + $value['effective_caller_id_number'], |
|
337 | + $voicemail_enabled, |
|
338 | + $this->common->get_status('status', 'sip_devices',$value), |
|
339 | + $this->common->convert_GMT_to('','',$value['creation_date']), |
|
340 | + $this->common->convert_GMT_to('','',$value['last_modified_date']), |
|
341 | + $this->get_action_fssipdevices_buttons($value['id'], $value['accountid'],$entity_type) |
|
342 | + )); |
|
343 | + }//exit; |
|
344 | + echo json_encode($json_data); |
|
345 | + } |
|
346 | 346 | /****************************/ |
347 | - function get_action_fssipdevices_buttons($id, $accountid,$entity_type='') { |
|
348 | - $ret_url = ''; |
|
349 | - if ($this->session->userdata("logintype") == '0'||$this->session->userdata("logintype") == '3') { |
|
350 | - $ret_url = '<a href="'. base_url() .'user/user_fssipdevices_action/edit/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm" rel="facebox_medium" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
|
351 | - $ret_url .= '<a href="'. base_url() .'user/user_fssipdevices_action/delete/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>'; |
|
352 | - } else { |
|
353 | - $ret_url = '<a href="'. base_url() .'accounts/'.$entity_type.'_fssipdevices_action/edit/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm" rel="facebox_medium" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
|
354 | - $ret_url .= '<a href="'. base_url() .'accounts/'.$entity_type.'_fssipdevices_action/delete/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>'; |
|
355 | - } |
|
356 | - return $ret_url; |
|
357 | - } |
|
347 | + function get_action_fssipdevices_buttons($id, $accountid,$entity_type='') { |
|
348 | + $ret_url = ''; |
|
349 | + if ($this->session->userdata("logintype") == '0'||$this->session->userdata("logintype") == '3') { |
|
350 | + $ret_url = '<a href="'. base_url() .'user/user_fssipdevices_action/edit/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm" rel="facebox_medium" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
|
351 | + $ret_url .= '<a href="'. base_url() .'user/user_fssipdevices_action/delete/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>'; |
|
352 | + } else { |
|
353 | + $ret_url = '<a href="'. base_url() .'accounts/'.$entity_type.'_fssipdevices_action/edit/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm" rel="facebox_medium" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
|
354 | + $ret_url .= '<a href="'. base_url() .'accounts/'.$entity_type.'_fssipdevices_action/delete/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>'; |
|
355 | + } |
|
356 | + return $ret_url; |
|
357 | + } |
|
358 | 358 | |
359 | - function fssipdevices_delete($id) { |
|
360 | - $this->freeswitch_model->delete_freeswith_devices($id); |
|
361 | - $this->session->set_flashdata('astpp_notification', 'SIP Device Removed Successfully!'); |
|
362 | - redirect(base_url() . 'freeswitch/fssipdevices/'); |
|
363 | - exit; |
|
364 | - } |
|
359 | + function fssipdevices_delete($id) { |
|
360 | + $this->freeswitch_model->delete_freeswith_devices($id); |
|
361 | + $this->session->set_flashdata('astpp_notification', 'SIP Device Removed Successfully!'); |
|
362 | + redirect(base_url() . 'freeswitch/fssipdevices/'); |
|
363 | + exit; |
|
364 | + } |
|
365 | 365 | |
366 | - function get_action_buttons_fssipdevices($id) { |
|
366 | + function get_action_buttons_fssipdevices($id) { |
|
367 | 367 | |
368 | - $ret_url = ''; |
|
369 | - $ret_url = '<a href="'. base_url() .'freeswitch/fssipdevices_edit/' . $id . '/" class="btn btn-royelblue btn-sm" rel="facebox_medium" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
|
370 | - $ret_url .= '<a href="'. base_url() .'freeswitch/fssipdevices_delete/' . $id . '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>'; |
|
371 | - return $ret_url; |
|
372 | - } |
|
368 | + $ret_url = ''; |
|
369 | + $ret_url = '<a href="'. base_url() .'freeswitch/fssipdevices_edit/' . $id . '/" class="btn btn-royelblue btn-sm" rel="facebox_medium" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
|
370 | + $ret_url .= '<a href="'. base_url() .'freeswitch/fssipdevices_delete/' . $id . '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>'; |
|
371 | + return $ret_url; |
|
372 | + } |
|
373 | 373 | |
374 | - function livecall_report() { |
|
374 | + function livecall_report() { |
|
375 | 375 | |
376 | - $data['username'] = $this->session->userdata('user_name'); |
|
377 | - $data['page_title'] = 'Live Call Report'; |
|
378 | - $this->load->view('view_fs_livecall_report', $data); |
|
379 | - } |
|
376 | + $data['username'] = $this->session->userdata('user_name'); |
|
377 | + $data['page_title'] = 'Live Call Report'; |
|
378 | + $this->load->view('view_fs_livecall_report', $data); |
|
379 | + } |
|
380 | 380 | |
381 | - function livecall_report_json() { |
|
382 | - $command = "api show channels"; |
|
383 | - $response = $this->freeswitch_model->reload_live_freeswitch($command); |
|
384 | - $calls = array(); |
|
385 | - $calls_final = array(); |
|
386 | - $data_header = array(); |
|
387 | - $k = 0; |
|
388 | - $data = explode("\n",$response); |
|
389 | - for ($i = 0; $i < count($data) - 2; $i++) { |
|
390 | - if (trim($data[$i]) != '') { |
|
391 | - if (count($data_header) ==0 || substr($data[$i],0,4) == "uuid") { |
|
392 | - $data_header = explode(",", $data[$i]); |
|
393 | - } else { |
|
394 | - $data_call = explode(",", $data[$i]); |
|
395 | - for ($j = 0; $j < count($data_call); $j++) { |
|
396 | - $calls[$k][@$data_header[$j]] = @$data_call[$j]; |
|
397 | - $calls_final[@$calls[$k]['uuid']] = @$calls[$k]; |
|
398 | - } |
|
399 | - $k++; |
|
400 | - } |
|
401 | - } |
|
402 | - } |
|
403 | - $json_data = array(); |
|
404 | - $count = 0; |
|
405 | - foreach ($calls as $key => $value) { |
|
406 | - if (isset($value['state']) && $value['state'] == 'CS_EXCHANGE_MEDIA') { |
|
407 | - $calls[$i]['application'] = $calls_final[$value['call_uuid']]['application']; |
|
408 | - $calls[$i]['application_data'] = $calls_final[$value['call_uuid']]['application_data']; |
|
409 | - $json_data['rows'][] = array('cell' => array( |
|
410 | - $value['created'], |
|
411 | - $value['cid_name'], |
|
412 | - $value['cid_num'], |
|
413 | - $value['ip_addr'], |
|
414 | - $value['dest'], |
|
415 | - $calls[$i]['application_data'], |
|
416 | - $value['read_codec'], |
|
417 | - $value['write_codec'], |
|
418 | - $value['callstate'], |
|
419 | - date("H:i:s", strtotime(date("Y-m-d H:i:s")) - $value['created_epoch']) |
|
420 | - )); |
|
421 | - $count++; |
|
422 | - } else { |
|
423 | - unset($calls[$i]); |
|
424 | - } |
|
425 | - } |
|
381 | + function livecall_report_json() { |
|
382 | + $command = "api show channels"; |
|
383 | + $response = $this->freeswitch_model->reload_live_freeswitch($command); |
|
384 | + $calls = array(); |
|
385 | + $calls_final = array(); |
|
386 | + $data_header = array(); |
|
387 | + $k = 0; |
|
388 | + $data = explode("\n",$response); |
|
389 | + for ($i = 0; $i < count($data) - 2; $i++) { |
|
390 | + if (trim($data[$i]) != '') { |
|
391 | + if (count($data_header) ==0 || substr($data[$i],0,4) == "uuid") { |
|
392 | + $data_header = explode(",", $data[$i]); |
|
393 | + } else { |
|
394 | + $data_call = explode(",", $data[$i]); |
|
395 | + for ($j = 0; $j < count($data_call); $j++) { |
|
396 | + $calls[$k][@$data_header[$j]] = @$data_call[$j]; |
|
397 | + $calls_final[@$calls[$k]['uuid']] = @$calls[$k]; |
|
398 | + } |
|
399 | + $k++; |
|
400 | + } |
|
401 | + } |
|
402 | + } |
|
403 | + $json_data = array(); |
|
404 | + $count = 0; |
|
405 | + foreach ($calls as $key => $value) { |
|
406 | + if (isset($value['state']) && $value['state'] == 'CS_EXCHANGE_MEDIA') { |
|
407 | + $calls[$i]['application'] = $calls_final[$value['call_uuid']]['application']; |
|
408 | + $calls[$i]['application_data'] = $calls_final[$value['call_uuid']]['application_data']; |
|
409 | + $json_data['rows'][] = array('cell' => array( |
|
410 | + $value['created'], |
|
411 | + $value['cid_name'], |
|
412 | + $value['cid_num'], |
|
413 | + $value['ip_addr'], |
|
414 | + $value['dest'], |
|
415 | + $calls[$i]['application_data'], |
|
416 | + $value['read_codec'], |
|
417 | + $value['write_codec'], |
|
418 | + $value['callstate'], |
|
419 | + date("H:i:s", strtotime(date("Y-m-d H:i:s")) - $value['created_epoch']) |
|
420 | + )); |
|
421 | + $count++; |
|
422 | + } else { |
|
423 | + unset($calls[$i]); |
|
424 | + } |
|
425 | + } |
|
426 | 426 | $json_data['page'] = 1; |
427 | - $json_data['total'] = $count; |
|
428 | - echo json_encode($json_data); |
|
429 | - } |
|
427 | + $json_data['total'] = $count; |
|
428 | + echo json_encode($json_data); |
|
429 | + } |
|
430 | 430 | |
431 | - function fsgateway() { |
|
432 | - $data['username'] = $this->session->userdata('user_name'); |
|
433 | - $data['page_title'] = 'Gateways'; |
|
431 | + function fsgateway() { |
|
432 | + $data['username'] = $this->session->userdata('user_name'); |
|
433 | + $data['page_title'] = 'Gateways'; |
|
434 | 434 | $data['search_flag'] = true; |
435 | - $this->session->set_userdata('advance_search', 0); |
|
436 | - $data['grid_fields'] = $this->freeswitch_form->build_fsgateway_list_for_admin(); |
|
437 | - $data["grid_buttons"] = $this->freeswitch_form->build_fdgateway_grid_buttons(); |
|
438 | - $data['form_search']=$this->form->build_serach_form($this->freeswitch_form->get_gateway_search_form()); |
|
439 | - $this->load->view('view_fsgateway_list', $data); |
|
440 | - } |
|
435 | + $this->session->set_userdata('advance_search', 0); |
|
436 | + $data['grid_fields'] = $this->freeswitch_form->build_fsgateway_list_for_admin(); |
|
437 | + $data["grid_buttons"] = $this->freeswitch_form->build_fdgateway_grid_buttons(); |
|
438 | + $data['form_search']=$this->form->build_serach_form($this->freeswitch_form->get_gateway_search_form()); |
|
439 | + $this->load->view('view_fsgateway_list', $data); |
|
440 | + } |
|
441 | 441 | |
442 | - function fsgateway_json() { |
|
443 | - $json_data = array(); |
|
442 | + function fsgateway_json() { |
|
443 | + $json_data = array(); |
|
444 | 444 | |
445 | - $count_all = $this->freeswitch_model->get_gateway_list(false); |
|
445 | + $count_all = $this->freeswitch_model->get_gateway_list(false); |
|
446 | 446 | |
447 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
448 | - $json_data = $paging_data["json_paging"]; |
|
449 | - $gateway_data = array(); |
|
450 | - $query = $this->freeswitch_model->get_gateway_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
451 | - $gateway_result = array(); |
|
452 | - if ($query->num_rows > 0) { |
|
453 | - $query = $query->result_array(); |
|
454 | - foreach ($query as $key => $query_value) { |
|
447 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
448 | + $json_data = $paging_data["json_paging"]; |
|
449 | + $gateway_data = array(); |
|
450 | + $query = $this->freeswitch_model->get_gateway_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
451 | + $gateway_result = array(); |
|
452 | + if ($query->num_rows > 0) { |
|
453 | + $query = $query->result_array(); |
|
454 | + foreach ($query as $key => $query_value) { |
|
455 | 455 | $gateway_data=array(); |
456 | 456 | $tmp=null; |
457 | - foreach ($query_value as $gateway_key => $gateway_val) { |
|
458 | - if ($gateway_key != "gateway_data") { |
|
459 | - $gateway_data[$gateway_key] = $gateway_val; |
|
460 | - } else { |
|
461 | - $tmp = (array) json_decode($gateway_val); |
|
462 | - } |
|
463 | - } |
|
464 | - $gateway_result[$key] = array_merge($gateway_data, $tmp); |
|
465 | - } |
|
466 | - } |
|
457 | + foreach ($query_value as $gateway_key => $gateway_val) { |
|
458 | + if ($gateway_key != "gateway_data") { |
|
459 | + $gateway_data[$gateway_key] = $gateway_val; |
|
460 | + } else { |
|
461 | + $tmp = (array) json_decode($gateway_val); |
|
462 | + } |
|
463 | + } |
|
464 | + $gateway_result[$key] = array_merge($gateway_data, $tmp); |
|
465 | + } |
|
466 | + } |
|
467 | 467 | |
468 | - $grid_fields = json_decode($this->freeswitch_form->build_fsgateway_list_for_admin()); |
|
469 | - $json_data['rows'] = $this->form->build_json_grid($gateway_result, $grid_fields); |
|
470 | - echo json_encode($json_data); |
|
471 | - } |
|
468 | + $grid_fields = json_decode($this->freeswitch_form->build_fsgateway_list_for_admin()); |
|
469 | + $json_data['rows'] = $this->form->build_json_grid($gateway_result, $grid_fields); |
|
470 | + echo json_encode($json_data); |
|
471 | + } |
|
472 | 472 | |
473 | - function fsgateway_add() { |
|
474 | - $data['username'] = $this->session->userdata('user_name'); |
|
475 | - $data['flag'] = 'create'; |
|
476 | - $data['page_title'] = 'Create Gateway'; |
|
477 | - $data['form'] = $this->form->build_form($this->freeswitch_form->get_gateway_form_fields(), ''); |
|
478 | - $this->load->view('view_fsgateway_add', $data); |
|
479 | - } |
|
473 | + function fsgateway_add() { |
|
474 | + $data['username'] = $this->session->userdata('user_name'); |
|
475 | + $data['flag'] = 'create'; |
|
476 | + $data['page_title'] = 'Create Gateway'; |
|
477 | + $data['form'] = $this->form->build_form($this->freeswitch_form->get_gateway_form_fields(), ''); |
|
478 | + $this->load->view('view_fsgateway_add', $data); |
|
479 | + } |
|
480 | 480 | |
481 | - function fsgateway_edit($edit_id = '') { |
|
482 | - $data['page_title'] = ' Edit Gateway'; |
|
483 | - $where = array('id' => $edit_id); |
|
484 | - $query = $this->db_model->getSelect("*", "gateways", $where); |
|
485 | - $query = $query->result_array(); |
|
486 | - $gateway_result = array(); |
|
487 | - foreach ($query as $key => $query_value) { |
|
488 | - foreach ($query_value as $gateway_key => $gatewau_val) { |
|
489 | - $gateway_data["status"] = isset($query_value["status"])?$query_value["status"]:""; |
|
490 | - if ($gateway_key != "gateway_data") { |
|
491 | - $gateway_data[$gateway_key] = $gatewau_val; |
|
492 | - }else if($gateway_key == "status") { |
|
493 | - $gateway_data[$gateway_key] = $gatewau_val; |
|
494 | - } |
|
495 | - /** |
|
481 | + function fsgateway_edit($edit_id = '') { |
|
482 | + $data['page_title'] = ' Edit Gateway'; |
|
483 | + $where = array('id' => $edit_id); |
|
484 | + $query = $this->db_model->getSelect("*", "gateways", $where); |
|
485 | + $query = $query->result_array(); |
|
486 | + $gateway_result = array(); |
|
487 | + foreach ($query as $key => $query_value) { |
|
488 | + foreach ($query_value as $gateway_key => $gatewau_val) { |
|
489 | + $gateway_data["status"] = isset($query_value["status"])?$query_value["status"]:""; |
|
490 | + if ($gateway_key != "gateway_data") { |
|
491 | + $gateway_data[$gateway_key] = $gatewau_val; |
|
492 | + }else if($gateway_key == "status") { |
|
493 | + $gateway_data[$gateway_key] = $gatewau_val; |
|
494 | + } |
|
495 | + /** |
|
496 | 496 | ASTPP 3.0 |
497 | 497 | put one variable with the name of dialplan variable |
498 | - **/ |
|
499 | - else if($gateway_key == "dialplan_variable") { |
|
500 | - $gateway_data[$gateway_key] = $gatewau_val; |
|
501 | - } |
|
502 | - /****************************************************/ |
|
503 | - else { |
|
504 | - $tmp = (array) json_decode($gatewau_val); |
|
505 | - $gateway_result = array_merge($gateway_data, $tmp); |
|
506 | - } |
|
507 | - } |
|
508 | - } |
|
509 | - /** |
|
498 | + **/ |
|
499 | + else if($gateway_key == "dialplan_variable") { |
|
500 | + $gateway_data[$gateway_key] = $gatewau_val; |
|
501 | + } |
|
502 | + /****************************************************/ |
|
503 | + else { |
|
504 | + $tmp = (array) json_decode($gatewau_val); |
|
505 | + $gateway_result = array_merge($gateway_data, $tmp); |
|
506 | + } |
|
507 | + } |
|
508 | + } |
|
509 | + /** |
|
510 | 510 | ASTPP 3.0 |
511 | 511 | put one variable with the name of dialplan variable |
512 | - **/ |
|
513 | - if(!empty($gateway_data['dialplan_variable']) && $gateway_data['dialplan_variable'] != ''){ |
|
514 | - $gateway_result['dialplan_variable'] = $gateway_data['dialplan_variable']; |
|
515 | - }else{ |
|
516 | - $gateway_result['dialplan_variable'] = ''; |
|
517 | - } |
|
518 | - /**********************************************************************************************/ |
|
519 | - $data['form'] = $this->form->build_form($this->freeswitch_form->get_gateway_form_fields(), $gateway_result); |
|
520 | - $this->load->view('view_fsgateway_add', $data); |
|
521 | - } |
|
512 | + **/ |
|
513 | + if(!empty($gateway_data['dialplan_variable']) && $gateway_data['dialplan_variable'] != ''){ |
|
514 | + $gateway_result['dialplan_variable'] = $gateway_data['dialplan_variable']; |
|
515 | + }else{ |
|
516 | + $gateway_result['dialplan_variable'] = ''; |
|
517 | + } |
|
518 | + /**********************************************************************************************/ |
|
519 | + $data['form'] = $this->form->build_form($this->freeswitch_form->get_gateway_form_fields(), $gateway_result); |
|
520 | + $this->load->view('view_fsgateway_add', $data); |
|
521 | + } |
|
522 | 522 | |
523 | - function fsgateway_save() { |
|
524 | - $gateway_data = $this->input->post(); |
|
525 | - $data['form'] = $this->form->build_form($this->freeswitch_form->get_gateway_form_fields(), $gateway_data); |
|
526 | - $insert_arr = array(); |
|
527 | - $gateway_arr = array(); |
|
528 | - $insert_arr['dialplan_variable'] =""; |
|
529 | - foreach ($gateway_data as $key => $gateway_value) { |
|
530 | - if ($gateway_value != "") { |
|
531 | - if ($key == "sip_profile_id") { |
|
532 | - $insert_arr['sip_profile_id'] = $gateway_data["sip_profile_id"]; |
|
533 | - } else if ($key == "name") { |
|
534 | - $insert_arr['name'] = $gateway_data["name"]; |
|
535 | - } else if ($key == "sip_profile_id") { |
|
536 | - $insert_arr['sip_profile_id'] = $gateway_data["sip_profile_id"]; |
|
537 | - } |
|
538 | - /** |
|
523 | + function fsgateway_save() { |
|
524 | + $gateway_data = $this->input->post(); |
|
525 | + $data['form'] = $this->form->build_form($this->freeswitch_form->get_gateway_form_fields(), $gateway_data); |
|
526 | + $insert_arr = array(); |
|
527 | + $gateway_arr = array(); |
|
528 | + $insert_arr['dialplan_variable'] =""; |
|
529 | + foreach ($gateway_data as $key => $gateway_value) { |
|
530 | + if ($gateway_value != "") { |
|
531 | + if ($key == "sip_profile_id") { |
|
532 | + $insert_arr['sip_profile_id'] = $gateway_data["sip_profile_id"]; |
|
533 | + } else if ($key == "name") { |
|
534 | + $insert_arr['name'] = $gateway_data["name"]; |
|
535 | + } else if ($key == "sip_profile_id") { |
|
536 | + $insert_arr['sip_profile_id'] = $gateway_data["sip_profile_id"]; |
|
537 | + } |
|
538 | + /** |
|
539 | 539 | ASTPP 3.0 |
540 | 540 | put one variable with the name of dialplan variable |
541 | - **/ |
|
542 | - else if ($key == "dialplan_variable") { |
|
543 | - $insert_arr['dialplan_variable'] = $gateway_data["dialplan_variable"]; |
|
544 | - } |
|
545 | - /*********************************************************************/ |
|
546 | - else if($key == "status") { |
|
547 | - $insert_arr[$key] = $gateway_data["status"]; |
|
548 | - } else { |
|
549 | - if ($key != "id") { |
|
550 | - $gateway_arr[$key] = $gateway_value; |
|
551 | - } |
|
552 | - } |
|
553 | - } |
|
554 | - } |
|
541 | + **/ |
|
542 | + else if ($key == "dialplan_variable") { |
|
543 | + $insert_arr['dialplan_variable'] = $gateway_data["dialplan_variable"]; |
|
544 | + } |
|
545 | + /*********************************************************************/ |
|
546 | + else if($key == "status") { |
|
547 | + $insert_arr[$key] = $gateway_data["status"]; |
|
548 | + } else { |
|
549 | + if ($key != "id") { |
|
550 | + $gateway_arr[$key] = $gateway_value; |
|
551 | + } |
|
552 | + } |
|
553 | + } |
|
554 | + } |
|
555 | 555 | |
556 | - $insert_arr["gateway_data"] = json_encode($gateway_arr); |
|
556 | + $insert_arr["gateway_data"] = json_encode($gateway_arr); |
|
557 | 557 | |
558 | - if ($gateway_data['id'] != '') { |
|
559 | - $data['page_title'] = 'Edit Gateway Details'; |
|
560 | - if ($this->form_validation->run() == FALSE) { |
|
561 | - $data['validation_errors'] = validation_errors(); |
|
562 | - echo $data['validation_errors']; |
|
563 | - exit; |
|
564 | - } else { |
|
558 | + if ($gateway_data['id'] != '') { |
|
559 | + $data['page_title'] = 'Edit Gateway Details'; |
|
560 | + if ($this->form_validation->run() == FALSE) { |
|
561 | + $data['validation_errors'] = validation_errors(); |
|
562 | + echo $data['validation_errors']; |
|
563 | + exit; |
|
564 | + } else { |
|
565 | 565 | if ( preg_match('/\s/',$insert_arr['name']) ) |
566 | 566 | { |
567 | 567 | echo json_encode(array("name_error"=> "Gateway name must not have any space.")); |
@@ -573,167 +573,167 @@ discard block |
||
573 | 573 | */ |
574 | 574 | $insert_arr['last_modified_date']=gmdate('Y-m-d H:i:s'); |
575 | 575 | /*************************************************/ |
576 | - $update = $this->db->update("gateways", $insert_arr, array('id' => $gateway_data['id'])); |
|
577 | - if ($update) { |
|
578 | - $profile_name = $this->common->get_field_name('name', 'sip_profiles', $insert_arr['sip_profile_id']); |
|
579 | - $sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $insert_arr['sip_profile_id']); |
|
580 | - $cmd = "api sofia profile ".$profile_name." killgw '".$insert_arr['name']."' "; |
|
581 | - $this->freeswitch_model->reload_freeswitch($cmd,$sip_ip); |
|
576 | + $update = $this->db->update("gateways", $insert_arr, array('id' => $gateway_data['id'])); |
|
577 | + if ($update) { |
|
578 | + $profile_name = $this->common->get_field_name('name', 'sip_profiles', $insert_arr['sip_profile_id']); |
|
579 | + $sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $insert_arr['sip_profile_id']); |
|
580 | + $cmd = "api sofia profile ".$profile_name." killgw '".$insert_arr['name']."' "; |
|
581 | + $this->freeswitch_model->reload_freeswitch($cmd,$sip_ip); |
|
582 | 582 | |
583 | - $cmd2 = "api sofia profile " . $profile_name . " rescan reloadacl reloadxml"; |
|
584 | - $this->freeswitch_model->reload_freeswitch($cmd2,$sip_ip); |
|
585 | - } |
|
586 | - echo json_encode(array("SUCCESS"=> $insert_arr['name']." Gateway Updated Successfully!")); |
|
587 | - exit; |
|
588 | - } |
|
589 | - } else { |
|
590 | - $data['page_title'] = 'Create Gateway Details'; |
|
591 | - if ($this->form_validation->run() == FALSE) { |
|
592 | - $data['validation_errors'] = validation_errors(); |
|
593 | - echo $data['validation_errors']; |
|
594 | - exit; |
|
595 | - } else { |
|
583 | + $cmd2 = "api sofia profile " . $profile_name . " rescan reloadacl reloadxml"; |
|
584 | + $this->freeswitch_model->reload_freeswitch($cmd2,$sip_ip); |
|
585 | + } |
|
586 | + echo json_encode(array("SUCCESS"=> $insert_arr['name']." Gateway Updated Successfully!")); |
|
587 | + exit; |
|
588 | + } |
|
589 | + } else { |
|
590 | + $data['page_title'] = 'Create Gateway Details'; |
|
591 | + if ($this->form_validation->run() == FALSE) { |
|
592 | + $data['validation_errors'] = validation_errors(); |
|
593 | + echo $data['validation_errors']; |
|
594 | + exit; |
|
595 | + } else { |
|
596 | 596 | if ( preg_match('/\s/',$insert_arr['name']) ) |
597 | 597 | { |
598 | 598 | echo json_encode(array("name_error"=> "Gateway name must not have any space.")); |
599 | 599 | exit; |
600 | 600 | } |
601 | - $insert_arr['created_date']=gmdate('Y-m-d H:i:s'); |
|
602 | - $insert = $this->db->insert("gateways", $insert_arr); |
|
603 | - if ($insert) { |
|
604 | - $profile_name = $this->common->get_field_name('name', 'sip_profiles', $insert_arr['sip_profile_id']); |
|
605 | - $sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $insert_arr['sip_profile_id']); |
|
606 | - $cmd = "api sofia profile " . $profile_name . " rescan reloadacl reloadxml"; |
|
607 | - $this->freeswitch_model->reload_freeswitch($cmd,$sip_ip); |
|
608 | - } |
|
609 | - echo json_encode(array("SUCCESS"=> $insert_arr['name']." Gateway Added Successfully!")); |
|
610 | - exit; |
|
611 | - } |
|
612 | - } |
|
613 | - } |
|
601 | + $insert_arr['created_date']=gmdate('Y-m-d H:i:s'); |
|
602 | + $insert = $this->db->insert("gateways", $insert_arr); |
|
603 | + if ($insert) { |
|
604 | + $profile_name = $this->common->get_field_name('name', 'sip_profiles', $insert_arr['sip_profile_id']); |
|
605 | + $sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $insert_arr['sip_profile_id']); |
|
606 | + $cmd = "api sofia profile " . $profile_name . " rescan reloadacl reloadxml"; |
|
607 | + $this->freeswitch_model->reload_freeswitch($cmd,$sip_ip); |
|
608 | + } |
|
609 | + echo json_encode(array("SUCCESS"=> $insert_arr['name']." Gateway Added Successfully!")); |
|
610 | + exit; |
|
611 | + } |
|
612 | + } |
|
613 | + } |
|
614 | 614 | |
615 | - function fsgateway_delete($gateway_id) { |
|
616 | - $delete = $this->db_model->delete("gateways", array("id" => $gateway_id)); |
|
617 | - if ($delete) { |
|
618 | - $profile_id = $this->common->get_field_name('sip_profile_id', 'gateways', $gateway_id); |
|
619 | - $profile_name = $this->common->get_field_name('name', 'sip_profiles', $profile_id); |
|
620 | - $sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $profile_id); |
|
621 | - $gateway_name = $this->common->get_field_name('name', 'gateways', $gateway_id); |
|
622 | - $cmd = "api sofia profile " . $profile_name . " killgw " . $gateway_name . " reloadxml"; |
|
623 | - $this->freeswitch_model->reload_freeswitch($cmd,$sip_ip); |
|
624 | - } |
|
615 | + function fsgateway_delete($gateway_id) { |
|
616 | + $delete = $this->db_model->delete("gateways", array("id" => $gateway_id)); |
|
617 | + if ($delete) { |
|
618 | + $profile_id = $this->common->get_field_name('sip_profile_id', 'gateways', $gateway_id); |
|
619 | + $profile_name = $this->common->get_field_name('name', 'sip_profiles', $profile_id); |
|
620 | + $sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $profile_id); |
|
621 | + $gateway_name = $this->common->get_field_name('name', 'gateways', $gateway_id); |
|
622 | + $cmd = "api sofia profile " . $profile_name . " killgw " . $gateway_name . " reloadxml"; |
|
623 | + $this->freeswitch_model->reload_freeswitch($cmd,$sip_ip); |
|
624 | + } |
|
625 | 625 | |
626 | - $this->session->set_flashdata('astpp_notification', 'Gateway Removed Successfully!'); |
|
627 | - redirect(base_url() . 'freeswitch/fsgateway/'); |
|
628 | - } |
|
626 | + $this->session->set_flashdata('astpp_notification', 'Gateway Removed Successfully!'); |
|
627 | + redirect(base_url() . 'freeswitch/fsgateway/'); |
|
628 | + } |
|
629 | 629 | |
630 | - function fsgateway_delete_multiple() { |
|
631 | - $ids = $this->input->post("selected_ids", true); |
|
632 | - $where = "id IN ($ids)"; |
|
633 | - $this->db->where($where); |
|
634 | - echo $this->db->delete("gateways"); |
|
635 | - } |
|
630 | + function fsgateway_delete_multiple() { |
|
631 | + $ids = $this->input->post("selected_ids", true); |
|
632 | + $where = "id IN ($ids)"; |
|
633 | + $this->db->where($where); |
|
634 | + echo $this->db->delete("gateways"); |
|
635 | + } |
|
636 | 636 | |
637 | - function fssipprofile() { |
|
638 | - $data['username'] = $this->session->userdata('user_name'); |
|
639 | - $data['page_title'] = 'SIP Profile'; |
|
637 | + function fssipprofile() { |
|
638 | + $data['username'] = $this->session->userdata('user_name'); |
|
639 | + $data['page_title'] = 'SIP Profile'; |
|
640 | 640 | $data['search_flag'] = true; |
641 | - $this->session->set_userdata('advance_search', 0); |
|
642 | - $data['grid_fields'] = $this->freeswitch_form->build_fssipprofile_list_for_admin(); |
|
643 | - $data["grid_buttons"] = $this->freeswitch_form->build_fssipprofile_grid_buttons(); |
|
641 | + $this->session->set_userdata('advance_search', 0); |
|
642 | + $data['grid_fields'] = $this->freeswitch_form->build_fssipprofile_list_for_admin(); |
|
643 | + $data["grid_buttons"] = $this->freeswitch_form->build_fssipprofile_grid_buttons(); |
|
644 | 644 | $data['form_search']=$this->form->build_serach_form($this->freeswitch_form->get_sipprofile_search_form()); |
645 | 645 | $data['button_name']="Add Setting"; |
646 | 646 | //$data['form_search'] = $this->form->build_serach_form($this->trunk_form->get_trunk_search_form()); |
647 | - $this->load->view('view_fssipprofile_list', $data); |
|
648 | - } |
|
647 | + $this->load->view('view_fssipprofile_list', $data); |
|
648 | + } |
|
649 | 649 | |
650 | - function fssipprofile_delete_multiple() { |
|
651 | - $ids = $this->input->post("selected_ids", true); |
|
652 | - $where = "id IN ($ids)"; |
|
653 | - $this->db->where($where); |
|
654 | - echo $this->db->delete("sip_profiles"); |
|
655 | - } |
|
650 | + function fssipprofile_delete_multiple() { |
|
651 | + $ids = $this->input->post("selected_ids", true); |
|
652 | + $where = "id IN ($ids)"; |
|
653 | + $this->db->where($where); |
|
654 | + echo $this->db->delete("sip_profiles"); |
|
655 | + } |
|
656 | 656 | |
657 | - function fssipprofile_json() { |
|
658 | - $json_data = array(); |
|
659 | - $count_all = $this->freeswitch_model->get_sipprofile_list(false); |
|
660 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
661 | - $json_data = $paging_data["json_paging"]; |
|
662 | - $gateway_data = array(); |
|
663 | - $query = $this->freeswitch_model->get_sipprofile_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
664 | - $grid_fields = json_decode($this->freeswitch_form->build_fssipprofile_list_for_admin()); |
|
665 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
657 | + function fssipprofile_json() { |
|
658 | + $json_data = array(); |
|
659 | + $count_all = $this->freeswitch_model->get_sipprofile_list(false); |
|
660 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
661 | + $json_data = $paging_data["json_paging"]; |
|
662 | + $gateway_data = array(); |
|
663 | + $query = $this->freeswitch_model->get_sipprofile_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
664 | + $grid_fields = json_decode($this->freeswitch_form->build_fssipprofile_list_for_admin()); |
|
665 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
666 | 666 | |
667 | - echo json_encode($json_data); |
|
668 | - } |
|
669 | - function fssipprofile_params_json($edited_id) |
|
670 | - { |
|
667 | + echo json_encode($json_data); |
|
668 | + } |
|
669 | + function fssipprofile_params_json($edited_id) |
|
670 | + { |
|
671 | 671 | $json_data = array(); |
672 | - $gateway_data = array(); |
|
672 | + $gateway_data = array(); |
|
673 | 673 | $where = array('id' => $edited_id); |
674 | - $query = $this->db_model->getSelect("*", "sip_profiles", $where); |
|
675 | - $query = $query->result_array(); |
|
676 | - $gateway_result = array(); |
|
677 | - $i=0; |
|
678 | - foreach ($query as $key => $query_value) { |
|
679 | - foreach ($query_value as $gateway_key => $gatewau_val) { |
|
680 | - if($gateway_key != 'id' && $gateway_key != 'name' && $gateway_key != 'sip_ip' && $gateway_key != 'sip_port'){ |
|
681 | - if ($gateway_key != "profile_data") { |
|
682 | - $gateway_data[$gateway_key] = $gatewau_val; |
|
683 | - } else { |
|
684 | - $tmp = (array) json_decode($gatewau_val); |
|
685 | - $gateway_result = array_merge($gateway_data, $tmp); |
|
686 | - } |
|
674 | + $query = $this->db_model->getSelect("*", "sip_profiles", $where); |
|
675 | + $query = $query->result_array(); |
|
676 | + $gateway_result = array(); |
|
677 | + $i=0; |
|
678 | + foreach ($query as $key => $query_value) { |
|
679 | + foreach ($query_value as $gateway_key => $gatewau_val) { |
|
680 | + if($gateway_key != 'id' && $gateway_key != 'name' && $gateway_key != 'sip_ip' && $gateway_key != 'sip_port'){ |
|
681 | + if ($gateway_key != "profile_data") { |
|
682 | + $gateway_data[$gateway_key] = $gatewau_val; |
|
683 | + } else { |
|
684 | + $tmp = (array) json_decode($gatewau_val); |
|
685 | + $gateway_result = array_merge($gateway_data, $tmp); |
|
686 | + } |
|
687 | 687 | } |
688 | - } |
|
689 | - } |
|
690 | - $paging_data = $this->form->load_grid_config(count($gateway_result), $_GET['rp'], $_GET['page']); |
|
691 | - $json_data = $paging_data["json_paging"]; |
|
688 | + } |
|
689 | + } |
|
690 | + $paging_data = $this->form->load_grid_config(count($gateway_result), $_GET['rp'], $_GET['page']); |
|
691 | + $json_data = $paging_data["json_paging"]; |
|
692 | 692 | |
693 | 693 | foreach ($gateway_result as $key => $value) { |
694 | 694 | $json_data['rows'][] = array('cell' => array( |
695 | - $key, |
|
696 | - $value, |
|
697 | - array('<a href="/freeswitch/fssipprofile_edit/'.$edited_id.'/edit/' . $key .'/" class="btn btn-royelblue btn-sm" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> <a href="/freeswitch/fssipprofile_delete_params/'.$edited_id.'/' . $key .'/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>') |
|
698 | - )); |
|
695 | + $key, |
|
696 | + $value, |
|
697 | + array('<a href="/freeswitch/fssipprofile_edit/'.$edited_id.'/edit/' . $key .'/" class="btn btn-royelblue btn-sm" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> <a href="/freeswitch/fssipprofile_delete_params/'.$edited_id.'/' . $key .'/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>') |
|
698 | + )); |
|
699 | 699 | } |
700 | - echo json_encode($json_data); |
|
701 | - } |
|
702 | - function fssipprofile_action($button_name,$id) { |
|
703 | - $where = array('id' => $id); |
|
704 | - $query = $this->db_model->getSelect("*", "sip_profiles", $where); |
|
705 | - $query = $query->result_array(); |
|
706 | - $where = array('sip_profile_id' => $id); |
|
707 | - if($button_name == "start") |
|
708 | - { |
|
709 | - $cmd = "api sofia profile " . trim($query[0]['name']) ." start"; |
|
710 | - } |
|
711 | - elseif($button_name == "stop") |
|
712 | - { |
|
713 | - $cmd= "api sofia profile stop"; |
|
714 | - } |
|
715 | - elseif($button_name == "reload") |
|
716 | - { |
|
717 | - $cmd = "api reloadxml"; |
|
718 | - } |
|
719 | - elseif($button_name == "rescan") |
|
720 | - { |
|
721 | - $cmd = "api sofia profile " . trim($query[0]['name']) . " rescan"; |
|
722 | - } |
|
700 | + echo json_encode($json_data); |
|
701 | + } |
|
702 | + function fssipprofile_action($button_name,$id) { |
|
703 | + $where = array('id' => $id); |
|
704 | + $query = $this->db_model->getSelect("*", "sip_profiles", $where); |
|
705 | + $query = $query->result_array(); |
|
706 | + $where = array('sip_profile_id' => $id); |
|
707 | + if($button_name == "start") |
|
708 | + { |
|
709 | + $cmd = "api sofia profile " . trim($query[0]['name']) ." start"; |
|
710 | + } |
|
711 | + elseif($button_name == "stop") |
|
712 | + { |
|
713 | + $cmd= "api sofia profile stop"; |
|
714 | + } |
|
715 | + elseif($button_name == "reload") |
|
716 | + { |
|
717 | + $cmd = "api reloadxml"; |
|
718 | + } |
|
719 | + elseif($button_name == "rescan") |
|
720 | + { |
|
721 | + $cmd = "api sofia profile " . trim($query[0]['name']) . " rescan"; |
|
722 | + } |
|
723 | 723 | |
724 | - $this->freeswitch_model->reload_freeswitch($cmd); |
|
724 | + $this->freeswitch_model->reload_freeswitch($cmd); |
|
725 | 725 | redirect(base_url() . 'freeswitch/fssipprofile/'); |
726 | - } |
|
727 | - function fssipprofile_add($add='') { |
|
726 | + } |
|
727 | + function fssipprofile_add($add='') { |
|
728 | 728 | |
729 | - $data['username'] = $this->session->userdata('user_name'); |
|
730 | - $data['flag'] = 'create'; |
|
731 | - $data['page_title'] = 'Create SIP Profile'; |
|
732 | - $sipprofile_data = $this->input->post(); |
|
733 | - $sipprofile_data['status']=$sipprofile_data['sipstatus']; |
|
734 | - $data['button_name']="Add Setting"; |
|
735 | - if($add == 'add') |
|
736 | - { |
|
729 | + $data['username'] = $this->session->userdata('user_name'); |
|
730 | + $data['flag'] = 'create'; |
|
731 | + $data['page_title'] = 'Create SIP Profile'; |
|
732 | + $sipprofile_data = $this->input->post(); |
|
733 | + $sipprofile_data['status']=$sipprofile_data['sipstatus']; |
|
734 | + $data['button_name']="Add Setting"; |
|
735 | + if($add == 'add') |
|
736 | + { |
|
737 | 737 | |
738 | 738 | unset($sipprofile_data['action']); |
739 | 739 | unset($sipprofile_data['sipstatus']); |
@@ -741,98 +741,98 @@ discard block |
||
741 | 741 | |
742 | 742 | if($sipprofile_data['name'] == '' || $sipprofile_data['sip_ip'] =='' || $sipprofile_data['sip_port'] =='') |
743 | 743 | { |
744 | - $this->session->set_flashdata('astpp_notification', 'Please enter All profile value!'); |
|
745 | - redirect(base_url() . 'freeswitch/fssipprofile_add/'); |
|
746 | - exit; |
|
744 | + $this->session->set_flashdata('astpp_notification', 'Please enter All profile value!'); |
|
745 | + redirect(base_url() . 'freeswitch/fssipprofile_add/'); |
|
746 | + exit; |
|
747 | 747 | } |
748 | 748 | if(preg_match('/\s/',$sipprofile_data['name'])) |
749 | 749 | { |
750 | - $this->session->set_flashdata('astpp_notification', 'SIP Profile name must not have any space!'); |
|
751 | - redirect(base_url() . 'freeswitch/fssipprofile_add/'); |
|
752 | - exit; |
|
750 | + $this->session->set_flashdata('astpp_notification', 'SIP Profile name must not have any space!'); |
|
751 | + redirect(base_url() . 'freeswitch/fssipprofile_add/'); |
|
752 | + exit; |
|
753 | 753 | } |
754 | 754 | if(!preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\z/', $sipprofile_data['sip_ip'])) |
755 | 755 | { |
756 | - $this->session->set_flashdata('astpp_notification', 'SIP IP must be proper!'); |
|
757 | - redirect(base_url() . 'freeswitch/fssipprofile_add/'); |
|
758 | - exit; |
|
756 | + $this->session->set_flashdata('astpp_notification', 'SIP IP must be proper!'); |
|
757 | + redirect(base_url() . 'freeswitch/fssipprofile_add/'); |
|
758 | + exit; |
|
759 | 759 | } |
760 | 760 | $sipprofile_data['id']=''; |
761 | 761 | $check_authentication = $this->freeswitch_model->profile_authentication($sipprofile_data); |
762 | 762 | if ($check_authentication->num_rows == 0) { |
763 | 763 | |
764 | - $sipprofile_data['created_date']=gmdate('Y-m-d H:i:s'); |
|
765 | - /** Version 2.1 |
|
766 | - * Purpose : Set default data for new created profile |
|
767 | - **/ |
|
768 | - $sipprofile_data['profile_data'] = $this->common->sip_profile_date(); |
|
769 | - /**====================================================================*/ |
|
770 | - $insert = $this->db->insert("sip_profiles", $sipprofile_data); |
|
764 | + $sipprofile_data['created_date']=gmdate('Y-m-d H:i:s'); |
|
765 | + /** Version 2.1 |
|
766 | + * Purpose : Set default data for new created profile |
|
767 | + **/ |
|
768 | + $sipprofile_data['profile_data'] = $this->common->sip_profile_date(); |
|
769 | + /**====================================================================*/ |
|
770 | + $insert = $this->db->insert("sip_profiles", $sipprofile_data); |
|
771 | 771 | |
772 | - } |
|
773 | - else { |
|
774 | - $this->session->set_flashdata('astpp_notification', 'Duplicate SIP IP OR Port found it must be unique!'); |
|
775 | - redirect(base_url() . 'freeswitch/fssipprofile_add/'); |
|
776 | - } |
|
777 | - $this->session->set_flashdata('astpp_errormsg', 'SIP Profile Added Successfully!'); |
|
778 | - redirect(base_url() . 'freeswitch/fssipprofile/'); |
|
779 | - } |
|
772 | + } |
|
773 | + else { |
|
774 | + $this->session->set_flashdata('astpp_notification', 'Duplicate SIP IP OR Port found it must be unique!'); |
|
775 | + redirect(base_url() . 'freeswitch/fssipprofile_add/'); |
|
776 | + } |
|
777 | + $this->session->set_flashdata('astpp_errormsg', 'SIP Profile Added Successfully!'); |
|
778 | + redirect(base_url() . 'freeswitch/fssipprofile/'); |
|
779 | + } |
|
780 | 780 | |
781 | - if($add == 'edit') |
|
782 | - { |
|
781 | + if($add == 'edit') |
|
782 | + { |
|
783 | 783 | $check_authentication = $this->freeswitch_model->profile_authentication($sipprofile_data); |
784 | - unset($sipprofile_data['action']); |
|
785 | - unset($sipprofile_data['sipstatus']); |
|
786 | - $insert_arr = $sipprofile_data; |
|
787 | - if ($check_authentication->num_rows == 0) { |
|
788 | - $insert_arr['last_modified_date']=gmdate("Y-m-d H:i:s"); |
|
789 | - $update = $this->db->update("sip_profiles", $insert_arr, array('id' => $sipprofile_data['id'])); |
|
790 | - $this->session->set_flashdata('astpp_errormsg', $sipprofile_data['name']." SIP Profile Updated Successfully!"); |
|
791 | - redirect(base_url() . 'freeswitch/fssipprofile/'); |
|
792 | - exit; |
|
793 | - } else { |
|
794 | - $this->session->set_flashdata('astpp_notification', 'Duplicate SIP IP OR Port found it must be unique!'); |
|
795 | - redirect(base_url() . 'freeswitch/fssipprofile/'); |
|
796 | - } |
|
784 | + unset($sipprofile_data['action']); |
|
785 | + unset($sipprofile_data['sipstatus']); |
|
786 | + $insert_arr = $sipprofile_data; |
|
787 | + if ($check_authentication->num_rows == 0) { |
|
788 | + $insert_arr['last_modified_date']=gmdate("Y-m-d H:i:s"); |
|
789 | + $update = $this->db->update("sip_profiles", $insert_arr, array('id' => $sipprofile_data['id'])); |
|
790 | + $this->session->set_flashdata('astpp_errormsg', $sipprofile_data['name']." SIP Profile Updated Successfully!"); |
|
791 | + redirect(base_url() . 'freeswitch/fssipprofile/'); |
|
792 | + exit; |
|
793 | + } else { |
|
794 | + $this->session->set_flashdata('astpp_notification', 'Duplicate SIP IP OR Port found it must be unique!'); |
|
795 | + redirect(base_url() . 'freeswitch/fssipprofile/'); |
|
796 | + } |
|
797 | 797 | redirect(base_url() . 'freeswitch/fssipprofile/'); |
798 | - } |
|
799 | - $this->load->view('view_fssipprofile_add', $data); |
|
800 | - } |
|
798 | + } |
|
799 | + $this->load->view('view_fssipprofile_add', $data); |
|
800 | + } |
|
801 | 801 | |
802 | 802 | |
803 | - function fssipprofile_edit($edit_id = '',$type='',$name_prams='') { |
|
804 | - $data['page_title'] = 'Edit SIP Profile'; |
|
805 | - $sipprofile_data = $this->input->post(); |
|
806 | - if(!$edit_id) |
|
807 | - { |
|
803 | + function fssipprofile_edit($edit_id = '',$type='',$name_prams='') { |
|
804 | + $data['page_title'] = 'Edit SIP Profile'; |
|
805 | + $sipprofile_data = $this->input->post(); |
|
806 | + if(!$edit_id) |
|
807 | + { |
|
808 | 808 | $edit_id=$sipprofile_data['id']; |
809 | - } |
|
810 | - $where = array('id' => $edit_id); |
|
811 | - $query = $this->db_model->getSelect("*", "sip_profiles", $where); |
|
812 | - $query = $query->result_array(); |
|
813 | - $gateway_result = array(); |
|
814 | - foreach ($query as $key => $query_value) { |
|
815 | - foreach ($query_value as $gateway_key => $gatewau_val) { |
|
816 | - if ($gateway_key != "profile_data") { |
|
817 | - $gateway_data[$gateway_key] = $gatewau_val; |
|
818 | - } else { |
|
819 | - $tmp = (array) json_decode($gatewau_val); |
|
820 | - $gateway_result = array_merge($gateway_data, $tmp); |
|
821 | - } |
|
822 | - } |
|
823 | - } |
|
824 | - $data['grid_fields'] = $this->freeswitch_form->build_fssipprofile_params_list_for_admin(); |
|
825 | - $data['edited_id'] = $edit_id; |
|
826 | - $data['sip_name']=$query[0]['name']; |
|
809 | + } |
|
810 | + $where = array('id' => $edit_id); |
|
811 | + $query = $this->db_model->getSelect("*", "sip_profiles", $where); |
|
812 | + $query = $query->result_array(); |
|
813 | + $gateway_result = array(); |
|
814 | + foreach ($query as $key => $query_value) { |
|
815 | + foreach ($query_value as $gateway_key => $gatewau_val) { |
|
816 | + if ($gateway_key != "profile_data") { |
|
817 | + $gateway_data[$gateway_key] = $gatewau_val; |
|
818 | + } else { |
|
819 | + $tmp = (array) json_decode($gatewau_val); |
|
820 | + $gateway_result = array_merge($gateway_data, $tmp); |
|
821 | + } |
|
822 | + } |
|
823 | + } |
|
824 | + $data['grid_fields'] = $this->freeswitch_form->build_fssipprofile_params_list_for_admin(); |
|
825 | + $data['edited_id'] = $edit_id; |
|
826 | + $data['sip_name']=$query[0]['name']; |
|
827 | 827 | $data['status']=$query[0]['status']; |
828 | 828 | $data['sip_ip']= $query[0]['sip_ip']; |
829 | 829 | $data['sip_port']=$query[0]['sip_port']; |
830 | 830 | $data['id']=$query[0]['id']; |
831 | - $data['button_name']="Add Setting"; |
|
832 | - if($type == 'edit' || isset($sipprofile_data['type']) && $sipprofile_data['type'] == 'save') |
|
833 | - { |
|
834 | - if($type == 'edit') |
|
835 | - { |
|
831 | + $data['button_name']="Add Setting"; |
|
832 | + if($type == 'edit' || isset($sipprofile_data['type']) && $sipprofile_data['type'] == 'save') |
|
833 | + { |
|
834 | + if($type == 'edit') |
|
835 | + { |
|
836 | 836 | $data['params_name']=$name_prams; |
837 | 837 | $data['params_status']=0; |
838 | 838 | if($gateway_result[$name_prams] == "true" || $gateway_result[$name_prams] == "false") |
@@ -841,192 +841,192 @@ discard block |
||
841 | 841 | } |
842 | 842 | $data['params_value']=$gateway_result[$name_prams]; |
843 | 843 | $data['button_name']="Update Setting"; |
844 | - } |
|
845 | - if(isset($sipprofile_data['type']) && $sipprofile_data['type'] == 'save'){ |
|
844 | + } |
|
845 | + if(isset($sipprofile_data['type']) && $sipprofile_data['type'] == 'save'){ |
|
846 | 846 | $sipprofile_data = $this->input->post(); |
847 | 847 | $tmp[$sipprofile_data['params_name']]=$sipprofile_data['params_value']; |
848 | 848 | $final_data= json_encode($tmp); |
849 | 849 | $insert_arr["profile_data"] = json_encode($tmp); |
850 | 850 | $update = $this->db->update("sip_profiles", $insert_arr, array('id' => $edit_id)); |
851 | 851 | if($sipprofile_data['type_settings']=="add_setting"){ |
852 | - $this->session->set_flashdata('astpp_errormsg',$data['sip_name']. " SIP Setting Added Successfully!"); |
|
853 | - }else{ |
|
854 | - $this->session->set_flashdata('astpp_errormsg',$data['sip_name']. " SIP Setting Updated Successfully!"); |
|
852 | + $this->session->set_flashdata('astpp_errormsg',$data['sip_name']. " SIP Setting Added Successfully!"); |
|
853 | + }else{ |
|
854 | + $this->session->set_flashdata('astpp_errormsg',$data['sip_name']. " SIP Setting Updated Successfully!"); |
|
855 | 855 | |
856 | - } |
|
857 | - redirect(base_url() . 'freeswitch/fssipprofile_edit/'.$sipprofile_data['id']); |
|
856 | + } |
|
857 | + redirect(base_url() . 'freeswitch/fssipprofile_edit/'.$sipprofile_data['id']); |
|
858 | 858 | exit; |
859 | 859 | |
860 | - } |
|
861 | - } |
|
862 | - $this->load->view('view_fssipprofile_edit', $data); |
|
863 | - } |
|
860 | + } |
|
861 | + } |
|
862 | + $this->load->view('view_fssipprofile_edit', $data); |
|
863 | + } |
|
864 | 864 | |
865 | 865 | function fssipprofile_save($id) { |
866 | 866 | $sipprofile_data = $this->input->post(); |
867 | 867 | $insert_arr = array(); |
868 | - $sipprofile_arr = array(); |
|
868 | + $sipprofile_arr = array(); |
|
869 | 869 | $where = array('id' => $id); |
870 | - $query = $this->db_model->getSelect("*", "sip_profiles", $where); |
|
871 | - $query = $query->result_array(); |
|
872 | - $gateway_result = array(); |
|
873 | - foreach ($query as $key => $query_value) { |
|
874 | - foreach ($query_value as $gateway_key => $gatewau_val) { |
|
875 | - if ($gateway_key != "profile_data") { |
|
876 | - $gateway_data[$gateway_key] = $gatewau_val; |
|
877 | - } else { |
|
878 | - $tmp = (array) json_decode($gatewau_val); |
|
879 | - $gateway_result = array_merge($gateway_data, $tmp); |
|
880 | - } |
|
881 | - } |
|
882 | - } |
|
883 | - $tmp[$sipprofile_data['params_name']]=$sipprofile_data['params_value']; |
|
870 | + $query = $this->db_model->getSelect("*", "sip_profiles", $where); |
|
871 | + $query = $query->result_array(); |
|
872 | + $gateway_result = array(); |
|
873 | + foreach ($query as $key => $query_value) { |
|
874 | + foreach ($query_value as $gateway_key => $gatewau_val) { |
|
875 | + if ($gateway_key != "profile_data") { |
|
876 | + $gateway_data[$gateway_key] = $gatewau_val; |
|
877 | + } else { |
|
878 | + $tmp = (array) json_decode($gatewau_val); |
|
879 | + $gateway_result = array_merge($gateway_data, $tmp); |
|
880 | + } |
|
881 | + } |
|
882 | + } |
|
883 | + $tmp[$sipprofile_data['params_name']]=$sipprofile_data['params_value']; |
|
884 | 884 | $final_data= json_encode($tmp); |
885 | 885 | $insert_arr["profile_data"] = json_encode($tmp); |
886 | 886 | $update = $this->db->update("sip_profiles", $insert_arr, array('id' => $id)); |
887 | 887 | $this->load->view('view_fssipprofile_edit', $data); |
888 | - } |
|
888 | + } |
|
889 | 889 | |
890 | - function fssipprofile_delete_params($id,$name) { |
|
890 | + function fssipprofile_delete_params($id,$name) { |
|
891 | 891 | $where = array('id' => $id); |
892 | - $query = $this->db_model->getSelect("*", "sip_profiles", $where); |
|
893 | - $query = $query->result_array(); |
|
894 | - $gateway_result = array(); |
|
895 | - foreach ($query as $key => $query_value) { |
|
896 | - foreach ($query_value as $gateway_key => $gatewau_val) { |
|
897 | - if ($gateway_key != "profile_data") { |
|
898 | - $gateway_data[$gateway_key] = $gatewau_val; |
|
899 | - } else { |
|
900 | - $tmp = (array) json_decode($gatewau_val); |
|
901 | - $gateway_result = array_merge($gateway_data, $tmp); |
|
902 | - } |
|
903 | - } |
|
904 | - } |
|
892 | + $query = $this->db_model->getSelect("*", "sip_profiles", $where); |
|
893 | + $query = $query->result_array(); |
|
894 | + $gateway_result = array(); |
|
895 | + foreach ($query as $key => $query_value) { |
|
896 | + foreach ($query_value as $gateway_key => $gatewau_val) { |
|
897 | + if ($gateway_key != "profile_data") { |
|
898 | + $gateway_data[$gateway_key] = $gatewau_val; |
|
899 | + } else { |
|
900 | + $tmp = (array) json_decode($gatewau_val); |
|
901 | + $gateway_result = array_merge($gateway_data, $tmp); |
|
902 | + } |
|
903 | + } |
|
904 | + } |
|
905 | 905 | if(isset($tmp[$name])){ |
906 | 906 | unset($tmp[$name]); |
907 | 907 | } |
908 | 908 | $insert_arr["profile_data"] = json_encode($tmp); |
909 | 909 | $update = $this->db->update("sip_profiles", $insert_arr, array('id' => $id)); |
910 | - $this->session->set_flashdata('astpp_notification', $name.' SIP Setting Removed Successfully!'); |
|
911 | - redirect(base_url() . 'freeswitch/fssipprofile_edit/'.$id); |
|
912 | - } |
|
910 | + $this->session->set_flashdata('astpp_notification', $name.' SIP Setting Removed Successfully!'); |
|
911 | + redirect(base_url() . 'freeswitch/fssipprofile_edit/'.$id); |
|
912 | + } |
|
913 | 913 | |
914 | - function fssipprofile_delete($profile_id) { |
|
914 | + function fssipprofile_delete($profile_id) { |
|
915 | 915 | $profile_name = $this->common->get_field_name('name', 'sip_profiles', $profile_id); |
916 | - $sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $profile_id); |
|
916 | + $sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $profile_id); |
|
917 | 917 | $delete = $this->db_model->delete("sip_profiles", array("id" => $profile_id)); |
918 | - $this->session->set_flashdata('astpp_notification', 'SIP Profile Removed Successfully!'); |
|
919 | - redirect(base_url() . 'freeswitch/fssipprofile/'); |
|
920 | - } |
|
918 | + $this->session->set_flashdata('astpp_notification', 'SIP Profile Removed Successfully!'); |
|
919 | + redirect(base_url() . 'freeswitch/fssipprofile/'); |
|
920 | + } |
|
921 | 921 | |
922 | - function fsserver_list() { |
|
922 | + function fsserver_list() { |
|
923 | 923 | |
924 | - $data['username'] = $this->session->userdata('user_name'); |
|
925 | - $data['page_title'] = 'Freeswitch Servers'; |
|
926 | - $data['search_flag'] = true; |
|
927 | - $data['cur_menu_no'] = 1; |
|
928 | - $this->session->set_userdata('advance_search', 0); |
|
929 | - $data['grid_fields'] = $this->freeswitch_form->build_fsserver_list(); |
|
930 | - $data["grid_buttons"] = $this->freeswitch_form->build_fsserver_grid_buttons(); |
|
924 | + $data['username'] = $this->session->userdata('user_name'); |
|
925 | + $data['page_title'] = 'Freeswitch Servers'; |
|
926 | + $data['search_flag'] = true; |
|
927 | + $data['cur_menu_no'] = 1; |
|
928 | + $this->session->set_userdata('advance_search', 0); |
|
929 | + $data['grid_fields'] = $this->freeswitch_form->build_fsserver_list(); |
|
930 | + $data["grid_buttons"] = $this->freeswitch_form->build_fsserver_grid_buttons(); |
|
931 | 931 | |
932 | - $data['form_search'] = $this->form->build_serach_form($this->freeswitch_form->get_search_fsserver_form()); |
|
933 | - $this->load->view('view_fsserver_list', $data); |
|
934 | - } |
|
932 | + $data['form_search'] = $this->form->build_serach_form($this->freeswitch_form->get_search_fsserver_form()); |
|
933 | + $this->load->view('view_fsserver_list', $data); |
|
934 | + } |
|
935 | 935 | |
936 | - /** |
|
937 | - * -------Here we write code for controller accounts functions account_list------ |
|
938 | - * Listing of Accounts table data through php function json_encode |
|
939 | - */ |
|
940 | - function fsserver_list_json() { |
|
941 | - $json_data = array(); |
|
936 | + /** |
|
937 | + * -------Here we write code for controller accounts functions account_list------ |
|
938 | + * Listing of Accounts table data through php function json_encode |
|
939 | + */ |
|
940 | + function fsserver_list_json() { |
|
941 | + $json_data = array(); |
|
942 | 942 | |
943 | - $count_all = $this->freeswitch_model->get_fsserver_list(false); |
|
944 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
945 | - $json_data = $paging_data["json_paging"]; |
|
946 | - $query = $this->freeswitch_model->get_fsserver_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
947 | - $grid_fields = json_decode($this->freeswitch_form->build_fsserver_list()); |
|
948 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
943 | + $count_all = $this->freeswitch_model->get_fsserver_list(false); |
|
944 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
945 | + $json_data = $paging_data["json_paging"]; |
|
946 | + $query = $this->freeswitch_model->get_fsserver_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
947 | + $grid_fields = json_decode($this->freeswitch_form->build_fsserver_list()); |
|
948 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
949 | 949 | |
950 | - echo json_encode($json_data); |
|
951 | - } |
|
950 | + echo json_encode($json_data); |
|
951 | + } |
|
952 | 952 | |
953 | - function fsserver_add($type = "") { |
|
954 | - $data['username'] = $this->session->userdata('user_name'); |
|
955 | - $data['flag'] = 'create'; |
|
956 | - $data['page_title'] = 'Create Freeswich Server'; |
|
957 | - $data['form'] = $this->form->build_form($this->freeswitch_form->get_form_fsserver_fields(), ''); |
|
953 | + function fsserver_add($type = "") { |
|
954 | + $data['username'] = $this->session->userdata('user_name'); |
|
955 | + $data['flag'] = 'create'; |
|
956 | + $data['page_title'] = 'Create Freeswich Server'; |
|
957 | + $data['form'] = $this->form->build_form($this->freeswitch_form->get_form_fsserver_fields(), ''); |
|
958 | 958 | |
959 | - $this->load->view('view_fsserver_add_edit', $data); |
|
960 | - } |
|
959 | + $this->load->view('view_fsserver_add_edit', $data); |
|
960 | + } |
|
961 | 961 | |
962 | - function fsserver_edit($edit_id = '') { |
|
963 | - $data['page_title'] = 'Edit Freeswich Server'; |
|
964 | - $where = array('id' => $edit_id); |
|
965 | - $account = $this->db_model->getSelect("*", "freeswich_servers", $where); |
|
966 | - foreach ($account->result_array() as $key => $value) { |
|
967 | - $edit_data = $value; |
|
968 | - } |
|
969 | - $data['form'] = $this->form->build_form($this->freeswitch_form->get_form_fsserver_fields(), $edit_data); |
|
970 | - $this->load->view('view_fsserver_add_edit', $data); |
|
971 | - } |
|
962 | + function fsserver_edit($edit_id = '') { |
|
963 | + $data['page_title'] = 'Edit Freeswich Server'; |
|
964 | + $where = array('id' => $edit_id); |
|
965 | + $account = $this->db_model->getSelect("*", "freeswich_servers", $where); |
|
966 | + foreach ($account->result_array() as $key => $value) { |
|
967 | + $edit_data = $value; |
|
968 | + } |
|
969 | + $data['form'] = $this->form->build_form($this->freeswitch_form->get_form_fsserver_fields(), $edit_data); |
|
970 | + $this->load->view('view_fsserver_add_edit', $data); |
|
971 | + } |
|
972 | 972 | |
973 | - function fsserver_save() { |
|
974 | - $add_array = $this->input->post(); |
|
973 | + function fsserver_save() { |
|
974 | + $add_array = $this->input->post(); |
|
975 | 975 | |
976 | - $data['form'] = $this->form->build_form($this->freeswitch_form->get_form_fsserver_fields(), $add_array); |
|
977 | - if ($add_array['id'] != '') { |
|
978 | - $data['page_title'] = 'Edit Freeswitch Server'; |
|
979 | - if ($this->form_validation->run() == FALSE) { |
|
980 | - $data['validation_errors'] = validation_errors(); |
|
981 | - echo $data['validation_errors']; |
|
982 | - exit; |
|
983 | - } else { |
|
984 | - $this->freeswitch_model->edit_fsserver($add_array, $add_array['id']); |
|
985 | - echo json_encode(array("SUCCESS"=> " Freeswitch Server Updated Successfully!")); |
|
986 | - exit; |
|
987 | - } |
|
988 | - } else { |
|
989 | - $data['page_title'] = 'Freeswich Server'; |
|
990 | - if ($this->form_validation->run() == FALSE) { |
|
991 | - $data['validation_errors'] = validation_errors(); |
|
992 | - echo $data['validation_errors']; |
|
993 | - exit; |
|
994 | - } else { |
|
995 | - $this->freeswitch_model->add_fssever($add_array); |
|
996 | - echo json_encode(array("SUCCESS"=> "Freeswitch Server Added Successfully!")); |
|
997 | - exit; |
|
998 | - } |
|
999 | - } |
|
1000 | - $this->load->view('view_callshop_details', $data); |
|
1001 | - } |
|
976 | + $data['form'] = $this->form->build_form($this->freeswitch_form->get_form_fsserver_fields(), $add_array); |
|
977 | + if ($add_array['id'] != '') { |
|
978 | + $data['page_title'] = 'Edit Freeswitch Server'; |
|
979 | + if ($this->form_validation->run() == FALSE) { |
|
980 | + $data['validation_errors'] = validation_errors(); |
|
981 | + echo $data['validation_errors']; |
|
982 | + exit; |
|
983 | + } else { |
|
984 | + $this->freeswitch_model->edit_fsserver($add_array, $add_array['id']); |
|
985 | + echo json_encode(array("SUCCESS"=> " Freeswitch Server Updated Successfully!")); |
|
986 | + exit; |
|
987 | + } |
|
988 | + } else { |
|
989 | + $data['page_title'] = 'Freeswich Server'; |
|
990 | + if ($this->form_validation->run() == FALSE) { |
|
991 | + $data['validation_errors'] = validation_errors(); |
|
992 | + echo $data['validation_errors']; |
|
993 | + exit; |
|
994 | + } else { |
|
995 | + $this->freeswitch_model->add_fssever($add_array); |
|
996 | + echo json_encode(array("SUCCESS"=> "Freeswitch Server Added Successfully!")); |
|
997 | + exit; |
|
998 | + } |
|
999 | + } |
|
1000 | + $this->load->view('view_callshop_details', $data); |
|
1001 | + } |
|
1002 | 1002 | |
1003 | - function fsserver_delete($id) { |
|
1004 | - $this->freeswitch_model->fsserver_delete($id); |
|
1005 | - $this->session->set_flashdata('astpp_notification', 'Freeswitch Server Removed Successfully!'); |
|
1006 | - redirect(base_url() . 'freeswitch/fsserver_list/'); |
|
1007 | - exit; |
|
1008 | - } |
|
1003 | + function fsserver_delete($id) { |
|
1004 | + $this->freeswitch_model->fsserver_delete($id); |
|
1005 | + $this->session->set_flashdata('astpp_notification', 'Freeswitch Server Removed Successfully!'); |
|
1006 | + redirect(base_url() . 'freeswitch/fsserver_list/'); |
|
1007 | + exit; |
|
1008 | + } |
|
1009 | 1009 | |
1010 | - function fsserver_list_search() { |
|
1011 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1010 | + function fsserver_list_search() { |
|
1011 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1012 | 1012 | |
1013 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1014 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1015 | - $action = $this->input->post(); |
|
1016 | - unset($action['action']); |
|
1017 | - unset($action['advance_search']); |
|
1018 | - $this->session->set_userdata('fsserver_list_search', $action); |
|
1019 | - } |
|
1020 | - if (@$ajax_search != 1) { |
|
1021 | - redirect(base_url() . 'freeswitch/fsserver_list/'); |
|
1022 | - } |
|
1023 | - } |
|
1013 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1014 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1015 | + $action = $this->input->post(); |
|
1016 | + unset($action['action']); |
|
1017 | + unset($action['advance_search']); |
|
1018 | + $this->session->set_userdata('fsserver_list_search', $action); |
|
1019 | + } |
|
1020 | + if (@$ajax_search != 1) { |
|
1021 | + redirect(base_url() . 'freeswitch/fsserver_list/'); |
|
1022 | + } |
|
1023 | + } |
|
1024 | 1024 | |
1025 | - function fsserver_list_clearsearchfilter() { |
|
1026 | - $this->session->set_userdata('advance_search', 0); |
|
1027 | - $this->session->set_userdata('account_search', ""); |
|
1028 | - } |
|
1029 | - function fssipprofile_edit_validation($id,$name){ |
|
1025 | + function fsserver_list_clearsearchfilter() { |
|
1026 | + $this->session->set_userdata('advance_search', 0); |
|
1027 | + $this->session->set_userdata('account_search', ""); |
|
1028 | + } |
|
1029 | + function fssipprofile_edit_validation($id,$name){ |
|
1030 | 1030 | $sip_profile_data=$this->common->get_field_name('profile_data','sip_profiles',$id); |
1031 | 1031 | $final_data= json_decode($sip_profile_data,true); |
1032 | 1032 | foreach($final_data as $key=>$value){ |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | } |
1038 | 1038 | echo 0; |
1039 | 1039 | return true; |
1040 | - } |
|
1040 | + } |
|
1041 | 1041 | } |
1042 | 1042 | |
1043 | 1043 | ?> |
@@ -23,480 +23,480 @@ discard block |
||
23 | 23 | ############################################################################### |
24 | 24 | |
25 | 25 | if (!defined('BASEPATH')) |
26 | - exit('No direct script access allowed'); |
|
26 | + exit('No direct script access allowed'); |
|
27 | 27 | |
28 | 28 | class Freeswitch_form { |
29 | 29 | |
30 | - function __construct() { |
|
31 | - $this->CI = & get_instance(); |
|
32 | - } |
|
30 | + function __construct() { |
|
31 | + $this->CI = & get_instance(); |
|
32 | + } |
|
33 | 33 | |
34 | - function get_freeswith_form_fields($id=false) { |
|
34 | + function get_freeswith_form_fields($id=false) { |
|
35 | 35 | $log_type = $this->CI->session->userdata("logintype"); |
36 | 36 | if($log_type == 0 || $log_type == 3 || $log_type == 1){ |
37 | - $sip_pro=null; |
|
37 | + $sip_pro=null; |
|
38 | 38 | } |
39 | 39 | else{ |
40 | - $sip_pro=array('SIP Profile', 'sip_profile_id', 'SELECT', '', 'trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', '', ''); |
|
40 | + $sip_pro=array('SIP Profile', 'sip_profile_id', 'SELECT', '', 'trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', '', ''); |
|
41 | 41 | |
42 | 42 | } |
43 | 43 | $val=$id > 0 ? 'sip_devices.username.'.$id : 'sip_devices.username'; |
44 | 44 | $uname_user = $this->CI->common->find_uniq_rendno('10', '', ''); |
45 | - $password = $this->CI->common->generate_password(); |
|
46 | - /*Edit functionality*/ |
|
47 | - $form['forms'] = array(base_url() . 'freeswitch/fssipdevices_save/', array("id" => "sipdevices_form", "name" => "sipdevices_form")); |
|
48 | - $form['Device Information'] = array( |
|
49 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
50 | - array('Username', 'INPUT', array('name' => 'fs_username', 'size' => '20', 'value'=>$uname_user,'id'=>'username1', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|xss_clean', 'tOOL TIP', 'Please Enter account number','<i style="cursor:pointer; color:#1BCB61 !important; font-size:14px; padding-left:5px; padding-top:8px; float:left;" title="Reset Password" class="change_number fa fa-refresh"></i>'), |
|
51 | - array('Password', 'INPUT', array('name' => 'fs_password', 'size' => '20', 'value'=>$password ,'id'=>'password1','class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password','<i style="cursor:pointer; color:#1BCB61 !important; font-size:14px; padding-left:5px; padding-top:8px; float:left;" title="Reset Password" class="change_pass fa fa-refresh"></i>'), |
|
45 | + $password = $this->CI->common->generate_password(); |
|
46 | + /*Edit functionality*/ |
|
47 | + $form['forms'] = array(base_url() . 'freeswitch/fssipdevices_save/', array("id" => "sipdevices_form", "name" => "sipdevices_form")); |
|
48 | + $form['Device Information'] = array( |
|
49 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
50 | + array('Username', 'INPUT', array('name' => 'fs_username', 'size' => '20', 'value'=>$uname_user,'id'=>'username1', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|xss_clean', 'tOOL TIP', 'Please Enter account number','<i style="cursor:pointer; color:#1BCB61 !important; font-size:14px; padding-left:5px; padding-top:8px; float:left;" title="Reset Password" class="change_number fa fa-refresh"></i>'), |
|
51 | + array('Password', 'INPUT', array('name' => 'fs_password', 'size' => '20', 'value'=>$password ,'id'=>'password1','class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password','<i style="cursor:pointer; color:#1BCB61 !important; font-size:14px; padding-left:5px; padding-top:8px; float:left;" title="Reset Password" class="change_pass fa fa-refresh"></i>'), |
|
52 | 52 | array('Account', 'accountcode', 'SELECT', '','trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0", "deleted" => "0")), |
53 | - array('Caller Name', 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
54 | - array('Caller Number', 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
55 | - array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
|
53 | + array('Caller Name', 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
54 | + array('Caller Number', 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
55 | + array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
|
56 | 56 | $sip_pro, |
57 | - ); |
|
57 | + ); |
|
58 | 58 | /****** |
59 | 59 | ASTPP 3.0 |
60 | 60 | Voicemail add edit |
61 | 61 | ******/ |
62 | 62 | |
63 | - $form['Voicemail Options'] = array( |
|
64 | - array('Enable', 'voicemail_enabled', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_sip_config_option'), |
|
63 | + $form['Voicemail Options'] = array( |
|
64 | + array('Enable', 'voicemail_enabled', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_sip_config_option'), |
|
65 | 65 | |
66 | 66 | array('Password', 'INPUT', array('name' => 'voicemail_password', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
67 | 67 | array('Mail To', 'INPUT', array('name' => 'voicemail_mail_to', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
68 | 68 | |
69 | - array('Attach File', 'voicemail_attach_file', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status_voicemail'), |
|
69 | + array('Attach File', 'voicemail_attach_file', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status_voicemail'), |
|
70 | 70 | |
71 | 71 | |
72 | - array('Local After Email', 'vm_keep_local_after_email', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status_voicemail'), |
|
72 | + array('Local After Email', 'vm_keep_local_after_email', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status_voicemail'), |
|
73 | 73 | |
74 | 74 | |
75 | 75 | |
76 | - array('Send all Message', 'vm_send_all_message', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status_voicemail'), |
|
76 | + array('Send all Message', 'vm_send_all_message', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status_voicemail'), |
|
77 | 77 | |
78 | 78 | |
79 | - ); |
|
79 | + ); |
|
80 | 80 | /**************************/ |
81 | - $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
82 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
81 | + $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
82 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
83 | 83 | // echo "<pre>";print_r($form);exit; |
84 | - return $form; |
|
85 | - } |
|
84 | + return $form; |
|
85 | + } |
|
86 | 86 | |
87 | - function get_freeswith_search_form() { |
|
88 | - $form['forms'] = array("", array('id' => "freeswith_search")); |
|
89 | - $form['Search'] = array( |
|
87 | + function get_freeswith_search_form() { |
|
88 | + $form['forms'] = array("", array('id' => "freeswith_search")); |
|
89 | + $form['Search'] = array( |
|
90 | 90 | |
91 | - array('SIP Profile', 'sip_profile_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', 'where_arr', ''), |
|
92 | - array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''), |
|
93 | - array('Gateway', 'gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown','where_arr', ''), |
|
94 | - array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0", "deleted" => "0")), |
|
91 | + array('SIP Profile', 'sip_profile_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', 'where_arr', ''), |
|
92 | + array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''), |
|
93 | + array('Gateway', 'gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown','where_arr', ''), |
|
94 | + array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0", "deleted" => "0")), |
|
95 | 95 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''), |
96 | 96 | array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', '')); |
97 | - $form['button_search'] = array('name' => 'action', 'id' => "freeswith_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
98 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
99 | - return $form; |
|
100 | - } |
|
101 | - |
|
102 | - function get_sipdevices_search_form_user() { |
|
103 | - $form['forms'] = array("", array('id' => "sipdevices_search")); |
|
104 | - $form['Search'] = array( |
|
105 | - array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''), |
|
106 | - array('SIP Profile', 'sip_profile_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', 'where_arr', ''), |
|
107 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
108 | - array('', 'HIDDEN', 'advance_search', '1', '', '', ''), |
|
97 | + $form['button_search'] = array('name' => 'action', 'id' => "freeswith_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
98 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
99 | + return $form; |
|
100 | + } |
|
101 | + |
|
102 | + function get_sipdevices_search_form_user() { |
|
103 | + $form['forms'] = array("", array('id' => "sipdevices_search")); |
|
104 | + $form['Search'] = array( |
|
105 | + array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''), |
|
106 | + array('SIP Profile', 'sip_profile_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', 'where_arr', ''), |
|
107 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
108 | + array('', 'HIDDEN', 'advance_search', '1', '', '', ''), |
|
109 | 109 | |
110 | 110 | |
111 | - ); |
|
112 | - $form['button_search'] = array('name' => 'action', 'id' => "sipdevices_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
113 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
114 | - return $form; |
|
115 | - } |
|
111 | + ); |
|
112 | + $form['button_search'] = array('name' => 'action', 'id' => "sipdevices_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
113 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
114 | + return $form; |
|
115 | + } |
|
116 | 116 | |
117 | - function get_gateway_search_form() { |
|
118 | - $form['forms'] = array("", array('id' => "freeswith_search")); |
|
119 | - $form['Search'] = array( |
|
117 | + function get_gateway_search_form() { |
|
118 | + $form['forms'] = array("", array('id' => "freeswith_search")); |
|
119 | + $form['Search'] = array( |
|
120 | 120 | |
121 | - array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''), |
|
121 | + array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''), |
|
122 | 122 | // array('Gateway Name', 'id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown','where_arr', ''), |
123 | - array('SIP Profile', 'sip_profile_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', 'where_arr', ''), |
|
124 | - // array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'maxlength' => '15', 'class' => "text field"), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''), |
|
123 | + array('SIP Profile', 'sip_profile_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', 'where_arr', ''), |
|
124 | + // array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'maxlength' => '15', 'class' => "text field"), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''), |
|
125 | 125 | |
126 | - array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
127 | - // array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0", "deleted" => "0")), |
|
128 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
129 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '')); |
|
130 | - $form['button_search'] = array('name' => 'action', 'id' => "fsgateway_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
131 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
132 | - return $form; |
|
133 | - } |
|
134 | - function get_sipprofile_search_form(){ |
|
126 | + array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
127 | + // array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0", "deleted" => "0")), |
|
128 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
129 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '')); |
|
130 | + $form['button_search'] = array('name' => 'action', 'id' => "fsgateway_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
131 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
132 | + return $form; |
|
133 | + } |
|
134 | + function get_sipprofile_search_form(){ |
|
135 | 135 | |
136 | - $form['forms'] = array("", array('id' => "freeswitch_search")); |
|
137 | - $form['Search'] = array( |
|
136 | + $form['forms'] = array("", array('id' => "freeswitch_search")); |
|
137 | + $form['Search'] = array( |
|
138 | 138 | |
139 | - array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''), |
|
140 | - array('SIP IP', 'INPUT', array('name' => 'sip_ip[sip_ip]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'sip_ip[sip_ip-string]', '', '', '', 'search_string_type', ''), |
|
141 | - array('SIP Port', 'INPUT', array('name' => 'sip_port[sip_port]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'sip_port[sip_port-string]', '', '', '', 'search_string_type', ''), |
|
139 | + array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''), |
|
140 | + array('SIP IP', 'INPUT', array('name' => 'sip_ip[sip_ip]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'sip_ip[sip_ip-string]', '', '', '', 'search_string_type', ''), |
|
141 | + array('SIP Port', 'INPUT', array('name' => 'sip_port[sip_port]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'sip_port[sip_port-string]', '', '', '', 'search_string_type', ''), |
|
142 | 142 | |
143 | - array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
144 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
145 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '')); |
|
146 | - $form['button_search'] = array('name' => 'action', 'id' => "fssipprofile_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
147 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
148 | - return $form; |
|
143 | + array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
144 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
145 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '')); |
|
146 | + $form['button_search'] = array('name' => 'action', 'id' => "fssipprofile_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
147 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
148 | + return $form; |
|
149 | 149 | |
150 | - } |
|
151 | - function get_sipdevice_search_form() { |
|
152 | - $form['forms'] = array("", array('id' => "freeswith_search")); |
|
153 | - $form['Search'] = array( |
|
150 | + } |
|
151 | + function get_sipdevice_search_form() { |
|
152 | + $form['forms'] = array("", array('id' => "freeswith_search")); |
|
153 | + $form['Search'] = array( |
|
154 | 154 | |
155 | - array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''), |
|
156 | - array('SIP Profile', 'sip_profile_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', 'where_arr', ''), |
|
157 | - array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"GLOBAL", "deleted" => "0")), |
|
158 | - array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
159 | - //array('Voicemail', 'vm-enabled', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_voicemail_status'), |
|
160 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', '')); |
|
161 | - $form['button_search'] = array('name' => 'action', 'id' => "fssipdevice_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
162 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
163 | - return $form; |
|
164 | - } |
|
165 | - /* |
|
155 | + array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''), |
|
156 | + array('SIP Profile', 'sip_profile_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', 'where_arr', ''), |
|
157 | + array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"GLOBAL", "deleted" => "0")), |
|
158 | + array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'), |
|
159 | + //array('Voicemail', 'vm-enabled', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_voicemail_status'), |
|
160 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', '')); |
|
161 | + $form['button_search'] = array('name' => 'action', 'id' => "fssipdevice_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
162 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
163 | + return $form; |
|
164 | + } |
|
165 | + /* |
|
166 | 166 | ASTPP 3.0 |
167 | 167 | Changes in gried size |
168 | 168 | */ |
169 | - function build_system_list_for_admin() { |
|
170 | - $grid_field_arr = json_encode(array( |
|
171 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "50", "", "", "", "","","false","center"), |
|
172 | - array("User Name", "100", "username", "", "", "","","true","center"), |
|
173 | - array("Password", "100", "password", "", "", "","","true","center"), |
|
174 | - array("SIP Profile", "100", "sip_profile_id", "name", "sip_profiles", "get_field_name","","true","center"), |
|
175 | - array("Account", "150", "accountid", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"), |
|
176 | - array("Caller Name", "100", "effective_caller_id_name", "", "", "","","true","center"), |
|
177 | - array("Caller Number", "100", "effective_caller_id_number", "", "", "","","true","center"), |
|
178 | - array("Voicemail", "100", "voicemail_enabled", "", "", "","","true","center"), |
|
179 | - array("Status", "100", "status", "status", "sip_devies", "get_status","","true","center"), |
|
180 | - array("Created Date", "130", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
181 | - array("Modified Date", "130", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
182 | - array("Action", "107", "", "", "", array("EDIT" => array("url" => "/freeswitch/fssipdevices_edit/", "mode" => "single","layout"=>"medium"), |
|
183 | - "DELETE" => array("url" => "/freeswitch/fssipdevices_delete/", "mode" => "single"))) |
|
184 | - )); |
|
185 | - return $grid_field_arr; |
|
186 | - } |
|
187 | - /*********************************/ |
|
188 | - |
|
189 | - |
|
190 | - function build_grid_buttons() { |
|
191 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fssipdevices_add/", "popup","medium"), |
|
169 | + function build_system_list_for_admin() { |
|
170 | + $grid_field_arr = json_encode(array( |
|
171 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "50", "", "", "", "","","false","center"), |
|
172 | + array("User Name", "100", "username", "", "", "","","true","center"), |
|
173 | + array("Password", "100", "password", "", "", "","","true","center"), |
|
174 | + array("SIP Profile", "100", "sip_profile_id", "name", "sip_profiles", "get_field_name","","true","center"), |
|
175 | + array("Account", "150", "accountid", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"), |
|
176 | + array("Caller Name", "100", "effective_caller_id_name", "", "", "","","true","center"), |
|
177 | + array("Caller Number", "100", "effective_caller_id_number", "", "", "","","true","center"), |
|
178 | + array("Voicemail", "100", "voicemail_enabled", "", "", "","","true","center"), |
|
179 | + array("Status", "100", "status", "status", "sip_devies", "get_status","","true","center"), |
|
180 | + array("Created Date", "130", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
181 | + array("Modified Date", "130", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
182 | + array("Action", "107", "", "", "", array("EDIT" => array("url" => "/freeswitch/fssipdevices_edit/", "mode" => "single","layout"=>"medium"), |
|
183 | + "DELETE" => array("url" => "/freeswitch/fssipdevices_delete/", "mode" => "single"))) |
|
184 | + )); |
|
185 | + return $grid_field_arr; |
|
186 | + } |
|
187 | + /*********************************/ |
|
188 | + |
|
189 | + |
|
190 | + function build_grid_buttons() { |
|
191 | + $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fssipdevices_add/", "popup","medium"), |
|
192 | 192 | array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/freeswitch/fssipdevices_delete_multiple/") |
193 | - )); |
|
194 | - return $buttons_json; |
|
195 | - } |
|
193 | + )); |
|
194 | + return $buttons_json; |
|
195 | + } |
|
196 | 196 | |
197 | - function fsdevices_build_grid_buttons($accountid) { |
|
198 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/freeswitch/customer_fssipdevices_add/$accountid/", "popup","medium"), |
|
199 | - array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/freeswitch/customer_fssipdevices_delete_multiple/") |
|
200 | - )); |
|
201 | - return $buttons_json; |
|
202 | - } |
|
203 | - |
|
204 | - function get_gateway_form_fields() { |
|
205 | - |
|
206 | - $form['forms'] = array(base_url() . 'freeswitch/fsgateway_save/', array("id" => "gateway_form", "name" => "gateway_form")); |
|
207 | - $form['Basic Information'] = array( |
|
208 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
209 | - array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Gateway Name'), |
|
210 | - array('SIP Profile', 'sip_profile_id', 'SELECT', '', '', 'tOOL TIP', '', 'id', 'name', 'sip_profiles', 'build_dropdown', '', ''), |
|
211 | - array('Username', 'INPUT', array('name' => 'username', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter user name'), |
|
212 | - array('Password', 'INPUT', array('name' => 'password', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
213 | - array('Proxy', 'INPUT', array('name' => 'proxy', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
214 | - array('Outbound-<br/>Proxy', 'INPUT', array('name' => 'outbound-proxy', 'size' => '20', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''), |
|
197 | + function fsdevices_build_grid_buttons($accountid) { |
|
198 | + $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/freeswitch/customer_fssipdevices_add/$accountid/", "popup","medium"), |
|
199 | + array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/freeswitch/customer_fssipdevices_delete_multiple/") |
|
200 | + )); |
|
201 | + return $buttons_json; |
|
202 | + } |
|
203 | + |
|
204 | + function get_gateway_form_fields() { |
|
205 | + |
|
206 | + $form['forms'] = array(base_url() . 'freeswitch/fsgateway_save/', array("id" => "gateway_form", "name" => "gateway_form")); |
|
207 | + $form['Basic Information'] = array( |
|
208 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
209 | + array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Gateway Name'), |
|
210 | + array('SIP Profile', 'sip_profile_id', 'SELECT', '', '', 'tOOL TIP', '', 'id', 'name', 'sip_profiles', 'build_dropdown', '', ''), |
|
211 | + array('Username', 'INPUT', array('name' => 'username', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter user name'), |
|
212 | + array('Password', 'INPUT', array('name' => 'password', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'), |
|
213 | + array('Proxy', 'INPUT', array('name' => 'proxy', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
214 | + array('Outbound-<br/>Proxy', 'INPUT', array('name' => 'outbound-proxy', 'size' => '20', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''), |
|
215 | 215 | array('Register', array('name' => 'register', 'class' => 'add_settings'), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
216 | - array('Caller-id-in-from', array('name' => 'caller-id-in-from', 'class' => 'add_settings'), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
217 | - array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
|
216 | + array('Caller-id-in-from', array('name' => 'caller-id-in-from', 'class' => 'add_settings'), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
217 | + array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
|
218 | 218 | |
219 | - ); |
|
220 | - $form['Optional Information'] = array( |
|
221 | - array('From- Domain', 'INPUT', array('name' => 'from_domain', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
222 | - array('From User', 'INPUT', array('name' => 'from_user', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
223 | - array('Realm', 'INPUT', array('name' => 'realm', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
224 | - array('Extension', 'INPUT', array('name' => 'extension', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
225 | - array('Expire Seconds', 'INPUT', array('name' => 'expire-seconds', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
226 | - array('Reg-<br/>Transport', 'INPUT', array('name' => 'register-transport', 'size' => '20','class' => "text field medium"), '', 'tOOL TIP', ''), |
|
227 | - array('Contact Params', 'INPUT', array('name' => 'contact-params', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
228 | - array('Ping', 'INPUT', array('name' => 'ping', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
229 | - array('Retry-<br/>Seconds', 'INPUT', array('name' => 'retry-seconds', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
230 | - array('Register-<br/>Proxy', 'INPUT', array('name' => 'register-proxy', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
231 | - array('Channel', 'INPUT', array('name' => 'channel', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
232 | - /** |
|
219 | + ); |
|
220 | + $form['Optional Information'] = array( |
|
221 | + array('From- Domain', 'INPUT', array('name' => 'from_domain', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
222 | + array('From User', 'INPUT', array('name' => 'from_user', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
223 | + array('Realm', 'INPUT', array('name' => 'realm', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
224 | + array('Extension', 'INPUT', array('name' => 'extension', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
225 | + array('Expire Seconds', 'INPUT', array('name' => 'expire-seconds', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
226 | + array('Reg-<br/>Transport', 'INPUT', array('name' => 'register-transport', 'size' => '20','class' => "text field medium"), '', 'tOOL TIP', ''), |
|
227 | + array('Contact Params', 'INPUT', array('name' => 'contact-params', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
228 | + array('Ping', 'INPUT', array('name' => 'ping', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
229 | + array('Retry-<br/>Seconds', 'INPUT', array('name' => 'retry-seconds', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
230 | + array('Register-<br/>Proxy', 'INPUT', array('name' => 'register-proxy', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
231 | + array('Channel', 'INPUT', array('name' => 'channel', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
232 | + /** |
|
233 | 233 | ASTPP 3.0 |
234 | 234 | put one variable with the name of dialplan variable |
235 | - **/ |
|
236 | - array('Dialplan Variable', 'TEXTAREA', array('name' => 'dialplan_variable', 'size' => '20','cols'=>'10','rows'=>'5', 'class' => "col_md-5 form-control", 'style'=>"width: 200px; height: 100px;font-family: Open sans,sans-serif !important;"), '', 'tOOL TIP', ''), |
|
237 | - /*********************************************************************************************************/ |
|
238 | - ); |
|
235 | + **/ |
|
236 | + array('Dialplan Variable', 'TEXTAREA', array('name' => 'dialplan_variable', 'size' => '20','cols'=>'10','rows'=>'5', 'class' => "col_md-5 form-control", 'style'=>"width: 200px; height: 100px;font-family: Open sans,sans-serif !important;"), '', 'tOOL TIP', ''), |
|
237 | + /*********************************************************************************************************/ |
|
238 | + ); |
|
239 | 239 | |
240 | - $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
241 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
240 | + $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
241 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
242 | 242 | |
243 | - return $form; |
|
244 | - } |
|
243 | + return $form; |
|
244 | + } |
|
245 | 245 | |
246 | - /* |
|
246 | + /* |
|
247 | 247 | ASTPP 3.0 |
248 | 248 | changes in grid size |
249 | 249 | */ |
250 | - function build_fsgateway_list_for_admin() { |
|
251 | - // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
252 | - $grid_field_arr = json_encode(array( |
|
253 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
250 | + function build_fsgateway_list_for_admin() { |
|
251 | + // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
252 | + $grid_field_arr = json_encode(array( |
|
253 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
254 | 254 | /** |
255 | 255 | ASTPP 3.0 |
256 | 256 | For Gateway Edit on Gateway name |
257 | 257 | **/ |
258 | - array("Name", "140", "name", "", "", "","EDITABLE","true","center"), |
|
258 | + array("Name", "140", "name", "", "", "","EDITABLE","true","center"), |
|
259 | 259 | /**********************************/ |
260 | - array("SIP Profile", "115", "sip_profile_id", "name", "sip_profiles", "get_field_name","","true","center"), |
|
261 | - array("Username", "140", "username", "", "", "","","true","center"), |
|
260 | + array("SIP Profile", "115", "sip_profile_id", "name", "sip_profiles", "get_field_name","","true","center"), |
|
261 | + array("Username", "140", "username", "", "", "","","true","center"), |
|
262 | 262 | // array("Password", "181", "password", "", "", ""), |
263 | - array("Proxy", "145", "proxy", "", "", "","","true","center"), |
|
264 | - array("Register", "120", "register", "register", "register", "convert_to_ucfirst","","true","center"), |
|
265 | - array("Caller-Id-In-Form", "130", "caller-id-in-from", "caller-id-in-from", "caller-id-in-from", "convert_to_ucfirst","","true","center"), |
|
266 | - /* |
|
263 | + array("Proxy", "145", "proxy", "", "", "","","true","center"), |
|
264 | + array("Register", "120", "register", "register", "register", "convert_to_ucfirst","","true","center"), |
|
265 | + array("Caller-Id-In-Form", "130", "caller-id-in-from", "caller-id-in-from", "caller-id-in-from", "convert_to_ucfirst","","true","center"), |
|
266 | + /* |
|
267 | 267 | ASTPP 3.0 |
268 | 268 | creation field show in grid |
269 | 269 | */ |
270 | - array("Status", "110", "status", "status", "gateways", "get_status","","true","center"), |
|
271 | - array("Created Date", "100", "created_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
272 | - array("Modified Date", "130", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
273 | - /********************************************************************/ |
|
274 | - /* |
|
270 | + array("Status", "110", "status", "status", "gateways", "get_status","","true","center"), |
|
271 | + array("Created Date", "100", "created_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
272 | + array("Modified Date", "130", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
273 | + /********************************************************************/ |
|
274 | + /* |
|
275 | 275 | ASTPP 3.0 |
276 | 276 | |
277 | 277 | status show active or inactive |
278 | 278 | */ |
279 | 279 | |
280 | - /******************************************/ |
|
281 | - array("Action", "106", "", "", "", array("EDIT" => array("url" => "/freeswitch/fsgateway_edit/", "mode" => "popup","layout"=>"medium"), |
|
282 | - "DELETE" => array("url" => "/freeswitch/fsgateway_delete/", "mode" => "single"))) |
|
283 | - )); |
|
284 | - return $grid_field_arr; |
|
285 | - } |
|
286 | - /******************************************************/ |
|
287 | - |
|
288 | - function build_fdgateway_grid_buttons() { |
|
289 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fsgateway_add/", "popup","medium"), |
|
290 | - array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/freeswitch/fsgateway_delete_multiple/") |
|
291 | - )); |
|
292 | - return $buttons_json; |
|
293 | - } |
|
294 | - |
|
295 | - function get_sipprofile_form_fields() { |
|
296 | - $form['forms'] = array(base_url() . 'freeswitch/fssipprofile_save/', array("id" => "fssipprofile_form", "name" => "fssipprofile_form")); |
|
297 | - $form['Basic Information'] = array( |
|
298 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
299 | - array('Profile name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Name'), |
|
300 | - array('sip-ip', 'INPUT', array('name' => 'sip_ip', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter SIP IP Name'), |
|
301 | - array('sip-port', 'INPUT', array('name' => 'sip_port', 'size' => '20', 'value' => '5060', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter SIP Port'), |
|
302 | - array('rtp-ip', 'INPUT', array('name' => 'rtp_ip', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
303 | - array('Dial Plan', 'INPUT', array('name' => 'dialplan', 'size' => '20', 'value' => 'XML', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
304 | - array('user-agent-string', 'INPUT', array('name' => 'user-agent-string', 'size' => '20', 'value' => 'ASTPP', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
305 | - array('debug', 'INPUT', array('name' => 'debug', 'size' => '20', 'value' => '0', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
306 | - array('sip-trace', 'sip-trace', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_drp_option'), |
|
307 | - array('tls', 'tls', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'), |
|
308 | - array('inbound-reg-force-matching-username', 'inbound-reg-force-matching-username', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
309 | - array('disable-transcoding', 'disable-transcoding', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
310 | - array('all-reg-options-ping', 'all-reg-options-ping', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
311 | - array('unregister-on-options-fail', 'unregister-on-options-fail', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
312 | - array('log-auth-failures', 'log-auth-failures', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
313 | - array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
|
314 | - ); |
|
315 | - |
|
316 | - $form['Others Information'] = array( |
|
317 | - array('inbound-bypass-media', 'inbound-bypass-media', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'), |
|
318 | - array('inbound-proxy-media', 'inbound-proxy-media', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'), |
|
319 | - array('disable-transfer', 'disable-transfer', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
320 | - array('enable-100rel', 'enable-100rel', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'), |
|
321 | - array('rtp-timeout-sec', 'INPUT', array('name' => 'rtp-timeout-sec', 'size' => '20', 'value' => '60', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
322 | - array('dtmf-duration', 'INPUT', array('name' => 'dtmf-duration', 'size' => '20', 'value' => '2000', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
323 | - array('manual-redirect','manual-redirect', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'), |
|
324 | - array('aggressive-nat-detection', 'aggressive-nat-detection', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
325 | - array('enable-Timer', 'enable-timer', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'), |
|
326 | - array('minimum-session-expires', 'INPUT', array('name' => 'minimum-session-expires', 'value' => '120', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
327 | - array('session-timeout', 'INPUT', array('name' => 'session-timeout-pt', 'value' => '1800', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
328 | - array('auth-calls', 'auth-calls', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
329 | - array('apply-inbound-acl', 'INPUT', array('name' => 'apply-inbound-acl', 'value' => 'default', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
330 | - array('inbound-codec-prefs', 'INPUT', array('name' => 'inbound-codec-prefs', 'size' => '25', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
331 | - array('outbound-codec-prefs', 'INPUT', array('name' => 'outbound-codec-prefs', 'size' => '25', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
332 | - array('inbound-late-negotiation', 'inbound-late-negotiation', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'), |
|
333 | - array('inbound-codec-negotiation', 'INPUT', array('name' => 'inbound-codec-negotiation', 'size' => '25', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
334 | - ); |
|
335 | - $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
336 | - $form['button_save'] = array('content' => 'Save', 'value' => 'save', 'type' => 'button','id'=>'submit', 'class' => 'btn btn-line-parrot'); |
|
337 | - |
|
338 | - return $form; |
|
339 | - } |
|
340 | - |
|
341 | - function build_fssipprofile_list_for_admin() { |
|
342 | - // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
343 | - $grid_field_arr = json_encode(array( |
|
344 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
280 | + /******************************************/ |
|
281 | + array("Action", "106", "", "", "", array("EDIT" => array("url" => "/freeswitch/fsgateway_edit/", "mode" => "popup","layout"=>"medium"), |
|
282 | + "DELETE" => array("url" => "/freeswitch/fsgateway_delete/", "mode" => "single"))) |
|
283 | + )); |
|
284 | + return $grid_field_arr; |
|
285 | + } |
|
286 | + /******************************************************/ |
|
287 | + |
|
288 | + function build_fdgateway_grid_buttons() { |
|
289 | + $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fsgateway_add/", "popup","medium"), |
|
290 | + array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/freeswitch/fsgateway_delete_multiple/") |
|
291 | + )); |
|
292 | + return $buttons_json; |
|
293 | + } |
|
294 | + |
|
295 | + function get_sipprofile_form_fields() { |
|
296 | + $form['forms'] = array(base_url() . 'freeswitch/fssipprofile_save/', array("id" => "fssipprofile_form", "name" => "fssipprofile_form")); |
|
297 | + $form['Basic Information'] = array( |
|
298 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
299 | + array('Profile name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Name'), |
|
300 | + array('sip-ip', 'INPUT', array('name' => 'sip_ip', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter SIP IP Name'), |
|
301 | + array('sip-port', 'INPUT', array('name' => 'sip_port', 'size' => '20', 'value' => '5060', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter SIP Port'), |
|
302 | + array('rtp-ip', 'INPUT', array('name' => 'rtp_ip', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
303 | + array('Dial Plan', 'INPUT', array('name' => 'dialplan', 'size' => '20', 'value' => 'XML', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
304 | + array('user-agent-string', 'INPUT', array('name' => 'user-agent-string', 'size' => '20', 'value' => 'ASTPP', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
305 | + array('debug', 'INPUT', array('name' => 'debug', 'size' => '20', 'value' => '0', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
306 | + array('sip-trace', 'sip-trace', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_drp_option'), |
|
307 | + array('tls', 'tls', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'), |
|
308 | + array('inbound-reg-force-matching-username', 'inbound-reg-force-matching-username', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
309 | + array('disable-transcoding', 'disable-transcoding', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
310 | + array('all-reg-options-ping', 'all-reg-options-ping', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
311 | + array('unregister-on-options-fail', 'unregister-on-options-fail', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
312 | + array('log-auth-failures', 'log-auth-failures', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
313 | + array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
|
314 | + ); |
|
315 | + |
|
316 | + $form['Others Information'] = array( |
|
317 | + array('inbound-bypass-media', 'inbound-bypass-media', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'), |
|
318 | + array('inbound-proxy-media', 'inbound-proxy-media', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'), |
|
319 | + array('disable-transfer', 'disable-transfer', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
320 | + array('enable-100rel', 'enable-100rel', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'), |
|
321 | + array('rtp-timeout-sec', 'INPUT', array('name' => 'rtp-timeout-sec', 'size' => '20', 'value' => '60', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
322 | + array('dtmf-duration', 'INPUT', array('name' => 'dtmf-duration', 'size' => '20', 'value' => '2000', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
323 | + array('manual-redirect','manual-redirect', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'), |
|
324 | + array('aggressive-nat-detection', 'aggressive-nat-detection', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
325 | + array('enable-Timer', 'enable-timer', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'), |
|
326 | + array('minimum-session-expires', 'INPUT', array('name' => 'minimum-session-expires', 'value' => '120', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
327 | + array('session-timeout', 'INPUT', array('name' => 'session-timeout-pt', 'value' => '1800', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
328 | + array('auth-calls', 'auth-calls', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'), |
|
329 | + array('apply-inbound-acl', 'INPUT', array('name' => 'apply-inbound-acl', 'value' => 'default', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
330 | + array('inbound-codec-prefs', 'INPUT', array('name' => 'inbound-codec-prefs', 'size' => '25', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
331 | + array('outbound-codec-prefs', 'INPUT', array('name' => 'outbound-codec-prefs', 'size' => '25', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
332 | + array('inbound-late-negotiation', 'inbound-late-negotiation', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'), |
|
333 | + array('inbound-codec-negotiation', 'INPUT', array('name' => 'inbound-codec-negotiation', 'size' => '25', 'class' => "text field medium"), '', 'tOOL TIP', ''), |
|
334 | + ); |
|
335 | + $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
336 | + $form['button_save'] = array('content' => 'Save', 'value' => 'save', 'type' => 'button','id'=>'submit', 'class' => 'btn btn-line-parrot'); |
|
337 | + |
|
338 | + return $form; |
|
339 | + } |
|
340 | + |
|
341 | + function build_fssipprofile_list_for_admin() { |
|
342 | + // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
343 | + $grid_field_arr = json_encode(array( |
|
344 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
345 | 345 | /** |
346 | 346 | ASTPP 3.0 |
347 | 347 | For Sip Profile edit on Profile name |
348 | 348 | **/ |
349 | - array("Name", "190", "name", "", "", "","EDITABLE","true","center"), |
|
349 | + array("Name", "190", "name", "", "", "","EDITABLE","true","center"), |
|
350 | 350 | /************************************/ |
351 | - array("SIP IP", "205", "sip_ip", "", "", "","","true","center"), |
|
352 | - array("SIP Port", "200", "sip_port", "", "", "","","true","center"), |
|
353 | - /* |
|
351 | + array("SIP IP", "205", "sip_ip", "", "", "","","true","center"), |
|
352 | + array("SIP Port", "200", "sip_port", "", "", "","","true","center"), |
|
353 | + /* |
|
354 | 354 | ASTPP 3.0 |
355 | 355 | status show active or inactive |
356 | 356 | */ |
357 | - array("Status", "160", "status", "status", "sip_profiles", "get_status","","true","center"), |
|
358 | - /*******************************************************/ |
|
359 | - array("Profile Action", "282", "", "", "", array("START" => array("url" => "/freeswitch/fssipprofile_action/start/","mode"=>"single"), |
|
360 | - "STOP" => array("url" => "/freeswitch/fssipprofile_action/stop/", "mode" => "single"), |
|
361 | - "RELOAD" => array("url" => "/freeswitch/fssipprofile_action/reload/", "mode" => "single"), |
|
362 | - "RESCAN" => array("url" => "/freeswitch/fssipprofile_action/rescan/", "mode" => "single"), |
|
363 | - ) |
|
364 | - ), |
|
365 | - array("Action", "202", "", "", "", array("EDIT" => array("url" => "/freeswitch/fssipprofile_edit/", "mode" => ""), |
|
366 | - "DELETE" => array("url" => "/freeswitch/fssipprofile_delete/", "mode" => "single"))) |
|
367 | - )); |
|
368 | - return $grid_field_arr; |
|
369 | - } |
|
370 | - |
|
371 | - function build_fssipprofile_grid_buttons() { |
|
372 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fssipprofile_add/",""), |
|
373 | - array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg","button_action", "/freeswitch/fssipprofile_delete_multiple/") |
|
374 | - )); |
|
375 | - return $buttons_json; |
|
376 | - } |
|
377 | - |
|
378 | - function build_fssipprofile_params_list_for_admin() |
|
379 | - { |
|
357 | + array("Status", "160", "status", "status", "sip_profiles", "get_status","","true","center"), |
|
358 | + /*******************************************************/ |
|
359 | + array("Profile Action", "282", "", "", "", array("START" => array("url" => "/freeswitch/fssipprofile_action/start/","mode"=>"single"), |
|
360 | + "STOP" => array("url" => "/freeswitch/fssipprofile_action/stop/", "mode" => "single"), |
|
361 | + "RELOAD" => array("url" => "/freeswitch/fssipprofile_action/reload/", "mode" => "single"), |
|
362 | + "RESCAN" => array("url" => "/freeswitch/fssipprofile_action/rescan/", "mode" => "single"), |
|
363 | + ) |
|
364 | + ), |
|
365 | + array("Action", "202", "", "", "", array("EDIT" => array("url" => "/freeswitch/fssipprofile_edit/", "mode" => ""), |
|
366 | + "DELETE" => array("url" => "/freeswitch/fssipprofile_delete/", "mode" => "single"))) |
|
367 | + )); |
|
368 | + return $grid_field_arr; |
|
369 | + } |
|
370 | + |
|
371 | + function build_fssipprofile_grid_buttons() { |
|
372 | + $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fssipprofile_add/",""), |
|
373 | + array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg","button_action", "/freeswitch/fssipprofile_delete_multiple/") |
|
374 | + )); |
|
375 | + return $buttons_json; |
|
376 | + } |
|
377 | + |
|
378 | + function build_fssipprofile_params_list_for_admin() |
|
379 | + { |
|
380 | 380 | $grid_field_arr = json_encode(array( |
381 | - array("Name", "450", "name", "", "", ""), |
|
382 | - array("Value", "414", "sip_ip", "", "", ""), |
|
381 | + array("Name", "450", "name", "", "", ""), |
|
382 | + array("Value", "414", "sip_ip", "", "", ""), |
|
383 | 383 | // array("SIP Port", "250", "sip_port", "", "", ""), |
384 | - array("Action", "400", "", "", "", array("DELETE" => array("url" => "/freeswitch/fssipprofile_delete/", "mode" => "single"))) |
|
385 | - )); |
|
386 | - return $grid_field_arr; |
|
387 | - } |
|
388 | - /* |
|
384 | + array("Action", "400", "", "", "", array("DELETE" => array("url" => "/freeswitch/fssipprofile_delete/", "mode" => "single"))) |
|
385 | + )); |
|
386 | + return $grid_field_arr; |
|
387 | + } |
|
388 | + /* |
|
389 | 389 | ASTPP 3.0 |
390 | 390 | changes in gried size |
391 | 391 | */ |
392 | - function build_fsserver_list() { |
|
393 | - // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
394 | - $grid_field_arr = json_encode(array( |
|
395 | - array("Host", "200", "freeswitch_host", "", "", "","","true","center"), |
|
396 | - array(" Password", "200", "freeswitch_password", "", "", "","","true","center"), |
|
397 | - array(" Port", "200", "freeswitch_port", "", "", "","","true","center"), |
|
398 | - /* |
|
392 | + function build_fsserver_list() { |
|
393 | + // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
394 | + $grid_field_arr = json_encode(array( |
|
395 | + array("Host", "200", "freeswitch_host", "", "", "","","true","center"), |
|
396 | + array(" Password", "200", "freeswitch_password", "", "", "","","true","center"), |
|
397 | + array(" Port", "200", "freeswitch_port", "", "", "","","true","center"), |
|
398 | + /* |
|
399 | 399 | ASTPP 3.0 .3 creation field show in grid |
400 | 400 | */ |
401 | - array("Status", "145", "status", "status", "freeswich_servers", "get_status","","true","center"), |
|
402 | - array("Created Date", "170", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
403 | - array("Modified Date", "170", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
404 | - /********************************************************************/ |
|
401 | + array("Status", "145", "status", "status", "freeswich_servers", "get_status","","true","center"), |
|
402 | + array("Created Date", "170", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
403 | + array("Modified Date", "170", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
404 | + /********************************************************************/ |
|
405 | 405 | |
406 | - array("Action", "182", "", "", "", array("EDIT" => array("url" => "/freeswitch/fsserver_edit/", "mode" => "popup"), |
|
407 | - "DELETE" => array("url" => "/freeswitch/fsserver_delete/", "mode" => "single"))) |
|
408 | - )); |
|
409 | - return $grid_field_arr; |
|
410 | - } |
|
411 | - /**************************************************/ |
|
412 | - |
|
413 | - function build_fsserver_grid_buttons() { |
|
414 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fsserver_add/", "popup"), |
|
406 | + array("Action", "182", "", "", "", array("EDIT" => array("url" => "/freeswitch/fsserver_edit/", "mode" => "popup"), |
|
407 | + "DELETE" => array("url" => "/freeswitch/fsserver_delete/", "mode" => "single"))) |
|
408 | + )); |
|
409 | + return $grid_field_arr; |
|
410 | + } |
|
411 | + /**************************************************/ |
|
412 | + |
|
413 | + function build_fsserver_grid_buttons() { |
|
414 | + $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fsserver_add/", "popup"), |
|
415 | 415 | //array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/freeswitch/fssipdevices_delete_multiple/") |
416 | - )); |
|
417 | - return $buttons_json; |
|
418 | - } |
|
419 | - |
|
420 | - function get_form_fsserver_fields() { |
|
421 | - $form['forms'] = array(base_url() . '/freeswitch/fsserver_save/', array("id" => "fsserver_form", "name" => "fsserver_form")); |
|
422 | - $form['Freeswitch Server Information'] = array( |
|
423 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
424 | - array(' Host', 'INPUT', array('name' => 'freeswitch_host', 'size' => '20', 'class' => "text field medium"), 'trim|required|valid_ip', 'tOOL TIP', 'Please Enter account number'), |
|
425 | - array(' Password', 'INPUT', array('name' => 'freeswitch_password', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
426 | - array(' Port', 'INPUT', array('name' => 'freeswitch_port', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric', 'tOOL TIP', 'Please Enter account number'), |
|
427 | - ); |
|
428 | - |
|
429 | - $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
430 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
431 | - |
|
432 | - return $form; |
|
433 | - } |
|
434 | - |
|
435 | - function get_search_fsserver_form() { |
|
436 | - $form['forms'] = array("", array('id' => "fsserver_search")); |
|
437 | - $form['Search'] = array( |
|
438 | - array(' Host', 'INPUT', array('name' => 'freeswitch_host[freeswitch_host]', '', 'id' => 'first_name', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'freeswitch_host[freeswitch_host-string]', '', '', '', 'search_string_type', ''), |
|
439 | - array(' Port', 'INPUT', array('name' => 'freeswitch_port[freeswitch_port]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'freeswitch_port[freeswitch_port-string]', '', '', '', 'search_string_type', ''), |
|
416 | + )); |
|
417 | + return $buttons_json; |
|
418 | + } |
|
419 | + |
|
420 | + function get_form_fsserver_fields() { |
|
421 | + $form['forms'] = array(base_url() . '/freeswitch/fsserver_save/', array("id" => "fsserver_form", "name" => "fsserver_form")); |
|
422 | + $form['Freeswitch Server Information'] = array( |
|
423 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
424 | + array(' Host', 'INPUT', array('name' => 'freeswitch_host', 'size' => '20', 'class' => "text field medium"), 'trim|required|valid_ip', 'tOOL TIP', 'Please Enter account number'), |
|
425 | + array(' Password', 'INPUT', array('name' => 'freeswitch_password', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
426 | + array(' Port', 'INPUT', array('name' => 'freeswitch_port', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric', 'tOOL TIP', 'Please Enter account number'), |
|
427 | + ); |
|
428 | + |
|
429 | + $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
430 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
431 | + |
|
432 | + return $form; |
|
433 | + } |
|
434 | + |
|
435 | + function get_search_fsserver_form() { |
|
436 | + $form['forms'] = array("", array('id' => "fsserver_search")); |
|
437 | + $form['Search'] = array( |
|
438 | + array(' Host', 'INPUT', array('name' => 'freeswitch_host[freeswitch_host]', '', 'id' => 'first_name', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'freeswitch_host[freeswitch_host-string]', '', '', '', 'search_string_type', ''), |
|
439 | + array(' Port', 'INPUT', array('name' => 'freeswitch_port[freeswitch_port]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'freeswitch_port[freeswitch_port-string]', '', '', '', 'search_string_type', ''), |
|
440 | 440 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_search_status'), |
441 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
442 | - array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
443 | - ); |
|
444 | - $form['button_search'] = array('name' => 'action', 'id' => "fsserver_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
445 | - $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
446 | - |
|
447 | - return $form; |
|
448 | - } |
|
441 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
442 | + array('', 'HIDDEN', 'advance_search', '1', '', '', '') |
|
443 | + ); |
|
444 | + $form['button_search'] = array('name' => 'action', 'id' => "fsserver_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
445 | + $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10'); |
|
446 | + |
|
447 | + return $form; |
|
448 | + } |
|
449 | 449 | /* |
450 | 450 | ASTPP 3.0 |
451 | 451 | CHanges in grid size |
452 | 452 | */ |
453 | - function build_devices_list_for_customer() { |
|
454 | - $grid_field_arr = json_encode(array( |
|
453 | + function build_devices_list_for_customer() { |
|
454 | + $grid_field_arr = json_encode(array( |
|
455 | 455 | array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
456 | - array("User Name", "100", "username", "", "", "","","true","center"), |
|
457 | - array("Password", "100", "password", "", "", "","","true","center"), |
|
458 | - array("SIP Profile", "90", "sip_profile_id", "name", "sip_profiles", "get_field_name","","true","center"), |
|
459 | - array("Caller Name", "100", "effective_caller_id_name", "", "", "","","true","center"), |
|
460 | - array("Caller Number", "100", "effective_caller_id_number", "", "", "","","true","center"), |
|
461 | - array("Voicemail", "100", "voicemail_enabled", "", "", "","","true","center"), |
|
462 | - //array("Call Waiting", "105", "call_waiting", "", "", ""), |
|
463 | - array("Status", "100", "status", "", "", "","","true","center"), |
|
456 | + array("User Name", "100", "username", "", "", "","","true","center"), |
|
457 | + array("Password", "100", "password", "", "", "","","true","center"), |
|
458 | + array("SIP Profile", "90", "sip_profile_id", "name", "sip_profiles", "get_field_name","","true","center"), |
|
459 | + array("Caller Name", "100", "effective_caller_id_name", "", "", "","","true","center"), |
|
460 | + array("Caller Number", "100", "effective_caller_id_number", "", "", "","","true","center"), |
|
461 | + array("Voicemail", "100", "voicemail_enabled", "", "", "","","true","center"), |
|
462 | + //array("Call Waiting", "105", "call_waiting", "", "", ""), |
|
463 | + array("Status", "100", "status", "", "", "","","true","center"), |
|
464 | 464 | array("Created Date", "100", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
465 | - array("Modified Date", "100", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
466 | - array("Action", "110", "", "", "", array("EDIT" => array("url" => "/accounts/fssipdevices_action/edit/", "mode" => "single"), |
|
467 | - "DELETE" => array("url" => "/accounts/fssipdevices_action/delete/", "mode" => "single"))) |
|
468 | - )); |
|
469 | - return $grid_field_arr; |
|
470 | - } |
|
465 | + array("Modified Date", "100", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
466 | + array("Action", "110", "", "", "", array("EDIT" => array("url" => "/accounts/fssipdevices_action/edit/", "mode" => "single"), |
|
467 | + "DELETE" => array("url" => "/accounts/fssipdevices_action/delete/", "mode" => "single"))) |
|
468 | + )); |
|
469 | + return $grid_field_arr; |
|
470 | + } |
|
471 | 471 | |
472 | - /******************8*/ |
|
472 | + /******************8*/ |
|
473 | 473 | |
474 | - function fsdevice_form_fields_for_customer($accountid , $id=false) { |
|
474 | + function fsdevice_form_fields_for_customer($accountid , $id=false) { |
|
475 | 475 | |
476 | 476 | // $val = $id > 0 ? 'sip_devices.username.' . $id : 'sip_devices.username'; |
477 | 477 | $val=$id > 0 ? 'sip_devices.username.'.$id : 'sip_devices.username'; |
478 | - $uname_user = $this->CI->common->find_uniq_rendno('10', '', ''); |
|
479 | - $password = $this->CI->common->generate_password(); |
|
480 | - if ($this->CI->session->userdata("logintype") == '0' || $this->CI->session->userdata("logintype") == '3') { |
|
481 | - $link = base_url() . 'freeswitch/user_fssipdevices_save/true'; |
|
482 | - $form['forms'] = array($link, array("id" => "sipdevices_form", "name" => "sipdevices_form")); |
|
483 | - $form['Device Information'] = array( |
|
484 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
485 | - array('', 'HIDDEN', array('name' => 'accountcode', 'value' => $accountid), '', '', '', ''), |
|
486 | - array('Username', 'INPUT', array('name' => 'fs_username', 'size' => '20', 'value'=>$uname_user,'id'=>'username', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|xss_clean', 'tOOL TIP', 'Please Enter account number','<i style="cursor:pointer;color:#1BCB61 !important;font-size:14px; padding-left:5px; padding-top:8px; float:left; " title="Reset Password" class="change_number fa fa-refresh"></i>'), |
|
487 | - array('Password', 'INPUT', array('name' => 'fs_password', 'size' => '20','id'=>'password1','value'=>$password, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password','<i style="cursor:pointer;color:#1BCB61 !important; font-size:14px; padding-left:5px; padding-top:8px; float:left;" title="Reset Password" class="change_pass fa fa-refresh"></i>'), |
|
488 | - array('Caller Name', 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
489 | - array('Caller Number', 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
490 | - //array('Call Waiting', 'call_waiting', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_call_waiting'), |
|
491 | - array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
|
492 | - ); |
|
478 | + $uname_user = $this->CI->common->find_uniq_rendno('10', '', ''); |
|
479 | + $password = $this->CI->common->generate_password(); |
|
480 | + if ($this->CI->session->userdata("logintype") == '0' || $this->CI->session->userdata("logintype") == '3') { |
|
481 | + $link = base_url() . 'freeswitch/user_fssipdevices_save/true'; |
|
482 | + $form['forms'] = array($link, array("id" => "sipdevices_form", "name" => "sipdevices_form")); |
|
483 | + $form['Device Information'] = array( |
|
484 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
485 | + array('', 'HIDDEN', array('name' => 'accountcode', 'value' => $accountid), '', '', '', ''), |
|
486 | + array('Username', 'INPUT', array('name' => 'fs_username', 'size' => '20', 'value'=>$uname_user,'id'=>'username', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|xss_clean', 'tOOL TIP', 'Please Enter account number','<i style="cursor:pointer;color:#1BCB61 !important;font-size:14px; padding-left:5px; padding-top:8px; float:left; " title="Reset Password" class="change_number fa fa-refresh"></i>'), |
|
487 | + array('Password', 'INPUT', array('name' => 'fs_password', 'size' => '20','id'=>'password1','value'=>$password, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password','<i style="cursor:pointer;color:#1BCB61 !important; font-size:14px; padding-left:5px; padding-top:8px; float:left;" title="Reset Password" class="change_pass fa fa-refresh"></i>'), |
|
488 | + array('Caller Name', 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
489 | + array('Caller Number', 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
490 | + //array('Call Waiting', 'call_waiting', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_call_waiting'), |
|
491 | + array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
|
492 | + ); |
|
493 | 493 | /****** |
494 | 494 | ASTPP 3.0 |
495 | 495 | Voicemail add edit |
496 | 496 | ******/ |
497 | - $form['Voicemail Options'] = array( |
|
497 | + $form['Voicemail Options'] = array( |
|
498 | 498 | |
499 | - array('Enable', 'voicemail_enabled', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_sip_config_option'), |
|
499 | + array('Enable', 'voicemail_enabled', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_sip_config_option'), |
|
500 | 500 | |
501 | 501 | |
502 | 502 | array('Password', 'INPUT', array('name' => 'voicemail_password', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
@@ -507,40 +507,40 @@ discard block |
||
507 | 507 | |
508 | 508 | array('Send all Message', 'vm_send_all_message', 'CHECKBOX', array('name' => 'vm_send_all_message', 'value' => 'on', 'checked' => false), '', 'tOOL TIP', 'Please Select Status', 'custom_status_voicemail', '', '', ''), |
509 | 509 | |
510 | - ); |
|
510 | + ); |
|
511 | 511 | /*******************/ |
512 | - } else { |
|
513 | - if($accountid){ |
|
514 | - $account_Arr=null; |
|
515 | - }else{ |
|
516 | - $account_Arr=array('Account', 'accountcode', 'SELECT', '','trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0", "deleted" => "0")); |
|
517 | - } |
|
518 | - if ($this->CI->session->userdata("logintype") == '1') { |
|
512 | + } else { |
|
513 | + if($accountid){ |
|
514 | + $account_Arr=null; |
|
515 | + }else{ |
|
516 | + $account_Arr=array('Account', 'accountcode', 'SELECT', '','trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0", "deleted" => "0")); |
|
517 | + } |
|
518 | + if ($this->CI->session->userdata("logintype") == '1') { |
|
519 | 519 | $sip_pro =null; |
520 | - $link = base_url() . 'freeswitch/customer_fssipdevices_save/true'; |
|
521 | - }else{ |
|
520 | + $link = base_url() . 'freeswitch/customer_fssipdevices_save/true'; |
|
521 | + }else{ |
|
522 | 522 | $sip_pro =array('SIP Profile', 'sip_profile_id', 'SELECT', '','trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', '', ''); |
523 | - $link = base_url() . 'freeswitch/fssipdevices_save/true'; |
|
524 | - } |
|
525 | - $form['forms'] = array($link, array("id" => "sipdevices_form", "name" => "sipdevices_form")); |
|
526 | - /*Add sipdevice*/ |
|
527 | - $form['Device Information'] = array( |
|
528 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
529 | - array('', 'HIDDEN', array('name' => 'accountcode', 'value' => $accountid), '', '', '', ''), |
|
530 | - array('Username', 'INPUT', array('name' => 'fs_username', 'size' => '20', 'value'=>$uname_user,'id'=>'username1', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|xss_clean', 'tOOL TIP', 'Please Enter account number','<i style="cursor:pointer; color:#1BCB61; font-size:14px; padding-left:5px; padding-top:8px; float:left;" title="Reset Password" class="change_number fa fa-refresh"></i>'), |
|
531 | - array('Password', 'INPUT', array('name' => 'fs_password', 'size' => '20', 'id'=>'password1','value'=>$password, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password','<i style="cursor:pointer; color:#1BCB61; font-size:14px; padding-left:5px;padding-top:8px; float:left;" title="Reset Password" class="change_pass fa fa-refresh"></i>'), |
|
532 | - array('Caller Name', 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
533 | - array('Caller Number', 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
523 | + $link = base_url() . 'freeswitch/fssipdevices_save/true'; |
|
524 | + } |
|
525 | + $form['forms'] = array($link, array("id" => "sipdevices_form", "name" => "sipdevices_form")); |
|
526 | + /*Add sipdevice*/ |
|
527 | + $form['Device Information'] = array( |
|
528 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
529 | + array('', 'HIDDEN', array('name' => 'accountcode', 'value' => $accountid), '', '', '', ''), |
|
530 | + array('Username', 'INPUT', array('name' => 'fs_username', 'size' => '20', 'value'=>$uname_user,'id'=>'username1', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|xss_clean', 'tOOL TIP', 'Please Enter account number','<i style="cursor:pointer; color:#1BCB61; font-size:14px; padding-left:5px; padding-top:8px; float:left;" title="Reset Password" class="change_number fa fa-refresh"></i>'), |
|
531 | + array('Password', 'INPUT', array('name' => 'fs_password', 'size' => '20', 'id'=>'password1','value'=>$password, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password','<i style="cursor:pointer; color:#1BCB61; font-size:14px; padding-left:5px;padding-top:8px; float:left;" title="Reset Password" class="change_pass fa fa-refresh"></i>'), |
|
532 | + array('Caller Name', 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
533 | + array('Caller Number', 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
|
534 | 534 | $account_Arr, |
535 | - array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
|
536 | - $sip_pro, |
|
537 | - ); |
|
535 | + array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'), |
|
536 | + $sip_pro, |
|
537 | + ); |
|
538 | 538 | /****** |
539 | 539 | ASTPP 3.0 |
540 | 540 | Voicemail add edit |
541 | 541 | ******/ |
542 | 542 | $form['Voicemail Options'] = array( |
543 | - array('Enable', 'voicemail_enabled', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_sip_config_option'), |
|
543 | + array('Enable', 'voicemail_enabled', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_sip_config_option'), |
|
544 | 544 | array('Password', 'INPUT', array('name' => 'voicemail_password', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'PleaseEnter account number'), |
545 | 545 | array('Mail To', 'INPUT', array('name' => 'voicemail_mail_to', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'), |
546 | 546 | array('Attach File', 'voicemail_attach_file', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status_voicemail'), |
@@ -551,15 +551,15 @@ discard block |
||
551 | 551 | array('Send all Message', 'vm_send_all_message', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status_voicemail'), |
552 | 552 | |
553 | 553 | |
554 | - ); |
|
554 | + ); |
|
555 | 555 | /********************/ |
556 | - } |
|
556 | + } |
|
557 | 557 | |
558 | - $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
559 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
558 | + $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')'); |
|
559 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot'); |
|
560 | 560 | |
561 | - return $form; |
|
562 | - } |
|
561 | + return $form; |
|
562 | + } |
|
563 | 563 | |
564 | 564 | } |
565 | 565 |
@@ -185,9 +185,9 @@ |
||
185 | 185 | <? |
186 | 186 | if($params_name!='') |
187 | 187 | { |
188 | - $type="edit_setting"; |
|
188 | + $type="edit_setting"; |
|
189 | 189 | }else{ |
190 | - $type="add_setting"; |
|
190 | + $type="add_setting"; |
|
191 | 191 | } |
192 | 192 | ?> |
193 | 193 | <input type='hidden' name='type_settings' value='<?=$type?>' /> |
@@ -39,10 +39,10 @@ |
||
39 | 39 | <div class="col-md-2"> |
40 | 40 | <select class="form-control" name="host_id" id="host_id"> |
41 | 41 | <?php |
42 | - foreach($fs_data as $name) { ?> |
|
42 | + foreach($fs_data as $name) { ?> |
|
43 | 43 | <option value="<?= $name['id'] ?>"<?php if(isset($host_id) && ($name['id'] == $host_id))echo 'selected';?>><?= $name['freeswitch_host'] ?></option> |
44 | 44 | <?php |
45 | - } ?> |
|
45 | + } ?> |
|
46 | 46 | </select> |
47 | 47 | </div> |
48 | 48 | <div class="col-md-2 " style="text-align:left;"> |
@@ -24,24 +24,24 @@ discard block |
||
24 | 24 | |
25 | 25 | class Freeswitch_model extends CI_Model { |
26 | 26 | |
27 | - function Freeswitch_model() { |
|
28 | - parent::__construct(); |
|
29 | - } |
|
27 | + function Freeswitch_model() { |
|
28 | + parent::__construct(); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | /****** |
32 | 32 | ASTPP 3.0 |
33 | 33 | Voicemail data get |
34 | 34 | ******/ |
35 | - function get_sipdevices_list($flag, $accountid = "",$entitytype='',$start = "", $limit = "") { |
|
35 | + function get_sipdevices_list($flag, $accountid = "",$entitytype='',$start = "", $limit = "") { |
|
36 | 36 | if ($accountid != "") { |
37 | 37 | $where = array("accountid" => $accountid); |
38 | 38 | } |
39 | 39 | $this->db_model->build_search('fssipdevices_list_search'); |
40 | - $instant_search=$this->session->userdata('left_panel_search_'.$entitytype.'_sipdevices'); |
|
41 | - if(!empty($instant_search)){ |
|
42 | - $like_str="(username like '%$instant_search%' OR creation_date like '%$instant_search%' OR last_modified_date like '%$instant_search%')"; |
|
43 | - $this->db->where($like_str); |
|
44 | - } |
|
40 | + $instant_search=$this->session->userdata('left_panel_search_'.$entitytype.'_sipdevices'); |
|
41 | + if(!empty($instant_search)){ |
|
42 | + $like_str="(username like '%$instant_search%' OR creation_date like '%$instant_search%' OR last_modified_date like '%$instant_search%')"; |
|
43 | + $this->db->where($like_str); |
|
44 | + } |
|
45 | 45 | $query = array(); |
46 | 46 | if ($flag) { |
47 | 47 | $deviceinfo = $this->db_model->select("*", "sip_devices", $where, "id", "ASC", $limit, $start); |
@@ -78,23 +78,23 @@ discard block |
||
78 | 78 | $query = $this->db_model->countQuery("*", "sip_devices", $where); |
79 | 79 | } |
80 | 80 | return $query; |
81 | - } |
|
81 | + } |
|
82 | 82 | /**********************/ |
83 | 83 | /****** |
84 | 84 | ASTPP 3.0 |
85 | 85 | Voicemail add in database |
86 | 86 | ******/ |
87 | - function add_freeswith($add_array) { |
|
88 | - $where = array('id' => $add_array['accountcode']); |
|
89 | - $query = $this->db_model->getSelect("*", "accounts", $where); |
|
90 | - $query = $query->result_array(); |
|
91 | - $account_data=$query[0]; |
|
87 | + function add_freeswith($add_array) { |
|
88 | + $where = array('id' => $add_array['accountcode']); |
|
89 | + $query = $this->db_model->getSelect("*", "accounts", $where); |
|
90 | + $query = $query->result_array(); |
|
91 | + $account_data=$query[0]; |
|
92 | 92 | |
93 | - $log_type = $this->session->userdata("logintype"); |
|
93 | + $log_type = $this->session->userdata("logintype"); |
|
94 | 94 | |
95 | - $reseller_id = $log_type==1 ? $account_data['reseller_id']:0; |
|
95 | + $reseller_id = $log_type==1 ? $account_data['reseller_id']:0; |
|
96 | 96 | |
97 | - $sip_profile_id = isset($add_array['sip_profile_id'])?$add_array['sip_profile_id']:$this->common->get_field_name('id','sip_profiles',array('name'=>'default')); |
|
97 | + $sip_profile_id = isset($add_array['sip_profile_id'])?$add_array['sip_profile_id']:$this->common->get_field_name('id','sip_profiles',array('name'=>'default')); |
|
98 | 98 | |
99 | 99 | $parms_array = array('password' => $add_array['fs_password'], |
100 | 100 | 'vm-enabled' => $add_array['voicemail_enabled'], |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | creation date add |
115 | 115 | */ |
116 | 116 | $new_array = array('creation_date'=>gmdate('Y-m-d H:i:s'), |
117 | - 'username' => $add_array['fs_username'], |
|
118 | - 'reseller_id'=>$reseller_id, |
|
119 | - 'accountid' => $add_array['accountcode'], |
|
120 | - 'status' => $add_array['status'], |
|
121 | - 'dir_params' => json_encode($parms_array), |
|
122 | - 'dir_vars' => json_encode($parms_array_vars), |
|
123 | - 'sip_profile_id' => $sip_profile_id, |
|
124 | - ); |
|
117 | + 'username' => $add_array['fs_username'], |
|
118 | + 'reseller_id'=>$reseller_id, |
|
119 | + 'accountid' => $add_array['accountcode'], |
|
120 | + 'status' => $add_array['status'], |
|
121 | + 'dir_params' => json_encode($parms_array), |
|
122 | + 'dir_vars' => json_encode($parms_array_vars), |
|
123 | + 'sip_profile_id' => $sip_profile_id, |
|
124 | + ); |
|
125 | 125 | /****************************************8*/ |
126 | 126 | $this->db->insert('sip_devices', $new_array); |
127 | 127 | /****** |
@@ -130,25 +130,25 @@ discard block |
||
130 | 130 | ******/ |
131 | 131 | $mail = (isset($add_array['voicemail_mail_to']) && $add_array['voicemail_mail_to'] != "")?$add_array['voicemail_mail_to']:$account_data['email']; |
132 | 132 | |
133 | - $add_array['id']=$add_array['accountcode']; |
|
134 | - $add_array['reseller_id']=$account_data['reseller_id']; |
|
135 | - $add_array['email']=$mail; |
|
136 | - $add_array['first_name']=$account_data['first_name']; |
|
137 | - $add_array['last_name']=$account_data['last_name']; |
|
138 | - $add_array['number']=$add_array['fs_username']; |
|
139 | - //$add_array['password']=$this->common->decode($add_array['fs_password']); |
|
133 | + $add_array['id']=$add_array['accountcode']; |
|
134 | + $add_array['reseller_id']=$account_data['reseller_id']; |
|
135 | + $add_array['email']=$mail; |
|
136 | + $add_array['first_name']=$account_data['first_name']; |
|
137 | + $add_array['last_name']=$account_data['last_name']; |
|
138 | + $add_array['number']=$add_array['fs_username']; |
|
139 | + //$add_array['password']=$this->common->decode($add_array['fs_password']); |
|
140 | 140 | $add_array['password']=$add_array['fs_password']; |
141 | 141 | //echo "<pre>"; print_r($add_array); exit; |
142 | 142 | $this->common->mail_to_users('add_sip_device', $add_array); |
143 | 143 | /****************************/ |
144 | 144 | return true; |
145 | - } |
|
145 | + } |
|
146 | 146 | /***********************/ |
147 | 147 | /****** |
148 | 148 | ASTPP 3.0 |
149 | 149 | Voicemail edit |
150 | 150 | ******/ |
151 | - function edit_freeswith($add_array, $id) { |
|
151 | + function edit_freeswith($add_array, $id) { |
|
152 | 152 | |
153 | 153 | $parms_array = array('password' => $add_array['fs_password'], |
154 | 154 | 'vm-enabled' => $add_array['voicemail_enabled'], |
@@ -173,27 +173,27 @@ discard block |
||
173 | 173 | $new_array = array('last_modified_date'=>gmdate('Y-m-d H:i:s'),'username' => $add_array['fs_username'], 'accountid' => $add_array['accountcode'],'status' => $add_array['status'], |
174 | 174 | 'dir_params' => json_encode($parms_array), |
175 | 175 | 'dir_vars' => json_encode($parms_array_vars), 'sip_profile_id' => $add_array['sip_profile_id']); |
176 | - /*******************************************/ |
|
176 | + /*******************************************/ |
|
177 | 177 | $this->db->where('id', $id); |
178 | 178 | $this->db->update('sip_devices', $new_array); |
179 | 179 | //echo $this->db->last_query(); exit; |
180 | 180 | return true; |
181 | - } |
|
181 | + } |
|
182 | 182 | /***********************/ |
183 | 183 | /****** |
184 | 184 | ASTPP 3.0 |
185 | 185 | Voicemail edit data get |
186 | 186 | ******/ |
187 | - function get_edited_data($edit_id) { |
|
188 | - $deviceinfo = array(); |
|
189 | - $where = array('id' => $edit_id); |
|
190 | - $deviceinfo = $this->db_model->getSelect("*", "sip_devices", $where); |
|
191 | - $add_array = $deviceinfo->result_array(); |
|
192 | - foreach ($add_array as $key => $value) { |
|
193 | - $vars = json_decode($value['dir_vars']); |
|
194 | - $vars_new = json_decode($value['dir_params'],true); |
|
195 | - $passowrds = json_decode($value['dir_params']); |
|
196 | - $query = array('id' => $value['id'],'fs_username' => $value['username'], |
|
187 | + function get_edited_data($edit_id) { |
|
188 | + $deviceinfo = array(); |
|
189 | + $where = array('id' => $edit_id); |
|
190 | + $deviceinfo = $this->db_model->getSelect("*", "sip_devices", $where); |
|
191 | + $add_array = $deviceinfo->result_array(); |
|
192 | + foreach ($add_array as $key => $value) { |
|
193 | + $vars = json_decode($value['dir_vars']); |
|
194 | + $vars_new = json_decode($value['dir_params'],true); |
|
195 | + $passowrds = json_decode($value['dir_params']); |
|
196 | + $query = array('id' => $value['id'],'fs_username' => $value['username'], |
|
197 | 197 | 'accountcode' => $value['accountid'], |
198 | 198 | 'status' => $value['status'], |
199 | 199 | 'sip_profile_id' => $value['sip_profile_id'], |
@@ -206,161 +206,161 @@ discard block |
||
206 | 206 | 'vm_send_all_message' => $vars_new['vm-email-all-messages'], |
207 | 207 | 'effective_caller_id_number' => $vars->effective_caller_id_number, |
208 | 208 | 'fs_password' => $passowrds->password); |
209 | - } |
|
210 | - return $query; |
|
211 | - } |
|
209 | + } |
|
210 | + return $query; |
|
211 | + } |
|
212 | 212 | /*************************/ |
213 | - function delete_freeswith_devices($id) { |
|
214 | - $this->db->where('id', $id); |
|
215 | - $this->db->delete('sip_devices'); |
|
216 | - return true; |
|
217 | - } |
|
213 | + function delete_freeswith_devices($id) { |
|
214 | + $this->db->where('id', $id); |
|
215 | + $this->db->delete('sip_devices'); |
|
216 | + return true; |
|
217 | + } |
|
218 | 218 | /****** |
219 | 219 | ASTPP 3.0 |
220 | 220 | Get json data |
221 | 221 | ******/ |
222 | - function fs_retrieve_sip_user($flag, $start = 0, $limit = 0) { |
|
223 | - $deviceinfo = array(); |
|
224 | - $this->db_model->build_search('fssipdevices_list_search'); |
|
225 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
226 | - $reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0; |
|
227 | - $query = array(); |
|
228 | - $logintype = $this->session->userdata("logintype"); |
|
222 | + function fs_retrieve_sip_user($flag, $start = 0, $limit = 0) { |
|
223 | + $deviceinfo = array(); |
|
224 | + $this->db_model->build_search('fssipdevices_list_search'); |
|
225 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
226 | + $reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0; |
|
227 | + $query = array(); |
|
228 | + $logintype = $this->session->userdata("logintype"); |
|
229 | 229 | |
230 | - $where['reseller_id']=$reseller_id; |
|
230 | + $where['reseller_id']=$reseller_id; |
|
231 | 231 | |
232 | - if ($flag) { |
|
233 | - $deviceinfo = $this->db_model->select("*", "sip_devices", $where, "id", "ASC", $limit, $start); |
|
234 | - if ($deviceinfo->num_rows > 0) { |
|
235 | - $add_array = $deviceinfo->result_array(); |
|
236 | - foreach ($add_array as $key => $value) { |
|
237 | - $vars = json_decode($value['dir_vars']); |
|
232 | + if ($flag) { |
|
233 | + $deviceinfo = $this->db_model->select("*", "sip_devices", $where, "id", "ASC", $limit, $start); |
|
234 | + if ($deviceinfo->num_rows > 0) { |
|
235 | + $add_array = $deviceinfo->result_array(); |
|
236 | + foreach ($add_array as $key => $value) { |
|
237 | + $vars = json_decode($value['dir_vars']); |
|
238 | 238 | $vars_new = json_decode($value['dir_params'],true); |
239 | - $passowrds = json_decode($value['dir_params']); |
|
240 | - /* |
|
239 | + $passowrds = json_decode($value['dir_params']); |
|
240 | + /* |
|
241 | 241 | ASTPP 3.0 |
242 | 242 | add two filed show on gried |
243 | 243 | */ |
244 | - $query[] = array('id' => $value['id'], |
|
245 | - 'username' => $value['username'], |
|
246 | - 'accountid' => $value['accountid'], |
|
247 | - 'status' => $value['status'], |
|
248 | - 'creation_date'=>$value['creation_date'], |
|
249 | - 'last_modified_date'=>$value['last_modified_date'], |
|
250 | - 'sip_profile_id' => $value['sip_profile_id'], |
|
244 | + $query[] = array('id' => $value['id'], |
|
245 | + 'username' => $value['username'], |
|
246 | + 'accountid' => $value['accountid'], |
|
247 | + 'status' => $value['status'], |
|
248 | + 'creation_date'=>$value['creation_date'], |
|
249 | + 'last_modified_date'=>$value['last_modified_date'], |
|
250 | + 'sip_profile_id' => $value['sip_profile_id'], |
|
251 | 251 | 'effective_caller_id_name' => $vars->effective_caller_id_name, |
252 | - 'voicemail_enabled' => $vars_new['vm-enabled'], |
|
253 | - 'voicemail_password' => $vars_new['vm-password'], |
|
254 | - 'voicemail_mail_to' => $vars_new['vm-mailto'], |
|
255 | - 'voicemail_attach_file' => $vars_new['vm-attach-file'], |
|
256 | - 'vm_keep_local_after_email' => $vars_new['vm-keep-local-after-email'], |
|
257 | - 'effective_caller_id_number' => $vars->effective_caller_id_number, |
|
252 | + 'voicemail_enabled' => $vars_new['vm-enabled'], |
|
253 | + 'voicemail_password' => $vars_new['vm-password'], |
|
254 | + 'voicemail_mail_to' => $vars_new['vm-mailto'], |
|
255 | + 'voicemail_attach_file' => $vars_new['vm-attach-file'], |
|
256 | + 'vm_keep_local_after_email' => $vars_new['vm-keep-local-after-email'], |
|
257 | + 'effective_caller_id_number' => $vars->effective_caller_id_number, |
|
258 | 258 | 'password' => $passowrds->password); |
259 | - } |
|
260 | - } |
|
261 | - } else { |
|
262 | - $query = $this->db_model->countQuery("*", 'sip_devices', $where); |
|
259 | + } |
|
260 | + } |
|
261 | + } else { |
|
262 | + $query = $this->db_model->countQuery("*", 'sip_devices', $where); |
|
263 | + } |
|
264 | + return $query; |
|
263 | 265 | } |
264 | - return $query; |
|
265 | - } |
|
266 | 266 | /**********************/ |
267 | 267 | |
268 | - function get_gateway_list($flag, $start = 0, $limit = 0) { |
|
268 | + function get_gateway_list($flag, $start = 0, $limit = 0) { |
|
269 | 269 | $this->db_model->build_search('fsgateway_list_search'); |
270 | - if ($flag) { |
|
271 | - $query = $this->db_model->select("*", "gateways", "", "id", "desc", $limit, $start); |
|
272 | - } else { |
|
273 | - $query = $this->db_model->countQuery("*", "gateways", ""); |
|
274 | - } |
|
275 | - return $query; |
|
276 | - } |
|
270 | + if ($flag) { |
|
271 | + $query = $this->db_model->select("*", "gateways", "", "id", "desc", $limit, $start); |
|
272 | + } else { |
|
273 | + $query = $this->db_model->countQuery("*", "gateways", ""); |
|
274 | + } |
|
275 | + return $query; |
|
276 | + } |
|
277 | 277 | |
278 | - function get_sipprofile_list($flag, $start = 0, $limit = 0) { |
|
279 | - $this->db_model->build_search('fssipprofile_list_search'); |
|
280 | - if ($flag) { |
|
281 | - $query = $this->db_model->select("*", "sip_profiles", "", "id", "desc", $limit, $start); |
|
282 | - } else { |
|
283 | - $query = $this->db_model->countQuery("*", "sip_profiles", ""); |
|
284 | - } |
|
285 | - return $query; |
|
286 | - } |
|
278 | + function get_sipprofile_list($flag, $start = 0, $limit = 0) { |
|
279 | + $this->db_model->build_search('fssipprofile_list_search'); |
|
280 | + if ($flag) { |
|
281 | + $query = $this->db_model->select("*", "sip_profiles", "", "id", "desc", $limit, $start); |
|
282 | + } else { |
|
283 | + $query = $this->db_model->countQuery("*", "sip_profiles", ""); |
|
284 | + } |
|
285 | + return $query; |
|
286 | + } |
|
287 | 287 | |
288 | - function profile_authentication($profile_data) { |
|
289 | - if ($profile_data['id'] != '') { |
|
290 | - $where = array('id <>' => $profile_data["id"], 'sip_ip' => $profile_data["sip_ip"], "sip_port" => $profile_data["sip_port"]); |
|
291 | - } else { |
|
292 | - $where = array('sip_ip' => $profile_data["sip_ip"], "sip_port" => $profile_data["sip_port"]); |
|
293 | - } |
|
294 | - $query = $this->db_model->getSelect("*", "sip_profiles", $where); |
|
295 | - return $query; |
|
296 | - } |
|
288 | + function profile_authentication($profile_data) { |
|
289 | + if ($profile_data['id'] != '') { |
|
290 | + $where = array('id <>' => $profile_data["id"], 'sip_ip' => $profile_data["sip_ip"], "sip_port" => $profile_data["sip_port"]); |
|
291 | + } else { |
|
292 | + $where = array('sip_ip' => $profile_data["sip_ip"], "sip_port" => $profile_data["sip_port"]); |
|
293 | + } |
|
294 | + $query = $this->db_model->getSelect("*", "sip_profiles", $where); |
|
295 | + return $query; |
|
296 | + } |
|
297 | 297 | |
298 | - function get_fsserver_list($flag, $start = 0, $limit = 0) { |
|
299 | - $this->db_model->build_search('fsserver_list_search'); |
|
300 | - if ($flag) { |
|
301 | - $query = $this->db_model->select("*", "freeswich_servers", "", "id", "desc", $limit, $start); |
|
302 | - } else { |
|
303 | - $query = $this->db_model->countQuery("*", "freeswich_servers", ""); |
|
304 | - } |
|
305 | - return $query; |
|
306 | - } |
|
298 | + function get_fsserver_list($flag, $start = 0, $limit = 0) { |
|
299 | + $this->db_model->build_search('fsserver_list_search'); |
|
300 | + if ($flag) { |
|
301 | + $query = $this->db_model->select("*", "freeswich_servers", "", "id", "desc", $limit, $start); |
|
302 | + } else { |
|
303 | + $query = $this->db_model->countQuery("*", "freeswich_servers", ""); |
|
304 | + } |
|
305 | + return $query; |
|
306 | + } |
|
307 | 307 | |
308 | - function add_fssever($data) { |
|
309 | - /* |
|
308 | + function add_fssever($data) { |
|
309 | + /* |
|
310 | 310 | ASTPP 3.0 ADD creation date |
311 | 311 | */ |
312 | - $data['creation_date']=gmdate('Y-m-d H:i:s'); |
|
313 | - /***********************************/ |
|
314 | - unset($data['action']); |
|
315 | - $this->db->insert('freeswich_servers', $data); |
|
316 | - return true; |
|
317 | - } |
|
312 | + $data['creation_date']=gmdate('Y-m-d H:i:s'); |
|
313 | + /***********************************/ |
|
314 | + unset($data['action']); |
|
315 | + $this->db->insert('freeswich_servers', $data); |
|
316 | + return true; |
|
317 | + } |
|
318 | 318 | |
319 | - function edit_fsserver($data, $id) { |
|
320 | - unset($data['action']); |
|
321 | - /* |
|
319 | + function edit_fsserver($data, $id) { |
|
320 | + unset($data['action']); |
|
321 | + /* |
|
322 | 322 | ASTPP 3.0 edit modified date add |
323 | 323 | */ |
324 | - $data['last_modified_date']=gmdate('Y-m-d H:i:s'); |
|
325 | - /***********************************************/ |
|
326 | - $this->db->where('id', $id); |
|
327 | - $this->db->update('freeswich_servers', $data); |
|
328 | - return true; |
|
329 | - } |
|
324 | + $data['last_modified_date']=gmdate('Y-m-d H:i:s'); |
|
325 | + /***********************************************/ |
|
326 | + $this->db->where('id', $id); |
|
327 | + $this->db->update('freeswich_servers', $data); |
|
328 | + return true; |
|
329 | + } |
|
330 | 330 | |
331 | - function fsserver_delete($id) { |
|
332 | - $this->db->where('id', $id); |
|
333 | - $this->db->delete('freeswich_servers'); |
|
334 | - return true; |
|
335 | - } |
|
331 | + function fsserver_delete($id) { |
|
332 | + $this->db->where('id', $id); |
|
333 | + $this->db->delete('freeswich_servers'); |
|
334 | + return true; |
|
335 | + } |
|
336 | 336 | |
337 | - function reload_freeswitch($command,$server_host="") { |
|
337 | + function reload_freeswitch($command,$server_host="") { |
|
338 | 338 | $response=''; |
339 | - $query = $this->db_model->getSelect("*", "freeswich_servers", ""); |
|
340 | - $fs_data = $query->result_array(); |
|
341 | - foreach ($fs_data as $fs_key => $fs_value) { |
|
342 | - $fp = $this->freeswitch_lib->event_socket_create($fs_value["freeswitch_host"], $fs_value["freeswitch_port"], $fs_value["freeswitch_password"]); |
|
343 | - if ($fp) { |
|
339 | + $query = $this->db_model->getSelect("*", "freeswich_servers", ""); |
|
340 | + $fs_data = $query->result_array(); |
|
341 | + foreach ($fs_data as $fs_key => $fs_value) { |
|
342 | + $fp = $this->freeswitch_lib->event_socket_create($fs_value["freeswitch_host"], $fs_value["freeswitch_port"], $fs_value["freeswitch_password"]); |
|
343 | + if ($fp) { |
|
344 | 344 | $response.= $this->freeswitch_lib->event_socket_request($fp, $command); |
345 | 345 | fclose($fp); |
346 | - } |
|
347 | - } |
|
348 | - return $response; |
|
349 | - } |
|
350 | - function reload_live_freeswitch($command) { |
|
346 | + } |
|
347 | + } |
|
348 | + return $response; |
|
349 | + } |
|
350 | + function reload_live_freeswitch($command) { |
|
351 | 351 | $response=''; |
352 | - $query = $this->db_model->getSelect("*", "freeswich_servers", ""); |
|
353 | - $fs_data = $query->result_array(); |
|
352 | + $query = $this->db_model->getSelect("*", "freeswich_servers", ""); |
|
353 | + $fs_data = $query->result_array(); |
|
354 | 354 | |
355 | - foreach ($fs_data as $fs_key => $fs_value) { |
|
356 | - $fp = $this->freeswitch_lib->event_socket_create($fs_value["freeswitch_host"], $fs_value["freeswitch_port"], $fs_value["freeswitch_password"]); |
|
357 | - if ($fp) { |
|
355 | + foreach ($fs_data as $fs_key => $fs_value) { |
|
356 | + $fp = $this->freeswitch_lib->event_socket_create($fs_value["freeswitch_host"], $fs_value["freeswitch_port"], $fs_value["freeswitch_password"]); |
|
357 | + if ($fp) { |
|
358 | 358 | $response .= $this->freeswitch_lib->event_socket_request($fp, $command); |
359 | 359 | fclose($fp); |
360 | - } |
|
361 | - } |
|
360 | + } |
|
361 | + } |
|
362 | 362 | $response = str_replace("0 total.","",$response); |
363 | - return $response; |
|
364 | - } |
|
363 | + return $response; |
|
364 | + } |
|
365 | 365 | |
366 | 366 | } |
@@ -25,19 +25,19 @@ |
||
25 | 25 | define('ENVIRONMENT', 'production'); |
26 | 26 | |
27 | 27 | if (defined('ENVIRONMENT')) { |
28 | - switch (ENVIRONMENT) { |
|
29 | - case 'development': |
|
30 | - error_reporting(E_ALL); |
|
31 | - break; |
|
28 | + switch (ENVIRONMENT) { |
|
29 | + case 'development': |
|
30 | + error_reporting(E_ALL); |
|
31 | + break; |
|
32 | 32 | |
33 | - case 'testing': |
|
34 | - case 'production': |
|
35 | - error_reporting(0); |
|
36 | - break; |
|
33 | + case 'testing': |
|
34 | + case 'production': |
|
35 | + error_reporting(0); |
|
36 | + break; |
|
37 | 37 | |
38 | - default: |
|
39 | - error_reporting(E_ALL); |
|
40 | - } |
|
38 | + default: |
|
39 | + error_reporting(E_ALL); |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | //Include file |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | case 'development': |
30 | 30 | // error_reporting(E_ALL); |
31 | - error_reporting(E_ERROR|E_WARNING|E_PARSE); |
|
31 | + error_reporting(E_ERROR|E_WARNING|E_PARSE); |
|
32 | 32 | break; |
33 | 33 | |
34 | 34 | case 'testing': |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | |
63 | 63 | if(isset($_SERVER["CONTENT_TYPE"]) && $_SERVER["CONTENT_TYPE"] == "application/json") { |
64 | 64 | |
65 | - $db->run("SET NAMES utf8"); |
|
66 | - $data = json_decode(file_get_contents("php://input"),true); |
|
67 | - //error_log(print_r($data,true)); |
|
68 | - $logger->log(print_r($data,true)); |
|
69 | - process_cdr($data,$db,$logger,$decimal_points); |
|
65 | + $db->run("SET NAMES utf8"); |
|
66 | + $data = json_decode(file_get_contents("php://input"),true); |
|
67 | + //error_log(print_r($data,true)); |
|
68 | + $logger->log(print_r($data,true)); |
|
69 | + process_cdr($data,$db,$logger,$decimal_points); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | //$db->cleanup(); |
@@ -23,58 +23,58 @@ |
||
23 | 23 | |
24 | 24 | class db extends PDO { |
25 | 25 | |
26 | - private $error; |
|
27 | - private $sql; |
|
28 | - private $bind; |
|
29 | - private $errorCallbackFunction; |
|
30 | - private $errorMsgFormat; |
|
26 | + private $error; |
|
27 | + private $sql; |
|
28 | + private $bind; |
|
29 | + private $errorCallbackFunction; |
|
30 | + private $errorMsgFormat; |
|
31 | 31 | |
32 | - public function __construct($dsn = "", $user = "", $passwd = "") { |
|
32 | + public function __construct($dsn = "", $user = "", $passwd = "") { |
|
33 | 33 | |
34 | - $config = parse_ini_file("/var/lib/astpp/astpp-config.conf"); |
|
34 | + $config = parse_ini_file("/var/lib/astpp/astpp-config.conf"); |
|
35 | 35 | |
36 | - $options = array( |
|
37 | - PDO::ATTR_PERSISTENT => true, |
|
38 | - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION |
|
39 | - ); |
|
36 | + $options = array( |
|
37 | + PDO::ATTR_PERSISTENT => true, |
|
38 | + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION |
|
39 | + ); |
|
40 | 40 | |
41 | - try { |
|
42 | - parent::__construct("mysql:host=".$config['dbhost'].";dbname=".$config['dbname']."", $config['dbuser'], $config['dbpass'], $options); |
|
43 | - } catch (PDOException $e) { |
|
41 | + try { |
|
42 | + parent::__construct("mysql:host=".$config['dbhost'].";dbname=".$config['dbname']."", $config['dbuser'], $config['dbpass'], $options); |
|
43 | + } catch (PDOException $e) { |
|
44 | 44 | |
45 | - $this->error = $e->getMessage(); |
|
46 | - } |
|
47 | - echo $this->error; |
|
48 | - } |
|
45 | + $this->error = $e->getMessage(); |
|
46 | + } |
|
47 | + echo $this->error; |
|
48 | + } |
|
49 | 49 | |
50 | - public function cleanup($bind) { |
|
51 | - if (!is_array($bind)) { |
|
52 | - if (!empty($bind)) |
|
53 | - $bind = array($bind); |
|
54 | - else |
|
55 | - $bind = array(); |
|
56 | - } |
|
57 | - return $bind; |
|
58 | - } |
|
50 | + public function cleanup($bind) { |
|
51 | + if (!is_array($bind)) { |
|
52 | + if (!empty($bind)) |
|
53 | + $bind = array($bind); |
|
54 | + else |
|
55 | + $bind = array(); |
|
56 | + } |
|
57 | + return $bind; |
|
58 | + } |
|
59 | 59 | |
60 | - public function run($sql, $bind = "") { |
|
61 | - $this->sql = trim($sql); |
|
62 | - $this->bind = $this->cleanup($bind); |
|
63 | - $this->error = ""; |
|
60 | + public function run($sql, $bind = "") { |
|
61 | + $this->sql = trim($sql); |
|
62 | + $this->bind = $this->cleanup($bind); |
|
63 | + $this->error = ""; |
|
64 | 64 | |
65 | - try { |
|
66 | - $pdostmt = $this->prepare($this->sql); |
|
67 | - if ($pdostmt->execute($this->bind) !== false) { |
|
68 | - if (preg_match("/^(" . implode("|", array("select", "describe", "pragma")) . ") /i", $this->sql)) |
|
69 | - return $pdostmt->fetchAll(PDO::FETCH_ASSOC); |
|
70 | - elseif (preg_match("/^(" . implode("|", array("delete", "insert", "update")) . ") /i", $this->sql)) |
|
71 | - return $pdostmt->rowCount(); |
|
72 | - } |
|
73 | - } catch (PDOException $e) { |
|
74 | - $this->error = $e->getMessage(); |
|
75 | - return $this->error; |
|
76 | - } |
|
77 | - } |
|
65 | + try { |
|
66 | + $pdostmt = $this->prepare($this->sql); |
|
67 | + if ($pdostmt->execute($this->bind) !== false) { |
|
68 | + if (preg_match("/^(" . implode("|", array("select", "describe", "pragma")) . ") /i", $this->sql)) |
|
69 | + return $pdostmt->fetchAll(PDO::FETCH_ASSOC); |
|
70 | + elseif (preg_match("/^(" . implode("|", array("delete", "insert", "update")) . ") /i", $this->sql)) |
|
71 | + return $pdostmt->rowCount(); |
|
72 | + } |
|
73 | + } catch (PDOException $e) { |
|
74 | + $this->error = $e->getMessage(); |
|
75 | + return $this->error; |
|
76 | + } |
|
77 | + } |
|
78 | 78 | |
79 | 79 | } |
80 | 80 |
@@ -23,172 +23,172 @@ discard block |
||
23 | 23 | |
24 | 24 | //If module/app not found |
25 | 25 | function xml_not_found() { |
26 | - header('Content-Type: text/xml'); |
|
27 | - |
|
28 | - $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
29 | - $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
30 | - $xml .= " <section name=\"result\">\n"; |
|
31 | - $xml .= " <result status=\"not found\"/>\n"; |
|
32 | - $xml .= " </section>\n"; |
|
33 | - $xml .= "</document>\n"; |
|
34 | - echo $xml; |
|
35 | - exit(); |
|
26 | + header('Content-Type: text/xml'); |
|
27 | + |
|
28 | + $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
29 | + $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
30 | + $xml .= " <section name=\"result\">\n"; |
|
31 | + $xml .= " <result status=\"not found\"/>\n"; |
|
32 | + $xml .= " </section>\n"; |
|
33 | + $xml .= "</document>\n"; |
|
34 | + echo $xml; |
|
35 | + exit(); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | //Build acl xml |
39 | 39 | function load_acl($logger, $db,$config) { |
40 | - $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
41 | - $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
42 | - $xml .= " <section name=\"Configuration\" description=\"Configuration\">\n"; |
|
43 | - $xml .= " <configuration name=\"acl.conf\" description=\"Network List\">\n"; |
|
44 | - $xml .= " <network-lists>\n"; |
|
40 | + $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
41 | + $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
42 | + $xml .= " <section name=\"Configuration\" description=\"Configuration\">\n"; |
|
43 | + $xml .= " <configuration name=\"acl.conf\" description=\"Network List\">\n"; |
|
44 | + $xml .= " <network-lists>\n"; |
|
45 | 45 | $xml .= " <list name=\"default\" default=\"deny\">\n"; |
46 | 46 | |
47 | - //For customer and provider ips |
|
48 | - $query = "SELECT ip FROM ip_map,accounts WHERE ip_map.accountid=accounts.id AND accounts.status=0 AND deleted=0"; |
|
49 | - $logger->log("ACL Query : " . $query); |
|
50 | - $res_acl = $db->run($query); |
|
51 | - $logger->log($res_acl); |
|
47 | + //For customer and provider ips |
|
48 | + $query = "SELECT ip FROM ip_map,accounts WHERE ip_map.accountid=accounts.id AND accounts.status=0 AND deleted=0"; |
|
49 | + $logger->log("ACL Query : " . $query); |
|
50 | + $res_acl = $db->run($query); |
|
51 | + $logger->log($res_acl); |
|
52 | 52 | |
53 | 53 | foreach ($res_acl as $res_acl_key => $res_acl_value) { |
54 | 54 | $xml .= " <node type=\"allow\" cidr=\"" . $res_acl_value['ip'] . "\"/>\n"; |
55 | 55 | } |
56 | 56 | |
57 | - //For gateways |
|
57 | + //For gateways |
|
58 | 58 | $query = "SELECT * FROM gateways WHERE status=0"; |
59 | - $logger->log("Sofia Gateway Query : " . $query); |
|
60 | - $sp_gw = $db->run($query); |
|
61 | - $logger->log($sp_gw); |
|
62 | - |
|
63 | - foreach ($sp_gw as $sp_gw_key => $sp_gw_value) { |
|
64 | - |
|
65 | - $sp_gw_settings = json_decode($sp_gw_value['gateway_data'], true); |
|
66 | - foreach ($sp_gw_settings as $sp_gw_settings_key => $sp_gw_settings_value) { |
|
67 | - if ($sp_gw_settings_value != "" && $sp_gw_settings_key == "proxy") |
|
68 | - { |
|
69 | - $tmp_ip_arr = explode(":",$sp_gw_settings_value); |
|
70 | - if (!filter_var($tmp_ip_arr[0], FILTER_VALIDATE_IP) === false) { |
|
71 | - $xml .= " <node type=\"allow\" cidr=\"" . $tmp_ip_arr[0] . "/32\"/>\n"; |
|
72 | - } |
|
73 | - } |
|
74 | - } |
|
75 | - |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - //For opensips |
|
80 | - if($config['opensips'] == '0') |
|
81 | - { |
|
82 | - $xml .= "<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n"; |
|
83 | - } |
|
84 | - |
|
85 | - $xml .= " </list>\n"; |
|
86 | - |
|
87 | - //For loopback |
|
88 | - if($config['opensips'] == '0') |
|
89 | - { |
|
90 | - $xml .= "<list name=\"loopback.auto\" default=\"allow\">\n"; |
|
91 | - $xml .= "<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n"; |
|
92 | - $xml .= "</list>\n"; |
|
93 | - } |
|
94 | - |
|
95 | - //For event handing |
|
96 | - $xml .= "<list name=\"event\" default=\"deny\">\n"; |
|
97 | - $xml .= ($config['opensips'] == "0")?"<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n":"\n"; |
|
98 | - $xml .= "<node type=\"allow\" cidr=\"127.0.0.0/8\"/>\n"; |
|
99 | - $xml .= "</list>\n"; |
|
100 | - $xml .= " </network-lists>\n"; |
|
101 | - $xml .= " </configuration>\n"; |
|
102 | - $xml .= " </section>\n"; |
|
103 | - $xml .= "</document>\n"; |
|
104 | - $logger->log($xml); |
|
105 | - return $xml; |
|
59 | + $logger->log("Sofia Gateway Query : " . $query); |
|
60 | + $sp_gw = $db->run($query); |
|
61 | + $logger->log($sp_gw); |
|
62 | + |
|
63 | + foreach ($sp_gw as $sp_gw_key => $sp_gw_value) { |
|
64 | + |
|
65 | + $sp_gw_settings = json_decode($sp_gw_value['gateway_data'], true); |
|
66 | + foreach ($sp_gw_settings as $sp_gw_settings_key => $sp_gw_settings_value) { |
|
67 | + if ($sp_gw_settings_value != "" && $sp_gw_settings_key == "proxy") |
|
68 | + { |
|
69 | + $tmp_ip_arr = explode(":",$sp_gw_settings_value); |
|
70 | + if (!filter_var($tmp_ip_arr[0], FILTER_VALIDATE_IP) === false) { |
|
71 | + $xml .= " <node type=\"allow\" cidr=\"" . $tmp_ip_arr[0] . "/32\"/>\n"; |
|
72 | + } |
|
73 | + } |
|
74 | + } |
|
75 | + |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + //For opensips |
|
80 | + if($config['opensips'] == '0') |
|
81 | + { |
|
82 | + $xml .= "<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n"; |
|
83 | + } |
|
84 | + |
|
85 | + $xml .= " </list>\n"; |
|
86 | + |
|
87 | + //For loopback |
|
88 | + if($config['opensips'] == '0') |
|
89 | + { |
|
90 | + $xml .= "<list name=\"loopback.auto\" default=\"allow\">\n"; |
|
91 | + $xml .= "<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n"; |
|
92 | + $xml .= "</list>\n"; |
|
93 | + } |
|
94 | + |
|
95 | + //For event handing |
|
96 | + $xml .= "<list name=\"event\" default=\"deny\">\n"; |
|
97 | + $xml .= ($config['opensips'] == "0")?"<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n":"\n"; |
|
98 | + $xml .= "<node type=\"allow\" cidr=\"127.0.0.0/8\"/>\n"; |
|
99 | + $xml .= "</list>\n"; |
|
100 | + $xml .= " </network-lists>\n"; |
|
101 | + $xml .= " </configuration>\n"; |
|
102 | + $xml .= " </section>\n"; |
|
103 | + $xml .= "</document>\n"; |
|
104 | + $logger->log($xml); |
|
105 | + return $xml; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | //Build sofia xml |
109 | 109 | function load_sofia($logger, $db) { |
110 | - $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
111 | - $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
112 | - $xml .= " <section name=\"Configuration\" description=\"Configuration\">\n"; |
|
113 | - $xml .= " <configuration name=\"sofia.conf\" description=\"SIP Profile\">\n"; |
|
114 | - $xml .= " <profiles>\n"; |
|
110 | + $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
111 | + $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
112 | + $xml .= " <section name=\"Configuration\" description=\"Configuration\">\n"; |
|
113 | + $xml .= " <configuration name=\"sofia.conf\" description=\"SIP Profile\">\n"; |
|
114 | + $xml .= " <profiles>\n"; |
|
115 | 115 | |
116 | - $query = "SELECT * FROM sip_profiles WHERE status=0"; |
|
117 | - $logger->log("Sofia Query : " . $query); |
|
118 | - $res_sp = $db->run($query); |
|
119 | - //$logger->log($res_sp); |
|
116 | + $query = "SELECT * FROM sip_profiles WHERE status=0"; |
|
117 | + $logger->log("Sofia Query : " . $query); |
|
118 | + $res_sp = $db->run($query); |
|
119 | + //$logger->log($res_sp); |
|
120 | 120 | |
121 | - foreach ($res_sp as $sp_key => $sp_value) { |
|
121 | + foreach ($res_sp as $sp_key => $sp_value) { |
|
122 | 122 | |
123 | 123 | $settings = json_decode($sp_value['profile_data'], true); |
124 | 124 | //$logger->log(print_r($settings,true)); |
125 | - $xml .= " <profile name=\"" . $sp_value['name'] . "\">\n"; |
|
125 | + $xml .= " <profile name=\"" . $sp_value['name'] . "\">\n"; |
|
126 | 126 | |
127 | - $xml .= " <domains>\n"; |
|
128 | - $xml .= " <domain name=\"" . $sp_value['sip_ip'] . "\" alias=\"true\" parse=\"true\"/>\n"; |
|
129 | - $xml .= " </domains>\n"; |
|
130 | - /*$xml .= " <aliases>\n"; |
|
127 | + $xml .= " <domains>\n"; |
|
128 | + $xml .= " <domain name=\"" . $sp_value['sip_ip'] . "\" alias=\"true\" parse=\"true\"/>\n"; |
|
129 | + $xml .= " </domains>\n"; |
|
130 | + /*$xml .= " <aliases>\n"; |
|
131 | 131 | $xml .= " <alias name=\"" . $sp_value['sip_ip'] . "\"/>\n"; |
132 | 132 | $xml .= " </aliases>\n";*/ |
133 | 133 | |
134 | 134 | $xml .= " <settings>\n"; |
135 | - $xml .= " <param name=\"sip-ip\" value=\"" . $sp_value['sip_ip'] . "\"/>\n"; |
|
136 | - $xml .= " <param name=\"sip-port\" value=\"" . $sp_value['sip_port'] . "\"/>\n"; |
|
135 | + $xml .= " <param name=\"sip-ip\" value=\"" . $sp_value['sip_ip'] . "\"/>\n"; |
|
136 | + $xml .= " <param name=\"sip-port\" value=\"" . $sp_value['sip_port'] . "\"/>\n"; |
|
137 | 137 | foreach($settings as $set_key => $set_val) |
138 | 138 | { |
139 | - $xml .= " <param name=\"" . $set_key . "\" value=\"" . $set_val . "\"/>\n"; |
|
139 | + $xml .= " <param name=\"" . $set_key . "\" value=\"" . $set_val . "\"/>\n"; |
|
140 | 140 | } |
141 | - $xml .= " </settings>\n"; |
|
141 | + $xml .= " </settings>\n"; |
|
142 | 142 | |
143 | 143 | |
144 | - //Gateway block start |
|
145 | - $xml .= " <gateways>\n"; |
|
146 | - $query = "SELECT * FROM gateways WHERE sip_profile_id=" . $sp_value['id'] . " AND status=0"; |
|
147 | - $logger->log("Sofia Gateway Query : " . $query); |
|
148 | - $sp_gw = $db->run($query); |
|
149 | - $logger->log($sp_gw); |
|
150 | - foreach ($sp_gw as $sp_gw_key => $sp_gw_value) { |
|
151 | - $xml .= " <gateway name=\"" . $sp_gw_value['name'] . "\">\n"; |
|
144 | + //Gateway block start |
|
145 | + $xml .= " <gateways>\n"; |
|
146 | + $query = "SELECT * FROM gateways WHERE sip_profile_id=" . $sp_value['id'] . " AND status=0"; |
|
147 | + $logger->log("Sofia Gateway Query : " . $query); |
|
148 | + $sp_gw = $db->run($query); |
|
149 | + $logger->log($sp_gw); |
|
150 | + foreach ($sp_gw as $sp_gw_key => $sp_gw_value) { |
|
151 | + $xml .= " <gateway name=\"" . $sp_gw_value['name'] . "\">\n"; |
|
152 | 152 | |
153 | 153 | |
154 | 154 | |
155 | 155 | $sp_gw_settings = json_decode($sp_gw_value['gateway_data'], true); |
156 | - foreach ($sp_gw_settings as $sp_gw_settings_key => $sp_gw_settings_value) { |
|
157 | - if ($sp_gw_settings_value != "") |
|
158 | - $xml .= " <param name=\"" . $sp_gw_settings_key . "\" value=\"" . $sp_gw_settings_value . "\"/>\n"; |
|
159 | - } |
|
160 | - $xml .= " </gateway>\n"; |
|
161 | - } |
|
162 | - $xml .= " </gateways>\n"; |
|
163 | - //Gateway block end |
|
164 | - |
|
165 | - $xml .= " </profile>\n"; |
|
166 | - } |
|
156 | + foreach ($sp_gw_settings as $sp_gw_settings_key => $sp_gw_settings_value) { |
|
157 | + if ($sp_gw_settings_value != "") |
|
158 | + $xml .= " <param name=\"" . $sp_gw_settings_key . "\" value=\"" . $sp_gw_settings_value . "\"/>\n"; |
|
159 | + } |
|
160 | + $xml .= " </gateway>\n"; |
|
161 | + } |
|
162 | + $xml .= " </gateways>\n"; |
|
163 | + //Gateway block end |
|
164 | + |
|
165 | + $xml .= " </profile>\n"; |
|
166 | + } |
|
167 | 167 | //echo $xml; |
168 | - $xml .= " </profiles>\n"; |
|
169 | - $xml .= " </configuration>\n"; |
|
170 | - $xml .= " </section>\n"; |
|
171 | - $xml .= "</document>\n"; |
|
172 | - $logger->log($xml); |
|
173 | - return $xml; |
|
168 | + $xml .= " </profiles>\n"; |
|
169 | + $xml .= " </configuration>\n"; |
|
170 | + $xml .= " </section>\n"; |
|
171 | + $xml .= "</document>\n"; |
|
172 | + $logger->log($xml); |
|
173 | + return $xml; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | //Build directory xml |
177 | 177 | function load_directory($logger, $db) { |
178 | - $xml = ""; |
|
178 | + $xml = ""; |
|
179 | 179 | |
180 | - $query = "SELECT username,dir_params,dir_vars,number as accountcode,accountid FROM sip_devices,accounts WHERE accounts.status=0 AND accounts.deleted=0 AND accounts.id=sip_devices.accountid AND username='" . $_REQUEST['user']."' limit 1"; |
|
180 | + $query = "SELECT username,dir_params,dir_vars,number as accountcode,accountid FROM sip_devices,accounts WHERE accounts.status=0 AND accounts.deleted=0 AND accounts.id=sip_devices.accountid AND username='" . $_REQUEST['user']."' limit 1"; |
|
181 | 181 | |
182 | - $logger->log("Directory Query : " . $query); |
|
183 | - $res_dir = $db->run($query); |
|
184 | - $logger->log($res_dir); |
|
182 | + $logger->log("Directory Query : " . $query); |
|
183 | + $res_dir = $db->run($query); |
|
184 | + $logger->log($res_dir); |
|
185 | 185 | |
186 | - foreach ($res_dir as $res_dir_key => $res_dir_value) { |
|
187 | - $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
188 | - $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
189 | - $xml .= " <section name=\"Directory\" description=\"Directory\">\n"; |
|
190 | - $xml .= " <domain name=\"" . $_REQUEST['domain'] . "\" alias=\"true\">\n"; |
|
191 | - $xml .= " <user id=\"" . $_REQUEST['user'] . "\">\n"; |
|
186 | + foreach ($res_dir as $res_dir_key => $res_dir_value) { |
|
187 | + $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
188 | + $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
189 | + $xml .= " <section name=\"Directory\" description=\"Directory\">\n"; |
|
190 | + $xml .= " <domain name=\"" . $_REQUEST['domain'] . "\" alias=\"true\">\n"; |
|
191 | + $xml .= " <user id=\"" . $_REQUEST['user'] . "\">\n"; |
|
192 | 192 | |
193 | 193 | $params = json_decode($res_dir_value['dir_params'], true); |
194 | 194 | |
@@ -196,36 +196,36 @@ discard block |
||
196 | 196 | $param_xml = $var_xml = ""; |
197 | 197 | foreach($params as $parms_key => $res_dir_params) |
198 | 198 | { |
199 | - $param_xml .= "<param name=\"" . $parms_key . "\" value=\"" . $res_dir_params . "\"/>\n"; |
|
199 | + $param_xml .= "<param name=\"" . $parms_key . "\" value=\"" . $res_dir_params . "\"/>\n"; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | foreach($vars as $var_key => $res_dir_vars) |
203 | 203 | { |
204 | - $var_xml .= "<variable name=\"" . $var_key . "\" value=\"" . $res_dir_vars . "\"/>\n"; |
|
204 | + $var_xml .= "<variable name=\"" . $var_key . "\" value=\"" . $res_dir_vars . "\"/>\n"; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | |
208 | - $xml .= " <params>\n"; |
|
209 | - $xml .= $param_xml; |
|
210 | - $xml .= "<param name=\"allow-empty-password\" value=\"false\"/>\n"; |
|
211 | - $xml .= "<param name=\"dial-string\" value=\"{sip_invite_domain=\${domain_name},presence_id=\${dialed_user}@\${domain_name}}\${sofia_contact(*/\${dialed_user}@\${domain_name})}\"/>\n"; |
|
212 | - $xml .= " </params>\n"; |
|
213 | - |
|
214 | - $xml .= " <variables>\n"; |
|
215 | - $xml .= $var_xml; |
|
216 | - $xml .= "<variable name=\"sipcall\" value=\"true\"/>\n"; |
|
217 | - $xml .= "<variable name=\"accountcode\" value=\"" . $res_dir_value['accountcode'] . "\"/>\n"; |
|
218 | - $xml .= "<variable name=\"domain_name\" value=\"" . $_REQUEST['domain'] . "\"/>\n"; |
|
219 | - $xml .= " </variables>\n"; |
|
220 | - |
|
221 | - $xml .= " </user>\n"; |
|
222 | - $xml .= " </domain>\n"; |
|
223 | - $xml .= " </section>\n"; |
|
224 | - $xml .= "</document>\n"; |
|
225 | - } |
|
208 | + $xml .= " <params>\n"; |
|
209 | + $xml .= $param_xml; |
|
210 | + $xml .= "<param name=\"allow-empty-password\" value=\"false\"/>\n"; |
|
211 | + $xml .= "<param name=\"dial-string\" value=\"{sip_invite_domain=\${domain_name},presence_id=\${dialed_user}@\${domain_name}}\${sofia_contact(*/\${dialed_user}@\${domain_name})}\"/>\n"; |
|
212 | + $xml .= " </params>\n"; |
|
213 | + |
|
214 | + $xml .= " <variables>\n"; |
|
215 | + $xml .= $var_xml; |
|
216 | + $xml .= "<variable name=\"sipcall\" value=\"true\"/>\n"; |
|
217 | + $xml .= "<variable name=\"accountcode\" value=\"" . $res_dir_value['accountcode'] . "\"/>\n"; |
|
218 | + $xml .= "<variable name=\"domain_name\" value=\"" . $_REQUEST['domain'] . "\"/>\n"; |
|
219 | + $xml .= " </variables>\n"; |
|
220 | + |
|
221 | + $xml .= " </user>\n"; |
|
222 | + $xml .= " </domain>\n"; |
|
223 | + $xml .= " </section>\n"; |
|
224 | + $xml .= "</document>\n"; |
|
225 | + } |
|
226 | 226 | |
227 | - $logger->log($xml); |
|
228 | - return $xml; |
|
227 | + $logger->log($xml); |
|
228 | + return $xml; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | ?> |