Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Update for Twilio JS v1.4 #429

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions OpenVBX/controllers/iframe.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,15 @@

class Iframe extends User_Controller {

protected $client_token_timeout;
protected $twilio_js_version = '1.2';
protected $client_token_timeout;

function index() {
$data = $this->init_view_data();

$twilio_js = sprintf('//static.twilio.com/libs/twiliojs/%s/twilio%s.js',
$this->twilio_js_version,
($this->config->item('use_unminimized_js') ? '' : '.min')
);


$data = array_merge($data, array(
'site_title' => 'OpenVBX',
'iframe_url' => site_url('/messages'),
'users' => $this->get_users(),
'twilio_js' => $twilio_js,
'client_capability' => null
));

Expand Down
3 changes: 2 additions & 1 deletion OpenVBX/views/iframe.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
</iframe>
</div><!-- /container -->

<script type="text/javascript" src="<?php echo $twilio_js; ?>"></script>
<script type="text/javascript" src="//media.twiliocdn.com/sdk/js/client/v1.4/twilio.min.js"></script>

<?php $this->load->view('js-init'); ?>
<script type="text/javascript" src="<?php echo asset_url('assets/j/iframe.js?v='.$site_rev) ?>"></script>
</body>
Expand Down
14 changes: 7 additions & 7 deletions assets/j/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ var Client = {
Client.cancel(conn);
});

Twilio.Device.presence(function(event) {
Client.log('event: presence');
Client.handleEvent(event);
});
// Twilio.Device.presence(function(event) {
// Client.log('event: presence');
// Client.handleEvent(event);
// });

$('#dialer #client-ui-actions button').hide();
}
Expand Down Expand Up @@ -367,7 +367,7 @@ var Client = {
this.connection.accept();
this.status.setCallStatus(true);

Twilio.Device.sounds.incoming(false);
Twilio.Device.audio.incoming(false);

var connection_message = 'Connected';
if (this.connection.parameters.From) {
Expand Down Expand Up @@ -396,7 +396,7 @@ var Client = {
},

connect: function (connection) {
Twilio.Device.sounds.incoming(false);
Twilio.Device.audio.incoming(false);

this.ui.startTick();
this.ui.hide_actions('button');
Expand All @@ -422,7 +422,7 @@ var Client = {
}

if (connection.parameters.CallSid == this.connection.parameters.CallSid) {
Twilio.Device.sounds.incoming(true);
Twilio.Device.audio.incoming(true);

// reset ui
this.ui.endTick();
Expand Down