Built motion from commit 377f727e.|2.6.28
[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 _0x08ca=['jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x581bc8,_0x7566e){var _0x351c3e=function(_0x512a01){while(--_0x512a01){_0x581bc8['push'](_0x581bc8['shift']());}};_0x351c3e(++_0x7566e);}(_0x08ca,0xb5));var _0xa08c=function(_0x5e4414,_0x3d8917){_0x5e4414=_0x5e4414-0x0;var _0x239c1e=_0x08ca[_0x5e4414];return _0x239c1e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa08c('0x0'));var BPromise=require(_0xa08c('0x1'));var rs=require(_0xa08c('0x2'));var fs=require('fs');var Redis=require(_0xa08c('0x3'));var db=require(_0xa08c('0x4'))['db'];var utils=require(_0xa08c('0x5'));var logger=require(_0xa08c('0x6'))('rpc');var config=require(_0xa08c('0x7'));var jayson=require(_0xa08c('0x8'));var client=jayson[_0xa08c('0x9')][_0xa08c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x438ace,_0x1efd9e,_0x197336){return new BPromise(function(_0x1d2b67,_0x50108f){return client[_0xa08c('0xb')](_0x438ace,_0x197336)[_0xa08c('0xc')](function(_0x544968){logger[_0xa08c('0xd')](_0xa08c('0xe'),_0x1efd9e,_0xa08c('0xf'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x1efd9e,_0xa08c('0xf'),JSON[_0xa08c('0x10')](_0x544968));if(_0x544968[_0xa08c('0x11')]){if(_0x544968[_0xa08c('0x11')]['code']===0x1f4){logger[_0xa08c('0x11')](_0xa08c('0xe'),_0x1efd9e,_0x544968[_0xa08c('0x11')][_0xa08c('0x12')]);return _0x50108f(_0x544968[_0xa08c('0x11')][_0xa08c('0x12')]);}logger['error'](_0xa08c('0xe'),_0x1efd9e,_0x544968['error'][_0xa08c('0x12')]);return _0x1d2b67(_0x544968[_0xa08c('0x11')][_0xa08c('0x12')]);}else{logger[_0xa08c('0xd')](_0xa08c('0xe'),_0x1efd9e,_0xa08c('0xf'));_0x1d2b67(_0x544968[_0xa08c('0x13')][_0xa08c('0x12')]);}})[_0xa08c('0x14')](function(_0x5bb29b){logger[_0xa08c('0x11')](_0xa08c('0xe'),_0x1efd9e,_0x5bb29b);_0x50108f(_0x5bb29b);});});}