7aef078cbfbbd8b53310e262c688b972bffddaf9
[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 _0x24c5=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x24c5,0x150));var _0x524c=function(_0x4d58f6,_0x5f5e1b){_0x4d58f6=_0x4d58f6-0x0;var _0x399216=_0x24c5[_0x4d58f6];return _0x399216;};'use strict';var _=require('lodash');var util=require(_0x524c('0x0'));var moment=require('moment');var BPromise=require(_0x524c('0x1'));var rs=require(_0x524c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x524c('0x3'))['db'];var utils=require(_0x524c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x524c('0x5'));var jayson=require(_0x524c('0x6'));var client=jayson[_0x524c('0x7')][_0x524c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb8adb5,_0x46f080,_0x43003e){return new BPromise(function(_0x324f33,_0x90c5c8){return client[_0x524c('0x9')](_0xb8adb5,_0x43003e)[_0x524c('0xa')](function(_0x390af6){logger[_0x524c('0xb')](_0x524c('0xc'),_0x46f080,'request\x20sent');logger['debug'](_0x524c('0xd'),_0x46f080,_0x524c('0xe'),JSON[_0x524c('0xf')](_0x390af6));if(_0x390af6[_0x524c('0x10')]){if(_0x390af6[_0x524c('0x10')][_0x524c('0x11')]===0x1f4){logger[_0x524c('0x10')](_0x524c('0xc'),_0x46f080,_0x390af6[_0x524c('0x10')]['message']);return _0x90c5c8(_0x390af6['error'][_0x524c('0x12')]);}logger[_0x524c('0x10')]('DeskField,\x20%s,\x20%s',_0x46f080,_0x390af6[_0x524c('0x10')][_0x524c('0x12')]);return _0x324f33(_0x390af6[_0x524c('0x10')][_0x524c('0x12')]);}else{logger[_0x524c('0xb')]('DeskField,\x20%s,\x20%s',_0x46f080,_0x524c('0xe'));_0x324f33(_0x390af6[_0x524c('0x13')][_0x524c('0x12')]);}})[_0x524c('0x14')](function(_0x517035){logger[_0x524c('0x10')](_0x524c('0xc'),_0x46f080,_0x517035);_0x90c5c8(_0x517035);});});}