162ac4e2245f5fbc46316a95175fa70b2aee10af
[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 _0x4777=['rpc','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','code','error','message','DeskField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0x4777,0x10b));var _0x7477=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0x4777[_0x95942];return _0x6d7f81;};'use strict';var _=require(_0x7477('0x0'));var util=require(_0x7477('0x1'));var moment=require(_0x7477('0x2'));var BPromise=require(_0x7477('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7477('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7477('0x5'));var logger=require('../../config/logger')(_0x7477('0x6'));var config=require('../../config/environment');var jayson=require(_0x7477('0x7'));var client=jayson[_0x7477('0x8')][_0x7477('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ba420,_0x49386f,_0x32be45){return new BPromise(function(_0x272963,_0x4ba565){return client[_0x7477('0xa')](_0x1ba420,_0x32be45)[_0x7477('0xb')](function(_0x47369d){logger['info']('DeskField,\x20%s,\x20%s',_0x49386f,_0x7477('0xc'));logger[_0x7477('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x49386f,_0x7477('0xc'),JSON[_0x7477('0xe')](_0x47369d));if(_0x47369d['error']){if(_0x47369d['error'][_0x7477('0xf')]===0x1f4){logger[_0x7477('0x10')]('DeskField,\x20%s,\x20%s',_0x49386f,_0x47369d[_0x7477('0x10')]['message']);return _0x4ba565(_0x47369d[_0x7477('0x10')][_0x7477('0x11')]);}logger[_0x7477('0x10')](_0x7477('0x12'),_0x49386f,_0x47369d[_0x7477('0x10')][_0x7477('0x11')]);return _0x272963(_0x47369d[_0x7477('0x10')][_0x7477('0x11')]);}else{logger['info'](_0x7477('0x12'),_0x49386f,'request\x20sent');_0x272963(_0x47369d[_0x7477('0x13')][_0x7477('0x11')]);}})[_0x7477('0x14')](function(_0x1a3295){logger[_0x7477('0x10')](_0x7477('0x12'),_0x49386f,_0x1a3295);_0x4ba565(_0x1a3295);});});}