Built motion from commit (unavailable).|2.5.17
[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 _0x6fa4=['DeskField,\x20%s,\x20%s','request\x20sent','debug','error','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then'];(function(_0x460f81,_0x553431){var _0x423f0d=function(_0x267a6b){while(--_0x267a6b){_0x460f81['push'](_0x460f81['shift']());}};_0x423f0d(++_0x553431);}(_0x6fa4,0x8c));var _0x46fa=function(_0x1caec4,_0x5947e7){_0x1caec4=_0x1caec4-0x0;var _0x11002b=_0x6fa4[_0x1caec4];return _0x11002b;};'use strict';var _=require(_0x46fa('0x0'));var util=require(_0x46fa('0x1'));var moment=require(_0x46fa('0x2'));var BPromise=require(_0x46fa('0x3'));var rs=require(_0x46fa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46fa('0x5'))['db'];var utils=require(_0x46fa('0x6'));var logger=require(_0x46fa('0x7'))('rpc');var config=require(_0x46fa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x46fa('0x9')][_0x46fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x95ae24,_0x3df916,_0x27bba4){return new BPromise(function(_0x6ef62b,_0xc7efbd){return client['request'](_0x95ae24,_0x27bba4)[_0x46fa('0xb')](function(_0x118338){logger['info'](_0x46fa('0xc'),_0x3df916,_0x46fa('0xd'));logger[_0x46fa('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x3df916,'request\x20sent',JSON['stringify'](_0x118338));if(_0x118338['error']){if(_0x118338[_0x46fa('0xf')]['code']===0x1f4){logger[_0x46fa('0xf')](_0x46fa('0xc'),_0x3df916,_0x118338[_0x46fa('0xf')][_0x46fa('0x10')]);return _0xc7efbd(_0x118338['error'][_0x46fa('0x10')]);}logger[_0x46fa('0xf')](_0x46fa('0xc'),_0x3df916,_0x118338['error'][_0x46fa('0x10')]);return _0x6ef62b(_0x118338[_0x46fa('0xf')]['message']);}else{logger[_0x46fa('0x11')](_0x46fa('0xc'),_0x3df916,_0x46fa('0xd'));_0x6ef62b(_0x118338['result'][_0x46fa('0x10')]);}})[_0x46fa('0x12')](function(_0x36b8d7){logger[_0x46fa('0xf')](_0x46fa('0xc'),_0x3df916,_0x36b8d7);_0xc7efbd(_0x36b8d7);});});}