Built motion from commit (unavailable).|2.5.15
[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 _0x45f8=['http','request','then','info','DeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client'];(function(_0x4bb437,_0xaf7873){var _0x16ffe1=function(_0x1319c5){while(--_0x1319c5){_0x4bb437['push'](_0x4bb437['shift']());}};_0x16ffe1(++_0xaf7873);}(_0x45f8,0x1b0));var _0x845f=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0x45f8[_0x45b1ba];return _0x145ddb;};'use strict';var _=require(_0x845f('0x0'));var util=require(_0x845f('0x1'));var moment=require('moment');var BPromise=require(_0x845f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x845f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x845f('0x4'));var config=require(_0x845f('0x5'));var jayson=require(_0x845f('0x6'));var client=jayson[_0x845f('0x7')][_0x845f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b6dfb,_0x5d7995,_0x427551){return new BPromise(function(_0x5f74f6,_0x2cc9d8){return client[_0x845f('0x9')](_0x1b6dfb,_0x427551)[_0x845f('0xa')](function(_0x81fbc3){logger[_0x845f('0xb')](_0x845f('0xc'),_0x5d7995,'request\x20sent');logger[_0x845f('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x5d7995,_0x845f('0xe'),JSON[_0x845f('0xf')](_0x81fbc3));if(_0x81fbc3[_0x845f('0x10')]){if(_0x81fbc3['error']['code']===0x1f4){logger['error'](_0x845f('0xc'),_0x5d7995,_0x81fbc3['error'][_0x845f('0x11')]);return _0x2cc9d8(_0x81fbc3['error']['message']);}logger[_0x845f('0x10')]('DeskField,\x20%s,\x20%s',_0x5d7995,_0x81fbc3['error'][_0x845f('0x11')]);return _0x5f74f6(_0x81fbc3[_0x845f('0x10')]['message']);}else{logger['info'](_0x845f('0xc'),_0x5d7995,'request\x20sent');_0x5f74f6(_0x81fbc3[_0x845f('0x12')]['message']);}})[_0x845f('0x13')](function(_0x59fbb5){logger['error'](_0x845f('0xc'),_0x5d7995,_0x59fbb5);_0x2cc9d8(_0x59fbb5);});});}