Built motion from commit (unavailable).|2.5.22
[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 _0x366b=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','ioredis','../../config/logger'];(function(_0x31aee4,_0xef6769){var _0x34db51=function(_0x47403f){while(--_0x47403f){_0x31aee4['push'](_0x31aee4['shift']());}};_0x34db51(++_0xef6769);}(_0x366b,0x14f));var _0xb366=function(_0x21c31c,_0x10347b){_0x21c31c=_0x21c31c-0x0;var _0x5d282a=_0x366b[_0x21c31c];return _0x5d282a;};'use strict';var _=require('lodash');var util=require(_0xb366('0x0'));var moment=require(_0xb366('0x1'));var BPromise=require(_0xb366('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb366('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb366('0x4'))(_0xb366('0x5'));var config=require(_0xb366('0x6'));var jayson=require(_0xb366('0x7'));var client=jayson['client'][_0xb366('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f63da,_0x414e5b,_0x54b579){return new BPromise(function(_0x59eb0d,_0x4a3618){return client[_0xb366('0x9')](_0x4f63da,_0x54b579)[_0xb366('0xa')](function(_0x319307){logger[_0xb366('0xb')](_0xb366('0xc'),_0x414e5b,_0xb366('0xd'));logger[_0xb366('0xe')](_0xb366('0xf'),_0x414e5b,_0xb366('0xd'),JSON[_0xb366('0x10')](_0x319307));if(_0x319307[_0xb366('0x11')]){if(_0x319307[_0xb366('0x11')][_0xb366('0x12')]===0x1f4){logger[_0xb366('0x11')](_0xb366('0xc'),_0x414e5b,_0x319307['error']['message']);return _0x4a3618(_0x319307[_0xb366('0x11')][_0xb366('0x13')]);}logger[_0xb366('0x11')](_0xb366('0xc'),_0x414e5b,_0x319307[_0xb366('0x11')][_0xb366('0x13')]);return _0x59eb0d(_0x319307['error'][_0xb366('0x13')]);}else{logger[_0xb366('0xb')](_0xb366('0xc'),_0x414e5b,'request\x20sent');_0x59eb0d(_0x319307['result'][_0xb366('0x13')]);}})['catch'](function(_0x29f147){logger[_0xb366('0x11')](_0xb366('0xc'),_0x414e5b,_0x29f147);_0x4a3618(_0x29f147);});});}