Built motion from commit 9d0783e6.|2.6.13
[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 _0xfa96=['../../config/environment','jayson/promise','client','http','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x236ce3,_0x2d67b1){var _0x3b425d=function(_0xf84f04){while(--_0xf84f04){_0x236ce3['push'](_0x236ce3['shift']());}};_0x3b425d(++_0x2d67b1);}(_0xfa96,0x77));var _0x6fa9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfa96[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6fa9('0x0'));var util=require(_0x6fa9('0x1'));var moment=require(_0x6fa9('0x2'));var BPromise=require('bluebird');var rs=require(_0x6fa9('0x3'));var fs=require('fs');var Redis=require(_0x6fa9('0x4'));var db=require(_0x6fa9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6fa9('0x6'))('rpc');var config=require(_0x6fa9('0x7'));var jayson=require(_0x6fa9('0x8'));var client=jayson[_0x6fa9('0x9')][_0x6fa9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444f9d,_0x58ed63,_0xe68e9c){return new BPromise(function(_0x1316f2,_0x49b82a){return client['request'](_0x444f9d,_0xe68e9c)['then'](function(_0x514715){logger[_0x6fa9('0xb')](_0x6fa9('0xc'),_0x58ed63,_0x6fa9('0xd'));logger[_0x6fa9('0xe')](_0x6fa9('0xf'),_0x58ed63,_0x6fa9('0xd'),JSON[_0x6fa9('0x10')](_0x514715));if(_0x514715[_0x6fa9('0x11')]){if(_0x514715['error'][_0x6fa9('0x12')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x58ed63,_0x514715[_0x6fa9('0x11')]['message']);return _0x49b82a(_0x514715[_0x6fa9('0x11')][_0x6fa9('0x13')]);}logger[_0x6fa9('0x11')](_0x6fa9('0xc'),_0x58ed63,_0x514715['error'][_0x6fa9('0x13')]);return _0x1316f2(_0x514715[_0x6fa9('0x11')][_0x6fa9('0x13')]);}else{logger[_0x6fa9('0xb')]('DeskField,\x20%s,\x20%s',_0x58ed63,'request\x20sent');_0x1316f2(_0x514715['result'][_0x6fa9('0x13')]);}})[_0x6fa9('0x14')](function(_0x3d30ae){logger['error'](_0x6fa9('0xc'),_0x58ed63,_0x3d30ae);_0x49b82a(_0x3d30ae);});});}