Built motion from commit (unavailable).|2.5.20
[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 _0x571f=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Disposition,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3003fc,_0x5ac5de){var _0x22cb43=function(_0x478661){while(--_0x478661){_0x3003fc['push'](_0x3003fc['shift']());}};_0x22cb43(++_0x5ac5de);}(_0x571f,0x94));var _0xf571=function(_0x249d99,_0x16b584){_0x249d99=_0x249d99-0x0;var _0x5bfb05=_0x571f[_0x249d99];return _0x5bfb05;};'use strict';var _=require(_0xf571('0x0'));var util=require(_0xf571('0x1'));var moment=require('moment');var BPromise=require(_0xf571('0x2'));var rs=require(_0xf571('0x3'));var fs=require('fs');var Redis=require(_0xf571('0x4'));var db=require(_0xf571('0x5'))['db'];var utils=require(_0xf571('0x6'));var logger=require('../../config/logger')(_0xf571('0x7'));var config=require(_0xf571('0x8'));var jayson=require(_0xf571('0x9'));var client=jayson['client'][_0xf571('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ac04d,_0x2b6c71,_0x43fd92){return new BPromise(function(_0x71aa93,_0x4959d0){return client[_0xf571('0xb')](_0x5ac04d,_0x43fd92)['then'](function(_0x5d01e6){logger['info']('Disposition,\x20%s,\x20%s',_0x2b6c71,'request\x20sent');logger[_0xf571('0xc')](_0xf571('0xd'),_0x2b6c71,_0xf571('0xe'),JSON[_0xf571('0xf')](_0x5d01e6));if(_0x5d01e6[_0xf571('0x10')]){if(_0x5d01e6['error'][_0xf571('0x11')]===0x1f4){logger['error'](_0xf571('0x12'),_0x2b6c71,_0x5d01e6['error'][_0xf571('0x13')]);return _0x4959d0(_0x5d01e6['error']['message']);}logger[_0xf571('0x10')](_0xf571('0x12'),_0x2b6c71,_0x5d01e6[_0xf571('0x10')]['message']);return _0x71aa93(_0x5d01e6[_0xf571('0x10')][_0xf571('0x13')]);}else{logger[_0xf571('0x14')]('Disposition,\x20%s,\x20%s',_0x2b6c71,_0xf571('0xe'));_0x71aa93(_0x5d01e6['result'][_0xf571('0x13')]);}})[_0xf571('0x15')](function(_0x5e14a9){logger['error'](_0xf571('0x12'),_0x2b6c71,_0x5e14a9);_0x4959d0(_0x5e14a9);});});}