Skip to content

Instantly share code, notes, and snippets.

/*
Set timers in the AM to wake device and keep Digital Signage running
Timers in the PM allow device to go into standby but wake when
someone enters the room but digital signage only plays for short amount of time once in halwake state
*/
import xapi from 'xapi';
const Sunday = 0, Saturday = 6;
@voipnorm
voipnorm / xmppToSparkBot.js
Last active January 13, 2020 22:02
xmpp client to Spark Bot
//CISCOSPARK_ACCESS_TOKEN=<your token> DEBUG=* node server.js
var xmpp = require('simple-xmpp'),
http = require('http'),
ciscospark = require('ciscospark'),
assert = require('assert'),
fs = require('fs'),
path = require('path'),
logger = require('log4js');
logger.configure({
//DEBUG=* node server.js
var xmpp = require('simple-xmpp'),
http = require('http'),
fs = require('fs'),
path = require('path'),
logger = require('log4js'),
sparkMessage = require('./myutils/sparkMethods'),
os = require('os');
//Console logging to file
logger.configure({
//Monitoring service route
app.get('/monitor', function(req, res){
var json_response = {'name':'JabberAssist'};
res.status(200).json(json_response);
});
"use strict"
var Monitor = require('ping-monitor');
var websites = require('./websites');
var http = require('http');
var port = process.env.PORT || 3008;
var events = require('./events');
var logger = require('log4js');
logger.configure({
/*
Module parses all incoming requests from Spark webhooks and provides the responses for the bot from the node-flint framework.
*/
var _ = require('lodash');
var botString = "YourBotName ";
module.exports = function(flint){
flint.hears(/(^| ).*( |.|$)/i, function(bot, trigger) {
var text = trigger.text;
const WebSocket = require('ws');
const XAPI = require('jsxapi/lib/xapi').default;
const WSBackend = require('jsxapi/lib/backend/ws').default;
const url = 'ws://codecip/ws';
const username = 'admin';
const password = '';
const auth = Buffer.from(`${username}:${password}`).toString('base64');
const options = {
const jsxapi = require('jsxapi');
const username = 'admin';
const password = 'password';
const url = 'ssh://ip-address'
const xapi = jsxapi.connect(url, {
username: username,
password: password,
const ciscoTPClient = require('cisco-tp-client');
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const port = 3000;
const ip = '<endpoint-IP>';
const serverip = 'http://<server-IP>:3000/';
const status = ["/Status/Audio/Volume"];
async function callHistory() {
const history = await this.xapi.command("CallHistory Recents", {Limit: 1, DetailLevel: "Full"});
console.log(history);
return history;
}