Built motion from commit (unavailable).|2.5.13
[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 _0xff03=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','stringify','Disposition,\x20%s,\x20%s','error','message','info','util','moment','bluebird','randomstring'];(function(_0x25b40a,_0x2652a7){var _0x2cd93f=function(_0x46b4b4){while(--_0x46b4b4){_0x25b40a['push'](_0x25b40a['shift']());}};_0x2cd93f(++_0x2652a7);}(_0xff03,0xa4));var _0x3ff0=function(_0x31f231,_0x4233b3){_0x31f231=_0x31f231-0x0;var _0x4e5321=_0xff03[_0x31f231];return _0x4e5321;};'use strict';var _=require('lodash');var util=require(_0x3ff0('0x0'));var moment=require(_0x3ff0('0x1'));var BPromise=require(_0x3ff0('0x2'));var rs=require(_0x3ff0('0x3'));var fs=require('fs');var Redis=require(_0x3ff0('0x4'));var db=require(_0x3ff0('0x5'))['db'];var utils=require(_0x3ff0('0x6'));var logger=require(_0x3ff0('0x7'))(_0x3ff0('0x8'));var config=require(_0x3ff0('0x9'));var jayson=require(_0x3ff0('0xa'));var client=jayson[_0x3ff0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c5f03,_0x5af4bc,_0x39bf68){return new BPromise(function(_0x407fe0,_0x433d72){return client[_0x3ff0('0xc')](_0x6c5f03,_0x39bf68)[_0x3ff0('0xd')](function(_0x288a6b){logger['info']('Disposition,\x20%s,\x20%s',_0x5af4bc,_0x3ff0('0xe'));logger['debug'](_0x3ff0('0xf'),_0x5af4bc,'request\x20sent',JSON[_0x3ff0('0x10')](_0x288a6b));if(_0x288a6b['error']){if(_0x288a6b['error']['code']===0x1f4){logger['error'](_0x3ff0('0x11'),_0x5af4bc,_0x288a6b[_0x3ff0('0x12')][_0x3ff0('0x13')]);return _0x433d72(_0x288a6b['error'][_0x3ff0('0x13')]);}logger[_0x3ff0('0x12')](_0x3ff0('0x11'),_0x5af4bc,_0x288a6b['error']['message']);return _0x407fe0(_0x288a6b[_0x3ff0('0x12')][_0x3ff0('0x13')]);}else{logger[_0x3ff0('0x14')]('Disposition,\x20%s,\x20%s',_0x5af4bc,_0x3ff0('0xe'));_0x407fe0(_0x288a6b['result'][_0x3ff0('0x13')]);}})['catch'](function(_0x5516f4){logger[_0x3ff0('0x12')](_0x3ff0('0x11'),_0x5af4bc,_0x5516f4);_0x433d72(_0x5516f4);});});}