46771b38cb3f6d47939009e3b94c36e1a6332246
[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 _0x6864=['error','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x31adae,_0x58368e){var _0x37b201=function(_0x177d25){while(--_0x177d25){_0x31adae['push'](_0x31adae['shift']());}};_0x37b201(++_0x58368e);}(_0x6864,0x1e8));var _0x4686=function(_0x48fea8,_0x54ea06){_0x48fea8=_0x48fea8-0x0;var _0x1e8ff7=_0x6864[_0x48fea8];return _0x1e8ff7;};'use strict';var _=require(_0x4686('0x0'));var util=require('util');var moment=require(_0x4686('0x1'));var BPromise=require(_0x4686('0x2'));var rs=require(_0x4686('0x3'));var fs=require('fs');var Redis=require(_0x4686('0x4'));var db=require(_0x4686('0x5'))['db'];var utils=require(_0x4686('0x6'));var logger=require(_0x4686('0x7'))(_0x4686('0x8'));var config=require('../../config/environment');var jayson=require(_0x4686('0x9'));var client=jayson[_0x4686('0xa')][_0x4686('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcfed96,_0x395e27,_0x3183be){return new BPromise(function(_0x3dd532,_0x99fe0a){return client[_0x4686('0xc')](_0xcfed96,_0x3183be)[_0x4686('0xd')](function(_0x565c8a){logger[_0x4686('0xe')]('ChatApplication,\x20%s,\x20%s',_0x395e27,'request\x20sent');logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x395e27,_0x4686('0xf'),JSON['stringify'](_0x565c8a));if(_0x565c8a[_0x4686('0x10')]){if(_0x565c8a['error']['code']===0x1f4){logger[_0x4686('0x10')](_0x4686('0x11'),_0x395e27,_0x565c8a[_0x4686('0x10')][_0x4686('0x12')]);return _0x99fe0a(_0x565c8a['error'][_0x4686('0x12')]);}logger[_0x4686('0x10')](_0x4686('0x11'),_0x395e27,_0x565c8a[_0x4686('0x10')][_0x4686('0x12')]);return _0x3dd532(_0x565c8a[_0x4686('0x10')][_0x4686('0x12')]);}else{logger[_0x4686('0xe')]('ChatApplication,\x20%s,\x20%s',_0x395e27,_0x4686('0xf'));_0x3dd532(_0x565c8a[_0x4686('0x13')][_0x4686('0x12')]);}})[_0x4686('0x14')](function(_0x423314){logger[_0x4686('0x10')](_0x4686('0x11'),_0x395e27,_0x423314);_0x99fe0a(_0x423314);});});}