]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8036 [verto.js] #resolve Add chatCallback to $.verto.conf
authorJoao Mesquita <jmesquita@indicium.com.ar>
Mon, 24 Aug 2015 16:37:26 +0000 (13:37 -0300)
committerJoao Mesquita <jmesquita@indicium.com.ar>
Mon, 24 Aug 2015 19:08:13 +0000 (16:08 -0300)
html5/verto/js/src/jquery.verto.js

index 956b3fd969389b9fcf29115f57aaf26b7625dc1d..e253d7d74a4a2593401ba9330ebfc2ae29bd14c0 100644 (file)
                     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) {
         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() {
             }
             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 = {};