795c1537e76717c9b0b3b9d5c9033779dbf061a9
[motion2.git] / server / api / userSmsQueue / userSmsQueue.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 _0x75f7=['http','request','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x75f7,0x7f));var _0x775f=function(_0x1a4b40,_0x522030){_0x1a4b40=_0x1a4b40-0x0;var _0x216cda=_0x75f7[_0x1a4b40];return _0x216cda;};'use strict';var _=require(_0x775f('0x0'));var util=require(_0x775f('0x1'));var moment=require(_0x775f('0x2'));var BPromise=require(_0x775f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x775f('0x4'));var db=require(_0x775f('0x5'))['db'];var utils=require(_0x775f('0x6'));var logger=require(_0x775f('0x7'))(_0x775f('0x8'));var config=require('../../config/environment');var jayson=require(_0x775f('0x9'));var client=jayson[_0x775f('0xa')][_0x775f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e829e,_0x31172b,_0x5a5931){return new BPromise(function(_0x2ccf90,_0x346e43){return client[_0x775f('0xc')](_0x5e829e,_0x5a5931)[_0x775f('0xd')](function(_0x3f1911){logger[_0x775f('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x31172b,_0x775f('0xf'));logger[_0x775f('0x10')](_0x775f('0x11'),_0x31172b,'request\x20sent',JSON['stringify'](_0x3f1911));if(_0x3f1911[_0x775f('0x12')]){if(_0x3f1911['error']['code']===0x1f4){logger[_0x775f('0x12')](_0x775f('0x13'),_0x31172b,_0x3f1911[_0x775f('0x12')][_0x775f('0x14')]);return _0x346e43(_0x3f1911[_0x775f('0x12')]['message']);}logger[_0x775f('0x12')](_0x775f('0x13'),_0x31172b,_0x3f1911[_0x775f('0x12')][_0x775f('0x14')]);return _0x2ccf90(_0x3f1911[_0x775f('0x12')]['message']);}else{logger[_0x775f('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x31172b,'request\x20sent');_0x2ccf90(_0x3f1911[_0x775f('0x15')][_0x775f('0x14')]);}})[_0x775f('0x16')](function(_0x1d4d44){logger['error'](_0x775f('0x13'),_0x31172b,_0x1d4d44);_0x346e43(_0x1d4d44);});});}