49a230fbdc1ef49d8dd75bf565309c2efd983ab2
[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 _0x0491=['jayson/promise','client','http','info','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','Disposition,\x20%s,\x20%s','message','request\x20sent','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3d1cb6,_0x470d90){var _0x163dff=function(_0x513077){while(--_0x513077){_0x3d1cb6['push'](_0x3d1cb6['shift']());}};_0x163dff(++_0x470d90);}(_0x0491,0x171));var _0x1049=function(_0x1e44a5,_0x35a714){_0x1e44a5=_0x1e44a5-0x0;var _0x54a65e=_0x0491[_0x1e44a5];return _0x54a65e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1049('0x0'));var BPromise=require(_0x1049('0x1'));var rs=require(_0x1049('0x2'));var fs=require('fs');var Redis=require(_0x1049('0x3'));var db=require(_0x1049('0x4'))['db'];var utils=require(_0x1049('0x5'));var logger=require(_0x1049('0x6'))(_0x1049('0x7'));var config=require(_0x1049('0x8'));var jayson=require(_0x1049('0x9'));var client=jayson[_0x1049('0xa')][_0x1049('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47f9e9,_0x24c6fe,_0x2f1962){return new BPromise(function(_0x2e21b4,_0x5c74f1){return client['request'](_0x47f9e9,_0x2f1962)['then'](function(_0x522566){logger[_0x1049('0xc')]('Disposition,\x20%s,\x20%s',_0x24c6fe,'request\x20sent');logger['debug'](_0x1049('0xd'),_0x24c6fe,'request\x20sent',JSON[_0x1049('0xe')](_0x522566));if(_0x522566[_0x1049('0xf')]){if(_0x522566[_0x1049('0xf')][_0x1049('0x10')]===0x1f4){logger[_0x1049('0xf')](_0x1049('0x11'),_0x24c6fe,_0x522566[_0x1049('0xf')][_0x1049('0x12')]);return _0x5c74f1(_0x522566[_0x1049('0xf')]['message']);}logger['error'](_0x1049('0x11'),_0x24c6fe,_0x522566[_0x1049('0xf')]['message']);return _0x2e21b4(_0x522566['error'][_0x1049('0x12')]);}else{logger['info'](_0x1049('0x11'),_0x24c6fe,_0x1049('0x13'));_0x2e21b4(_0x522566['result'][_0x1049('0x12')]);}})[_0x1049('0x14')](function(_0x6041d3){logger[_0x1049('0xf')]('Disposition,\x20%s,\x20%s',_0x24c6fe,_0x6041d3);_0x5c74f1(_0x6041d3);});});}