Built motion from commit f7863d46.|2.5.41
[motion2.git] / server / api / smsMessage / smsMessage.model.js
index c24e4e3..469d2c1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbac2=['out','secret','UserId','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','phone','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','&password=','password','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','catch','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','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','message_id','clickSend','plivo','authId','remote','/api/sms/messages/','/status?token=','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','crypto','apiKey','login','text','timestamp','keys','sort','createHash','md5','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','bandwidth','accountId','/messages','applicationId','intelepeer','Bearer\x20','code','message','refid','status','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbac2,0x67));var _0x2bac=function(_0x4664db,_0x1de672){_0x4664db=_0x4664db-0x0;var _0x5615b4=_0xbac2[_0x4664db];return _0x5615b4;};'use strict';var _=require(_0x2bac('0x0'));var util=require(_0x2bac('0x1'));var logger=require(_0x2bac('0x2'))(_0x2bac('0x3'));var moment=require(_0x2bac('0x4'));var BPromise=require(_0x2bac('0x5'));var rp=require(_0x2bac('0x6'));var fs=require('fs');var path=require(_0x2bac('0x7'));var rimraf=require(_0x2bac('0x8'));var config=require(_0x2bac('0x9'));var attributes=require(_0x2bac('0xa'));module[_0x2bac('0xb')]=function(_0x5af138,_0x4a1c2e){return _0x5af138[_0x2bac('0xc')](_0x2bac('0xd'),attributes,{'tableName':_0x2bac('0xe'),'paranoid':![],'indexes':[{'name':_0x2bac('0xf'),'fields':['messageId']},{'name':_0x2bac('0x10'),'fields':[_0x2bac('0x11')],'type':_0x2bac('0x12')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c8fca,_0x1e3cc7,_0x4ef652){var _0x2b7b51=_0x5af138[_0x2bac('0x13')];var _0x2372b1=_0x2c8fca[_0x2bac('0x14')]({'plain':!![]});if(_0x2372b1[_0x2bac('0x15')]['toLowerCase']()==='in'||_0x2372b1[_0x2bac('0x15')][_0x2bac('0x16')]()===_0x2bac('0x17')&&!_0x2372b1[_0x2bac('0x18')]&&!_['isNil'](_0x2372b1[_0x2bac('0x19')])&&!_[_0x2bac('0x1a')](_0x2372b1['SmsInteractionId'])){_0x2b7b51[_0x2bac('0x1b')][_0x2bac('0x1c')]({'where':{'id':_0x2372b1[_0x2bac('0x1d')]}})[_0x2bac('0x1e')](function(_0x4661b){if(_0x4661b){_0x4661b[_0x2bac('0x1f')]({'lastMsgAt':_0x2372b1[_0x2bac('0x20')],'lastMsgDirection':_0x2372b1['direction'][_0x2bac('0x16')]()});}})['catch'](function(_0x1deb49){console[_0x2bac('0x21')](_0x1deb49);});}if(_0x2372b1[_0x2bac('0x15')]===_0x2bac('0x17')&&!_0x2372b1[_0x2bac('0x18')]){var _0x16ae03;_0x2b7b51[_0x2bac('0x22')][_0x2bac('0x23')]({'where':{'id':_0x2372b1[_0x2bac('0x24')]},'raw':!![]})[_0x2bac('0x1e')](function(_0x31578c){_0x16ae03=_0x31578c;if(_0x16ae03&&_0x16ae03[_0x2bac('0x25')]){switch(_0x16ae03[_0x2bac('0x25')]){case _0x2bac('0x26'):var _0x464754=require(_0x2bac('0x26'));if(_0x16ae03[_0x2bac('0x27')]&&_0x16ae03['authToken']&&_0x16ae03['phone']){var _0x8d0d28=new _0x464754(_0x16ae03[_0x2bac('0x27')],_0x16ae03[_0x2bac('0x28')]);_0x8d0d28[_0x2bac('0x29')]['create']({'body':_0x2372b1[_0x2bac('0x11')],'to':_0x2372b1['phone'],'from':_0x16ae03[_0x2bac('0x2a')],'statusCallback':_0x16ae03['remote']+'/api/sms/messages/'+_0x2372b1['id']+'/status?token='+_0x16ae03[_0x2bac('0x2b')]})['then'](function(_0x5c664e){if(_0x5c664e[_0x2bac('0x2c')]){return _0x2c8fca[_0x2bac('0x1f')]({'messageId':_0x5c664e[_0x2bac('0x2c')]});}})['catch'](function(_0x396b40){logger['error'](_0x2bac('0x2d'),'afterCreate','twilio',util[_0x2bac('0x2e')](_0x396b40,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2bac('0x2f'),'twilio',_0x2bac('0x30'));}break;case _0x2bac('0x31'):var _0x22856d=_0x2bac('0x32');if(_0x16ae03[_0x2bac('0x33')]&&_0x16ae03['password']){var _0x56e888={'recipient':[_0x2372b1[_0x2bac('0x2a')]],'message':_0x2372b1['body'],'message_type':_0x16ae03['smsMethod']};if(_0x16ae03[_0x2bac('0x34')]&&_0x16ae03[_0x2bac('0x34')]!=='SI'){_0x56e888[_0x2bac('0x35')]=_0x16ae03['phone'];}var _0x3c5d42={'url':_0x22856d+'login?username='+_0x16ae03[_0x2bac('0x33')]+_0x2bac('0x36')+_0x16ae03[_0x2bac('0x37')],'method':_0x2bac('0x38')};rp(_0x3c5d42)['then'](function(_0x45c0e9){var _0x373503=_0x45c0e9[_0x2bac('0x39')](';');var _0x33f217={'user_key':_0x373503[0x0],'session_key':_0x373503[0x1]};_0x3c5d42={'url':_0x22856d+_0x2bac('0x3a'),'method':_0x2bac('0x3b'),'headers':{'user_key':_0x33f217[_0x2bac('0x3c')],'Session_key':_0x33f217[_0x2bac('0x3d')]},'json':!![],'body':_0x56e888};return rp(_0x3c5d42);})['then'](function(_0x4b124f){if(_0x4b124f[_0x2bac('0x3e')]>=0x1){var _0x405dff={'messageId':_0x4b124f[_0x2bac('0x3f')]};if(_0x16ae03[_0x2bac('0x34')]!=='GP'||!_0x16ae03[_0x2bac('0x40')]){_0x405dff[_0x2bac('0x41')]=!![];}return _0x2c8fca[_0x2bac('0x1f')](_0x405dff);}else{return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x31'),util['inspect'](_0x4b124f,{'showHidden':![],'depth':null}));}})[_0x2bac('0x42')](function(_0x17adb6){return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),'skebby',util['inspect'](_0x17adb6,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate','skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x2bac('0x43'):if(_0x16ae03['authToken']){var _0x1a79cc={'recipient':_0x2372b1[_0x2bac('0x2a')],'message':_0x2372b1[_0x2bac('0x11')],'sender':_0x16ae03[_0x2bac('0x44')]||_0x16ae03[_0x2bac('0x2a')],'authorization':_0x16ae03[_0x2bac('0x28')]};var _0x1e3cc7={'method':_0x2bac('0x3b'),'uri':_0x2bac('0x45'),'body':_0x1a79cc,'json':!![]};rp(_0x1e3cc7)[_0x2bac('0x1e')](function(_0x2d6864){var _0x38e49e={'messageId':_0x2d6864[_0x2bac('0x46')]};if(!_0x16ae03[_0x2bac('0x40')]){_0x38e49e[_0x2bac('0x41')]=!![];}return _0x2c8fca['update'](_0x38e49e);})[_0x2bac('0x42')](function(_0x4fabaf){logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x43'),util[_0x2bac('0x2e')](_0x4fabaf,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate','connectel',_0x2bac('0x47'));}break;case'clicksend':if(_0x16ae03['username']&&_0x16ae03[_0x2bac('0x37')]){var _0x1a79cc={'messages':[{'source':_0x2bac('0x48'),'to':_0x2372b1['phone'],'body':_0x2372b1[_0x2bac('0x11')],'from':_0x16ae03[_0x2bac('0x44')]||_0x16ae03[_0x2bac('0x2a')]}]};var _0x4d3c61=util[_0x2bac('0x49')](_0x2bac('0x4a'),_0x16ae03[_0x2bac('0x33')],_0x16ae03[_0x2bac('0x37')]);var _0x1e3cc7={'method':_0x2bac('0x3b'),'uri':_0x2bac('0x4b'),'body':_0x1a79cc,'headers':{'Authorization':util[_0x2bac('0x49')](_0x2bac('0x4c'),new Buffer(_0x4d3c61)[_0x2bac('0x4d')](_0x2bac('0x4e')))},'json':!![]};rp(_0x1e3cc7)['then'](function(_0x357d30){if(_0x357d30[_0x2bac('0x4f')]>=0xc8&&_0x357d30[_0x2bac('0x4f')]<=0xce){if(_0x357d30[_0x2bac('0x50')]&&_0x357d30[_0x2bac('0x50')][_0x2bac('0x51')]>0x0){var _0x1ae0a6=_['head'](_0x357d30['data'][_0x2bac('0x29')]);var _0x2bdb0d={'messageId':_0x1ae0a6[_0x2bac('0x52')]};if(!_0x16ae03['deliveryReport']){_0x2bdb0d['read']=!![];}return _0x2c8fca[_0x2bac('0x1f')](_0x2bdb0d);}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x53'),util[_0x2bac('0x2e')](_0x357d30,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x2bac('0x2d'),_0x2bac('0x2f'),'clickSend',util['inspect'](_0x357d30,{'showHidden':![],'depth':null}));}})[_0x2bac('0x42')](function(_0x653213){logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate',_0x2bac('0x53'),util[_0x2bac('0x2e')](_0x653213,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x53'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x2bac('0x54'):if(_0x16ae03[_0x2bac('0x55')]&&_0x16ae03[_0x2bac('0x28')]){var _0x1a79cc={'dst':_0x2372b1[_0x2bac('0x2a')],'text':_0x2372b1[_0x2bac('0x11')],'src':_0x16ae03[_0x2bac('0x44')]||_0x16ae03[_0x2bac('0x2a')],'url':_0x16ae03[_0x2bac('0x56')]+_0x2bac('0x57')+_0x2372b1['id']+_0x2bac('0x58')+_0x16ae03[_0x2bac('0x2b')]};var _0x4d3c61=util[_0x2bac('0x49')](_0x2bac('0x4a'),_0x16ae03[_0x2bac('0x55')],_0x16ae03['authToken']);var _0x1e3cc7={'method':'POST','uri':util[_0x2bac('0x49')]('https://api.plivo.com/v1/Account/%s/Message/',_0x16ae03[_0x2bac('0x55')]),'body':_0x1a79cc,'headers':{'Authorization':util[_0x2bac('0x49')](_0x2bac('0x4c'),new Buffer(_0x4d3c61)[_0x2bac('0x4d')](_0x2bac('0x4e')))},'json':!![]};rp(_0x1e3cc7)['then'](function(_0x5948b4){var _0xd6d770={'messageId':_0x5948b4['message_uuid'][0x0]};return _0x2c8fca[_0x2bac('0x1f')](_0xd6d770);})[_0x2bac('0x42')](function(_0x5d170d){logger[_0x2bac('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2bac('0x2f'),_0x2bac('0x54'),util[_0x2bac('0x2e')](_0x5d170d,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate',_0x2bac('0x54'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x2bac('0x59'):if(_0x16ae03[_0x2bac('0x33')]&&_0x16ae03['password']){if(_0x16ae03[_0x2bac('0x5a')]){var _0x4a0d49={'method':'POST','uri':_0x16ae03['baseUrl']+_0x2bac('0x5b'),'body':{'username':_0x16ae03['username'],'password':_0x16ae03[_0x2bac('0x37')]},'json':!![]};return rp(_0x4a0d49)['then'](function(_0x4a7f8c){var _0x8d5561={'method':_0x2bac('0x3b'),'uri':_0x16ae03[_0x2bac('0x5a')]+_0x2bac('0x5c'),'body':{'messages':[{'from':_0x16ae03['phone'],'destinations':[{'to':_0x2372b1[_0x2bac('0x2a')]}],'text':_0x2372b1[_0x2bac('0x11')],'notifyUrl':_0x16ae03[_0x2bac('0x56')]+_0x2bac('0x57')+_0x2372b1['id']+'/status?token='+_0x16ae03[_0x2bac('0x2b')],'notifyContentType':_0x2bac('0x5d'),'callbackData':_0x16ae03['phone']+';'+_0x2372b1[_0x2bac('0x11')]}]},'headers':{'Authorization':_0x2bac('0x5e')+_0x4a7f8c[_0x2bac('0x2b')]},'json':!![]};return rp(_0x8d5561)[_0x2bac('0x1e')](function(_0x4cd197){if(_0x4cd197['messages']){var _0x39ff0b={'messageId':_0x4cd197[_0x2bac('0x29')][0x0][_0x2bac('0xf')]};if(!_0x16ae03[_0x2bac('0x40')]){_0x39ff0b['read']=!![];}return _0x2c8fca[_0x2bac('0x1f')](_0x39ff0b);}else{return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x59'),util[_0x2bac('0x2e')](_0x4cd197,{'showHidden':![],'depth':null}));}});})[_0x2bac('0x42')](function(_0x7fef72){return logger[_0x2bac('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0x2bac('0x2e')](_0x7fef72,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x59'),_0x2bac('0x5f'));}}else{logger[_0x2bac('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2bac('0x59'),_0x2bac('0x60'));}break;case _0x2bac('0x61'):var _0x2e060b=require(_0x2bac('0x62'));if(_0x16ae03[_0x2bac('0x63')]){var _0x5576f2={};_0x5576f2[_0x2bac('0x64')]=_0x16ae03[_0x2bac('0x33')];_0x5576f2[_0x2bac('0x2a')]=_0x2372b1[_0x2bac('0x2a')];_0x5576f2[_0x2bac('0x35')]=_0x16ae03['phone'];_0x5576f2[_0x2bac('0x65')]=_0x2372b1[_0x2bac('0x11')];_0x5576f2[_0x2bac('0x66')]=+new Date();var _0x2160f2='';var _0x282412='';var _0x498bb6=Object[_0x2bac('0x67')](_0x5576f2);_0x498bb6[_0x2bac('0x68')]();for(var _0x837352=0x0;_0x837352<_0x498bb6['length'];_0x837352++){if(_0x2160f2!=''){_0x2160f2+='&';}_0x2160f2+=_0x498bb6[_0x837352]+'='+encodeURIComponent(_0x5576f2[_0x498bb6[_0x837352]]);_0x282412+=_0x5576f2[_0x498bb6[_0x837352]];}_0x282412+=_0x16ae03['apiKey'];_0x282412=_0x2e060b[_0x2bac('0x69')](_0x2bac('0x6a'))['update'](_0x282412)[_0x2bac('0x6b')](_0x2bac('0x6c'));if(_0x2160f2!==''){_0x2160f2+='&';}_0x2160f2+=_0x2bac('0x6d')+_0x282412;var _0x3c5d42={'method':_0x2bac('0x38'),'uri':_0x16ae03[_0x2bac('0x5a')]+_0x2bac('0x6e')+_0x2160f2,'json':!![]};return rp(_0x3c5d42)[_0x2bac('0x1e')](function(_0x45ff17){var _0x4027a2=Object[_0x2bac('0x67')](_0x45ff17);if(_0x45ff17[_0x4027a2[0x0]][_0x2bac('0x21')]&&parseInt(_0x45ff17[_0x4027a2[0x0]][_0x2bac('0x21')])===0x0){var _0x25f8fa={'messageId':_0x45ff17[_0x4027a2[0x0]]['id_sms']};if(!_0x16ae03[_0x2bac('0x40')]){_0x25f8fa[_0x2bac('0x41')]=!![];}return _0x2c8fca[_0x2bac('0x1f')](_0x25f8fa);}else{return logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate',_0x2bac('0x61'),util[_0x2bac('0x2e')](_0x45ff17['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0xf2e6a2){return logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate',_0x2bac('0x61'),util[_0x2bac('0x2e')](_0xf2e6a2,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate',_0x2bac('0x61'),_0x2bac('0x6f'));}break;case _0x2bac('0x70'):if(_0x16ae03[_0x2bac('0x63')]){var _0x4b21a7={'method':_0x2bac('0x3b'),'uri':_0x2bac('0x71'),'headers':{'Authorization':_0x16ae03[_0x2bac('0x63')]},'body':{'content':_0x2372b1[_0x2bac('0x11')],'to':[_0x2372b1[_0x2bac('0x2a')]],'from':_0x16ae03[_0x2bac('0x2a')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x4b21a7)[_0x2bac('0x1e')](function(_0x2a490d){if(!_0x2a490d[_0x2bac('0x21')]){var _0x3992d2={'messageId':_0x2a490d[_0x2bac('0x29')][0x0]['apiMessageId']};if(!_0x16ae03['deliveryReport']){_0x3992d2['read']=!![];}return _0x2c8fca[_0x2bac('0x1f')](_0x3992d2);}else{return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x70'),util[_0x2bac('0x2e')](_0x2a490d[_0x2bac('0x21')],{'showHidden':![],'depth':null}));}})[_0x2bac('0x42')](function(_0x443dd9){return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x70'),util[_0x2bac('0x2e')](_0x443dd9,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),'clickatell',_0x2bac('0x6f'));}break;case _0x2bac('0x72'):if(_0x16ae03[_0x2bac('0x33')]&&_0x16ae03['password']){var _0x4d3c61=util[_0x2bac('0x49')](_0x2bac('0x4a'),_0x16ae03[_0x2bac('0x33')],_0x16ae03['password']);var _0x1e3cc7={'method':_0x2bac('0x3b'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x16ae03[_0x2bac('0x73')]+_0x2bac('0x74'),'body':{'to':[_0x2372b1[_0x2bac('0x2a')]],'text':_0x2372b1[_0x2bac('0x11')],'from':_0x16ae03['phone'],'applicationId':_0x16ae03[_0x2bac('0x75')]},'headers':{'Authorization':util['format'](_0x2bac('0x4c'),new Buffer(_0x4d3c61)[_0x2bac('0x4d')](_0x2bac('0x4e')))},'json':!![]};rp(_0x1e3cc7)[_0x2bac('0x1e')](function(_0x39df22){if(_0x39df22['id']){var _0x38a211={'messageId':_0x39df22['id']};return _0x2c8fca['update'](_0x38a211);}else{logger[_0x2bac('0x21')](_0x2bac('0x2d'),'afterCreate',_0x2bac('0x72'),util['inspect'](_0x39df22,{'showHidden':![],'depth':null}));}})['catch'](function(_0x21d903){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util[_0x2bac('0x2e')](_0x21d903,{'showHidden':![],'depth':null}));});}else{logger[_0x2bac('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2bac('0x2f'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x2bac('0x76'):if(_0x16ae03[_0x2bac('0x63')]){var _0x26bdef={};var _0x3c5d42={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x2bac('0x77')+_0x16ae03[_0x2bac('0x63')],'Content-Type':_0x2bac('0x5d')},'body':{'from':_0x16ae03[_0x2bac('0x2a')],'to':_0x2372b1['phone'],'text':_0x2372b1[_0x2bac('0x11')]},'json':!![]};return rp(_0x3c5d42)[_0x2bac('0x1e')](function(_0x55b55d){if(_0x55b55d[_0x2bac('0x78')]==0xca){_0x26bdef[_0x2bac('0x79')]=_0x55b55d;var _0x1c9198={'method':_0x2bac('0x3b'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x16ae03[_0x2bac('0x63')],'Content-Type':'application/json'},'body':{'refid':_0x26bdef[_0x2bac('0x79')][_0x2bac('0x7a')]},'json':!![]};return rp(_0x1c9198)[_0x2bac('0x1e')](function(_0x131c09){_0x26bdef[_0x2bac('0x7b')]=_0x131c09;var _0x4a0c8d={'messageId':_0x26bdef[_0x2bac('0x79')][_0x2bac('0x7a')],'read':!![]};return _0x2c8fca['update'](_0x4a0c8d);});}else{return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x76'),util[_0x2bac('0x2e')](_0x55b55d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x18f559){return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),_0x2bac('0x76'),util[_0x2bac('0x2e')](_0x18f559,{'showHidden':![],'depth':null}));});}else{return logger[_0x2bac('0x21')](_0x2bac('0x2d'),_0x2bac('0x2f'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x2bac('0x7c')](function(){_0x4ef652();});}else{_0x4ef652();}}},'charset':'utf8mb4','collate':_0x2bac('0x7d')});};
\ No newline at end of file
+var _0xbb34=['update','createdAt','error','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','sid','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','login?username=','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','catch','connectel','requestid','Missing\x20parameters:\x20authToken','clicksend','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','token','authId','https://api.plivo.com/v1/Account/%s/Message/','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','infobip','Missing\x20parameters:\x20base_url','apiKey','login','sender','text','keys','length','createHash','md5','hex','signature=','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','messageId','fti_sms_messages','body','get','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then'];(function(_0x5354fe,_0x4dc0eb){var _0x444088=function(_0x5a9af4){while(--_0x5a9af4){_0x5354fe['push'](_0x5354fe['shift']());}};_0x444088(++_0x4dc0eb);}(_0xbb34,0x14a));var _0x4bb3=function(_0x37ae2e,_0x35be3a){_0x37ae2e=_0x37ae2e-0x0;var _0x19c50f=_0xbb34[_0x37ae2e];return _0x19c50f;};'use strict';var _=require(_0x4bb3('0x0'));var util=require(_0x4bb3('0x1'));var logger=require(_0x4bb3('0x2'))(_0x4bb3('0x3'));var moment=require(_0x4bb3('0x4'));var BPromise=require(_0x4bb3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4bb3('0x6'));var config=require(_0x4bb3('0x7'));var attributes=require(_0x4bb3('0x8'));module['exports']=function(_0xfde869,_0x236ae4){return _0xfde869[_0x4bb3('0x9')](_0x4bb3('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x4bb3('0xb'),'fields':[_0x4bb3('0xb')]},{'name':_0x4bb3('0xc'),'fields':[_0x4bb3('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47caf4,_0x30a193,_0x2dd92b){var _0x908f13=_0xfde869['models'];var _0x16e22d=_0x47caf4[_0x4bb3('0xe')]({'plain':!![]});if(_0x16e22d[_0x4bb3('0xf')][_0x4bb3('0x10')]()==='in'||_0x16e22d[_0x4bb3('0xf')]['toLowerCase']()==='out'&&!_0x16e22d[_0x4bb3('0x11')]&&!_[_0x4bb3('0x12')](_0x16e22d[_0x4bb3('0x13')])&&!_[_0x4bb3('0x12')](_0x16e22d[_0x4bb3('0x14')])){_0x908f13[_0x4bb3('0x15')][_0x4bb3('0x16')]({'where':{'id':_0x16e22d[_0x4bb3('0x14')]}})[_0x4bb3('0x17')](function(_0x3e7849){if(_0x3e7849){_0x3e7849[_0x4bb3('0x18')]({'lastMsgAt':_0x16e22d[_0x4bb3('0x19')],'lastMsgDirection':_0x16e22d[_0x4bb3('0xf')][_0x4bb3('0x10')]()});}})['catch'](function(_0x16715d){console[_0x4bb3('0x1a')](_0x16715d);});}if(_0x16e22d['direction']==='out'&&!_0x16e22d[_0x4bb3('0x11')]){var _0x4cbb8f;_0x908f13['SmsAccount']['find']({'where':{'id':_0x16e22d[_0x4bb3('0x1b')]},'raw':!![]})[_0x4bb3('0x17')](function(_0x4d1434){_0x4cbb8f=_0x4d1434;if(_0x4cbb8f&&_0x4cbb8f[_0x4bb3('0x1c')]){switch(_0x4cbb8f['type']){case _0x4bb3('0x1d'):var _0x11a33d=require(_0x4bb3('0x1d'));if(_0x4cbb8f[_0x4bb3('0x1e')]&&_0x4cbb8f[_0x4bb3('0x1f')]&&_0x4cbb8f[_0x4bb3('0x20')]){var _0x28b079=new _0x11a33d(_0x4cbb8f[_0x4bb3('0x1e')],_0x4cbb8f['authToken']);_0x28b079[_0x4bb3('0x21')]['create']({'body':_0x16e22d['body'],'to':_0x16e22d[_0x4bb3('0x20')],'from':_0x4cbb8f[_0x4bb3('0x20')],'statusCallback':_0x4cbb8f[_0x4bb3('0x22')]+_0x4bb3('0x23')+_0x16e22d['id']+_0x4bb3('0x24')+_0x4cbb8f['token']})[_0x4bb3('0x17')](function(_0x5d8682){if(_0x5d8682[_0x4bb3('0x25')]){return _0x47caf4[_0x4bb3('0x18')]({'messageId':_0x5d8682['sid']});}})['catch'](function(_0xdb7706){logger['error'](_0x4bb3('0x26'),_0x4bb3('0x27'),'twilio',util[_0x4bb3('0x28')](_0xdb7706,{'showHidden':![],'depth':null}));});}else{logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),'twilio',_0x4bb3('0x29'));}break;case _0x4bb3('0x2a'):var _0x105332=_0x4bb3('0x2b');if(_0x4cbb8f[_0x4bb3('0x2c')]&&_0x4cbb8f[_0x4bb3('0x2d')]){var _0x3bdacf={'recipient':[_0x16e22d[_0x4bb3('0x20')]],'message':_0x16e22d[_0x4bb3('0xd')],'message_type':_0x4cbb8f[_0x4bb3('0x2e')]};if(_0x4cbb8f['smsMethod']&&_0x4cbb8f[_0x4bb3('0x2e')]!=='SI'){_0x3bdacf['sender']=_0x4cbb8f[_0x4bb3('0x20')];}var _0x117115={'url':_0x105332+_0x4bb3('0x2f')+_0x4cbb8f['username']+'&password='+_0x4cbb8f['password'],'method':_0x4bb3('0x30')};rp(_0x117115)[_0x4bb3('0x17')](function(_0x476f22){var _0xb8c3a8=_0x476f22[_0x4bb3('0x31')](';');var _0x34f621={'user_key':_0xb8c3a8[0x0],'session_key':_0xb8c3a8[0x1]};_0x117115={'url':_0x105332+_0x4bb3('0x32'),'method':_0x4bb3('0x33'),'headers':{'user_key':_0x34f621[_0x4bb3('0x34')],'Session_key':_0x34f621[_0x4bb3('0x35')]},'json':!![],'body':_0x3bdacf};return rp(_0x117115);})['then'](function(_0x2c7f58){if(_0x2c7f58[_0x4bb3('0x36')]>=0x1){var _0x456da3={'messageId':_0x2c7f58['internal_order_id']};if(_0x4cbb8f['smsMethod']!=='GP'||!_0x4cbb8f[_0x4bb3('0x37')]){_0x456da3[_0x4bb3('0x38')]=!![];}return _0x47caf4[_0x4bb3('0x18')](_0x456da3);}else{return logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x2a'),util[_0x4bb3('0x28')](_0x2c7f58,{'showHidden':![],'depth':null}));}})[_0x4bb3('0x39')](function(_0x3ab3ec){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4bb3('0x27'),_0x4bb3('0x2a'),util[_0x4bb3('0x28')](_0x3ab3ec,{'showHidden':![],'depth':null}));});}else{logger[_0x4bb3('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4bb3('0x27'),_0x4bb3('0x2a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x4bb3('0x3a'):if(_0x4cbb8f[_0x4bb3('0x1f')]){var _0x2f4ab1={'recipient':_0x16e22d[_0x4bb3('0x20')],'message':_0x16e22d[_0x4bb3('0xd')],'sender':_0x4cbb8f['senderString']||_0x4cbb8f[_0x4bb3('0x20')],'authorization':_0x4cbb8f['authToken']};var _0x30a193={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x2f4ab1,'json':!![]};rp(_0x30a193)[_0x4bb3('0x17')](function(_0x1722a4){var _0x4b6063={'messageId':_0x1722a4[_0x4bb3('0x3b')]};if(!_0x4cbb8f[_0x4bb3('0x37')]){_0x4b6063[_0x4bb3('0x38')]=!![];}return _0x47caf4[_0x4bb3('0x18')](_0x4b6063);})[_0x4bb3('0x39')](function(_0xef55a5){logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),'afterCreate',_0x4bb3('0x3a'),util['inspect'](_0xef55a5,{'showHidden':![],'depth':null}));});}else{logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x3a'),_0x4bb3('0x3c'));}break;case _0x4bb3('0x3d'):if(_0x4cbb8f['username']&&_0x4cbb8f[_0x4bb3('0x2d')]){var _0x2f4ab1={'messages':[{'source':'xCALLY\x20Motion','to':_0x16e22d['phone'],'body':_0x16e22d['body'],'from':_0x4cbb8f[_0x4bb3('0x3e')]||_0x4cbb8f['phone']}]};var _0x3206da=util[_0x4bb3('0x3f')](_0x4bb3('0x40'),_0x4cbb8f[_0x4bb3('0x2c')],_0x4cbb8f['password']);var _0x30a193={'method':_0x4bb3('0x33'),'uri':_0x4bb3('0x41'),'body':_0x2f4ab1,'headers':{'Authorization':util[_0x4bb3('0x3f')](_0x4bb3('0x42'),new Buffer(_0x3206da)[_0x4bb3('0x43')](_0x4bb3('0x44')))},'json':!![]};rp(_0x30a193)[_0x4bb3('0x17')](function(_0xecba2d){if(_0xecba2d[_0x4bb3('0x45')]>=0xc8&&_0xecba2d[_0x4bb3('0x45')]<=0xce){if(_0xecba2d[_0x4bb3('0x46')]&&_0xecba2d[_0x4bb3('0x46')]['queued_count']>0x0){var _0x1bbf7b=_[_0x4bb3('0x47')](_0xecba2d['data']['messages']);var _0xe4a141={'messageId':_0x1bbf7b[_0x4bb3('0x48')]};if(!_0x4cbb8f[_0x4bb3('0x37')]){_0xe4a141[_0x4bb3('0x38')]=!![];}return _0x47caf4[_0x4bb3('0x18')](_0xe4a141);}else{logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),'clickSend',util[_0x4bb3('0x28')](_0xecba2d,{'showHidden':![],'depth':null}));}}else{logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x49'),util['inspect'](_0xecba2d,{'showHidden':![],'depth':null}));}})[_0x4bb3('0x39')](function(_0xb92e81){logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),'afterCreate',_0x4bb3('0x49'),util[_0x4bb3('0x28')](_0xb92e81,{'showHidden':![],'depth':null}));});}else{logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x49'),_0x4bb3('0x4a'));}break;case'plivo':if(_0x4cbb8f['authId']&&_0x4cbb8f[_0x4bb3('0x1f')]){var _0x2f4ab1={'dst':_0x16e22d[_0x4bb3('0x20')],'text':_0x16e22d[_0x4bb3('0xd')],'src':_0x4cbb8f[_0x4bb3('0x3e')]||_0x4cbb8f[_0x4bb3('0x20')],'url':_0x4cbb8f[_0x4bb3('0x22')]+_0x4bb3('0x23')+_0x16e22d['id']+_0x4bb3('0x24')+_0x4cbb8f[_0x4bb3('0x4b')]};var _0x3206da=util[_0x4bb3('0x3f')](_0x4bb3('0x40'),_0x4cbb8f[_0x4bb3('0x4c')],_0x4cbb8f[_0x4bb3('0x1f')]);var _0x30a193={'method':_0x4bb3('0x33'),'uri':util[_0x4bb3('0x3f')](_0x4bb3('0x4d'),_0x4cbb8f['authId']),'body':_0x2f4ab1,'headers':{'Authorization':util[_0x4bb3('0x3f')](_0x4bb3('0x42'),new Buffer(_0x3206da)[_0x4bb3('0x43')](_0x4bb3('0x44')))},'json':!![]};rp(_0x30a193)[_0x4bb3('0x17')](function(_0x52ea59){var _0x35764d={'messageId':_0x52ea59['message_uuid'][0x0]};return _0x47caf4['update'](_0x35764d);})['catch'](function(_0x46c8ac){logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),'afterCreate',_0x4bb3('0x4e'),util[_0x4bb3('0x28')](_0x46c8ac,{'showHidden':![],'depth':null}));});}else{logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x4e'),_0x4bb3('0x4f'));}break;case'infobip':if(_0x4cbb8f[_0x4bb3('0x2c')]&&_0x4cbb8f[_0x4bb3('0x2d')]){if(_0x4cbb8f[_0x4bb3('0x50')]){var _0x4c7256={'method':_0x4bb3('0x33'),'uri':_0x4cbb8f[_0x4bb3('0x50')]+_0x4bb3('0x51'),'body':{'username':_0x4cbb8f['username'],'password':_0x4cbb8f['password']},'json':!![]};return rp(_0x4c7256)[_0x4bb3('0x17')](function(_0x200339){var _0x98d6d9={'method':_0x4bb3('0x33'),'uri':_0x4cbb8f[_0x4bb3('0x50')]+_0x4bb3('0x52'),'body':{'messages':[{'from':_0x4cbb8f[_0x4bb3('0x20')],'destinations':[{'to':_0x16e22d[_0x4bb3('0x20')]}],'text':_0x16e22d[_0x4bb3('0xd')],'notifyUrl':_0x4cbb8f['remote']+'/api/sms/messages/'+_0x16e22d['id']+_0x4bb3('0x24')+_0x4cbb8f[_0x4bb3('0x4b')],'notifyContentType':_0x4bb3('0x53'),'callbackData':_0x4cbb8f[_0x4bb3('0x20')]+';'+_0x16e22d[_0x4bb3('0xd')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x200339[_0x4bb3('0x4b')]},'json':!![]};return rp(_0x98d6d9)[_0x4bb3('0x17')](function(_0x1701f2){if(_0x1701f2[_0x4bb3('0x21')]){var _0x8f31a8={'messageId':_0x1701f2[_0x4bb3('0x21')][0x0][_0x4bb3('0xb')]};if(!_0x4cbb8f[_0x4bb3('0x37')]){_0x8f31a8[_0x4bb3('0x38')]=!![];}return _0x47caf4['update'](_0x8f31a8);}else{return logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x54'),util[_0x4bb3('0x28')](_0x1701f2,{'showHidden':![],'depth':null}));}});})[_0x4bb3('0x39')](function(_0x300b71){return logger['error'](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x54'),util[_0x4bb3('0x28')](_0x300b71,{'showHidden':![],'depth':null}));});}else{logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x54'),_0x4bb3('0x55'));}}else{logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x54'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x327503=require('crypto');if(_0x4cbb8f[_0x4bb3('0x56')]){var _0x34e775={};_0x34e775[_0x4bb3('0x57')]=_0x4cbb8f[_0x4bb3('0x2c')];_0x34e775['phone']=_0x16e22d['phone'];_0x34e775[_0x4bb3('0x58')]=_0x4cbb8f[_0x4bb3('0x20')];_0x34e775[_0x4bb3('0x59')]=_0x16e22d[_0x4bb3('0xd')];_0x34e775['timestamp']=+new Date();var _0x57ec59='';var _0x48d336='';var _0x582fd3=Object[_0x4bb3('0x5a')](_0x34e775);_0x582fd3['sort']();for(var _0xdaf21f=0x0;_0xdaf21f<_0x582fd3[_0x4bb3('0x5b')];_0xdaf21f++){if(_0x57ec59!=''){_0x57ec59+='&';}_0x57ec59+=_0x582fd3[_0xdaf21f]+'='+encodeURIComponent(_0x34e775[_0x582fd3[_0xdaf21f]]);_0x48d336+=_0x34e775[_0x582fd3[_0xdaf21f]];}_0x48d336+=_0x4cbb8f[_0x4bb3('0x56')];_0x48d336=_0x327503[_0x4bb3('0x5c')](_0x4bb3('0x5d'))[_0x4bb3('0x18')](_0x48d336)['digest'](_0x4bb3('0x5e'));if(_0x57ec59!==''){_0x57ec59+='&';}_0x57ec59+=_0x4bb3('0x5f')+_0x48d336;var _0x117115={'method':'GET','uri':_0x4cbb8f[_0x4bb3('0x50')]+'/external/get/send.php?'+_0x57ec59,'json':!![]};return rp(_0x117115)[_0x4bb3('0x17')](function(_0x35e446){var _0x555e6a=Object[_0x4bb3('0x5a')](_0x35e446);if(_0x35e446[_0x555e6a[0x0]]['error']&&parseInt(_0x35e446[_0x555e6a[0x0]][_0x4bb3('0x1a')])===0x0){var _0x3c1562={'messageId':_0x35e446[_0x555e6a[0x0]]['id_sms']};if(!_0x4cbb8f[_0x4bb3('0x37')]){_0x3c1562[_0x4bb3('0x38')]=!![];}return _0x47caf4[_0x4bb3('0x18')](_0x3c1562);}else{return logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x60'),util[_0x4bb3('0x28')](_0x35e446[_0x4bb3('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x42dd44){return logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),'afterCreate',_0x4bb3('0x60'),util[_0x4bb3('0x28')](_0x42dd44,{'showHidden':![],'depth':null}));});}else{logger[_0x4bb3('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4bb3('0x60'),_0x4bb3('0x61'));}break;case _0x4bb3('0x62'):if(_0x4cbb8f[_0x4bb3('0x56')]){var _0x3eb3fd={'method':_0x4bb3('0x33'),'uri':_0x4bb3('0x63'),'headers':{'Authorization':_0x4cbb8f[_0x4bb3('0x56')]},'body':{'content':_0x16e22d[_0x4bb3('0xd')],'to':[_0x16e22d[_0x4bb3('0x20')]],'from':_0x4cbb8f['phone'],'binary':![],'clientMessageId':_0x4bb3('0x64'),'charset':'UTF-8'},'json':!![]};rp(_0x3eb3fd)['then'](function(_0x3eba9e){if(!_0x3eba9e[_0x4bb3('0x1a')]){var _0x4bf213={'messageId':_0x3eba9e[_0x4bb3('0x21')][0x0][_0x4bb3('0x65')]};if(!_0x4cbb8f['deliveryReport']){_0x4bf213[_0x4bb3('0x38')]=!![];}return _0x47caf4[_0x4bb3('0x18')](_0x4bf213);}else{return logger['error'](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x62'),util[_0x4bb3('0x28')](_0x3eba9e['error'],{'showHidden':![],'depth':null}));}})[_0x4bb3('0x39')](function(_0x5f03bc){return logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),'clickatell',util['inspect'](_0x5f03bc,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x4bb3('0x66'):if(_0x4cbb8f['username']&&_0x4cbb8f['password']){var _0x3206da=util['format'](_0x4bb3('0x40'),_0x4cbb8f[_0x4bb3('0x2c')],_0x4cbb8f[_0x4bb3('0x2d')]);var _0x30a193={'method':_0x4bb3('0x33'),'uri':_0x4bb3('0x67')+_0x4cbb8f[_0x4bb3('0x68')]+_0x4bb3('0x69'),'body':{'to':[_0x16e22d[_0x4bb3('0x20')]],'text':_0x16e22d[_0x4bb3('0xd')],'from':_0x4cbb8f[_0x4bb3('0x20')],'applicationId':_0x4cbb8f[_0x4bb3('0x6a')]},'headers':{'Authorization':util['format'](_0x4bb3('0x42'),new Buffer(_0x3206da)[_0x4bb3('0x43')](_0x4bb3('0x44')))},'json':!![]};rp(_0x30a193)['then'](function(_0x1ac917){if(_0x1ac917['id']){var _0x1649ff={'messageId':_0x1ac917['id']};return _0x47caf4[_0x4bb3('0x18')](_0x1649ff);}else{logger['error'](_0x4bb3('0x26'),'afterCreate',_0x4bb3('0x66'),util[_0x4bb3('0x28')](_0x1ac917,{'showHidden':![],'depth':null}));}})[_0x4bb3('0x39')](function(_0x11c2bb){logger['error'](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x66'),util[_0x4bb3('0x28')](_0x11c2bb,{'showHidden':![],'depth':null}));});}else{logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x66'),_0x4bb3('0x4a'));}break;case _0x4bb3('0x6b'):if(_0x4cbb8f[_0x4bb3('0x56')]){var _0x2a4ff2={};var _0x117115={'method':_0x4bb3('0x33'),'uri':_0x4bb3('0x6c'),'headers':{'Authorization':_0x4bb3('0x6d')+_0x4cbb8f[_0x4bb3('0x56')],'Content-Type':_0x4bb3('0x53')},'body':{'from':_0x4cbb8f[_0x4bb3('0x20')],'to':_0x16e22d[_0x4bb3('0x20')],'text':_0x16e22d[_0x4bb3('0xd')]},'json':!![]};return rp(_0x117115)[_0x4bb3('0x17')](function(_0x380f22){if(_0x380f22[_0x4bb3('0x6e')]==0xca){_0x2a4ff2['message']=_0x380f22;var _0x1cde75={'method':_0x4bb3('0x33'),'uri':_0x4bb3('0x6f'),'headers':{'Authorization':_0x4bb3('0x6d')+_0x4cbb8f['apiKey'],'Content-Type':_0x4bb3('0x53')},'body':{'refid':_0x2a4ff2[_0x4bb3('0x70')]['refid']},'json':!![]};return rp(_0x1cde75)[_0x4bb3('0x17')](function(_0x5afa1c){_0x2a4ff2[_0x4bb3('0x71')]=_0x5afa1c;var _0x3813ae={'messageId':_0x2a4ff2[_0x4bb3('0x70')]['refid'],'read':!![]};return _0x47caf4[_0x4bb3('0x18')](_0x3813ae);});}else{return logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x6b'),util['inspect'](_0x380f22,{'showHidden':![],'depth':null}));}})[_0x4bb3('0x39')](function(_0x29ff4d){return logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x6b'),util[_0x4bb3('0x28')](_0x29ff4d,{'showHidden':![],'depth':null}));});}else{return logger[_0x4bb3('0x1a')](_0x4bb3('0x26'),_0x4bb3('0x27'),_0x4bb3('0x6b'),_0x4bb3('0x72'));}break;}}})[_0x4bb3('0x73')](function(){_0x2dd92b();});}else{_0x2dd92b();}}},'charset':_0x4bb3('0x74'),'collate':_0x4bb3('0x75')});};
\ No newline at end of file