Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / api / userFaxQueue / userFaxQueue.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 _0x0ea8=['stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x596c43,_0x28647a){var _0x4e1315=function(_0x58e910){while(--_0x58e910){_0x596c43['push'](_0x596c43['shift']());}};_0x4e1315(++_0x28647a);}(_0x0ea8,0x1aa));var _0x80ea=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0ea8[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x80ea('0x0'));var util=require('util');var moment=require(_0x80ea('0x1'));var BPromise=require(_0x80ea('0x2'));var rs=require(_0x80ea('0x3'));var fs=require('fs');var Redis=require(_0x80ea('0x4'));var db=require(_0x80ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x80ea('0x6'))(_0x80ea('0x7'));var config=require(_0x80ea('0x8'));var jayson=require(_0x80ea('0x9'));var client=jayson['client'][_0x80ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x263867,_0x3417e3,_0x50aaff){return new BPromise(function(_0xeedbd1,_0x194c52){return client['request'](_0x263867,_0x50aaff)[_0x80ea('0xb')](function(_0x46dafa){logger['info'](_0x80ea('0xc'),_0x3417e3,_0x80ea('0xd'));logger[_0x80ea('0xe')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3417e3,'request\x20sent',JSON[_0x80ea('0xf')](_0x46dafa));if(_0x46dafa[_0x80ea('0x10')]){if(_0x46dafa[_0x80ea('0x10')][_0x80ea('0x11')]===0x1f4){logger[_0x80ea('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x3417e3,_0x46dafa[_0x80ea('0x10')][_0x80ea('0x12')]);return _0x194c52(_0x46dafa[_0x80ea('0x10')]['message']);}logger[_0x80ea('0x10')](_0x80ea('0xc'),_0x3417e3,_0x46dafa[_0x80ea('0x10')][_0x80ea('0x12')]);return _0xeedbd1(_0x46dafa[_0x80ea('0x10')][_0x80ea('0x12')]);}else{logger[_0x80ea('0x13')](_0x80ea('0xc'),_0x3417e3,_0x80ea('0xd'));_0xeedbd1(_0x46dafa['result'][_0x80ea('0x12')]);}})[_0x80ea('0x14')](function(_0x1d043c){logger[_0x80ea('0x10')](_0x80ea('0xc'),_0x3417e3,_0x1d043c);_0x194c52(_0x1d043c);});});}