Built motion from commit 0900f080.|2.5.45
[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 _0x05b3=['stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x05b3,0xbe));var _0x305b=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0x05b3[_0x406696];return _0x10e35c;};'use strict';var _=require(_0x305b('0x0'));var util=require(_0x305b('0x1'));var moment=require(_0x305b('0x2'));var BPromise=require(_0x305b('0x3'));var rs=require(_0x305b('0x4'));var fs=require('fs');var Redis=require(_0x305b('0x5'));var db=require(_0x305b('0x6'))['db'];var utils=require(_0x305b('0x7'));var logger=require(_0x305b('0x8'))('rpc');var config=require(_0x305b('0x9'));var jayson=require(_0x305b('0xa'));var client=jayson[_0x305b('0xb')][_0x305b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5148ef,_0x4383b5,_0x532b0a){return new BPromise(function(_0x567b20,_0x5928ce){return client['request'](_0x5148ef,_0x532b0a)['then'](function(_0x1e45c9){logger[_0x305b('0xd')]('ChatApplication,\x20%s,\x20%s',_0x4383b5,_0x305b('0xe'));logger[_0x305b('0xf')](_0x305b('0x10'),_0x4383b5,_0x305b('0xe'),JSON[_0x305b('0x11')](_0x1e45c9));if(_0x1e45c9[_0x305b('0x12')]){if(_0x1e45c9[_0x305b('0x12')][_0x305b('0x13')]===0x1f4){logger[_0x305b('0x12')](_0x305b('0x14'),_0x4383b5,_0x1e45c9[_0x305b('0x12')]['message']);return _0x5928ce(_0x1e45c9['error'][_0x305b('0x15')]);}logger['error'](_0x305b('0x14'),_0x4383b5,_0x1e45c9['error']['message']);return _0x567b20(_0x1e45c9[_0x305b('0x12')][_0x305b('0x15')]);}else{logger[_0x305b('0xd')](_0x305b('0x14'),_0x4383b5,'request\x20sent');_0x567b20(_0x1e45c9[_0x305b('0x16')][_0x305b('0x15')]);}})['catch'](function(_0x2f14c6){logger[_0x305b('0x12')](_0x305b('0x14'),_0x4383b5,_0x2f14c6);_0x5928ce(_0x2f14c6);});});}