Built motion from commit 449495f6.|2.6.27
[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 _0xfcf8=['debug','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x23c445,_0x38a426){var _0x1eb9cd=function(_0x11f80a){while(--_0x11f80a){_0x23c445['push'](_0x23c445['shift']());}};_0x1eb9cd(++_0x38a426);}(_0xfcf8,0x1aa));var _0x8fcf=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xfcf8[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require(_0x8fcf('0x0'));var moment=require(_0x8fcf('0x1'));var BPromise=require(_0x8fcf('0x2'));var rs=require(_0x8fcf('0x3'));var fs=require('fs');var Redis=require(_0x8fcf('0x4'));var db=require(_0x8fcf('0x5'))['db'];var utils=require(_0x8fcf('0x6'));var logger=require(_0x8fcf('0x7'))(_0x8fcf('0x8'));var config=require(_0x8fcf('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8fcf('0xa')][_0x8fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c384e,_0x30634e,_0x4bf8ff){return new BPromise(function(_0x3ebc9c,_0x27a798){return client['request'](_0x5c384e,_0x4bf8ff)['then'](function(_0x37afc3){logger['info'](_0x8fcf('0xc'),_0x30634e,_0x8fcf('0xd'));logger[_0x8fcf('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x30634e,'request\x20sent',JSON[_0x8fcf('0xf')](_0x37afc3));if(_0x37afc3[_0x8fcf('0x10')]){if(_0x37afc3['error'][_0x8fcf('0x11')]===0x1f4){logger['error'](_0x8fcf('0xc'),_0x30634e,_0x37afc3['error'][_0x8fcf('0x12')]);return _0x27a798(_0x37afc3[_0x8fcf('0x10')][_0x8fcf('0x12')]);}logger[_0x8fcf('0x10')](_0x8fcf('0xc'),_0x30634e,_0x37afc3[_0x8fcf('0x10')]['message']);return _0x3ebc9c(_0x37afc3['error']['message']);}else{logger[_0x8fcf('0x13')](_0x8fcf('0xc'),_0x30634e,_0x8fcf('0xd'));_0x3ebc9c(_0x37afc3[_0x8fcf('0x14')][_0x8fcf('0x12')]);}})[_0x8fcf('0x15')](function(_0x4421bd){logger[_0x8fcf('0x10')](_0x8fcf('0xc'),_0x30634e,_0x4421bd);_0x27a798(_0x4421bd);});});}