Built motion from commit b5996064.|2.6.21
[motion2.git] / server / api / chatApplication / chatApplication.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 _0xf64b=['info','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x55d91,_0x351fae){var _0x46d0b3=function(_0x60c293){while(--_0x60c293){_0x55d91['push'](_0x55d91['shift']());}};_0x46d0b3(++_0x351fae);}(_0xf64b,0x1ad));var _0xbf64=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0xf64b[_0x4702ee];return _0x62ca7d;};'use strict';var _=require(_0xbf64('0x0'));var util=require('util');var moment=require(_0xbf64('0x1'));var BPromise=require(_0xbf64('0x2'));var rs=require(_0xbf64('0x3'));var fs=require('fs');var Redis=require(_0xbf64('0x4'));var db=require(_0xbf64('0x5'))['db'];var utils=require(_0xbf64('0x6'));var logger=require(_0xbf64('0x7'))('rpc');var config=require(_0xbf64('0x8'));var jayson=require(_0xbf64('0x9'));var client=jayson['client'][_0xbf64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1873e1,_0x206d80,_0x4f1c2d){return new BPromise(function(_0x18c7ed,_0x21baad){return client[_0xbf64('0xb')](_0x1873e1,_0x4f1c2d)['then'](function(_0xb72d8a){logger[_0xbf64('0xc')]('ChatApplication,\x20%s,\x20%s',_0x206d80,_0xbf64('0xd'));logger['debug'](_0xbf64('0xe'),_0x206d80,_0xbf64('0xd'),JSON[_0xbf64('0xf')](_0xb72d8a));if(_0xb72d8a[_0xbf64('0x10')]){if(_0xb72d8a[_0xbf64('0x10')][_0xbf64('0x11')]===0x1f4){logger[_0xbf64('0x10')](_0xbf64('0x12'),_0x206d80,_0xb72d8a['error'][_0xbf64('0x13')]);return _0x21baad(_0xb72d8a[_0xbf64('0x10')]['message']);}logger[_0xbf64('0x10')](_0xbf64('0x12'),_0x206d80,_0xb72d8a[_0xbf64('0x10')][_0xbf64('0x13')]);return _0x18c7ed(_0xb72d8a[_0xbf64('0x10')][_0xbf64('0x13')]);}else{logger['info'](_0xbf64('0x12'),_0x206d80,_0xbf64('0xd'));_0x18c7ed(_0xb72d8a[_0xbf64('0x14')][_0xbf64('0x13')]);}})['catch'](function(_0x460336){logger[_0xbf64('0x10')]('ChatApplication,\x20%s,\x20%s',_0x206d80,_0x460336);_0x21baad(_0x460336);});});}