Built motion from commit 3e059bc2.|2.5.32
[motion2.git] / server / api / intDeskField / intDeskField.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 _0x7813=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','bluebird','randomstring','../../mysqldb'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7813,0x1d8));var _0x3781=function(_0x17d090,_0x4fc0c7){_0x17d090=_0x17d090-0x0;var _0x1c89b8=_0x7813[_0x17d090];return _0x1c89b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3781('0x0'));var rs=require(_0x3781('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3781('0x2'))['db'];var utils=require(_0x3781('0x3'));var logger=require(_0x3781('0x4'))(_0x3781('0x5'));var config=require(_0x3781('0x6'));var jayson=require(_0x3781('0x7'));var client=jayson[_0x3781('0x8')][_0x3781('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c49c4,_0x59db0a,_0x5dff9c){return new BPromise(function(_0x254a6f,_0x28337d){return client[_0x3781('0xa')](_0x5c49c4,_0x5dff9c)['then'](function(_0x369549){logger['info'](_0x3781('0xb'),_0x59db0a,_0x3781('0xc'));logger[_0x3781('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x59db0a,_0x3781('0xc'),JSON[_0x3781('0xe')](_0x369549));if(_0x369549[_0x3781('0xf')]){if(_0x369549[_0x3781('0xf')]['code']===0x1f4){logger['error'](_0x3781('0xb'),_0x59db0a,_0x369549[_0x3781('0xf')][_0x3781('0x10')]);return _0x28337d(_0x369549['error'][_0x3781('0x10')]);}logger['error'](_0x3781('0xb'),_0x59db0a,_0x369549[_0x3781('0xf')]['message']);return _0x254a6f(_0x369549[_0x3781('0xf')]['message']);}else{logger[_0x3781('0x11')](_0x3781('0xb'),_0x59db0a,_0x3781('0xc'));_0x254a6f(_0x369549[_0x3781('0x12')][_0x3781('0x10')]);}})['catch'](function(_0x71a70c){logger[_0x3781('0xf')](_0x3781('0xb'),_0x59db0a,_0x71a70c);_0x28337d(_0x71a70c);});});}