Built motion from commit 85328c08.|2.5.50
[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 _0xf894=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','result'];(function(_0x4f94eb,_0x27af5a){var _0x556912=function(_0x58ee93){while(--_0x58ee93){_0x4f94eb['push'](_0x4f94eb['shift']());}};_0x556912(++_0x27af5a);}(_0xf894,0xfd));var _0x4f89=function(_0x9b9c0c,_0x5579e7){_0x9b9c0c=_0x9b9c0c-0x0;var _0x3945b1=_0xf894[_0x9b9c0c];return _0x3945b1;};'use strict';var _=require(_0x4f89('0x0'));var util=require(_0x4f89('0x1'));var moment=require(_0x4f89('0x2'));var BPromise=require(_0x4f89('0x3'));var rs=require(_0x4f89('0x4'));var fs=require('fs');var Redis=require(_0x4f89('0x5'));var db=require(_0x4f89('0x6'))['db'];var utils=require(_0x4f89('0x7'));var logger=require(_0x4f89('0x8'))(_0x4f89('0x9'));var config=require(_0x4f89('0xa'));var jayson=require(_0x4f89('0xb'));var client=jayson[_0x4f89('0xc')][_0x4f89('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x324870,_0x33920a,_0x39b492){return new BPromise(function(_0x188d3f,_0x5cb3a5){return client[_0x4f89('0xe')](_0x324870,_0x39b492)[_0x4f89('0xf')](function(_0x2eb8fe){logger[_0x4f89('0x10')](_0x4f89('0x11'),_0x33920a,_0x4f89('0x12'));logger[_0x4f89('0x13')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x33920a,'request\x20sent',JSON['stringify'](_0x2eb8fe));if(_0x2eb8fe[_0x4f89('0x14')]){if(_0x2eb8fe[_0x4f89('0x14')]['code']===0x1f4){logger[_0x4f89('0x14')](_0x4f89('0x11'),_0x33920a,_0x2eb8fe[_0x4f89('0x14')][_0x4f89('0x15')]);return _0x5cb3a5(_0x2eb8fe[_0x4f89('0x14')][_0x4f89('0x15')]);}logger[_0x4f89('0x14')](_0x4f89('0x11'),_0x33920a,_0x2eb8fe[_0x4f89('0x14')]['message']);return _0x188d3f(_0x2eb8fe[_0x4f89('0x14')][_0x4f89('0x15')]);}else{logger[_0x4f89('0x10')](_0x4f89('0x11'),_0x33920a,_0x4f89('0x12'));_0x188d3f(_0x2eb8fe[_0x4f89('0x16')][_0x4f89('0x15')]);}})['catch'](function(_0x9c194){logger['error']('SmsApplication,\x20%s,\x20%s',_0x33920a,_0x9c194);_0x5cb3a5(_0x9c194);});});}