From: Joao Mesquita Date: Mon, 24 Aug 2015 16:37:26 +0000 (-0300) Subject: FS-8036 [verto.js] #resolve Add chatCallback to $.verto.conf X-Git-Tag: v1.6.2~115^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=749313a2b266314645db82fb74d86e413baeb772;p=thirdparty%2Ffreeswitch.git FS-8036 [verto.js] #resolve Add chatCallback to $.verto.conf --- diff --git a/html5/verto/js/src/jquery.verto.js b/html5/verto/js/src/jquery.verto.js index 956b3fd969..e253d7d74a 100644 --- a/html5/verto/js/src/jquery.verto.js +++ b/html5/verto/js/src/jquery.verto.js @@ -1193,7 +1193,15 @@ conf.params.onBroadcast(verto, conf, e.data); } } - }) + }); + + verto.subscribe(conf.params.laData.chatChannel, { + handler: function(v, e) { + if (typeof(conf.params.chatCallback) === "function") { + conf.params.chatCallback(v,e); + } + } + }); }; $.verto.conf.prototype.modCommand = function(cmd, id, value) { @@ -1219,6 +1227,10 @@ if (conf.params.laData.modChannel) { conf.verto.unsubscribe(conf.params.laData.modChannel); } + + if (conf.params.laData.chatChannel) { + conf.verto.unsubscribe(conf.params.laData.chatChannel); + } }; function createMainModeratorMethods() { @@ -1312,6 +1324,19 @@ } this.modCommand("transfer", parseInt(memberID), "exten"); }; + + $.verto.conf.prototype.sendChat = function(message, type) { + var conf = this; + conf.verto.rpcClient.call("verto.broadcast", { + "eventChannel": conf.params.laData.chatChannel, + "data": { + "action": "send", + "message": message, + "type": type + } + }); + }; + } $.verto.modfuncs = {};