3ed7af780885f24d4bc9e0047aa934f23708bb0a
[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 _0x3c16=['request','then','info','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','Disposition,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x32b1c0,_0x2396f){var _0x50bd24=function(_0x2717da){while(--_0x2717da){_0x32b1c0['push'](_0x32b1c0['shift']());}};_0x50bd24(++_0x2396f);}(_0x3c16,0x182));var _0x63c1=function(_0x236815,_0x2d5f45){_0x236815=_0x236815-0x0;var _0x7dc87f=_0x3c16[_0x236815];return _0x7dc87f;};'use strict';var _=require(_0x63c1('0x0'));var util=require('util');var moment=require(_0x63c1('0x1'));var BPromise=require(_0x63c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63c1('0x3'));var db=require(_0x63c1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x63c1('0x5'))(_0x63c1('0x6'));var config=require(_0x63c1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x63c1('0x8')][_0x63c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdabbf9,_0xeb3228,_0x53082f){return new BPromise(function(_0x2819b4,_0x192c45){return client[_0x63c1('0xa')](_0xdabbf9,_0x53082f)[_0x63c1('0xb')](function(_0x51e37e){logger[_0x63c1('0xc')]('Disposition,\x20%s,\x20%s',_0xeb3228,_0x63c1('0xd'));logger[_0x63c1('0xe')](_0x63c1('0xf'),_0xeb3228,_0x63c1('0xd'),JSON[_0x63c1('0x10')](_0x51e37e));if(_0x51e37e[_0x63c1('0x11')]){if(_0x51e37e['error'][_0x63c1('0x12')]===0x1f4){logger[_0x63c1('0x11')](_0x63c1('0x13'),_0xeb3228,_0x51e37e[_0x63c1('0x11')][_0x63c1('0x14')]);return _0x192c45(_0x51e37e[_0x63c1('0x11')][_0x63c1('0x14')]);}logger[_0x63c1('0x11')](_0x63c1('0x13'),_0xeb3228,_0x51e37e[_0x63c1('0x11')][_0x63c1('0x14')]);return _0x2819b4(_0x51e37e[_0x63c1('0x11')][_0x63c1('0x14')]);}else{logger[_0x63c1('0xc')](_0x63c1('0x13'),_0xeb3228,_0x63c1('0xd'));_0x2819b4(_0x51e37e['result'][_0x63c1('0x14')]);}})[_0x63c1('0x15')](function(_0x128a31){logger[_0x63c1('0x11')]('Disposition,\x20%s,\x20%s',_0xeb3228,_0x128a31);_0x192c45(_0x128a31);});});}