From: Seven Du Date: Tue, 13 Aug 2013 00:30:52 +0000 (+0800) Subject: add api/bgapi event functions X-Git-Tag: v1.4.1~18^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3901ff4dddf6553c985f9a000398a1af918f36f6;p=thirdparty%2Ffreeswitch.git add api/bgapi event functions --- diff --git a/htdocs/portal/assets/js/fsportal.js b/htdocs/portal/assets/js/fsportal.js index cf9f87f1fe..f76c371d23 100644 --- a/htdocs/portal/assets/js/fsportal.js +++ b/htdocs/portal/assets/js/fsportal.js @@ -783,3 +783,30 @@ function eventCallback(data) { } } +// execute api +function api(cmdstr) +{ + cmdarr = cmdstr.split(" "); + cmd = cmdarr.shift(); + arg = escape(cmdarr.join(" ")); + arg = arg ? "?" + arg : ""; + url = "/txtapi/" + cmd + arg; + $.get(url, function(data){ + console.log(data); + }); + return url; +} + +//execute bgapi +function bgapi(cmd) +{ + api("bgapi " + cmd); +} + +// subscribe event +function event(e) +{ + cmd = "event json " + e; + socket.send(cmd); + return cmd; +}