f47eb1ce54ee045186a1fb8e8535b22f834b65fb
[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 _0x2cf8=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s'];(function(_0x3d13bb,_0x262a54){var _0x4b5a1b=function(_0x53417e){while(--_0x53417e){_0x3d13bb['push'](_0x3d13bb['shift']());}};_0x4b5a1b(++_0x262a54);}(_0x2cf8,0x163));var _0x82cf=function(_0x1f6fd5,_0x399cb0){_0x1f6fd5=_0x1f6fd5-0x0;var _0x587d12=_0x2cf8[_0x1f6fd5];return _0x587d12;};'use strict';var _=require(_0x82cf('0x0'));var util=require(_0x82cf('0x1'));var moment=require(_0x82cf('0x2'));var BPromise=require(_0x82cf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82cf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x82cf('0x5'));var logger=require(_0x82cf('0x6'))('rpc');var config=require(_0x82cf('0x7'));var jayson=require(_0x82cf('0x8'));var client=jayson['client'][_0x82cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x518e44,_0x12431e,_0x415bd3){return new BPromise(function(_0x4a9487,_0x52c4e0){return client['request'](_0x518e44,_0x415bd3)[_0x82cf('0xa')](function(_0x6770c){logger[_0x82cf('0xb')]('ChatApplication,\x20%s,\x20%s',_0x12431e,_0x82cf('0xc'));logger[_0x82cf('0xd')](_0x82cf('0xe'),_0x12431e,_0x82cf('0xc'),JSON[_0x82cf('0xf')](_0x6770c));if(_0x6770c[_0x82cf('0x10')]){if(_0x6770c[_0x82cf('0x10')][_0x82cf('0x11')]===0x1f4){logger[_0x82cf('0x10')](_0x82cf('0x12'),_0x12431e,_0x6770c[_0x82cf('0x10')][_0x82cf('0x13')]);return _0x52c4e0(_0x6770c[_0x82cf('0x10')]['message']);}logger[_0x82cf('0x10')]('ChatApplication,\x20%s,\x20%s',_0x12431e,_0x6770c['error'][_0x82cf('0x13')]);return _0x4a9487(_0x6770c[_0x82cf('0x10')][_0x82cf('0x13')]);}else{logger[_0x82cf('0xb')](_0x82cf('0x12'),_0x12431e,'request\x20sent');_0x4a9487(_0x6770c[_0x82cf('0x14')][_0x82cf('0x13')]);}})[_0x82cf('0x15')](function(_0x27b8fc){logger[_0x82cf('0x10')](_0x82cf('0x12'),_0x12431e,_0x27b8fc);_0x52c4e0(_0x27b8fc);});});}