fae16826eb6ed14abfecd7f3438beb67f84c4b8f
[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 _0x2cb1=['rpc','../../config/environment','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x338c4f,_0x171548){var _0x223a58=function(_0x66e089){while(--_0x66e089){_0x338c4f['push'](_0x338c4f['shift']());}};_0x223a58(++_0x171548);}(_0x2cb1,0x9a));var _0x12cb=function(_0x452ac9,_0x2fb033){_0x452ac9=_0x452ac9-0x0;var _0x388aa7=_0x2cb1[_0x452ac9];return _0x388aa7;};'use strict';var _=require(_0x12cb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x12cb('0x1'));var rs=require(_0x12cb('0x2'));var fs=require('fs');var Redis=require(_0x12cb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x12cb('0x4'));var logger=require(_0x12cb('0x5'))(_0x12cb('0x6'));var config=require(_0x12cb('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x12cb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52bb90,_0x4a13ed,_0x52d18d){return new BPromise(function(_0x5e42df,_0x54e12f){return client[_0x12cb('0x9')](_0x52bb90,_0x52d18d)[_0x12cb('0xa')](function(_0x1ffbd1){logger[_0x12cb('0xb')](_0x12cb('0xc'),_0x4a13ed,_0x12cb('0xd'));logger[_0x12cb('0xe')](_0x12cb('0xf'),_0x4a13ed,_0x12cb('0xd'),JSON['stringify'](_0x1ffbd1));if(_0x1ffbd1['error']){if(_0x1ffbd1['error'][_0x12cb('0x10')]===0x1f4){logger[_0x12cb('0x11')](_0x12cb('0xc'),_0x4a13ed,_0x1ffbd1[_0x12cb('0x11')][_0x12cb('0x12')]);return _0x54e12f(_0x1ffbd1['error'][_0x12cb('0x12')]);}logger[_0x12cb('0x11')](_0x12cb('0xc'),_0x4a13ed,_0x1ffbd1[_0x12cb('0x11')][_0x12cb('0x12')]);return _0x5e42df(_0x1ffbd1[_0x12cb('0x11')]['message']);}else{logger['info'](_0x12cb('0xc'),_0x4a13ed,_0x12cb('0xd'));_0x5e42df(_0x1ffbd1['result'][_0x12cb('0x12')]);}})[_0x12cb('0x13')](function(_0x42ea3e){logger[_0x12cb('0x11')](_0x12cb('0xc'),_0x4a13ed,_0x42ea3e);_0x54e12f(_0x42ea3e);});});}