Built motion from commit 44b1f254.|2.6.26
[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 _0x9bf9=['moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash'];(function(_0x3c3530,_0x374b49){var _0x1e3374=function(_0x31fe72){while(--_0x31fe72){_0x3c3530['push'](_0x3c3530['shift']());}};_0x1e3374(++_0x374b49);}(_0x9bf9,0x1a3));var _0x99bf=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x9bf9[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0x99bf('0x0'));var util=require('util');var moment=require(_0x99bf('0x1'));var BPromise=require('bluebird');var rs=require(_0x99bf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x99bf('0x3'))(_0x99bf('0x4'));var config=require(_0x99bf('0x5'));var jayson=require(_0x99bf('0x6'));var client=jayson[_0x99bf('0x7')][_0x99bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x188537,_0x2ec35f,_0xfef775){return new BPromise(function(_0x49efa6,_0x157bed){return client[_0x99bf('0x9')](_0x188537,_0xfef775)[_0x99bf('0xa')](function(_0x377e0b){logger[_0x99bf('0xb')](_0x99bf('0xc'),_0x2ec35f,_0x99bf('0xd'));logger[_0x99bf('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x2ec35f,_0x99bf('0xd'),JSON[_0x99bf('0xf')](_0x377e0b));if(_0x377e0b['error']){if(_0x377e0b['error']['code']===0x1f4){logger[_0x99bf('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x2ec35f,_0x377e0b[_0x99bf('0x10')][_0x99bf('0x11')]);return _0x157bed(_0x377e0b[_0x99bf('0x10')][_0x99bf('0x11')]);}logger[_0x99bf('0x10')](_0x99bf('0xc'),_0x2ec35f,_0x377e0b[_0x99bf('0x10')][_0x99bf('0x11')]);return _0x49efa6(_0x377e0b[_0x99bf('0x10')]['message']);}else{logger[_0x99bf('0xb')](_0x99bf('0xc'),_0x2ec35f,_0x99bf('0xd'));_0x49efa6(_0x377e0b[_0x99bf('0x12')][_0x99bf('0x11')]);}})[_0x99bf('0x13')](function(_0x133251){logger[_0x99bf('0x10')](_0x99bf('0xc'),_0x2ec35f,_0x133251);_0x157bed(_0x133251);});});}