Built motion from commit (unavailable).|2.5.11
[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 _0x295a=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x295a,0x10e));var _0xa295=function(_0x518cde,_0x3b8f9){_0x518cde=_0x518cde-0x0;var _0x2abde1=_0x295a[_0x518cde];return _0x2abde1;};'use strict';var _=require(_0xa295('0x0'));var util=require(_0xa295('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa295('0x2'));var fs=require('fs');var Redis=require(_0xa295('0x3'));var db=require(_0xa295('0x4'))['db'];var utils=require(_0xa295('0x5'));var logger=require(_0xa295('0x6'))('rpc');var config=require(_0xa295('0x7'));var jayson=require(_0xa295('0x8'));var client=jayson[_0xa295('0x9')][_0xa295('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25ff74,_0x44206d,_0x459c92){return new BPromise(function(_0x28d67c,_0x357206){return client[_0xa295('0xb')](_0x25ff74,_0x459c92)[_0xa295('0xc')](function(_0x3d3270){logger[_0xa295('0xd')](_0xa295('0xe'),_0x44206d,'request\x20sent');logger[_0xa295('0xf')](_0xa295('0x10'),_0x44206d,_0xa295('0x11'),JSON[_0xa295('0x12')](_0x3d3270));if(_0x3d3270[_0xa295('0x13')]){if(_0x3d3270['error']['code']===0x1f4){logger[_0xa295('0x13')](_0xa295('0xe'),_0x44206d,_0x3d3270[_0xa295('0x13')][_0xa295('0x14')]);return _0x357206(_0x3d3270[_0xa295('0x13')][_0xa295('0x14')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x44206d,_0x3d3270[_0xa295('0x13')][_0xa295('0x14')]);return _0x28d67c(_0x3d3270[_0xa295('0x13')]['message']);}else{logger[_0xa295('0xd')](_0xa295('0xe'),_0x44206d,_0xa295('0x11'));_0x28d67c(_0x3d3270[_0xa295('0x15')][_0xa295('0x14')]);}})[_0xa295('0x16')](function(_0x1d33fa){logger[_0xa295('0x13')](_0xa295('0xe'),_0x44206d,_0x1d33fa);_0x357206(_0x1d33fa);});});}