cc3ed1a8886fd4f5fb9dd12607ba2eb2b827a1a7
[motion2.git] / server / api / disposition / disposition.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 _0x3f01=['Disposition,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3f01,0x170));var _0x13f0=function(_0x336fea,_0x588d2b){_0x336fea=_0x336fea-0x0;var _0xb7340c=_0x3f01[_0x336fea];return _0xb7340c;};'use strict';var _=require(_0x13f0('0x0'));var util=require(_0x13f0('0x1'));var moment=require(_0x13f0('0x2'));var BPromise=require('bluebird');var rs=require(_0x13f0('0x3'));var fs=require('fs');var Redis=require(_0x13f0('0x4'));var db=require(_0x13f0('0x5'))['db'];var utils=require(_0x13f0('0x6'));var logger=require(_0x13f0('0x7'))(_0x13f0('0x8'));var config=require(_0x13f0('0x9'));var jayson=require(_0x13f0('0xa'));var client=jayson[_0x13f0('0xb')][_0x13f0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34499c,_0x1e8323,_0x4b178d){return new BPromise(function(_0x2ae631,_0x2e0b54){return client[_0x13f0('0xd')](_0x34499c,_0x4b178d)[_0x13f0('0xe')](function(_0x4e7851){logger[_0x13f0('0xf')](_0x13f0('0x10'),_0x1e8323,_0x13f0('0x11'));logger['debug']('Disposition,\x20%s,\x20%s,\x20%s',_0x1e8323,_0x13f0('0x11'),JSON[_0x13f0('0x12')](_0x4e7851));if(_0x4e7851[_0x13f0('0x13')]){if(_0x4e7851[_0x13f0('0x13')][_0x13f0('0x14')]===0x1f4){logger[_0x13f0('0x13')](_0x13f0('0x10'),_0x1e8323,_0x4e7851[_0x13f0('0x13')][_0x13f0('0x15')]);return _0x2e0b54(_0x4e7851[_0x13f0('0x13')][_0x13f0('0x15')]);}logger[_0x13f0('0x13')](_0x13f0('0x10'),_0x1e8323,_0x4e7851[_0x13f0('0x13')]['message']);return _0x2ae631(_0x4e7851[_0x13f0('0x13')][_0x13f0('0x15')]);}else{logger[_0x13f0('0xf')](_0x13f0('0x10'),_0x1e8323,_0x13f0('0x11'));_0x2ae631(_0x4e7851[_0x13f0('0x16')][_0x13f0('0x15')]);}})[_0x13f0('0x17')](function(_0x4dc6d1){logger[_0x13f0('0x13')]('Disposition,\x20%s,\x20%s',_0x1e8323,_0x4dc6d1);_0x2e0b54(_0x4dc6d1);});});}