Built motion from commit (unavailable).|2.5.26
[motion2.git] / server / api / smsApplication / smsApplication.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 _0x046b=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x58e331,_0x3e7165){var _0x16f0dc=function(_0xeea11e){while(--_0xeea11e){_0x58e331['push'](_0x58e331['shift']());}};_0x16f0dc(++_0x3e7165);}(_0x046b,0x147));var _0xb046=function(_0x4aa0c7,_0x5959da){_0x4aa0c7=_0x4aa0c7-0x0;var _0x2ff444=_0x046b[_0x4aa0c7];return _0x2ff444;};'use strict';var _=require('lodash');var util=require(_0xb046('0x0'));var moment=require(_0xb046('0x1'));var BPromise=require(_0xb046('0x2'));var rs=require(_0xb046('0x3'));var fs=require('fs');var Redis=require(_0xb046('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb046('0x5'));var logger=require(_0xb046('0x6'))(_0xb046('0x7'));var config=require(_0xb046('0x8'));var jayson=require(_0xb046('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13203d,_0x1f00c8,_0x190c9a){return new BPromise(function(_0x308e79,_0x3c0678){return client[_0xb046('0xa')](_0x13203d,_0x190c9a)[_0xb046('0xb')](function(_0x170b66){logger['info'](_0xb046('0xc'),_0x1f00c8,'request\x20sent');logger[_0xb046('0xd')](_0xb046('0xe'),_0x1f00c8,_0xb046('0xf'),JSON[_0xb046('0x10')](_0x170b66));if(_0x170b66[_0xb046('0x11')]){if(_0x170b66['error']['code']===0x1f4){logger['error'](_0xb046('0xc'),_0x1f00c8,_0x170b66[_0xb046('0x11')]['message']);return _0x3c0678(_0x170b66[_0xb046('0x11')]['message']);}logger[_0xb046('0x11')](_0xb046('0xc'),_0x1f00c8,_0x170b66['error'][_0xb046('0x12')]);return _0x308e79(_0x170b66[_0xb046('0x11')][_0xb046('0x12')]);}else{logger[_0xb046('0x13')](_0xb046('0xc'),_0x1f00c8,'request\x20sent');_0x308e79(_0x170b66[_0xb046('0x14')][_0xb046('0x12')]);}})[_0xb046('0x15')](function(_0xa3b910){logger[_0xb046('0x11')](_0xb046('0xc'),_0x1f00c8,_0xa3b910);_0x3c0678(_0xa3b910);});});}