Built motion from commit (unavailable).|2.5.29
[motion2.git] / server / api / userNotification / userNotification.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 _0x5ac4=['socket.io-emitter','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5ac4,0xbd));var _0x45ac=function(_0x2ea896,_0x1bd4b4){_0x2ea896=_0x2ea896-0x0;var _0x5c5d41=_0x5ac4[_0x2ea896];return _0x5c5d41;};'use strict';var _=require(_0x45ac('0x0'));var util=require(_0x45ac('0x1'));var moment=require(_0x45ac('0x2'));var BPromise=require('bluebird');var rs=require(_0x45ac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45ac('0x4'))['db'];var utils=require(_0x45ac('0x5'));var logger=require(_0x45ac('0x6'))(_0x45ac('0x7'));var config=require(_0x45ac('0x8'));var jayson=require(_0x45ac('0x9'));var client=jayson[_0x45ac('0xa')][_0x45ac('0xb')]({'port':0x232a});config[_0x45ac('0xc')]=_[_0x45ac('0xd')](config[_0x45ac('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x45ac('0xe'))(new Redis(config[_0x45ac('0xc')]));require('./userNotification.socket')[_0x45ac('0xf')](socket);function respondWithRpcPromise(_0x3930f2,_0x58fef2,_0x347e2b){return new BPromise(function(_0x57b010,_0x4d1022){return client[_0x45ac('0x10')](_0x3930f2,_0x347e2b)[_0x45ac('0x11')](function(_0x3d896c){logger['info'](_0x45ac('0x12'),_0x58fef2,_0x45ac('0x13'));logger[_0x45ac('0x14')](_0x45ac('0x15'),_0x58fef2,_0x45ac('0x13'),JSON[_0x45ac('0x16')](_0x3d896c));if(_0x3d896c[_0x45ac('0x17')]){if(_0x3d896c[_0x45ac('0x17')][_0x45ac('0x18')]===0x1f4){logger[_0x45ac('0x17')](_0x45ac('0x12'),_0x58fef2,_0x3d896c[_0x45ac('0x17')][_0x45ac('0x19')]);return _0x4d1022(_0x3d896c[_0x45ac('0x17')][_0x45ac('0x19')]);}logger[_0x45ac('0x17')](_0x45ac('0x12'),_0x58fef2,_0x3d896c[_0x45ac('0x17')][_0x45ac('0x19')]);return _0x57b010(_0x3d896c[_0x45ac('0x17')]['message']);}else{logger[_0x45ac('0x1a')](_0x45ac('0x12'),_0x58fef2,_0x45ac('0x13'));_0x57b010(_0x3d896c[_0x45ac('0x1b')][_0x45ac('0x19')]);}})[_0x45ac('0x1c')](function(_0x373188){logger['error']('UserNotification,\x20%s,\x20%s',_0x58fef2,_0x373188);_0x4d1022(_0x373188);});});}