4200361155dd08be32f6c4a24cb4d9c643e1645f
[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 _0xc993=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x18c057,_0x2ac2e3){var _0x2afcc1=function(_0x28ecd3){while(--_0x28ecd3){_0x18c057['push'](_0x18c057['shift']());}};_0x2afcc1(++_0x2ac2e3);}(_0xc993,0x9a));var _0x3c99=function(_0xfb9eb5,_0x468bc6){_0xfb9eb5=_0xfb9eb5-0x0;var _0x3d0096=_0xc993[_0xfb9eb5];return _0x3d0096;};'use strict';var _=require(_0x3c99('0x0'));var util=require(_0x3c99('0x1'));var moment=require(_0x3c99('0x2'));var BPromise=require('bluebird');var rs=require(_0x3c99('0x3'));var fs=require('fs');var Redis=require(_0x3c99('0x4'));var db=require(_0x3c99('0x5'))['db'];var utils=require(_0x3c99('0x6'));var logger=require(_0x3c99('0x7'))('rpc');var config=require(_0x3c99('0x8'));var jayson=require(_0x3c99('0x9'));var client=jayson[_0x3c99('0xa')][_0x3c99('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15c08f,_0x484b7c,_0x4c9036){return new BPromise(function(_0x177f99,_0x354111){return client[_0x3c99('0xc')](_0x15c08f,_0x4c9036)[_0x3c99('0xd')](function(_0x3bc3dc){logger[_0x3c99('0xe')](_0x3c99('0xf'),_0x484b7c,_0x3c99('0x10'));logger[_0x3c99('0x11')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x484b7c,_0x3c99('0x10'),JSON[_0x3c99('0x12')](_0x3bc3dc));if(_0x3bc3dc[_0x3c99('0x13')]){if(_0x3bc3dc[_0x3c99('0x13')][_0x3c99('0x14')]===0x1f4){logger[_0x3c99('0x13')](_0x3c99('0xf'),_0x484b7c,_0x3bc3dc['error'][_0x3c99('0x15')]);return _0x354111(_0x3bc3dc[_0x3c99('0x13')][_0x3c99('0x15')]);}logger[_0x3c99('0x13')](_0x3c99('0xf'),_0x484b7c,_0x3bc3dc[_0x3c99('0x13')][_0x3c99('0x15')]);return _0x177f99(_0x3bc3dc[_0x3c99('0x13')]['message']);}else{logger[_0x3c99('0xe')](_0x3c99('0xf'),_0x484b7c,_0x3c99('0x10'));_0x177f99(_0x3bc3dc['result']['message']);}})[_0x3c99('0x16')](function(_0x5eaa3c){logger[_0x3c99('0x13')](_0x3c99('0xf'),_0x484b7c,_0x5eaa3c);_0x354111(_0x5eaa3c);});});}