]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
auto subscribe to background_job when use bgapi
authorSeven Du <dujinfang@gmail.com>
Tue, 13 Aug 2013 00:46:16 +0000 (08:46 +0800)
committerSeven Du <dujinfang@gmail.com>
Tue, 13 Aug 2013 10:30:19 +0000 (18:30 +0800)
htdocs/portal/assets/js/fsportal.js

index f76c371d23385966d64ff2b1da90a87211cf11f6..d002cac4d10a93db538ed71af8a965685b5c39e5 100644 (file)
@@ -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);
 }