f9c2d7e637696ef2e10674b0c261d6f53a25ace9
[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 _0xbc21=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','DeskField,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x5c92fd,_0x23beb7){var _0x48c9a7=function(_0x4d7d99){while(--_0x4d7d99){_0x5c92fd['push'](_0x5c92fd['shift']());}};_0x48c9a7(++_0x23beb7);}(_0xbc21,0x1f1));var _0x1bc2=function(_0x4b0997,_0x25ab7e){_0x4b0997=_0x4b0997-0x0;var _0x1b88b2=_0xbc21[_0x4b0997];return _0x1b88b2;};'use strict';var _=require(_0x1bc2('0x0'));var util=require(_0x1bc2('0x1'));var moment=require(_0x1bc2('0x2'));var BPromise=require('bluebird');var rs=require(_0x1bc2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1bc2('0x4'))['db'];var utils=require(_0x1bc2('0x5'));var logger=require(_0x1bc2('0x6'))(_0x1bc2('0x7'));var config=require(_0x1bc2('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1bc2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39201e,_0x16ae40,_0x50c2ec){return new BPromise(function(_0xddf857,_0xfac52e){return client[_0x1bc2('0xa')](_0x39201e,_0x50c2ec)[_0x1bc2('0xb')](function(_0x57ff47){logger[_0x1bc2('0xc')]('DeskField,\x20%s,\x20%s',_0x16ae40,_0x1bc2('0xd'));logger[_0x1bc2('0xe')](_0x1bc2('0xf'),_0x16ae40,_0x1bc2('0xd'),JSON['stringify'](_0x57ff47));if(_0x57ff47[_0x1bc2('0x10')]){if(_0x57ff47['error']['code']===0x1f4){logger['error'](_0x1bc2('0x11'),_0x16ae40,_0x57ff47['error']['message']);return _0xfac52e(_0x57ff47[_0x1bc2('0x10')][_0x1bc2('0x12')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x16ae40,_0x57ff47[_0x1bc2('0x10')][_0x1bc2('0x12')]);return _0xddf857(_0x57ff47[_0x1bc2('0x10')][_0x1bc2('0x12')]);}else{logger[_0x1bc2('0xc')](_0x1bc2('0x11'),_0x16ae40,_0x1bc2('0xd'));_0xddf857(_0x57ff47['result']['message']);}})[_0x1bc2('0x13')](function(_0x57eab6){logger['error'](_0x1bc2('0x11'),_0x16ae40,_0x57eab6);_0xfac52e(_0x57eab6);});});}