From: Seven Du Date: Tue, 13 Aug 2013 00:46:16 +0000 (+0800) Subject: auto subscribe to background_job when use bgapi X-Git-Tag: v1.4.1~18^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1540c63269401bab80aa012a06ac79f4259a21a;p=thirdparty%2Ffreeswitch.git auto subscribe to background_job when use bgapi --- diff --git a/htdocs/portal/assets/js/fsportal.js b/htdocs/portal/assets/js/fsportal.js index f76c371d23..d002cac4d1 100644 --- a/htdocs/portal/assets/js/fsportal.js +++ b/htdocs/portal/assets/js/fsportal.js @@ -716,11 +716,13 @@ App.usersController = Ember.ArrayController.create({ App.initialize(); var global_debug_event = false; +var global_background_job = false; function eventCallback(data) { console.log(data["Event-Name"]); - if (global_debug_event) { + if (global_debug_event || + (global_background_job && data["Event-Name"] == "BACKGROUND_JOB")) { console.log(data); } @@ -800,6 +802,10 @@ function api(cmdstr) //execute bgapi function bgapi(cmd) { + if (!global_background_job) { + socket.send("event json BACKGROUND_JOB"); + global_background_job = true; + } api("bgapi " + cmd); }