Built motion from commit 9e1399f3.|2.5.37
[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 _0xd291=['info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x15318f,_0x7114dc){var _0x159e91=function(_0x5a6515){while(--_0x5a6515){_0x15318f['push'](_0x15318f['shift']());}};_0x159e91(++_0x7114dc);}(_0xd291,0x1a6));var _0x1d29=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd291[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x1d29('0x0'));var moment=require(_0x1d29('0x1'));var BPromise=require(_0x1d29('0x2'));var rs=require(_0x1d29('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d29('0x4'))['db'];var utils=require(_0x1d29('0x5'));var logger=require(_0x1d29('0x6'))(_0x1d29('0x7'));var config=require(_0x1d29('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1d29('0x9')][_0x1d29('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x348a84,_0x1cf6dd,_0x18f39f){return new BPromise(function(_0x459497,_0x5d5d2f){return client['request'](_0x348a84,_0x18f39f)[_0x1d29('0xb')](function(_0x43e750){logger['info'](_0x1d29('0xc'),_0x1cf6dd,_0x1d29('0xd'));logger[_0x1d29('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x1cf6dd,_0x1d29('0xd'),JSON[_0x1d29('0xf')](_0x43e750));if(_0x43e750[_0x1d29('0x10')]){if(_0x43e750[_0x1d29('0x10')][_0x1d29('0x11')]===0x1f4){logger[_0x1d29('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x1cf6dd,_0x43e750[_0x1d29('0x10')][_0x1d29('0x12')]);return _0x5d5d2f(_0x43e750[_0x1d29('0x10')]['message']);}logger['error'](_0x1d29('0xc'),_0x1cf6dd,_0x43e750[_0x1d29('0x10')][_0x1d29('0x12')]);return _0x459497(_0x43e750[_0x1d29('0x10')][_0x1d29('0x12')]);}else{logger[_0x1d29('0x13')](_0x1d29('0xc'),_0x1cf6dd,_0x1d29('0xd'));_0x459497(_0x43e750['result'][_0x1d29('0x12')]);}})[_0x1d29('0x14')](function(_0x269cec){logger[_0x1d29('0x10')](_0x1d29('0xc'),_0x1cf6dd,_0x269cec);_0x5d5d2f(_0x269cec);});});}