15970625183ba7fad1f6eef69d40d6bd349889cd
[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 _0xa560=['request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','DeskField,\x20%s,\x20%s'];(function(_0x450b9e,_0x18a758){var _0x4bef5b=function(_0x2a313b){while(--_0x2a313b){_0x450b9e['push'](_0x450b9e['shift']());}};_0x4bef5b(++_0x18a758);}(_0xa560,0xce));var _0x0a56=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa560[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x0a56('0x0'));var moment=require(_0x0a56('0x1'));var BPromise=require(_0x0a56('0x2'));var rs=require(_0x0a56('0x3'));var fs=require('fs');var Redis=require(_0x0a56('0x4'));var db=require(_0x0a56('0x5'))['db'];var utils=require(_0x0a56('0x6'));var logger=require('../../config/logger')(_0x0a56('0x7'));var config=require(_0x0a56('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a56('0x9')][_0x0a56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50baa8,_0x5488f1,_0x1001c9){return new BPromise(function(_0x376970,_0x323fc9){return client[_0x0a56('0xb')](_0x50baa8,_0x1001c9)[_0x0a56('0xc')](function(_0x16affc){logger['info'](_0x0a56('0xd'),_0x5488f1,_0x0a56('0xe'));logger['debug'](_0x0a56('0xf'),_0x5488f1,'request\x20sent',JSON['stringify'](_0x16affc));if(_0x16affc[_0x0a56('0x10')]){if(_0x16affc[_0x0a56('0x10')][_0x0a56('0x11')]===0x1f4){logger[_0x0a56('0x10')](_0x0a56('0xd'),_0x5488f1,_0x16affc[_0x0a56('0x10')][_0x0a56('0x12')]);return _0x323fc9(_0x16affc[_0x0a56('0x10')]['message']);}logger[_0x0a56('0x10')]('DeskField,\x20%s,\x20%s',_0x5488f1,_0x16affc[_0x0a56('0x10')]['message']);return _0x376970(_0x16affc[_0x0a56('0x10')][_0x0a56('0x12')]);}else{logger[_0x0a56('0x13')](_0x0a56('0xd'),_0x5488f1,_0x0a56('0xe'));_0x376970(_0x16affc['result'][_0x0a56('0x12')]);}})['catch'](function(_0x149940){logger['error'](_0x0a56('0xd'),_0x5488f1,_0x149940);_0x323fc9(_0x149940);});});}