From 38bd4e2a4bc93bca5e3171c5ad9289ce0d94a276 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 14 Jan 2016 11:10:05 -0800 Subject: [PATCH] wss support --- Webrtc.class.php | 12 +++++++++--- module.xml | 2 +- ucp/assets/js/global.js | 3 ++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Webrtc.class.php b/Webrtc.class.php index a4291aa..ed630bc 100644 --- a/Webrtc.class.php +++ b/Webrtc.class.php @@ -9,7 +9,7 @@ class Webrtc extends \FreePBX_Helpers implements \BMO { */ private $overrides = array( "sip" => array( - "transport" => "ws", + "transport" => "wss,ws", "avpf" => "yes", "force_avp" => "yes", "icesupport" => "yes", @@ -377,6 +377,9 @@ public function getClientSettingsByUser($user) { $this->removeClientSettingsByUser($user); return false; } + if($this->freepbx->Config->get('HTTPTLSENABLE') && $dev['transport'] == "chan_sip" && ($dev['transport'] != "wss" && $dev['transport'] != "wss,ws")) { + return false; + } //$usr = core_users_get($results['user']); $results['realm'] = !empty($results['realm']) ? $results['realm'] : $sip_server; $results['username'] = !empty($results['username']) ? $results['username'] : $dev['id']; @@ -384,7 +387,10 @@ public function getClientSettingsByUser($user) { $results['password'] = !empty($results['password']) ? $results['password'] : $dev['secret']; $prefix = $this->freepbx->Config->get('HTTPPREFIX'); $suffix = !empty($prefix) ? "/".$prefix."/ws" : "/ws"; - $results['websocket'] = !empty($results['websocket']) ? $results['websocket'] : 'ws://'.$sip_server.':'.$this->freepbx->Config->get('HTTPBINDPORT').$suffix; + + $type = $this->freepbx->Config->get('HTTPTLSENABLE') ? 'wss' : 'ws'; + $port = $this->freepbx->Config->get('HTTPTLSENABLE') ? $this->freepbx->Config->get('HTTPTLSBINDPORT') : $this->freepbx->Config->get('HTTPBINDPORT'); + $results['websocket'] = !empty($results['websocket']) ? $results['websocket'] : $type.'://'.$sip_server.':'.$port.$suffix; $results['breaker'] = !empty($results['breaker']) ? (bool)$results['breaker'] : false; $results['cid'] = !empty($results['cid']) ? $results['cid'] : ''; return $results; @@ -426,7 +432,7 @@ public function createDevice($extension,$certid) { case 'sip': $settings['avpf']['value'] = 'yes'; $settings['force_avp']['value'] = 'yes'; - $settings['transport']['value'] = 'ws'; + $settings['transport']['value'] = 'wss,ws'; $settings['icesupport']['value'] = 'yes'; $settings['encryption']['value'] = 'yes'; $this->core->addDevice($id,'sip',$settings); diff --git a/module.xml b/module.xml index 7cf9712..00d2ec8 100644 --- a/module.xml +++ b/module.xml @@ -57,7 +57,7 @@ asterisk 11.5 certman ge 12.0.0alpha1 - core ge 12.0.1beta9 + core ge 13.0.33 ucp ge 12.0.0beta7 12.0.1beta34 diff --git a/ucp/assets/js/global.js b/ucp/assets/js/global.js index c0c6ea8..20f0091 100644 --- a/ucp/assets/js/global.js +++ b/ucp/assets/js/global.js @@ -188,7 +188,8 @@ var WebrtcC = UCPMC.extend({ $.each(this.callBinds, function(i, v) { Webrtc.activeCalls[Webrtc.activeCallId].on(v, function(e) { - if(v == "progress" && webrtcDetectedType == "webkit") { + if(v == "progress") { + //TODO: was webrtcDetectedType == "webkit" e.body = null; } Webrtc.sessionEvent(v, e);