Built motion from commit (unavailable).|2.5.31
[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 _0x0b04=['Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x21dd3e,_0x34b31e){var _0x29d586=function(_0x39cdc5){while(--_0x39cdc5){_0x21dd3e['push'](_0x21dd3e['shift']());}};_0x29d586(++_0x34b31e);}(_0x0b04,0x1a4));var _0x40b0=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x0b04[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x40b0('0x0'));var util=require(_0x40b0('0x1'));var moment=require(_0x40b0('0x2'));var BPromise=require(_0x40b0('0x3'));var rs=require(_0x40b0('0x4'));var fs=require('fs');var Redis=require(_0x40b0('0x5'));var db=require(_0x40b0('0x6'))['db'];var utils=require(_0x40b0('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x40b0('0x8'));var jayson=require(_0x40b0('0x9'));var client=jayson[_0x40b0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42fa01,_0x852e9c,_0x34775b){return new BPromise(function(_0x35791b,_0x56e28b){return client[_0x40b0('0xb')](_0x42fa01,_0x34775b)[_0x40b0('0xc')](function(_0x4c3db2){logger[_0x40b0('0xd')](_0x40b0('0xe'),_0x852e9c,_0x40b0('0xf'));logger[_0x40b0('0x10')](_0x40b0('0x11'),_0x852e9c,'request\x20sent',JSON[_0x40b0('0x12')](_0x4c3db2));if(_0x4c3db2[_0x40b0('0x13')]){if(_0x4c3db2['error'][_0x40b0('0x14')]===0x1f4){logger[_0x40b0('0x13')](_0x40b0('0xe'),_0x852e9c,_0x4c3db2[_0x40b0('0x13')]['message']);return _0x56e28b(_0x4c3db2[_0x40b0('0x13')]['message']);}logger['error'](_0x40b0('0xe'),_0x852e9c,_0x4c3db2['error'][_0x40b0('0x15')]);return _0x35791b(_0x4c3db2[_0x40b0('0x13')][_0x40b0('0x15')]);}else{logger[_0x40b0('0xd')](_0x40b0('0xe'),_0x852e9c,'request\x20sent');_0x35791b(_0x4c3db2['result'][_0x40b0('0x15')]);}})[_0x40b0('0x16')](function(_0x36b4ac){logger[_0x40b0('0x13')]('Disposition,\x20%s,\x20%s',_0x852e9c,_0x36b4ac);_0x56e28b(_0x36b4ac);});});}