Built motion from commit (unavailable).|2.5.22
[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 _0x9040=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x1b2d4d,_0x595487){var _0xd8aeab=function(_0x19f2df){while(--_0x19f2df){_0x1b2d4d['push'](_0x1b2d4d['shift']());}};_0xd8aeab(++_0x595487);}(_0x9040,0xe2));var _0x0904=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x9040[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x0904('0x0'));var util=require(_0x0904('0x1'));var moment=require('moment');var BPromise=require(_0x0904('0x2'));var rs=require(_0x0904('0x3'));var fs=require('fs');var Redis=require(_0x0904('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0904('0x5'));var logger=require('../../config/logger')(_0x0904('0x6'));var config=require(_0x0904('0x7'));var jayson=require(_0x0904('0x8'));var client=jayson[_0x0904('0x9')][_0x0904('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x170b5e,_0x42656e,_0x5f45fe){return new BPromise(function(_0x2569ec,_0x544332){return client[_0x0904('0xb')](_0x170b5e,_0x5f45fe)['then'](function(_0x2c4ffc){logger[_0x0904('0xc')](_0x0904('0xd'),_0x42656e,_0x0904('0xe'));logger['debug'](_0x0904('0xf'),_0x42656e,_0x0904('0xe'),JSON[_0x0904('0x10')](_0x2c4ffc));if(_0x2c4ffc[_0x0904('0x11')]){if(_0x2c4ffc[_0x0904('0x11')]['code']===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x42656e,_0x2c4ffc[_0x0904('0x11')][_0x0904('0x12')]);return _0x544332(_0x2c4ffc[_0x0904('0x11')][_0x0904('0x12')]);}logger[_0x0904('0x11')](_0x0904('0xd'),_0x42656e,_0x2c4ffc[_0x0904('0x11')][_0x0904('0x12')]);return _0x2569ec(_0x2c4ffc[_0x0904('0x11')][_0x0904('0x12')]);}else{logger['info'](_0x0904('0xd'),_0x42656e,_0x0904('0xe'));_0x2569ec(_0x2c4ffc[_0x0904('0x13')][_0x0904('0x12')]);}})[_0x0904('0x14')](function(_0x39bcf4){logger['error'](_0x0904('0xd'),_0x42656e,_0x39bcf4);_0x544332(_0x39bcf4);});});}