Built motion from commit (unavailable).|2.4.4
[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 _0x44b8=['rpc','../../config/environment','jayson/promise','http','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xa32538,_0x3e7a5f){var _0x304f4f=function(_0x5731d2){while(--_0x5731d2){_0xa32538['push'](_0xa32538['shift']());}};_0x304f4f(++_0x3e7a5f);}(_0x44b8,0x8d));var _0x844b=function(_0x42ab50,_0x21a455){_0x42ab50=_0x42ab50-0x0;var _0x11a297=_0x44b8[_0x42ab50];return _0x11a297;};'use strict';var _=require(_0x844b('0x0'));var util=require('util');var moment=require(_0x844b('0x1'));var BPromise=require(_0x844b('0x2'));var rs=require(_0x844b('0x3'));var fs=require('fs');var Redis=require(_0x844b('0x4'));var db=require(_0x844b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x844b('0x6'));var config=require(_0x844b('0x7'));var jayson=require(_0x844b('0x8'));var client=jayson['client'][_0x844b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd448ca,_0x1d9154,_0x546e48){return new BPromise(function(_0x24bc28,_0x4399eb){return client['request'](_0xd448ca,_0x546e48)['then'](function(_0x2ad72b){logger['info']('ChatApplication,\x20%s,\x20%s',_0x1d9154,_0x844b('0xa'));logger[_0x844b('0xb')](_0x844b('0xc'),_0x1d9154,_0x844b('0xa'),JSON[_0x844b('0xd')](_0x2ad72b));if(_0x2ad72b[_0x844b('0xe')]){if(_0x2ad72b[_0x844b('0xe')][_0x844b('0xf')]===0x1f4){logger[_0x844b('0xe')]('ChatApplication,\x20%s,\x20%s',_0x1d9154,_0x2ad72b['error'][_0x844b('0x10')]);return _0x4399eb(_0x2ad72b[_0x844b('0xe')][_0x844b('0x10')]);}logger[_0x844b('0xe')](_0x844b('0x11'),_0x1d9154,_0x2ad72b[_0x844b('0xe')][_0x844b('0x10')]);return _0x24bc28(_0x2ad72b[_0x844b('0xe')][_0x844b('0x10')]);}else{logger[_0x844b('0x12')](_0x844b('0x11'),_0x1d9154,_0x844b('0xa'));_0x24bc28(_0x2ad72b[_0x844b('0x13')][_0x844b('0x10')]);}})[_0x844b('0x14')](function(_0x4b6415){logger['error'](_0x844b('0x11'),_0x1d9154,_0x4b6415);_0x4399eb(_0x4b6415);});});}