Built motion from commit (unavailable).|2.5.21
[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 _0x94ab=['jayson/promise','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment'];(function(_0x2ab388,_0x4a2cfa){var _0xb9d436=function(_0x4f45f5){while(--_0x4f45f5){_0x2ab388['push'](_0x2ab388['shift']());}};_0xb9d436(++_0x4a2cfa);}(_0x94ab,0xe0));var _0xb94a=function(_0x54c505,_0x58f42c){_0x54c505=_0x54c505-0x0;var _0x475946=_0x94ab[_0x54c505];return _0x475946;};'use strict';var _=require(_0xb94a('0x0'));var util=require('util');var moment=require(_0xb94a('0x1'));var BPromise=require(_0xb94a('0x2'));var rs=require(_0xb94a('0x3'));var fs=require('fs');var Redis=require(_0xb94a('0x4'));var db=require(_0xb94a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb94a('0x6'));var jayson=require(_0xb94a('0x7'));var client=jayson['client'][_0xb94a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd097c0,_0x24b86b,_0x2ef0f1){return new BPromise(function(_0x24fa76,_0x586432){return client[_0xb94a('0x9')](_0xd097c0,_0x2ef0f1)[_0xb94a('0xa')](function(_0x42eaca){logger[_0xb94a('0xb')](_0xb94a('0xc'),_0x24b86b,_0xb94a('0xd'));logger[_0xb94a('0xe')](_0xb94a('0xf'),_0x24b86b,'request\x20sent',JSON[_0xb94a('0x10')](_0x42eaca));if(_0x42eaca[_0xb94a('0x11')]){if(_0x42eaca['error']['code']===0x1f4){logger[_0xb94a('0x11')](_0xb94a('0xc'),_0x24b86b,_0x42eaca['error'][_0xb94a('0x12')]);return _0x586432(_0x42eaca[_0xb94a('0x11')][_0xb94a('0x12')]);}logger['error'](_0xb94a('0xc'),_0x24b86b,_0x42eaca[_0xb94a('0x11')][_0xb94a('0x12')]);return _0x24fa76(_0x42eaca[_0xb94a('0x11')]['message']);}else{logger[_0xb94a('0xb')](_0xb94a('0xc'),_0x24b86b,_0xb94a('0xd'));_0x24fa76(_0x42eaca[_0xb94a('0x13')]['message']);}})[_0xb94a('0x14')](function(_0x2251b9){logger[_0xb94a('0x11')](_0xb94a('0xc'),_0x24b86b,_0x2251b9);_0x586432(_0x2251b9);});});}