Skip to content

Commit

Permalink
wss support
Browse files Browse the repository at this point in the history
  • Loading branch information
tm1000 committed Jan 14, 2016
1 parent 4223cc4 commit 38bd4e2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
12 changes: 9 additions & 3 deletions Webrtc.class.php
Expand Up @@ -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",
Expand Down Expand Up @@ -377,14 +377,20 @@ 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'];
$results['sipuri'] = !empty($results['sipuri']) ? $results['sipuri'] : 'sip:'.$results['username'].'@'.$sip_server;
$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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion module.xml
Expand Up @@ -57,7 +57,7 @@
<depends>
<engine>asterisk 11.5</engine>
<module>certman ge 12.0.0alpha1</module>
<module>core ge 12.0.1beta9</module>
<module>core ge 13.0.33</module>
<module>ucp ge 12.0.0beta7</module>
<version>12.0.1beta34</version>
</depends>
Expand Down
3 changes: 2 additions & 1 deletion ucp/assets/js/global.js
Expand Up @@ -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);
Expand Down

0 comments on commit 38bd4e2

Please sign in to comment.