From 7f461ef8a167b5e21456f03b3da8a3f09a085f33 Mon Sep 17 00:00:00 2001 From: Thomas NOEL Date: Fri, 24 Mar 2017 11:14:34 +0100 Subject: [PATCH] phone: check aif call in progress on loading page (#15592) --- welco/static/js/welco.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/welco/static/js/welco.js b/welco/static/js/welco.js index 549ef97..e73b0f9 100644 --- a/welco/static/js/welco.js +++ b/welco/static/js/welco.js @@ -572,6 +572,29 @@ $(function() { }); } } + + /* check current call */ + var current_calls_url = $('[data-current-calls]').data('current-calls'); + $.ajax({url: current_calls_url, + dataType: 'json', + success: function(response) { + if (response.data.calls.length != 0) { + /* a call is in progress */ + var caller = response.data.calls[0].caller; + var zone = $('.source-phone .source [data-zone-url]'); + $.ajax({url: zone.data('zone-url'), + dataType: 'html', + success: function(data) { + $(zone).parent('div').html(data); + refresh_bottom_cells(function() { + $('.contacts input[name=q]').val(caller).trigger('keyup'); + }); + } + }); + } + } + }); + window.setTimeout(check_calls, 1000); } -- 2.11.0