Built motion from commit f7863d46.|2.5.41
[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 _0xf385=['result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','UserSmsQueue,\x20%s,\x20%s'];(function(_0x5dce9e,_0x191faf){var _0x212e8a=function(_0x5c5d53){while(--_0x5c5d53){_0x5dce9e['push'](_0x5dce9e['shift']());}};_0x212e8a(++_0x191faf);}(_0xf385,0x113));var _0x5f38=function(_0x33f31b,_0x550ae9){_0x33f31b=_0x33f31b-0x0;var _0x33514e=_0xf385[_0x33f31b];return _0x33514e;};'use strict';var _=require(_0x5f38('0x0'));var util=require(_0x5f38('0x1'));var moment=require(_0x5f38('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f38('0x3'));var fs=require('fs');var Redis=require(_0x5f38('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5f38('0x5'))(_0x5f38('0x6'));var config=require(_0x5f38('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5f38('0x8')][_0x5f38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb5768a,_0x22ac9b,_0x14f965){return new BPromise(function(_0x348930,_0x5f29a4){return client[_0x5f38('0xa')](_0xb5768a,_0x14f965)['then'](function(_0x4c70d4){logger[_0x5f38('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x22ac9b,_0x5f38('0xc'));logger[_0x5f38('0xd')](_0x5f38('0xe'),_0x22ac9b,_0x5f38('0xc'),JSON['stringify'](_0x4c70d4));if(_0x4c70d4['error']){if(_0x4c70d4[_0x5f38('0xf')][_0x5f38('0x10')]===0x1f4){logger[_0x5f38('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x22ac9b,_0x4c70d4[_0x5f38('0xf')][_0x5f38('0x11')]);return _0x5f29a4(_0x4c70d4[_0x5f38('0xf')][_0x5f38('0x11')]);}logger['error'](_0x5f38('0x12'),_0x22ac9b,_0x4c70d4[_0x5f38('0xf')][_0x5f38('0x11')]);return _0x348930(_0x4c70d4['error'][_0x5f38('0x11')]);}else{logger[_0x5f38('0xb')](_0x5f38('0x12'),_0x22ac9b,_0x5f38('0xc'));_0x348930(_0x4c70d4[_0x5f38('0x13')]['message']);}})[_0x5f38('0x14')](function(_0x598334){logger['error'](_0x5f38('0x12'),_0x22ac9b,_0x598334);_0x5f29a4(_0x598334);});});}