0fcc157360487351aab7997e2e11af358018cd0e
[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 _0xec58=['http','request','then','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','DeskField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec58,0xa5));var _0x8ec5=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0xec58[_0x3b1b23];return _0x1efc85;};'use strict';var _=require(_0x8ec5('0x0'));var util=require(_0x8ec5('0x1'));var moment=require(_0x8ec5('0x2'));var BPromise=require(_0x8ec5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ec5('0x4'));var db=require(_0x8ec5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ec5('0x6'))(_0x8ec5('0x7'));var config=require(_0x8ec5('0x8'));var jayson=require(_0x8ec5('0x9'));var client=jayson[_0x8ec5('0xa')][_0x8ec5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b99ff,_0xc72232,_0xb45606){return new BPromise(function(_0x4fff63,_0x395087){return client[_0x8ec5('0xc')](_0x4b99ff,_0xb45606)[_0x8ec5('0xd')](function(_0x274a6a){logger['info']('DeskField,\x20%s,\x20%s',_0xc72232,_0x8ec5('0xe'));logger[_0x8ec5('0xf')](_0x8ec5('0x10'),_0xc72232,_0x8ec5('0xe'),JSON[_0x8ec5('0x11')](_0x274a6a));if(_0x274a6a[_0x8ec5('0x12')]){if(_0x274a6a[_0x8ec5('0x12')]['code']===0x1f4){logger[_0x8ec5('0x12')](_0x8ec5('0x13'),_0xc72232,_0x274a6a[_0x8ec5('0x12')]['message']);return _0x395087(_0x274a6a['error'][_0x8ec5('0x14')]);}logger[_0x8ec5('0x12')](_0x8ec5('0x13'),_0xc72232,_0x274a6a['error'][_0x8ec5('0x14')]);return _0x4fff63(_0x274a6a[_0x8ec5('0x12')][_0x8ec5('0x14')]);}else{logger['info'](_0x8ec5('0x13'),_0xc72232,'request\x20sent');_0x4fff63(_0x274a6a[_0x8ec5('0x15')][_0x8ec5('0x14')]);}})['catch'](function(_0x3f1c16){logger[_0x8ec5('0x12')](_0x8ec5('0x13'),_0xc72232,_0x3f1c16);_0x395087(_0x3f1c16);});});}