fb4765103202504d96f06f4b89cabfcf50e3d632
[motion2.git] / server / api / smsMessage / smsMessage.model.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 _0xc22f=['%s:%s','toString','http_code','data','queued_count','head','clickSend','remote','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','infobip','apiKey','login','timestamp','sort','createHash','md5','digest','signature=','GET','keys','id_sms','csc','Missing\x20parameters:\x20apiKey','uuid','UTF-8','apiMessageId','clickatell','https://messaging.bandwidth.com/api/v2/users/','/messages','bandwidth','intelepeer','Bearer\x20','message','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','SmsInteraction','SmsInteractionId','then','update','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','password','smsMethod','sender','login?username=','username','sms','POST','user_key','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','xCALLY\x20Motion','format'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc22f,0x183));var _0xfc22=function(_0x340151,_0x3f1b6d){_0x340151=_0x340151-0x0;var _0x28c336=_0xc22f[_0x340151];return _0x28c336;};'use strict';var _=require(_0xfc22('0x0'));var util=require(_0xfc22('0x1'));var logger=require(_0xfc22('0x2'))(_0xfc22('0x3'));var moment=require('moment');var BPromise=require(_0xfc22('0x4'));var rp=require(_0xfc22('0x5'));var fs=require('fs');var path=require(_0xfc22('0x6'));var rimraf=require(_0xfc22('0x7'));var config=require(_0xfc22('0x8'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0xbb472b,_0x1b6f09){return _0xbb472b[_0xfc22('0x9')](_0xfc22('0xa'),attributes,{'tableName':_0xfc22('0xb'),'paranoid':![],'indexes':[{'name':_0xfc22('0xc'),'fields':[_0xfc22('0xc')]},{'name':_0xfc22('0xd'),'fields':['body'],'type':_0xfc22('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24a3ae,_0x44c985,_0x575d42){var _0x16ee36=_0xbb472b[_0xfc22('0xf')];var _0x2532ce=_0x24a3ae[_0xfc22('0x10')]({'plain':!![]});if(_0x2532ce[_0xfc22('0x11')][_0xfc22('0x12')]()==='in'||_0x2532ce[_0xfc22('0x11')]['toLowerCase']()===_0xfc22('0x13')&&!_0x2532ce[_0xfc22('0x14')]&&!_['isNil'](_0x2532ce[_0xfc22('0x15')])&&!_['isNil'](_0x2532ce['SmsInteractionId'])){_0x16ee36[_0xfc22('0x16')]['findOne']({'where':{'id':_0x2532ce[_0xfc22('0x17')]}})[_0xfc22('0x18')](function(_0x3f2fd9){if(_0x3f2fd9){_0x3f2fd9[_0xfc22('0x19')]({'lastMsgAt':_0x2532ce['createdAt'],'lastMsgDirection':_0x2532ce[_0xfc22('0x11')][_0xfc22('0x12')]()});}})['catch'](function(_0x42c2fe){console['error'](_0x42c2fe);});}if(_0x2532ce[_0xfc22('0x11')]===_0xfc22('0x13')&&!_0x2532ce[_0xfc22('0x14')]){var _0x271d1b;_0x16ee36[_0xfc22('0x1a')]['find']({'where':{'id':_0x2532ce[_0xfc22('0x1b')]},'raw':!![]})['then'](function(_0x2bec13){_0x271d1b=_0x2bec13;if(_0x271d1b&&_0x271d1b[_0xfc22('0x1c')]){switch(_0x271d1b['type']){case _0xfc22('0x1d'):var _0x4f5a8c=require(_0xfc22('0x1d'));if(_0x271d1b[_0xfc22('0x1e')]&&_0x271d1b[_0xfc22('0x1f')]&&_0x271d1b[_0xfc22('0x20')]){var _0xd22ba6=new _0x4f5a8c(_0x271d1b[_0xfc22('0x1e')],_0x271d1b['authToken']);_0xd22ba6[_0xfc22('0x21')][_0xfc22('0x22')]({'body':_0x2532ce[_0xfc22('0x23')],'to':_0x2532ce[_0xfc22('0x20')],'from':_0x271d1b[_0xfc22('0x20')],'statusCallback':_0x271d1b['remote']+_0xfc22('0x24')+_0x2532ce['id']+_0xfc22('0x25')+_0x271d1b[_0xfc22('0x26')]})[_0xfc22('0x18')](function(_0x2c4fb5){if(_0x2c4fb5[_0xfc22('0x27')]){return _0x24a3ae[_0xfc22('0x19')]({'messageId':_0x2c4fb5[_0xfc22('0x27')]});}})[_0xfc22('0x28')](function(_0x2b8eb6){logger['error'](_0xfc22('0x29'),_0xfc22('0x2a'),_0xfc22('0x1d'),util[_0xfc22('0x2b')](_0x2b8eb6,{'showHidden':![],'depth':null}));});}else{logger[_0xfc22('0x2c')](_0xfc22('0x29'),_0xfc22('0x2a'),_0xfc22('0x1d'),_0xfc22('0x2d'));}break;case'skebby':var _0x20f20b='https://api.skebby.it/API/v1.0/REST/';if(_0x271d1b['username']&&_0x271d1b[_0xfc22('0x2e')]){var _0x5c2695={'recipient':[_0x2532ce[_0xfc22('0x20')]],'message':_0x2532ce[_0xfc22('0x23')],'message_type':_0x271d1b[_0xfc22('0x2f')]};if(_0x271d1b['smsMethod']&&_0x271d1b[_0xfc22('0x2f')]!=='SI'){_0x5c2695[_0xfc22('0x30')]=_0x271d1b['phone'];}var _0x1bab2d={'url':_0x20f20b+_0xfc22('0x31')+_0x271d1b[_0xfc22('0x32')]+'&password='+_0x271d1b[_0xfc22('0x2e')],'method':'GET'};rp(_0x1bab2d)[_0xfc22('0x18')](function(_0x2f67dc){var _0x3c3804=_0x2f67dc['split'](';');var _0x1fd9b1={'user_key':_0x3c3804[0x0],'session_key':_0x3c3804[0x1]};_0x1bab2d={'url':_0x20f20b+_0xfc22('0x33'),'method':_0xfc22('0x34'),'headers':{'user_key':_0x1fd9b1[_0xfc22('0x35')],'Session_key':_0x1fd9b1['session_key']},'json':!![],'body':_0x5c2695};return rp(_0x1bab2d);})['then'](function(_0x2a8cf3){if(_0x2a8cf3['total_sent']>=0x1){var _0x1261f4={'messageId':_0x2a8cf3[_0xfc22('0x36')]};if(_0x271d1b[_0xfc22('0x2f')]!=='GP'||!_0x271d1b[_0xfc22('0x37')]){_0x1261f4[_0xfc22('0x38')]=!![];}return _0x24a3ae[_0xfc22('0x19')](_0x1261f4);}else{return logger['error'](_0xfc22('0x29'),_0xfc22('0x2a'),'skebby',util[_0xfc22('0x2b')](_0x2a8cf3,{'showHidden':![],'depth':null}));}})[_0xfc22('0x28')](function(_0x5b4dd8){return logger[_0xfc22('0x2c')](_0xfc22('0x29'),_0xfc22('0x2a'),_0xfc22('0x39'),util[_0xfc22('0x2b')](_0x5b4dd8,{'showHidden':![],'depth':null}));});}else{logger[_0xfc22('0x2c')](_0xfc22('0x29'),_0xfc22('0x2a'),_0xfc22('0x39'),_0xfc22('0x3a'));}break;case _0xfc22('0x3b'):if(_0x271d1b[_0xfc22('0x1f')]){var _0x236cfc={'recipient':_0x2532ce[_0xfc22('0x20')],'message':_0x2532ce[_0xfc22('0x23')],'sender':_0x271d1b[_0xfc22('0x3c')]||_0x271d1b[_0xfc22('0x20')],'authorization':_0x271d1b[_0xfc22('0x1f')]};var _0x44c985={'method':_0xfc22('0x34'),'uri':_0xfc22('0x3d'),'body':_0x236cfc,'json':!![]};rp(_0x44c985)['then'](function(_0x3a2e1a){var _0x5dc4e8={'messageId':_0x3a2e1a[_0xfc22('0x3e')]};if(!_0x271d1b['deliveryReport']){_0x5dc4e8[_0xfc22('0x38')]=!![];}return _0x24a3ae[_0xfc22('0x19')](_0x5dc4e8);})['catch'](function(_0x230e7a){logger[_0xfc22('0x2c')](_0xfc22('0x29'),'afterCreate',_0xfc22('0x3b'),util[_0xfc22('0x2b')](_0x230e7a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfc22('0x29'),_0xfc22('0x2a'),'connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x271d1b[_0xfc22('0x32')]&&_0x271d1b[_0xfc22('0x2e')]){var _0x236cfc={'messages':[{'source':_0xfc22('0x3f'),'to':_0x2532ce[_0xfc22('0x20')],'body':_0x2532ce[_0xfc22('0x23')],'from':_0x271d1b[_0xfc22('0x3c')]||_0x271d1b[_0xfc22('0x20')]}]};var _0x240927=util[_0xfc22('0x40')](_0xfc22('0x41'),_0x271d1b[_0xfc22('0x32')],_0x271d1b[_0xfc22('0x2e')]);var _0x44c985={'method':_0xfc22('0x34'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x236cfc,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x240927)[_0xfc22('0x42')]('base64'))},'json':!![]};rp(_0x44c985)[_0xfc22('0x18')](function(_0x4911a){if(_0x4911a[_0xfc22('0x43')]>=0xc8&&_0x4911a[_0xfc22('0x43')]<=0xce){if(_0x4911a[_0xfc22('0x44')]&&_0x4911a[_0xfc22('0x44')][_0xfc22('0x45')]>0x0){var _0x1bdb95=_[_0xfc22('0x46')](_0x4911a['data'][_0xfc22('0x21')]);var _0x1e244d={'messageId':_0x1bdb95['message_id']};if(!_0x271d1b[_0xfc22('0x37')]){_0x1e244d['read']=!![];}return _0x24a3ae['update'](_0x1e244d);}else{logger[_0xfc22('0x2c')](_0xfc22('0x29'),_0xfc22('0x2a'),_0xfc22('0x47'),util['inspect'](_0x4911a,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfc22('0x2a'),'clickSend',util['inspect'](_0x4911a,{'showHidden':![],'depth':null}));}})[_0xfc22('0x28')](function(_0xcbbc16){logger[_0xfc22('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfc22('0x2a'),_0xfc22('0x47'),util['inspect'](_0xcbbc16,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfc22('0x29'),_0xfc22('0x2a'),_0xfc22('0x47'),_0xfc22('0x3a'));}break;case'plivo':if(_0x271d1b['authId']&&_0x271d1b[_0xfc22('0x1f')]){var _0x236cfc={'dst':_0x2532ce[_0xfc22('0x20')],'text':_0x2532ce[_0xfc22('0x23')],'src':_0x271d1b['senderString']||_0x271d1b['phone'],'url':_0x271d1b[_0xfc22('0x48')]+_0xfc22('0x24')+_0x2532ce['id']+_0xfc22('0x25')+_0x271d1b['token']};var _0x240927=util[_0xfc22('0x40')](_0xfc22('0x41'),_0x271d1b[_0xfc22('0x49')],_0x271d1b[_0xfc22('0x1f')]);var _0x44c985={'method':_0xfc22('0x34'),'uri':util[_0xfc22('0x40')](_0xfc22('0x4a'),_0x271d1b[_0xfc22('0x49')]),'body':_0x236cfc,'headers':{'Authorization':util[_0xfc22('0x40')](_0xfc22('0x4b'),new Buffer(_0x240927)[_0xfc22('0x42')](_0xfc22('0x4c')))},'json':!![]};rp(_0x44c985)[_0xfc22('0x18')](function(_0x20fd63){var _0x10a219={'messageId':_0x20fd63[_0xfc22('0x4d')][0x0]};return _0x24a3ae[_0xfc22('0x19')](_0x10a219);})[_0xfc22('0x28')](function(_0xdc9895){logger[_0xfc22('0x2c')](_0xfc22('0x29'),_0xfc22('0x2a'),'plivo',util[_0xfc22('0x2b')](_0xdc9895,{'showHidden':![],'depth':null}));});}else{logger[_0xfc22('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfc22('0x4e'),_0xfc22('0x4f'));}break;case'infobip':if(_0x271d1b[_0xfc22('0x32')]&&_0x271d1b[_0xfc22('0x2e')]){if(_0x271d1b['baseUrl']){var _0x49d033={'method':_0xfc22('0x34'),'uri':_0x271d1b[_0xfc22('0x50')]+_0xfc22('0x51'),'body':{'username':_0x271d1b[_0xfc22('0x32')],'password':_0x271d1b[_0xfc22('0x2e')]},'json':!![]};return rp(_0x49d033)[_0xfc22('0x18')](function(_0x1a7c36){var _0x510fdd={'method':_0xfc22('0x34'),'uri':_0x271d1b[_0xfc22('0x50')]+_0xfc22('0x52'),'body':{'messages':[{'from':_0x271d1b['phone'],'destinations':[{'to':_0x2532ce[_0xfc22('0x20')]}],'text':_0x2532ce[_0xfc22('0x23')],'notifyUrl':_0x271d1b[_0xfc22('0x48')]+_0xfc22('0x24')+_0x2532ce['id']+_0xfc22('0x25')+_0x271d1b[_0xfc22('0x26')],'notifyContentType':_0xfc22('0x53'),'callbackData':_0x271d1b['phone']+';'+_0x2532ce[_0xfc22('0x23')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x1a7c36[_0xfc22('0x26')]},'json':!![]};return rp(_0x510fdd)['then'](function(_0x10ee6e){if(_0x10ee6e[_0xfc22('0x21')]){var _0x14a242={'messageId':_0x10ee6e[_0xfc22('0x21')][0x0]['messageId']};if(!_0x271d1b['deliveryReport']){_0x14a242[_0xfc22('0x38')]=!![];}return _0x24a3ae[_0xfc22('0x19')](_0x14a242);}else{return logger['error'](_0xfc22('0x29'),_0xfc22('0x2a'),_0xfc22('0x54'),util[_0xfc22('0x2b')](_0x10ee6e,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x379c8f){return logger[_0xfc22('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfc22('0x2a'),_0xfc22('0x54'),util[_0xfc22('0x2b')](_0x379c8f,{'showHidden':![],'depth':null}));});}else{logger[_0xfc22('0x2c')](_0xfc22('0x29'),'afterCreate',_0xfc22('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xfc22('0x2c')](_0xfc22('0x29'),_0xfc22('0x2a'),_0xfc22('0x54'),_0xfc22('0x3a'));}break;case'csc':var _0xbd4d7a=require('crypto');if(_0x271d1b[_0xfc22('0x55')]){var _0x4b2b74={};_0x4b2b74[_0xfc22('0x56')]=_0x271d1b['username'];_0x4b2b74['phone']=_0x2532ce[_0xfc22('0x20')];_0x4b2b74[_0xfc22('0x30')]=_0x271d1b[_0xfc22('0x20')];_0x4b2b74['text']=_0x2532ce[_0xfc22('0x23')];_0x4b2b74[_0xfc22('0x57')]=+new Date();var _0x2dcaf6='';var _0x1cca11='';var _0x466f05=Object['keys'](_0x4b2b74);_0x466f05[_0xfc22('0x58')]();for(var _0x423031=0x0;_0x423031<_0x466f05['length'];_0x423031++){if(_0x2dcaf6!=''){_0x2dcaf6+='&';}_0x2dcaf6+=_0x466f05[_0x423031]+'='+encodeURIComponent(_0x4b2b74[_0x466f05[_0x423031]]);_0x1cca11+=_0x4b2b74[_0x466f05[_0x423031]];}_0x1cca11+=_0x271d1b[_0xfc22('0x55')];_0x1cca11=_0xbd4d7a[_0xfc22('0x59')](_0xfc22('0x5a'))['update'](_0x1cca11)[_0xfc22('0x5b')]('hex');if(_0x2dcaf6!==''){_0x2dcaf6+='&';}_0x2dcaf6+=_0xfc22('0x5c')+_0x1cca11;var _0x1bab2d={'method':_0xfc22('0x5d'),'uri':_0x271d1b['baseUrl']+'/external/get/send.php?'+_0x2dcaf6,'json':!![]};return rp(_0x1bab2d)['then'](function(_0x18a641){var _0x9799c4=Object[_0xfc22('0x5e')](_0x18a641);if(_0x18a641[_0x9799c4[0x0]][_0xfc22('0x2c')]&&parseInt(_0x18a641[_0x9799c4[0x0]][_0xfc22('0x2c')])===0x0){var _0x4421e2={'messageId':_0x18a641[_0x9799c4[0x0]][_0xfc22('0x5f')]};if(!_0x271d1b[_0xfc22('0x37')]){_0x4421e2[_0xfc22('0x38')]=!![];}return _0x24a3ae['update'](_0x4421e2);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfc22('0x60'),util[_0xfc22('0x2b')](_0x18a641[_0xfc22('0x2c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x158ff8){return logger[_0xfc22('0x2c')](_0xfc22('0x29'),_0xfc22('0x2a'),_0xfc22('0x60'),util[_0xfc22('0x2b')](_0x158ff8,{'showHidden':![],'depth':null}));});}else{logger[_0xfc22('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfc22('0x2a'),_0xfc22('0x60'),_0xfc22('0x61'));}break;case'clickatell':if(_0x271d1b[_0xfc22('0x55')]){var _0x10e18b={'method':_0xfc22('0x34'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x271d1b['apiKey']},'body':{'content':_0x2532ce[_0xfc22('0x23')],'to':[_0x2532ce['phone']],'from':_0x271d1b[_0xfc22('0x20')],'binary':![],'clientMessageId':_0xfc22('0x62'),'charset':_0xfc22('0x63')},'json':!![]};rp(_0x10e18b)['then'](function(_0x360a33){if(!_0x360a33['error']){var _0xe8746d={'messageId':_0x360a33[_0xfc22('0x21')][0x0][_0xfc22('0x64')]};if(!_0x271d1b[_0xfc22('0x37')]){_0xe8746d[_0xfc22('0x38')]=!![];}return _0x24a3ae[_0xfc22('0x19')](_0xe8746d);}else{return logger[_0xfc22('0x2c')](_0xfc22('0x29'),'afterCreate',_0xfc22('0x65'),util[_0xfc22('0x2b')](_0x360a33[_0xfc22('0x2c')],{'showHidden':![],'depth':null}));}})[_0xfc22('0x28')](function(_0x1489e5){return logger[_0xfc22('0x2c')](_0xfc22('0x29'),_0xfc22('0x2a'),_0xfc22('0x65'),util[_0xfc22('0x2b')](_0x1489e5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfc22('0x29'),_0xfc22('0x2a'),_0xfc22('0x65'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x271d1b[_0xfc22('0x32')]&&_0x271d1b['password']){var _0x240927=util[_0xfc22('0x40')](_0xfc22('0x41'),_0x271d1b['username'],_0x271d1b[_0xfc22('0x2e')]);var _0x44c985={'method':_0xfc22('0x34'),'uri':_0xfc22('0x66')+_0x271d1b['accountId']+_0xfc22('0x67'),'body':{'to':[_0x2532ce[_0xfc22('0x20')]],'text':_0x2532ce[_0xfc22('0x23')],'from':_0x271d1b[_0xfc22('0x20')],'applicationId':_0x271d1b['applicationId']},'headers':{'Authorization':util[_0xfc22('0x40')](_0xfc22('0x4b'),new Buffer(_0x240927)[_0xfc22('0x42')]('base64'))},'json':!![]};rp(_0x44c985)[_0xfc22('0x18')](function(_0x4200dc){if(_0x4200dc['id']){var _0x1a41a6={'messageId':_0x4200dc['id']};return _0x24a3ae[_0xfc22('0x19')](_0x1a41a6);}else{logger[_0xfc22('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfc22('0x2a'),'bandwidth',util[_0xfc22('0x2b')](_0x4200dc,{'showHidden':![],'depth':null}));}})[_0xfc22('0x28')](function(_0x2db74c){logger[_0xfc22('0x2c')](_0xfc22('0x29'),'afterCreate',_0xfc22('0x68'),util[_0xfc22('0x2b')](_0x2db74c,{'showHidden':![],'depth':null}));});}else{logger[_0xfc22('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfc22('0x2a'),_0xfc22('0x68'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xfc22('0x69'):if(_0x271d1b[_0xfc22('0x55')]){var _0x42bf04={};var _0x1bab2d={'method':_0xfc22('0x34'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xfc22('0x6a')+_0x271d1b[_0xfc22('0x55')],'Content-Type':_0xfc22('0x53')},'body':{'from':_0x271d1b['phone'],'to':_0x2532ce[_0xfc22('0x20')],'text':_0x2532ce[_0xfc22('0x23')]},'json':!![]};return rp(_0x1bab2d)[_0xfc22('0x18')](function(_0x267611){if(_0x267611['code']==0xca){_0x42bf04[_0xfc22('0x6b')]=_0x267611;var _0x1b3b18={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xfc22('0x6a')+_0x271d1b[_0xfc22('0x55')],'Content-Type':'application/json'},'body':{'refid':_0x42bf04[_0xfc22('0x6b')][_0xfc22('0x6c')]},'json':!![]};return rp(_0x1b3b18)[_0xfc22('0x18')](function(_0xb074b){_0x42bf04['status']=_0xb074b;var _0x3ac2e9={'messageId':_0x42bf04['message'][_0xfc22('0x6c')],'read':!![]};return _0x24a3ae[_0xfc22('0x19')](_0x3ac2e9);});}else{return logger[_0xfc22('0x2c')](_0xfc22('0x29'),'afterCreate',_0xfc22('0x69'),util[_0xfc22('0x2b')](_0x267611,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4b514d){return logger[_0xfc22('0x2c')](_0xfc22('0x29'),_0xfc22('0x2a'),_0xfc22('0x69'),util['inspect'](_0x4b514d,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfc22('0x69'),_0xfc22('0x6d'));}break;}}})[_0xfc22('0x6e')](function(){_0x575d42();});}else{_0x575d42();}}},'charset':_0xfc22('0x6f'),'collate':_0xfc22('0x70')});};