196eadfc86d6e4ee4810d0c07d6bdbb1e9de8a29
[motion2.git] / server / api / cannedAnswer / cannedAnswer.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xbecf=['jayson/promise','client','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1b8077,_0x2c1e02){var _0x5b003d=function(_0x3715b0){while(--_0x3715b0){_0x1b8077['push'](_0x1b8077['shift']());}};_0x5b003d(++_0x2c1e02);}(_0xbecf,0x149));var _0xfbec=function(_0x43c16f,_0x1ccc87){_0x43c16f=_0x43c16f-0x0;var _0x294b0a=_0xbecf[_0x43c16f];return _0x294b0a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfbec('0x0'));var BPromise=require(_0xfbec('0x1'));var rs=require(_0xfbec('0x2'));var fs=require('fs');var Redis=require(_0xfbec('0x3'));var db=require(_0xfbec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbec('0x5'))(_0xfbec('0x6'));var config=require('../../config/environment');var jayson=require(_0xfbec('0x7'));var client=jayson[_0xfbec('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cb1d7,_0x591f83,_0x5619e1){return new BPromise(function(_0x510599,_0x14f707){return client[_0xfbec('0x9')](_0x2cb1d7,_0x5619e1)[_0xfbec('0xa')](function(_0x449c55){logger[_0xfbec('0xb')](_0xfbec('0xc'),_0x591f83,_0xfbec('0xd'));logger[_0xfbec('0xe')](_0xfbec('0xf'),_0x591f83,_0xfbec('0xd'),JSON['stringify'](_0x449c55));if(_0x449c55[_0xfbec('0x10')]){if(_0x449c55[_0xfbec('0x10')][_0xfbec('0x11')]===0x1f4){logger[_0xfbec('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x591f83,_0x449c55[_0xfbec('0x10')][_0xfbec('0x12')]);return _0x14f707(_0x449c55[_0xfbec('0x10')][_0xfbec('0x12')]);}logger[_0xfbec('0x10')](_0xfbec('0xc'),_0x591f83,_0x449c55[_0xfbec('0x10')][_0xfbec('0x12')]);return _0x510599(_0x449c55['error'][_0xfbec('0x12')]);}else{logger[_0xfbec('0xb')](_0xfbec('0xc'),_0x591f83,_0xfbec('0xd'));_0x510599(_0x449c55[_0xfbec('0x13')]['message']);}})[_0xfbec('0x14')](function(_0x1922db){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x591f83,_0x1922db);_0x14f707(_0x1922db);});});}