Built motion from commit a679711e.|2.6.15
[motion2.git] / server / api / smsMessage / smsMessage.model.js
index c690663..81bc78c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc5ff=['Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','createdAt','catch','error','secret','SmsAccount','SmsAccountId','type','twilio','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','senderString','read','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','apiKey','text','timestamp','sort','length','createHash','md5','digest','hex','/external/get/send.php?','keys','id_sms'];(function(_0x51985c,_0x2a9bd8){var _0x136a91=function(_0x541ba8){while(--_0x541ba8){_0x51985c['push'](_0x51985c['shift']());}};_0x136a91(++_0x2a9bd8);}(_0xc5ff,0x17b));var _0xfc5f=function(_0x3e2246,_0x4006ce){_0x3e2246=_0x3e2246-0x0;var _0x58b878=_0xc5ff[_0x3e2246];return _0x58b878;};'use strict';var _=require(_0xfc5f('0x0'));var util=require(_0xfc5f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfc5f('0x2'));var BPromise=require(_0xfc5f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc5f('0x4'));var config=require(_0xfc5f('0x5'));var attributes=require(_0xfc5f('0x6'));module['exports']=function(_0x3120df,_0x28e94d){return _0x3120df[_0xfc5f('0x7')](_0xfc5f('0x8'),attributes,{'tableName':_0xfc5f('0x9'),'paranoid':![],'indexes':[{'name':_0xfc5f('0xa'),'fields':[_0xfc5f('0xa')]},{'name':_0xfc5f('0xb'),'fields':[_0xfc5f('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f8e5e,_0xb869e2,_0x5001b0){var _0x52e27d=_0x3120df[_0xfc5f('0xd')];var _0x59b320=_0x4f8e5e[_0xfc5f('0xe')]({'plain':!![]});if(_0x59b320[_0xfc5f('0xf')][_0xfc5f('0x10')]()==='in'||_0x59b320[_0xfc5f('0xf')][_0xfc5f('0x10')]()===_0xfc5f('0x11')&&!_0x59b320['secret']&&!_[_0xfc5f('0x12')](_0x59b320[_0xfc5f('0x13')])&&!_[_0xfc5f('0x12')](_0x59b320['SmsInteractionId'])){_0x52e27d[_0xfc5f('0x14')][_0xfc5f('0x15')]({'where':{'id':_0x59b320[_0xfc5f('0x16')]}})[_0xfc5f('0x17')](function(_0x511445){if(_0x511445){_0x511445['update']({'lastMsgAt':_0x59b320[_0xfc5f('0x18')],'lastMsgDirection':_0x59b320[_0xfc5f('0xf')][_0xfc5f('0x10')]()});}})[_0xfc5f('0x19')](function(_0x198a4d){console[_0xfc5f('0x1a')](_0x198a4d);});}if(_0x59b320[_0xfc5f('0xf')]===_0xfc5f('0x11')&&!_0x59b320[_0xfc5f('0x1b')]){var _0x213160;_0x52e27d[_0xfc5f('0x1c')]['find']({'where':{'id':_0x59b320[_0xfc5f('0x1d')]},'raw':!![]})[_0xfc5f('0x17')](function(_0x33d05e){_0x213160=_0x33d05e;if(_0x213160&&_0x213160[_0xfc5f('0x1e')]){switch(_0x213160[_0xfc5f('0x1e')]){case _0xfc5f('0x1f'):var _0x1803da=require(_0xfc5f('0x1f'));if(_0x213160['accountSid']&&_0x213160[_0xfc5f('0x20')]&&_0x213160[_0xfc5f('0x21')]){var _0x47754c=new _0x1803da(_0x213160['accountSid'],_0x213160['authToken']);_0x47754c[_0xfc5f('0x22')]['create']({'body':_0x59b320[_0xfc5f('0xc')],'to':_0x59b320[_0xfc5f('0x21')],'from':_0x213160['phone'],'statusCallback':_0x213160[_0xfc5f('0x23')]+_0xfc5f('0x24')+_0x59b320['id']+_0xfc5f('0x25')+_0x213160[_0xfc5f('0x26')]})[_0xfc5f('0x17')](function(_0x37b28f){if(_0x37b28f['sid']){return _0x4f8e5e[_0xfc5f('0x27')]({'messageId':_0x37b28f['sid']});}})[_0xfc5f('0x19')](function(_0x474421){logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x1f'),util[_0xfc5f('0x2a')](_0x474421,{'showHidden':![],'depth':null}));});}else{logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x1f'),_0xfc5f('0x2b'));}break;case _0xfc5f('0x2c'):var _0x4f51d1=_0xfc5f('0x2d');if(_0x213160[_0xfc5f('0x2e')]&&_0x213160[_0xfc5f('0x2f')]){var _0x462068={'recipient':[_0x59b320[_0xfc5f('0x21')]],'message':_0x59b320[_0xfc5f('0xc')],'message_type':_0x213160[_0xfc5f('0x30')]};if(_0x213160[_0xfc5f('0x30')]&&_0x213160['smsMethod']!=='SI'){_0x462068[_0xfc5f('0x31')]=_0x213160['phone'];}var _0x27deef={'url':_0x4f51d1+_0xfc5f('0x32')+_0x213160[_0xfc5f('0x2e')]+_0xfc5f('0x33')+_0x213160[_0xfc5f('0x2f')],'method':_0xfc5f('0x34')};rp(_0x27deef)['then'](function(_0x1e36d1){var _0x29f0ee=_0x1e36d1[_0xfc5f('0x35')](';');var _0x46de38={'user_key':_0x29f0ee[0x0],'session_key':_0x29f0ee[0x1]};_0x27deef={'url':_0x4f51d1+_0xfc5f('0x36'),'method':_0xfc5f('0x37'),'headers':{'user_key':_0x46de38[_0xfc5f('0x38')],'Session_key':_0x46de38[_0xfc5f('0x39')]},'json':!![],'body':_0x462068};return rp(_0x27deef);})[_0xfc5f('0x17')](function(_0x30ce4e){if(_0x30ce4e[_0xfc5f('0x3a')]>=0x1){var _0x4cb505={'messageId':_0x30ce4e[_0xfc5f('0x3b')]};if(_0x213160[_0xfc5f('0x30')]!=='GP'||!_0x213160[_0xfc5f('0x3c')]){_0x4cb505['read']=!![];}return _0x4f8e5e[_0xfc5f('0x27')](_0x4cb505);}else{return logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x2c'),util[_0xfc5f('0x2a')](_0x30ce4e,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3c598f){return logger[_0xfc5f('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfc5f('0x29'),'skebby',util[_0xfc5f('0x2a')](_0x3c598f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x2c'),_0xfc5f('0x3d'));}break;case'connectel':if(_0x213160[_0xfc5f('0x20')]){var _0x3389bf={'recipient':_0x59b320[_0xfc5f('0x21')],'message':_0x59b320[_0xfc5f('0xc')],'sender':_0x213160[_0xfc5f('0x3e')]||_0x213160[_0xfc5f('0x21')],'authorization':_0x213160['authToken']};var _0xb869e2={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x3389bf,'json':!![]};rp(_0xb869e2)[_0xfc5f('0x17')](function(_0x32e1d9){var _0x55e4bd={'messageId':_0x32e1d9['requestid']};if(!_0x213160[_0xfc5f('0x3c')]){_0x55e4bd[_0xfc5f('0x3f')]=!![];}return _0x4f8e5e['update'](_0x55e4bd);})[_0xfc5f('0x19')](function(_0x54a968){logger['error'](_0xfc5f('0x28'),_0xfc5f('0x29'),'connectel',util['inspect'](_0x54a968,{'showHidden':![],'depth':null}));});}else{logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),'afterCreate','connectel',_0xfc5f('0x40'));}break;case'clicksend':if(_0x213160[_0xfc5f('0x2e')]&&_0x213160[_0xfc5f('0x2f')]){var _0x3389bf={'messages':[{'source':_0xfc5f('0x41'),'to':_0x59b320['phone'],'body':_0x59b320[_0xfc5f('0xc')],'from':_0x213160[_0xfc5f('0x3e')]||_0x213160[_0xfc5f('0x21')]}]};var _0xef4f90=util[_0xfc5f('0x42')](_0xfc5f('0x43'),_0x213160['username'],_0x213160['password']);var _0xb869e2={'method':_0xfc5f('0x37'),'uri':_0xfc5f('0x44'),'body':_0x3389bf,'headers':{'Authorization':util['format'](_0xfc5f('0x45'),new Buffer(_0xef4f90)[_0xfc5f('0x46')](_0xfc5f('0x47')))},'json':!![]};rp(_0xb869e2)['then'](function(_0x366940){if(_0x366940[_0xfc5f('0x48')]>=0xc8&&_0x366940[_0xfc5f('0x48')]<=0xce){if(_0x366940[_0xfc5f('0x49')]&&_0x366940[_0xfc5f('0x49')][_0xfc5f('0x4a')]>0x0){var _0x5b3055=_['head'](_0x366940[_0xfc5f('0x49')][_0xfc5f('0x22')]);var _0x5c77cd={'messageId':_0x5b3055['message_id']};if(!_0x213160['deliveryReport']){_0x5c77cd[_0xfc5f('0x3f')]=!![];}return _0x4f8e5e[_0xfc5f('0x27')](_0x5c77cd);}else{logger[_0xfc5f('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfc5f('0x29'),_0xfc5f('0x4b'),util['inspect'](_0x366940,{'showHidden':![],'depth':null}));}}else{logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),'afterCreate',_0xfc5f('0x4b'),util['inspect'](_0x366940,{'showHidden':![],'depth':null}));}})[_0xfc5f('0x19')](function(_0x4290aa){logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x4b'),util[_0xfc5f('0x2a')](_0x4290aa,{'showHidden':![],'depth':null}));});}else{logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x4b'),_0xfc5f('0x3d'));}break;case _0xfc5f('0x4c'):if(_0x213160[_0xfc5f('0x4d')]&&_0x213160['authToken']){var _0x3389bf={'dst':_0x59b320[_0xfc5f('0x21')],'text':_0x59b320[_0xfc5f('0xc')],'src':_0x213160[_0xfc5f('0x3e')]||_0x213160[_0xfc5f('0x21')],'url':_0x213160[_0xfc5f('0x23')]+'/api/sms/messages/'+_0x59b320['id']+_0xfc5f('0x25')+_0x213160['token']};var _0xef4f90=util[_0xfc5f('0x42')](_0xfc5f('0x43'),_0x213160[_0xfc5f('0x4d')],_0x213160[_0xfc5f('0x20')]);var _0xb869e2={'method':_0xfc5f('0x37'),'uri':util[_0xfc5f('0x42')](_0xfc5f('0x4e'),_0x213160[_0xfc5f('0x4d')]),'body':_0x3389bf,'headers':{'Authorization':util[_0xfc5f('0x42')](_0xfc5f('0x45'),new Buffer(_0xef4f90)[_0xfc5f('0x46')](_0xfc5f('0x47')))},'json':!![]};rp(_0xb869e2)[_0xfc5f('0x17')](function(_0x4c0ce3){var _0x4b0984={'messageId':_0x4c0ce3[_0xfc5f('0x4f')][0x0]};return _0x4f8e5e[_0xfc5f('0x27')](_0x4b0984);})['catch'](function(_0x490537){logger['error'](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x4c'),util[_0xfc5f('0x2a')](_0x490537,{'showHidden':![],'depth':null}));});}else{logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),'afterCreate',_0xfc5f('0x4c'),_0xfc5f('0x50'));}break;case _0xfc5f('0x51'):if(_0x213160[_0xfc5f('0x2e')]&&_0x213160[_0xfc5f('0x2f')]){if(_0x213160[_0xfc5f('0x52')]){var _0x2d0946={'method':_0xfc5f('0x37'),'uri':_0x213160[_0xfc5f('0x52')]+_0xfc5f('0x53'),'body':{'username':_0x213160['username'],'password':_0x213160['password']},'json':!![]};return rp(_0x2d0946)[_0xfc5f('0x17')](function(_0x3e7a39){var _0x25284e={'method':_0xfc5f('0x37'),'uri':_0x213160[_0xfc5f('0x52')]+_0xfc5f('0x54'),'body':{'messages':[{'from':_0x213160[_0xfc5f('0x21')],'destinations':[{'to':_0x59b320[_0xfc5f('0x21')]}],'text':_0x59b320[_0xfc5f('0xc')],'notifyUrl':_0x213160[_0xfc5f('0x23')]+'/api/sms/messages/'+_0x59b320['id']+_0xfc5f('0x25')+_0x213160[_0xfc5f('0x26')],'notifyContentType':_0xfc5f('0x55'),'callbackData':_0x213160[_0xfc5f('0x21')]+';'+_0x59b320[_0xfc5f('0xc')]}]},'headers':{'Authorization':_0xfc5f('0x56')+_0x3e7a39[_0xfc5f('0x26')]},'json':!![]};return rp(_0x25284e)[_0xfc5f('0x17')](function(_0x2debcb){if(_0x2debcb[_0xfc5f('0x22')]){var _0x3f6f73={'messageId':_0x2debcb[_0xfc5f('0x22')][0x0][_0xfc5f('0xa')]};if(!_0x213160[_0xfc5f('0x3c')]){_0x3f6f73['read']=!![];}return _0x4f8e5e[_0xfc5f('0x27')](_0x3f6f73);}else{return logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x51'),util[_0xfc5f('0x2a')](_0x2debcb,{'showHidden':![],'depth':null}));}});})[_0xfc5f('0x19')](function(_0xb3227d){return logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),'infobip',util[_0xfc5f('0x2a')](_0xb3227d,{'showHidden':![],'depth':null}));});}else{logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x51'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0xfc5f('0x28'),_0xfc5f('0x29'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0xfc5f('0x57'):var _0x1d194b=require(_0xfc5f('0x58'));if(_0x213160[_0xfc5f('0x59')]){var _0x3093fe={};_0x3093fe['login']=_0x213160['username'];_0x3093fe[_0xfc5f('0x21')]=_0x59b320[_0xfc5f('0x21')];_0x3093fe['sender']=_0x213160[_0xfc5f('0x21')];_0x3093fe[_0xfc5f('0x5a')]=_0x59b320['body'];_0x3093fe[_0xfc5f('0x5b')]=+new Date();var _0x2ca44d='';var _0x1d7dfc='';var _0x42cdf2=Object['keys'](_0x3093fe);_0x42cdf2[_0xfc5f('0x5c')]();for(var _0x2de0d7=0x0;_0x2de0d7<_0x42cdf2[_0xfc5f('0x5d')];_0x2de0d7++){if(_0x2ca44d!=''){_0x2ca44d+='&';}_0x2ca44d+=_0x42cdf2[_0x2de0d7]+'='+encodeURIComponent(_0x3093fe[_0x42cdf2[_0x2de0d7]]);_0x1d7dfc+=_0x3093fe[_0x42cdf2[_0x2de0d7]];}_0x1d7dfc+=_0x213160[_0xfc5f('0x59')];_0x1d7dfc=_0x1d194b[_0xfc5f('0x5e')](_0xfc5f('0x5f'))[_0xfc5f('0x27')](_0x1d7dfc)[_0xfc5f('0x60')](_0xfc5f('0x61'));if(_0x2ca44d!==''){_0x2ca44d+='&';}_0x2ca44d+='signature='+_0x1d7dfc;var _0x27deef={'method':_0xfc5f('0x34'),'uri':_0x213160[_0xfc5f('0x52')]+_0xfc5f('0x62')+_0x2ca44d,'json':!![]};return rp(_0x27deef)[_0xfc5f('0x17')](function(_0x3b9d84){var _0x338fba=Object[_0xfc5f('0x63')](_0x3b9d84);if(_0x3b9d84[_0x338fba[0x0]][_0xfc5f('0x1a')]&&parseInt(_0x3b9d84[_0x338fba[0x0]]['error'])===0x0){var _0x5dafdd={'messageId':_0x3b9d84[_0x338fba[0x0]][_0xfc5f('0x64')]};if(!_0x213160[_0xfc5f('0x3c')]){_0x5dafdd[_0xfc5f('0x3f')]=!![];}return _0x4f8e5e[_0xfc5f('0x27')](_0x5dafdd);}else{return logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x57'),util['inspect'](_0x3b9d84[_0xfc5f('0x1a')],{'showHidden':![],'depth':null}));}})[_0xfc5f('0x19')](function(_0x27f4d0){return logger[_0xfc5f('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfc5f('0x29'),_0xfc5f('0x57'),util['inspect'](_0x27f4d0,{'showHidden':![],'depth':null}));});}else{logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x57'),_0xfc5f('0x65'));}break;case _0xfc5f('0x66'):if(_0x213160['apiKey']){var _0xfc8027={'method':'POST','uri':_0xfc5f('0x67'),'headers':{'Authorization':_0x213160[_0xfc5f('0x59')]},'body':{'content':_0x59b320[_0xfc5f('0xc')],'to':[_0x59b320[_0xfc5f('0x21')]],'from':_0x213160[_0xfc5f('0x21')],'binary':![],'clientMessageId':_0xfc5f('0x68'),'charset':'UTF-8'},'json':!![]};rp(_0xfc8027)[_0xfc5f('0x17')](function(_0x5e5801){if(!_0x5e5801[_0xfc5f('0x1a')]){var _0x37c538={'messageId':_0x5e5801[_0xfc5f('0x22')][0x0][_0xfc5f('0x69')]};if(!_0x213160[_0xfc5f('0x3c')]){_0x37c538[_0xfc5f('0x3f')]=!![];}return _0x4f8e5e[_0xfc5f('0x27')](_0x37c538);}else{return logger[_0xfc5f('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfc5f('0x29'),_0xfc5f('0x66'),util['inspect'](_0x5e5801[_0xfc5f('0x1a')],{'showHidden':![],'depth':null}));}})[_0xfc5f('0x19')](function(_0x11e67f){return logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),'clickatell',util['inspect'](_0x11e67f,{'showHidden':![],'depth':null}));});}else{logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x66'),_0xfc5f('0x65'));}break;case _0xfc5f('0x6a'):if(_0x213160[_0xfc5f('0x2e')]&&_0x213160[_0xfc5f('0x2f')]){var _0xef4f90=util[_0xfc5f('0x42')]('%s:%s',_0x213160['username'],_0x213160[_0xfc5f('0x2f')]);var _0xb869e2={'method':_0xfc5f('0x37'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x213160[_0xfc5f('0x6b')]+_0xfc5f('0x6c'),'body':{'to':[_0x59b320[_0xfc5f('0x21')]],'text':_0x59b320[_0xfc5f('0xc')],'from':_0x213160['phone'],'applicationId':_0x213160['applicationId']},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0xef4f90)[_0xfc5f('0x46')](_0xfc5f('0x47')))},'json':!![]};rp(_0xb869e2)[_0xfc5f('0x17')](function(_0x129a1a){if(_0x129a1a['id']){var _0x56ef00={'messageId':_0x129a1a['id']};return _0x4f8e5e[_0xfc5f('0x27')](_0x56ef00);}else{logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x6a'),util[_0xfc5f('0x2a')](_0x129a1a,{'showHidden':![],'depth':null}));}})[_0xfc5f('0x19')](function(_0x191d3e){logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x6a'),util[_0xfc5f('0x2a')](_0x191d3e,{'showHidden':![],'depth':null}));});}else{logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x6a'),_0xfc5f('0x3d'));}break;case _0xfc5f('0x6d'):if(_0x213160[_0xfc5f('0x59')]){var _0x2988b5={};var _0x27deef={'method':_0xfc5f('0x37'),'uri':_0xfc5f('0x6e'),'headers':{'Authorization':_0xfc5f('0x6f')+_0x213160[_0xfc5f('0x59')],'Content-Type':_0xfc5f('0x55')},'body':{'from':_0x213160['phone'],'to':_0x59b320['phone'],'text':_0x59b320[_0xfc5f('0xc')]},'json':!![]};return rp(_0x27deef)[_0xfc5f('0x17')](function(_0x5ca9d6){if(_0x5ca9d6[_0xfc5f('0x70')]==0xca){_0x2988b5['message']=_0x5ca9d6;var _0x5e8bdb={'method':_0xfc5f('0x37'),'uri':_0xfc5f('0x71'),'headers':{'Authorization':_0xfc5f('0x6f')+_0x213160['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x2988b5[_0xfc5f('0x72')][_0xfc5f('0x73')]},'json':!![]};return rp(_0x5e8bdb)[_0xfc5f('0x17')](function(_0x374881){_0x2988b5['status']=_0x374881;var _0x2030fa={'messageId':_0x2988b5[_0xfc5f('0x72')]['refid'],'read':!![]};return _0x4f8e5e[_0xfc5f('0x27')](_0x2030fa);});}else{return logger['error'](_0xfc5f('0x28'),'afterCreate','intelepeer',util[_0xfc5f('0x2a')](_0x5ca9d6,{'showHidden':![],'depth':null}));}})[_0xfc5f('0x19')](function(_0x332cc8){return logger[_0xfc5f('0x1a')](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x6d'),util[_0xfc5f('0x2a')](_0x332cc8,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xfc5f('0x28'),_0xfc5f('0x29'),_0xfc5f('0x6d'),_0xfc5f('0x74'));}break;}}})[_0xfc5f('0x75')](function(){_0x5001b0();});}else{_0x5001b0();}}},'charset':_0xfc5f('0x76'),'collate':_0xfc5f('0x77')});};
\ No newline at end of file
+var _0x376a=['/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','username','password','smsMethod','sender','login?username=','&password=','GET','sms','session_key','total_sent','Missing\x20parameters:\x20username,\x20password','connectel','POST','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','read','inspect','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','plivo','senderString','token','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','sort','apiKey','createHash','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','rimraf','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','secret','isNil','UserId','SmsInteractionId','then','update','createdAt','catch','error','out','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/'];(function(_0x1862b4,_0x54aed3){var _0x371687=function(_0x4bd5ff){while(--_0x4bd5ff){_0x1862b4['push'](_0x1862b4['shift']());}};_0x371687(++_0x54aed3);}(_0x376a,0xcf));var _0xa376=function(_0x384c9f,_0x39ed3e){_0x384c9f=_0x384c9f-0x0;var _0x5ab9c1=_0x376a[_0x384c9f];return _0x5ab9c1;};'use strict';var _=require(_0xa376('0x0'));var util=require(_0xa376('0x1'));var logger=require(_0xa376('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa376('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa376('0x4'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0xa376('0x5')]=function(_0x41db08,_0x202971){return _0x41db08[_0xa376('0x6')](_0xa376('0x7'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xa376('0x8')]},{'name':_0xa376('0x9'),'fields':[_0xa376('0xa')],'type':_0xa376('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5cf7ed,_0x5d5afb,_0x4d4fcc){var _0x3e0997=_0x41db08[_0xa376('0xc')];var _0x1feadc=_0x5cf7ed[_0xa376('0xd')]({'plain':!![]});if(_0x1feadc['direction'][_0xa376('0xe')]()==='in'||_0x1feadc[_0xa376('0xf')][_0xa376('0xe')]()==='out'&&!_0x1feadc[_0xa376('0x10')]&&!_[_0xa376('0x11')](_0x1feadc[_0xa376('0x12')])&&!_[_0xa376('0x11')](_0x1feadc['SmsInteractionId'])){_0x3e0997['SmsInteraction']['findOne']({'where':{'id':_0x1feadc[_0xa376('0x13')]}})[_0xa376('0x14')](function(_0x4e870d){if(_0x4e870d){_0x4e870d[_0xa376('0x15')]({'lastMsgAt':_0x1feadc[_0xa376('0x16')],'lastMsgDirection':_0x1feadc[_0xa376('0xf')][_0xa376('0xe')]()});}})[_0xa376('0x17')](function(_0x277c2f){console[_0xa376('0x18')](_0x277c2f);});}if(_0x1feadc['direction']===_0xa376('0x19')&&!_0x1feadc[_0xa376('0x10')]){var _0x2c2a9b;_0x3e0997['SmsAccount'][_0xa376('0x1a')]({'where':{'id':_0x1feadc[_0xa376('0x1b')]},'raw':!![]})[_0xa376('0x14')](function(_0x282e1f){_0x2c2a9b=_0x282e1f;if(_0x2c2a9b&&_0x2c2a9b['type']){switch(_0x2c2a9b[_0xa376('0x1c')]){case'twilio':var _0x63ca36=require(_0xa376('0x1d'));if(_0x2c2a9b[_0xa376('0x1e')]&&_0x2c2a9b['authToken']&&_0x2c2a9b['phone']){var _0x148aa0=new _0x63ca36(_0x2c2a9b['accountSid'],_0x2c2a9b[_0xa376('0x1f')]);_0x148aa0[_0xa376('0x20')][_0xa376('0x21')]({'body':_0x1feadc[_0xa376('0xa')],'to':_0x1feadc[_0xa376('0x22')],'from':_0x2c2a9b[_0xa376('0x22')],'statusCallback':_0x2c2a9b[_0xa376('0x23')]+_0xa376('0x24')+_0x1feadc['id']+_0xa376('0x25')+_0x2c2a9b['token']})[_0xa376('0x14')](function(_0x4a69a3){if(_0x4a69a3[_0xa376('0x26')]){return _0x5cf7ed[_0xa376('0x15')]({'messageId':_0x4a69a3[_0xa376('0x26')]});}})[_0xa376('0x17')](function(_0x179031){logger[_0xa376('0x18')](_0xa376('0x27'),'afterCreate','twilio',util['inspect'](_0x179031,{'showHidden':![],'depth':null}));});}else{logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xa376('0x29'):var _0x1d2fe8='https://api.skebby.it/API/v1.0/REST/';if(_0x2c2a9b[_0xa376('0x2a')]&&_0x2c2a9b[_0xa376('0x2b')]){var _0x557fb9={'recipient':[_0x1feadc['phone']],'message':_0x1feadc[_0xa376('0xa')],'message_type':_0x2c2a9b['smsMethod']};if(_0x2c2a9b['smsMethod']&&_0x2c2a9b[_0xa376('0x2c')]!=='SI'){_0x557fb9[_0xa376('0x2d')]=_0x2c2a9b['phone'];}var _0x47ed8b={'url':_0x1d2fe8+_0xa376('0x2e')+_0x2c2a9b[_0xa376('0x2a')]+_0xa376('0x2f')+_0x2c2a9b[_0xa376('0x2b')],'method':_0xa376('0x30')};rp(_0x47ed8b)[_0xa376('0x14')](function(_0x54e55a){var _0x56c79f=_0x54e55a['split'](';');var _0x4c1a81={'user_key':_0x56c79f[0x0],'session_key':_0x56c79f[0x1]};_0x47ed8b={'url':_0x1d2fe8+_0xa376('0x31'),'method':'POST','headers':{'user_key':_0x4c1a81['user_key'],'Session_key':_0x4c1a81[_0xa376('0x32')]},'json':!![],'body':_0x557fb9};return rp(_0x47ed8b);})[_0xa376('0x14')](function(_0x490960){if(_0x490960[_0xa376('0x33')]>=0x1){var _0x526bd3={'messageId':_0x490960['internal_order_id']};if(_0x2c2a9b['smsMethod']!=='GP'||!_0x2c2a9b['deliveryReport']){_0x526bd3['read']=!![];}return _0x5cf7ed['update'](_0x526bd3);}else{return logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),'skebby',util['inspect'](_0x490960,{'showHidden':![],'depth':null}));}})[_0xa376('0x17')](function(_0x9933f6){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa376('0x28'),_0xa376('0x29'),util['inspect'](_0x9933f6,{'showHidden':![],'depth':null}));});}else{logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x29'),_0xa376('0x34'));}break;case _0xa376('0x35'):if(_0x2c2a9b[_0xa376('0x1f')]){var _0x2931e2={'recipient':_0x1feadc[_0xa376('0x22')],'message':_0x1feadc[_0xa376('0xa')],'sender':_0x2c2a9b['senderString']||_0x2c2a9b[_0xa376('0x22')],'authorization':_0x2c2a9b['authToken']};var _0x5d5afb={'method':_0xa376('0x36'),'uri':_0xa376('0x37'),'body':_0x2931e2,'json':!![]};rp(_0x5d5afb)[_0xa376('0x14')](function(_0x4431c8){var _0x16ea65={'messageId':_0x4431c8[_0xa376('0x38')]};if(!_0x2c2a9b[_0xa376('0x39')]){_0x16ea65[_0xa376('0x3a')]=!![];}return _0x5cf7ed[_0xa376('0x15')](_0x16ea65);})[_0xa376('0x17')](function(_0x22be43){logger[_0xa376('0x18')](_0xa376('0x27'),'afterCreate',_0xa376('0x35'),util[_0xa376('0x3b')](_0x22be43,{'showHidden':![],'depth':null}));});}else{logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x35'),'Missing\x20parameters:\x20authToken');}break;case _0xa376('0x3c'):if(_0x2c2a9b[_0xa376('0x2a')]&&_0x2c2a9b[_0xa376('0x2b')]){var _0x2931e2={'messages':[{'source':'xCALLY\x20Motion','to':_0x1feadc[_0xa376('0x22')],'body':_0x1feadc['body'],'from':_0x2c2a9b['senderString']||_0x2c2a9b[_0xa376('0x22')]}]};var _0x580450=util[_0xa376('0x3d')](_0xa376('0x3e'),_0x2c2a9b[_0xa376('0x2a')],_0x2c2a9b[_0xa376('0x2b')]);var _0x5d5afb={'method':'POST','uri':_0xa376('0x3f'),'body':_0x2931e2,'headers':{'Authorization':util[_0xa376('0x3d')](_0xa376('0x40'),new Buffer(_0x580450)[_0xa376('0x41')](_0xa376('0x42')))},'json':!![]};rp(_0x5d5afb)[_0xa376('0x14')](function(_0x39a2ef){if(_0x39a2ef[_0xa376('0x43')]>=0xc8&&_0x39a2ef[_0xa376('0x43')]<=0xce){if(_0x39a2ef[_0xa376('0x44')]&&_0x39a2ef[_0xa376('0x44')]['queued_count']>0x0){var _0xee4f03=_[_0xa376('0x45')](_0x39a2ef[_0xa376('0x44')][_0xa376('0x20')]);var _0x4f182f={'messageId':_0xee4f03[_0xa376('0x46')]};if(!_0x2c2a9b['deliveryReport']){_0x4f182f['read']=!![];}return _0x5cf7ed['update'](_0x4f182f);}else{logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x47'),util[_0xa376('0x3b')](_0x39a2ef,{'showHidden':![],'depth':null}));}}else{logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x47'),util['inspect'](_0x39a2ef,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1e494c){logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x47'),util[_0xa376('0x3b')](_0x1e494c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa376('0x27'),_0xa376('0x28'),'clickSend',_0xa376('0x34'));}break;case _0xa376('0x48'):if(_0x2c2a9b['authId']&&_0x2c2a9b[_0xa376('0x1f')]){var _0x2931e2={'dst':_0x1feadc[_0xa376('0x22')],'text':_0x1feadc[_0xa376('0xa')],'src':_0x2c2a9b[_0xa376('0x49')]||_0x2c2a9b['phone'],'url':_0x2c2a9b[_0xa376('0x23')]+'/api/sms/messages/'+_0x1feadc['id']+_0xa376('0x25')+_0x2c2a9b[_0xa376('0x4a')]};var _0x580450=util[_0xa376('0x3d')]('%s:%s',_0x2c2a9b[_0xa376('0x4b')],_0x2c2a9b[_0xa376('0x1f')]);var _0x5d5afb={'method':_0xa376('0x36'),'uri':util['format'](_0xa376('0x4c'),_0x2c2a9b['authId']),'body':_0x2931e2,'headers':{'Authorization':util[_0xa376('0x3d')](_0xa376('0x40'),new Buffer(_0x580450)[_0xa376('0x41')](_0xa376('0x42')))},'json':!![]};rp(_0x5d5afb)[_0xa376('0x14')](function(_0x24ebbb){var _0x3b37f8={'messageId':_0x24ebbb[_0xa376('0x4d')][0x0]};return _0x5cf7ed[_0xa376('0x15')](_0x3b37f8);})[_0xa376('0x17')](function(_0x4b741e){logger[_0xa376('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa376('0x48'),util[_0xa376('0x3b')](_0x4b741e,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa376('0x28'),_0xa376('0x48'),_0xa376('0x4e'));}break;case _0xa376('0x4f'):if(_0x2c2a9b['username']&&_0x2c2a9b[_0xa376('0x2b')]){if(_0x2c2a9b[_0xa376('0x50')]){var _0x3b6280={'method':'POST','uri':_0x2c2a9b[_0xa376('0x50')]+_0xa376('0x51'),'body':{'username':_0x2c2a9b[_0xa376('0x2a')],'password':_0x2c2a9b[_0xa376('0x2b')]},'json':!![]};return rp(_0x3b6280)[_0xa376('0x14')](function(_0x3912f1){var _0x5f1d46={'method':_0xa376('0x36'),'uri':_0x2c2a9b[_0xa376('0x50')]+_0xa376('0x52'),'body':{'messages':[{'from':_0x2c2a9b[_0xa376('0x22')],'destinations':[{'to':_0x1feadc[_0xa376('0x22')]}],'text':_0x1feadc[_0xa376('0xa')],'notifyUrl':_0x2c2a9b[_0xa376('0x23')]+_0xa376('0x24')+_0x1feadc['id']+_0xa376('0x25')+_0x2c2a9b[_0xa376('0x4a')],'notifyContentType':_0xa376('0x53'),'callbackData':_0x2c2a9b[_0xa376('0x22')]+';'+_0x1feadc[_0xa376('0xa')]}]},'headers':{'Authorization':_0xa376('0x54')+_0x3912f1[_0xa376('0x4a')]},'json':!![]};return rp(_0x5f1d46)['then'](function(_0x5eff1f){if(_0x5eff1f[_0xa376('0x20')]){var _0x50d807={'messageId':_0x5eff1f[_0xa376('0x20')][0x0][_0xa376('0x8')]};if(!_0x2c2a9b['deliveryReport']){_0x50d807[_0xa376('0x3a')]=!![];}return _0x5cf7ed[_0xa376('0x15')](_0x50d807);}else{return logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),'infobip',util['inspect'](_0x5eff1f,{'showHidden':![],'depth':null}));}});})[_0xa376('0x17')](function(_0x18ba71){return logger['error'](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x4f'),util['inspect'](_0x18ba71,{'showHidden':![],'depth':null}));});}else{logger[_0xa376('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa376('0x28'),_0xa376('0x4f'),_0xa376('0x55'));}}else{logger[_0xa376('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa376('0x28'),_0xa376('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xa376('0x56'):var _0x4ab15b=require(_0xa376('0x57'));if(_0x2c2a9b['apiKey']){var _0x57200a={};_0x57200a[_0xa376('0x58')]=_0x2c2a9b[_0xa376('0x2a')];_0x57200a[_0xa376('0x22')]=_0x1feadc['phone'];_0x57200a[_0xa376('0x2d')]=_0x2c2a9b['phone'];_0x57200a[_0xa376('0x59')]=_0x1feadc['body'];_0x57200a[_0xa376('0x5a')]=+new Date();var _0x5c073c='';var _0x196177='';var _0x3a8227=Object['keys'](_0x57200a);_0x3a8227[_0xa376('0x5b')]();for(var _0x35c736=0x0;_0x35c736<_0x3a8227['length'];_0x35c736++){if(_0x5c073c!=''){_0x5c073c+='&';}_0x5c073c+=_0x3a8227[_0x35c736]+'='+encodeURIComponent(_0x57200a[_0x3a8227[_0x35c736]]);_0x196177+=_0x57200a[_0x3a8227[_0x35c736]];}_0x196177+=_0x2c2a9b[_0xa376('0x5c')];_0x196177=_0x4ab15b[_0xa376('0x5d')](_0xa376('0x5e'))[_0xa376('0x15')](_0x196177)[_0xa376('0x5f')](_0xa376('0x60'));if(_0x5c073c!==''){_0x5c073c+='&';}_0x5c073c+=_0xa376('0x61')+_0x196177;var _0x47ed8b={'method':'GET','uri':_0x2c2a9b[_0xa376('0x50')]+_0xa376('0x62')+_0x5c073c,'json':!![]};return rp(_0x47ed8b)['then'](function(_0x4dfc3d){var _0x588d20=Object[_0xa376('0x63')](_0x4dfc3d);if(_0x4dfc3d[_0x588d20[0x0]][_0xa376('0x18')]&&parseInt(_0x4dfc3d[_0x588d20[0x0]][_0xa376('0x18')])===0x0){var _0x1e059b={'messageId':_0x4dfc3d[_0x588d20[0x0]][_0xa376('0x64')]};if(!_0x2c2a9b[_0xa376('0x39')]){_0x1e059b['read']=!![];}return _0x5cf7ed[_0xa376('0x15')](_0x1e059b);}else{return logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x56'),util[_0xa376('0x3b')](_0x4dfc3d['error'],{'showHidden':![],'depth':null}));}})[_0xa376('0x17')](function(_0x523081){return logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x56'),util[_0xa376('0x3b')](_0x523081,{'showHidden':![],'depth':null}));});}else{logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x56'),_0xa376('0x65'));}break;case _0xa376('0x66'):if(_0x2c2a9b[_0xa376('0x5c')]){var _0x4b06de={'method':_0xa376('0x36'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x2c2a9b[_0xa376('0x5c')]},'body':{'content':_0x1feadc['body'],'to':[_0x1feadc[_0xa376('0x22')]],'from':_0x2c2a9b[_0xa376('0x22')],'binary':![],'clientMessageId':_0xa376('0x67'),'charset':_0xa376('0x68')},'json':!![]};rp(_0x4b06de)[_0xa376('0x14')](function(_0x409054){if(!_0x409054[_0xa376('0x18')]){var _0x375903={'messageId':_0x409054[_0xa376('0x20')][0x0][_0xa376('0x69')]};if(!_0x2c2a9b[_0xa376('0x39')]){_0x375903['read']=!![];}return _0x5cf7ed[_0xa376('0x15')](_0x375903);}else{return logger[_0xa376('0x18')](_0xa376('0x27'),'afterCreate',_0xa376('0x66'),util[_0xa376('0x3b')](_0x409054['error'],{'showHidden':![],'depth':null}));}})[_0xa376('0x17')](function(_0x4ff940){return logger[_0xa376('0x18')](_0xa376('0x27'),'afterCreate',_0xa376('0x66'),util[_0xa376('0x3b')](_0x4ff940,{'showHidden':![],'depth':null}));});}else{logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),'clickatell',_0xa376('0x65'));}break;case'bandwidth':if(_0x2c2a9b[_0xa376('0x2a')]&&_0x2c2a9b[_0xa376('0x2b')]){var _0x580450=util[_0xa376('0x3d')](_0xa376('0x3e'),_0x2c2a9b[_0xa376('0x2a')],_0x2c2a9b[_0xa376('0x2b')]);var _0x5d5afb={'method':'POST','uri':_0xa376('0x6a')+_0x2c2a9b[_0xa376('0x6b')]+_0xa376('0x6c'),'body':{'to':[_0x1feadc['phone']],'text':_0x1feadc[_0xa376('0xa')],'from':_0x2c2a9b[_0xa376('0x22')],'applicationId':_0x2c2a9b['applicationId']},'headers':{'Authorization':util['format'](_0xa376('0x40'),new Buffer(_0x580450)[_0xa376('0x41')]('base64'))},'json':!![]};rp(_0x5d5afb)['then'](function(_0x2fe80f){if(_0x2fe80f['id']){var _0x12432e={'messageId':_0x2fe80f['id']};return _0x5cf7ed[_0xa376('0x15')](_0x12432e);}else{logger[_0xa376('0x18')](_0xa376('0x27'),'afterCreate',_0xa376('0x6d'),util['inspect'](_0x2fe80f,{'showHidden':![],'depth':null}));}})[_0xa376('0x17')](function(_0x3c2721){logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x6d'),util[_0xa376('0x3b')](_0x3c2721,{'showHidden':![],'depth':null}));});}else{logger[_0xa376('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa376('0x28'),'bandwidth',_0xa376('0x34'));}break;case'intelepeer':if(_0x2c2a9b[_0xa376('0x5c')]){var _0x496ab7={};var _0x47ed8b={'method':_0xa376('0x36'),'uri':_0xa376('0x6e'),'headers':{'Authorization':_0xa376('0x6f')+_0x2c2a9b[_0xa376('0x5c')],'Content-Type':'application/json'},'body':{'from':_0x2c2a9b[_0xa376('0x22')],'to':_0x1feadc[_0xa376('0x22')],'text':_0x1feadc['body']},'json':!![]};return rp(_0x47ed8b)[_0xa376('0x14')](function(_0x3d724c){if(_0x3d724c[_0xa376('0x70')]==0xca){_0x496ab7[_0xa376('0x71')]=_0x3d724c;var _0x1ae696={'method':_0xa376('0x36'),'uri':_0xa376('0x72'),'headers':{'Authorization':_0xa376('0x6f')+_0x2c2a9b[_0xa376('0x5c')],'Content-Type':_0xa376('0x53')},'body':{'refid':_0x496ab7[_0xa376('0x71')][_0xa376('0x73')]},'json':!![]};return rp(_0x1ae696)[_0xa376('0x14')](function(_0x325880){_0x496ab7[_0xa376('0x74')]=_0x325880;var _0x19101d={'messageId':_0x496ab7[_0xa376('0x71')][_0xa376('0x73')],'read':!![]};return _0x5cf7ed[_0xa376('0x15')](_0x19101d);});}else{return logger[_0xa376('0x18')](_0xa376('0x27'),_0xa376('0x28'),'intelepeer',util[_0xa376('0x3b')](_0x3d724c,{'showHidden':![],'depth':null}));}})[_0xa376('0x17')](function(_0x20c5f7){return logger['error'](_0xa376('0x27'),_0xa376('0x28'),'intelepeer',util[_0xa376('0x3b')](_0x20c5f7,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xa376('0x27'),_0xa376('0x28'),_0xa376('0x75'),_0xa376('0x76'));}break;}}})[_0xa376('0x77')](function(){_0x4d4fcc();});}else{_0x4d4fcc();}}},'charset':_0xa376('0x78'),'collate':_0xa376('0x79')});};
\ No newline at end of file