Built motion from commit (unavailable).|2.5.23
[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 _0x07f7=['then','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4fee31,_0x6905e3){var _0x27d650=function(_0x583e4e){while(--_0x583e4e){_0x4fee31['push'](_0x4fee31['shift']());}};_0x27d650(++_0x6905e3);}(_0x07f7,0x96));var _0x707f=function(_0x43747e,_0x13b832){_0x43747e=_0x43747e-0x0;var _0x7fb853=_0x07f7[_0x43747e];return _0x7fb853;};'use strict';var _=require('lodash');var util=require(_0x707f('0x0'));var moment=require(_0x707f('0x1'));var BPromise=require(_0x707f('0x2'));var rs=require(_0x707f('0x3'));var fs=require('fs');var Redis=require(_0x707f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x707f('0x5'));var logger=require(_0x707f('0x6'))('rpc');var config=require(_0x707f('0x7'));var jayson=require(_0x707f('0x8'));var client=jayson[_0x707f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x547b07,_0x2b7f0a,_0x620bd8){return new BPromise(function(_0x58e7f0,_0x2e716c){return client['request'](_0x547b07,_0x620bd8)[_0x707f('0xa')](function(_0x553837){logger['info']('DeskField,\x20%s,\x20%s',_0x2b7f0a,_0x707f('0xb'));logger['debug'](_0x707f('0xc'),_0x2b7f0a,_0x707f('0xb'),JSON[_0x707f('0xd')](_0x553837));if(_0x553837['error']){if(_0x553837[_0x707f('0xe')][_0x707f('0xf')]===0x1f4){logger[_0x707f('0xe')](_0x707f('0x10'),_0x2b7f0a,_0x553837[_0x707f('0xe')]['message']);return _0x2e716c(_0x553837[_0x707f('0xe')][_0x707f('0x11')]);}logger['error'](_0x707f('0x10'),_0x2b7f0a,_0x553837[_0x707f('0xe')][_0x707f('0x11')]);return _0x58e7f0(_0x553837['error']['message']);}else{logger['info'](_0x707f('0x10'),_0x2b7f0a,'request\x20sent');_0x58e7f0(_0x553837[_0x707f('0x12')][_0x707f('0x11')]);}})[_0x707f('0x13')](function(_0x2f803d){logger[_0x707f('0xe')](_0x707f('0x10'),_0x2b7f0a,_0x2f803d);_0x2e716c(_0x2f803d);});});}