fc97454909cb7af6a26d8d569008459c0dc61186
[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 _0xf3ca=['debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent'];(function(_0x6aa584,_0x1c1525){var _0x83fc01=function(_0xe96a0c){while(--_0xe96a0c){_0x6aa584['push'](_0x6aa584['shift']());}};_0x83fc01(++_0x1c1525);}(_0xf3ca,0xbf));var _0xaf3c=function(_0x162810,_0x4dd5aa){_0x162810=_0x162810-0x0;var _0x503762=_0xf3ca[_0x162810];return _0x503762;};'use strict';var _=require('lodash');var util=require(_0xaf3c('0x0'));var moment=require(_0xaf3c('0x1'));var BPromise=require(_0xaf3c('0x2'));var rs=require(_0xaf3c('0x3'));var fs=require('fs');var Redis=require(_0xaf3c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaf3c('0x5'));var logger=require(_0xaf3c('0x6'))(_0xaf3c('0x7'));var config=require(_0xaf3c('0x8'));var jayson=require(_0xaf3c('0x9'));var client=jayson['client'][_0xaf3c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd9c676,_0x760e0f,_0x55d515){return new BPromise(function(_0x1ac85a,_0x26dd6b){return client[_0xaf3c('0xb')](_0xd9c676,_0x55d515)[_0xaf3c('0xc')](function(_0x328592){logger[_0xaf3c('0xd')](_0xaf3c('0xe'),_0x760e0f,_0xaf3c('0xf'));logger[_0xaf3c('0x10')](_0xaf3c('0x11'),_0x760e0f,_0xaf3c('0xf'),JSON[_0xaf3c('0x12')](_0x328592));if(_0x328592[_0xaf3c('0x13')]){if(_0x328592[_0xaf3c('0x13')][_0xaf3c('0x14')]===0x1f4){logger[_0xaf3c('0x13')](_0xaf3c('0xe'),_0x760e0f,_0x328592[_0xaf3c('0x13')][_0xaf3c('0x15')]);return _0x26dd6b(_0x328592['error'][_0xaf3c('0x15')]);}logger['error']('Disposition,\x20%s,\x20%s',_0x760e0f,_0x328592['error']['message']);return _0x1ac85a(_0x328592[_0xaf3c('0x13')][_0xaf3c('0x15')]);}else{logger['info']('Disposition,\x20%s,\x20%s',_0x760e0f,_0xaf3c('0xf'));_0x1ac85a(_0x328592[_0xaf3c('0x16')][_0xaf3c('0x15')]);}})['catch'](function(_0x2fac67){logger[_0xaf3c('0x13')](_0xaf3c('0xe'),_0x760e0f,_0x2fac67);_0x26dd6b(_0x2fac67);});});}