d9dcd2ae0740e0a9fae2c39b06b0704214eaac69
[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 _0x00f0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','randomstring'];(function(_0x3dff0d,_0x4d59ff){var _0x352383=function(_0x46e5ef){while(--_0x46e5ef){_0x3dff0d['push'](_0x3dff0d['shift']());}};_0x352383(++_0x4d59ff);}(_0x00f0,0x1cb));var _0x000f=function(_0x239191,_0xaba0f4){_0x239191=_0x239191-0x0;var _0x2c6992=_0x00f0[_0x239191];return _0x2c6992;};'use strict';var _=require(_0x000f('0x0'));var util=require('util');var moment=require(_0x000f('0x1'));var BPromise=require('bluebird');var rs=require(_0x000f('0x2'));var fs=require('fs');var Redis=require(_0x000f('0x3'));var db=require(_0x000f('0x4'))['db'];var utils=require(_0x000f('0x5'));var logger=require(_0x000f('0x6'))(_0x000f('0x7'));var config=require(_0x000f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x000f('0x9')][_0x000f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d70e5,_0xec9ea,_0x28c084){return new BPromise(function(_0x83efc6,_0x2e6615){return client[_0x000f('0xb')](_0x1d70e5,_0x28c084)[_0x000f('0xc')](function(_0x137cd4){logger[_0x000f('0xd')](_0x000f('0xe'),_0xec9ea,_0x000f('0xf'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0xec9ea,_0x000f('0xf'),JSON[_0x000f('0x10')](_0x137cd4));if(_0x137cd4[_0x000f('0x11')]){if(_0x137cd4['error'][_0x000f('0x12')]===0x1f4){logger[_0x000f('0x11')](_0x000f('0xe'),_0xec9ea,_0x137cd4[_0x000f('0x11')][_0x000f('0x13')]);return _0x2e6615(_0x137cd4[_0x000f('0x11')][_0x000f('0x13')]);}logger[_0x000f('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0xec9ea,_0x137cd4[_0x000f('0x11')]['message']);return _0x83efc6(_0x137cd4[_0x000f('0x11')][_0x000f('0x13')]);}else{logger[_0x000f('0xd')](_0x000f('0xe'),_0xec9ea,_0x000f('0xf'));_0x83efc6(_0x137cd4[_0x000f('0x14')][_0x000f('0x13')]);}})['catch'](function(_0x5bcdfb){logger[_0x000f('0x11')](_0x000f('0xe'),_0xec9ea,_0x5bcdfb);_0x2e6615(_0x5bcdfb);});});}