Built motion from commit (unavailable).|2.5.30
[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 _0x838b=['stringify','error','code','message','result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s'];(function(_0x584b72,_0x33de9c){var _0x20f953=function(_0x4cd154){while(--_0x4cd154){_0x584b72['push'](_0x584b72['shift']());}};_0x20f953(++_0x33de9c);}(_0x838b,0x1d1));var _0xb838=function(_0x5ced15,_0x3d6adc){_0x5ced15=_0x5ced15-0x0;var _0x1f93d5=_0x838b[_0x5ced15];return _0x1f93d5;};'use strict';var _=require('lodash');var util=require(_0xb838('0x0'));var moment=require('moment');var BPromise=require(_0xb838('0x1'));var rs=require(_0xb838('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb838('0x3'))['db'];var utils=require(_0xb838('0x4'));var logger=require(_0xb838('0x5'))(_0xb838('0x6'));var config=require(_0xb838('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb838('0x8')][_0xb838('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f81ee,_0x4cc827,_0x404b6c){return new BPromise(function(_0x400af7,_0x1e3cfd){return client[_0xb838('0xa')](_0x1f81ee,_0x404b6c)[_0xb838('0xb')](function(_0x495adc){logger['info'](_0xb838('0xc'),_0x4cc827,_0xb838('0xd'));logger['debug'](_0xb838('0xe'),_0x4cc827,_0xb838('0xd'),JSON[_0xb838('0xf')](_0x495adc));if(_0x495adc[_0xb838('0x10')]){if(_0x495adc[_0xb838('0x10')][_0xb838('0x11')]===0x1f4){logger[_0xb838('0x10')]('Disposition,\x20%s,\x20%s',_0x4cc827,_0x495adc['error'][_0xb838('0x12')]);return _0x1e3cfd(_0x495adc[_0xb838('0x10')][_0xb838('0x12')]);}logger[_0xb838('0x10')](_0xb838('0xc'),_0x4cc827,_0x495adc[_0xb838('0x10')]['message']);return _0x400af7(_0x495adc[_0xb838('0x10')][_0xb838('0x12')]);}else{logger['info'](_0xb838('0xc'),_0x4cc827,_0xb838('0xd'));_0x400af7(_0x495adc[_0xb838('0x13')][_0xb838('0x12')]);}})['catch'](function(_0x3241cf){logger['error'](_0xb838('0xc'),_0x4cc827,_0x3241cf);_0x1e3cfd(_0x3241cf);});});}