Skip to content

Commit af8f230

Browse files
authored
Merge pull request #3 from iKnowITWorks/master
For WebRTC feature from #7666 issue tracker
2 parents 55546b4 + df5c1aa commit af8f230

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

goSettings/goCheckWebrtc.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,22 @@
2020
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
*/
2222

23+
$user_id = $goDB->escape($_REQUEST['user_id']);
24+
2325
$goDB->where('setting', 'GO_agent_use_wss');
2426
$rslt = $goDB->getOne('settings', 'value');
2527

2628
if($rslt){
27-
$apiresults = array("result" => $rslt['value']);
29+
$webrtc = $rslt['value'];
30+
if ($webrtc > 0 && (!empty($user_id) && !is_null($user_id))) {
31+
$goDB->where('userid', $user_id);
32+
$rsltu = $goDB->getOne('users', 'enable_webrtc');
33+
if ($rsltu['enable_webrtc'] > -1) {
34+
$webrtc = $rsltu['enable_webrtc'];
35+
}
36+
}
37+
38+
$apiresults = array("result" => $webrtc);
2839
} else {
2940
$apiresults = array("result" => "Faile to get Result.");
3041
}

goUsers/goEditUser.php

+14-8
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
$agentonly_callbacks = $astDB->escape($_REQUEST['agentonly_callbacks']);
4949
$agent_lead_search_override = $astDB->escape($_REQUEST['agent_lead_search_override']);
5050
$avatar = $astDB->escape($_REQUEST['avatar']);
51+
$enable_webrtc = $astDB->escape($_REQUEST['enable_webrtc']);
5152
$location = $astDB->escape($_REQUEST['location_id']);
5253

5354
// Default Values
@@ -184,7 +185,8 @@
184185
"avatar" => $avatar,
185186
"user_group" => $user_group,
186187
"role" => $user_level,
187-
"status" => $goactive
188+
"status" => $goactive,
189+
"enable_webrtc" => $enable_webrtc
188190
);
189191

190192
$insertUserGoArray = array(
@@ -312,18 +314,18 @@
312314

313315
$update_array = array_merge($update_array, array(
314316
"pass_hash" => $pass_hash,
315-
"pass" => "",
316-
"phone_pass" => ""
317+
"pass" => ((int)$enable_webrtc == 0) ? $pass : "",
318+
"phone_pass" => ((int)$enable_webrtc == 0) ? $phone_pass : ""
317319
)
318320
);
319321

320-
$goDB->where("setting", "GO_agent_domain");
321-
$fetch_value = $astDB->getOne("settings", "value");
322+
$goDB->where("setting", "GO_agent_wss_sip");
323+
$fetch_value = $goDB->getOne("settings", "value");
322324

323325
$value = $fetch_value["value"];
324326
$realm = (!is_null ($value) || $value !== '') ? $value : 'goautodial.com';
325-
$ha1 = md5 ("{$phone_login}:{$realm}:{$phone_pass}");
326-
$ha1b = md5 ("{$phone_login}@{$realm}:{$realm}:{$phone_pass}");
327+
$ha1 = md5 ("{$phone_login}:{$realm}:{$pass}");
328+
$ha1b = md5 ("{$phone_login}@{$realm}:{$realm}:{$pass}");
327329

328330
$subscriber_array = array(
329331
"password" => "",
@@ -376,6 +378,10 @@
376378
$astDB->update("phones", $phones_array);
377379

378380
$log_id = log_action($goDB, 'MODIFY', $log_user, $log_ip, "Modified Phone: $phone_login", $log_group, $astDB->getLastQuery());
381+
382+
if ($protocol != "EXTERNAL") {
383+
$rebuild = rebuildconfQuery($astDB);
384+
}
379385
}
380386

381387
$astDB->where("user", $user);
@@ -403,7 +409,7 @@
403409
$goDB->where("carrier_id", $user_group);
404410
$goDB->update('justgovoip_sippy_info', $justgovoip_array);
405411

406-
$log_id = log_action($goDB, 'MODIFY', $log_user, $log_ip, "Modified Phone: $phone_pass", $log_group, $goDB->getLastQuery());
412+
$log_id = log_action($goDB, 'MODIFY', $log_user, $log_ip, "Modified Phone: $phone_login", $log_group, $goDB->getLastQuery());
407413

408414
if ($queryUpdateUser) {
409415
$apiresults = array(

0 commit comments

Comments
 (0)