Built motion from commit 092f8824.|2.5.49
[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 _0x9fa5=['out','secret','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','find','SmsAccountId','type','authToken','accountSid','create','phone','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','inspect','skebby','username','password','smsMethod','sender','login?username=','&password=','GET','sms','user_key','session_key','internal_order_id','deliveryReport','read','afterCreate','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','POST','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','messages','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','remote','/status?token=','plivo','infobip','baseUrl','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','timestamp','keys','sort','createHash','md5','hex','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0xc08f00,_0x28067f){var _0x8649f7=function(_0x25f9a2){while(--_0x25f9a2){_0xc08f00['push'](_0xc08f00['shift']());}};_0x8649f7(++_0x28067f);}(_0x9fa5,0x66));var _0x59fa=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x9fa5[_0x173d7e];return _0x2220d6;};'use strict';var _=require('lodash');var util=require(_0x59fa('0x0'));var logger=require(_0x59fa('0x1'))(_0x59fa('0x2'));var moment=require(_0x59fa('0x3'));var BPromise=require(_0x59fa('0x4'));var rp=require(_0x59fa('0x5'));var fs=require('fs');var path=require(_0x59fa('0x6'));var rimraf=require('rimraf');var config=require(_0x59fa('0x7'));var attributes=require(_0x59fa('0x8'));module[_0x59fa('0x9')]=function(_0x1d56cc,_0x2f0132){return _0x1d56cc['define'](_0x59fa('0xa'),attributes,{'tableName':_0x59fa('0xb'),'paranoid':![],'indexes':[{'name':_0x59fa('0xc'),'fields':[_0x59fa('0xc')]},{'name':_0x59fa('0xd'),'fields':[_0x59fa('0xe')],'type':_0x59fa('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x35313c,_0x3363b9,_0x1734bc){var _0x2d5700=_0x1d56cc[_0x59fa('0x10')];var _0x50beb2=_0x35313c[_0x59fa('0x11')]({'plain':!![]});if(_0x50beb2['direction']['toLowerCase']()==='in'||_0x50beb2[_0x59fa('0x12')][_0x59fa('0x13')]()===_0x59fa('0x14')&&!_0x50beb2[_0x59fa('0x15')]&&!_[_0x59fa('0x16')](_0x50beb2['UserId'])&&!_[_0x59fa('0x16')](_0x50beb2[_0x59fa('0x17')])){_0x2d5700[_0x59fa('0x18')][_0x59fa('0x19')]({'where':{'id':_0x50beb2[_0x59fa('0x17')]}})[_0x59fa('0x1a')](function(_0x28045a){if(_0x28045a){_0x28045a[_0x59fa('0x1b')]({'lastMsgAt':_0x50beb2[_0x59fa('0x1c')],'lastMsgDirection':_0x50beb2[_0x59fa('0x12')][_0x59fa('0x13')]()});}})[_0x59fa('0x1d')](function(_0x35b7a4){console[_0x59fa('0x1e')](_0x35b7a4);});}if(_0x50beb2['direction']==='out'&&!_0x50beb2[_0x59fa('0x15')]){var _0x3676bf;_0x2d5700['SmsAccount'][_0x59fa('0x1f')]({'where':{'id':_0x50beb2[_0x59fa('0x20')]},'raw':!![]})[_0x59fa('0x1a')](function(_0x26f5e1){_0x3676bf=_0x26f5e1;if(_0x3676bf&&_0x3676bf[_0x59fa('0x21')]){switch(_0x3676bf['type']){case'twilio':var _0x289cab=require('twilio');if(_0x3676bf['accountSid']&&_0x3676bf[_0x59fa('0x22')]&&_0x3676bf['phone']){var _0x48d119=new _0x289cab(_0x3676bf[_0x59fa('0x23')],_0x3676bf[_0x59fa('0x22')]);_0x48d119['messages'][_0x59fa('0x24')]({'body':_0x50beb2['body'],'to':_0x50beb2[_0x59fa('0x25')],'from':_0x3676bf[_0x59fa('0x25')],'statusCallback':_0x3676bf['remote']+_0x59fa('0x26')+_0x50beb2['id']+'/status?token='+_0x3676bf[_0x59fa('0x27')]})['then'](function(_0x58e686){if(_0x58e686[_0x59fa('0x28')]){return _0x35313c[_0x59fa('0x1b')]({'messageId':_0x58e686[_0x59fa('0x28')]});}})[_0x59fa('0x1d')](function(_0x23fd50){logger[_0x59fa('0x1e')](_0x59fa('0x29'),'afterCreate',_0x59fa('0x2a'),util[_0x59fa('0x2b')](_0x23fd50,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x59fa('0x29'),'afterCreate',_0x59fa('0x2a'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x59fa('0x2c'):var _0x31be8a='https://api.skebby.it/API/v1.0/REST/';if(_0x3676bf[_0x59fa('0x2d')]&&_0x3676bf[_0x59fa('0x2e')]){var _0xde00c9={'recipient':[_0x50beb2[_0x59fa('0x25')]],'message':_0x50beb2[_0x59fa('0xe')],'message_type':_0x3676bf[_0x59fa('0x2f')]};if(_0x3676bf[_0x59fa('0x2f')]&&_0x3676bf['smsMethod']!=='SI'){_0xde00c9[_0x59fa('0x30')]=_0x3676bf[_0x59fa('0x25')];}var _0x3d246e={'url':_0x31be8a+_0x59fa('0x31')+_0x3676bf['username']+_0x59fa('0x32')+_0x3676bf[_0x59fa('0x2e')],'method':_0x59fa('0x33')};rp(_0x3d246e)['then'](function(_0xec52d3){var _0x1e63ef=_0xec52d3['split'](';');var _0x525abe={'user_key':_0x1e63ef[0x0],'session_key':_0x1e63ef[0x1]};_0x3d246e={'url':_0x31be8a+_0x59fa('0x34'),'method':'POST','headers':{'user_key':_0x525abe[_0x59fa('0x35')],'Session_key':_0x525abe[_0x59fa('0x36')]},'json':!![],'body':_0xde00c9};return rp(_0x3d246e);})['then'](function(_0x275863){if(_0x275863['total_sent']>=0x1){var _0x2e9d7e={'messageId':_0x275863[_0x59fa('0x37')]};if(_0x3676bf[_0x59fa('0x2f')]!=='GP'||!_0x3676bf[_0x59fa('0x38')]){_0x2e9d7e[_0x59fa('0x39')]=!![];}return _0x35313c[_0x59fa('0x1b')](_0x2e9d7e);}else{return logger[_0x59fa('0x1e')](_0x59fa('0x29'),_0x59fa('0x3a'),_0x59fa('0x2c'),util[_0x59fa('0x2b')](_0x275863,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1fda04){return logger['error'](_0x59fa('0x29'),'afterCreate',_0x59fa('0x2c'),util[_0x59fa('0x2b')](_0x1fda04,{'showHidden':![],'depth':null}));});}else{logger[_0x59fa('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x59fa('0x3a'),_0x59fa('0x2c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x59fa('0x3b'):if(_0x3676bf[_0x59fa('0x22')]){var _0x1f6a11={'recipient':_0x50beb2[_0x59fa('0x25')],'message':_0x50beb2[_0x59fa('0xe')],'sender':_0x3676bf[_0x59fa('0x3c')]||_0x3676bf['phone'],'authorization':_0x3676bf[_0x59fa('0x22')]};var _0x3363b9={'method':'POST','uri':_0x59fa('0x3d'),'body':_0x1f6a11,'json':!![]};rp(_0x3363b9)[_0x59fa('0x1a')](function(_0x915518){var _0x2d75c1={'messageId':_0x915518[_0x59fa('0x3e')]};if(!_0x3676bf[_0x59fa('0x38')]){_0x2d75c1[_0x59fa('0x39')]=!![];}return _0x35313c['update'](_0x2d75c1);})[_0x59fa('0x1d')](function(_0x4c0483){logger[_0x59fa('0x1e')](_0x59fa('0x29'),'afterCreate',_0x59fa('0x3b'),util[_0x59fa('0x2b')](_0x4c0483,{'showHidden':![],'depth':null}));});}else{logger[_0x59fa('0x1e')](_0x59fa('0x29'),_0x59fa('0x3a'),_0x59fa('0x3b'),_0x59fa('0x3f'));}break;case _0x59fa('0x40'):if(_0x3676bf[_0x59fa('0x2d')]&&_0x3676bf[_0x59fa('0x2e')]){var _0x1f6a11={'messages':[{'source':_0x59fa('0x41'),'to':_0x50beb2[_0x59fa('0x25')],'body':_0x50beb2[_0x59fa('0xe')],'from':_0x3676bf[_0x59fa('0x3c')]||_0x3676bf[_0x59fa('0x25')]}]};var _0x4bc7f6=util[_0x59fa('0x42')](_0x59fa('0x43'),_0x3676bf[_0x59fa('0x2d')],_0x3676bf[_0x59fa('0x2e')]);var _0x3363b9={'method':_0x59fa('0x44'),'uri':_0x59fa('0x45'),'body':_0x1f6a11,'headers':{'Authorization':util[_0x59fa('0x42')](_0x59fa('0x46'),new Buffer(_0x4bc7f6)[_0x59fa('0x47')](_0x59fa('0x48')))},'json':!![]};rp(_0x3363b9)[_0x59fa('0x1a')](function(_0x210461){if(_0x210461['http_code']>=0xc8&&_0x210461[_0x59fa('0x49')]<=0xce){if(_0x210461[_0x59fa('0x4a')]&&_0x210461['data']['queued_count']>0x0){var _0x2f5672=_['head'](_0x210461[_0x59fa('0x4a')][_0x59fa('0x4b')]);var _0x39af2c={'messageId':_0x2f5672[_0x59fa('0x4c')]};if(!_0x3676bf[_0x59fa('0x38')]){_0x39af2c[_0x59fa('0x39')]=!![];}return _0x35313c[_0x59fa('0x1b')](_0x39af2c);}else{logger[_0x59fa('0x1e')](_0x59fa('0x29'),_0x59fa('0x3a'),_0x59fa('0x4d'),util[_0x59fa('0x2b')](_0x210461,{'showHidden':![],'depth':null}));}}else{logger[_0x59fa('0x1e')](_0x59fa('0x29'),_0x59fa('0x3a'),_0x59fa('0x4d'),util[_0x59fa('0x2b')](_0x210461,{'showHidden':![],'depth':null}));}})[_0x59fa('0x1d')](function(_0x19c934){logger[_0x59fa('0x1e')](_0x59fa('0x29'),_0x59fa('0x3a'),_0x59fa('0x4d'),util[_0x59fa('0x2b')](_0x19c934,{'showHidden':![],'depth':null}));});}else{logger[_0x59fa('0x1e')](_0x59fa('0x29'),_0x59fa('0x3a'),'clickSend',_0x59fa('0x4e'));}break;case'plivo':if(_0x3676bf[_0x59fa('0x4f')]&&_0x3676bf[_0x59fa('0x22')]){var _0x1f6a11={'dst':_0x50beb2[_0x59fa('0x25')],'text':_0x50beb2[_0x59fa('0xe')],'src':_0x3676bf[_0x59fa('0x3c')]||_0x3676bf[_0x59fa('0x25')],'url':_0x3676bf[_0x59fa('0x50')]+_0x59fa('0x26')+_0x50beb2['id']+_0x59fa('0x51')+_0x3676bf[_0x59fa('0x27')]};var _0x4bc7f6=util[_0x59fa('0x42')](_0x59fa('0x43'),_0x3676bf[_0x59fa('0x4f')],_0x3676bf['authToken']);var _0x3363b9={'method':_0x59fa('0x44'),'uri':util[_0x59fa('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x3676bf['authId']),'body':_0x1f6a11,'headers':{'Authorization':util[_0x59fa('0x42')](_0x59fa('0x46'),new Buffer(_0x4bc7f6)['toString'](_0x59fa('0x48')))},'json':!![]};rp(_0x3363b9)[_0x59fa('0x1a')](function(_0x25bacf){var _0x24883e={'messageId':_0x25bacf['message_uuid'][0x0]};return _0x35313c[_0x59fa('0x1b')](_0x24883e);})[_0x59fa('0x1d')](function(_0x56800e){logger[_0x59fa('0x1e')](_0x59fa('0x29'),_0x59fa('0x3a'),_0x59fa('0x52'),util[_0x59fa('0x2b')](_0x56800e,{'showHidden':![],'depth':null}));});}else{logger[_0x59fa('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x59fa('0x52'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x59fa('0x53'):if(_0x3676bf[_0x59fa('0x2d')]&&_0x3676bf[_0x59fa('0x2e')]){if(_0x3676bf[_0x59fa('0x54')]){var _0x1f3113={'method':_0x59fa('0x44'),'uri':_0x3676bf[_0x59fa('0x54')]+'/auth/1/session','body':{'username':_0x3676bf[_0x59fa('0x2d')],'password':_0x3676bf[_0x59fa('0x2e')]},'json':!![]};return rp(_0x1f3113)[_0x59fa('0x1a')](function(_0x251419){var _0xb0aad5={'method':_0x59fa('0x44'),'uri':_0x3676bf['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3676bf[_0x59fa('0x25')],'destinations':[{'to':_0x50beb2[_0x59fa('0x25')]}],'text':_0x50beb2['body'],'notifyUrl':_0x3676bf[_0x59fa('0x50')]+'/api/sms/messages/'+_0x50beb2['id']+_0x59fa('0x51')+_0x3676bf['token'],'notifyContentType':_0x59fa('0x55'),'callbackData':_0x3676bf['phone']+';'+_0x50beb2[_0x59fa('0xe')]}]},'headers':{'Authorization':_0x59fa('0x56')+_0x251419[_0x59fa('0x27')]},'json':!![]};return rp(_0xb0aad5)[_0x59fa('0x1a')](function(_0x19bb83){if(_0x19bb83[_0x59fa('0x4b')]){var _0x2dd381={'messageId':_0x19bb83[_0x59fa('0x4b')][0x0][_0x59fa('0xc')]};if(!_0x3676bf[_0x59fa('0x38')]){_0x2dd381['read']=!![];}return _0x35313c[_0x59fa('0x1b')](_0x2dd381);}else{return logger[_0x59fa('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x59fa('0x3a'),_0x59fa('0x53'),util[_0x59fa('0x2b')](_0x19bb83,{'showHidden':![],'depth':null}));}});})[_0x59fa('0x1d')](function(_0x71097){return logger['error'](_0x59fa('0x29'),_0x59fa('0x3a'),_0x59fa('0x53'),util[_0x59fa('0x2b')](_0x71097,{'showHidden':![],'depth':null}));});}else{logger[_0x59fa('0x1e')](_0x59fa('0x29'),_0x59fa('0x3a'),_0x59fa('0x53'),_0x59fa('0x57'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x59fa('0x3a'),_0x59fa('0x53'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x2cbb38=require(_0x59fa('0x58'));if(_0x3676bf[_0x59fa('0x59')]){var _0x1e81c4={};_0x1e81c4[_0x59fa('0x5a')]=_0x3676bf['username'];_0x1e81c4[_0x59fa('0x25')]=_0x50beb2[_0x59fa('0x25')];_0x1e81c4[_0x59fa('0x30')]=_0x3676bf[_0x59fa('0x25')];_0x1e81c4[_0x59fa('0x5b')]=_0x50beb2[_0x59fa('0xe')];_0x1e81c4[_0x59fa('0x5c')]=+new Date();var _0x3de613='';var _0xabf9b2='';var _0x90b9f=Object[_0x59fa('0x5d')](_0x1e81c4);_0x90b9f[_0x59fa('0x5e')]();for(var _0x76c245=0x0;_0x76c245<_0x90b9f['length'];_0x76c245++){if(_0x3de613!=''){_0x3de613+='&';}_0x3de613+=_0x90b9f[_0x76c245]+'='+encodeURIComponent(_0x1e81c4[_0x90b9f[_0x76c245]]);_0xabf9b2+=_0x1e81c4[_0x90b9f[_0x76c245]];}_0xabf9b2+=_0x3676bf['apiKey'];_0xabf9b2=_0x2cbb38[_0x59fa('0x5f')](_0x59fa('0x60'))['update'](_0xabf9b2)['digest'](_0x59fa('0x61'));if(_0x3de613!==''){_0x3de613+='&';}_0x3de613+=_0x59fa('0x62')+_0xabf9b2;var _0x3d246e={'method':_0x59fa('0x33'),'uri':_0x3676bf[_0x59fa('0x54')]+_0x59fa('0x63')+_0x3de613,'json':!![]};return rp(_0x3d246e)[_0x59fa('0x1a')](function(_0x2d1000){var _0x378a6b=Object['keys'](_0x2d1000);if(_0x2d1000[_0x378a6b[0x0]][_0x59fa('0x1e')]&&parseInt(_0x2d1000[_0x378a6b[0x0]][_0x59fa('0x1e')])===0x0){var _0x56afde={'messageId':_0x2d1000[_0x378a6b[0x0]][_0x59fa('0x64')]};if(!_0x3676bf['deliveryReport']){_0x56afde[_0x59fa('0x39')]=!![];}return _0x35313c['update'](_0x56afde);}else{return logger['error'](_0x59fa('0x29'),_0x59fa('0x3a'),_0x59fa('0x65'),util[_0x59fa('0x2b')](_0x2d1000[_0x59fa('0x1e')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x594706){return logger[_0x59fa('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x59fa('0x65'),util[_0x59fa('0x2b')](_0x594706,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x59fa('0x29'),_0x59fa('0x3a'),_0x59fa('0x65'),_0x59fa('0x66'));}break;case'clickatell':if(_0x3676bf[_0x59fa('0x59')]){var _0x34ab60={'method':_0x59fa('0x44'),'uri':_0x59fa('0x67'),'headers':{'Authorization':_0x3676bf['apiKey']},'body':{'content':_0x50beb2[_0x59fa('0xe')],'to':[_0x50beb2[_0x59fa('0x25')]],'from':_0x3676bf[_0x59fa('0x25')],'binary':![],'clientMessageId':_0x59fa('0x68'),'charset':_0x59fa('0x69')},'json':!![]};rp(_0x34ab60)[_0x59fa('0x1a')](function(_0x4a6cbc){if(!_0x4a6cbc['error']){var _0x51ddb5={'messageId':_0x4a6cbc[_0x59fa('0x4b')][0x0][_0x59fa('0x6a')]};if(!_0x3676bf[_0x59fa('0x38')]){_0x51ddb5[_0x59fa('0x39')]=!![];}return _0x35313c[_0x59fa('0x1b')](_0x51ddb5);}else{return logger[_0x59fa('0x1e')](_0x59fa('0x29'),'afterCreate',_0x59fa('0x6b'),util[_0x59fa('0x2b')](_0x4a6cbc[_0x59fa('0x1e')],{'showHidden':![],'depth':null}));}})[_0x59fa('0x1d')](function(_0x28c2f8){return logger[_0x59fa('0x1e')](_0x59fa('0x29'),_0x59fa('0x3a'),_0x59fa('0x6b'),util[_0x59fa('0x2b')](_0x28c2f8,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x59fa('0x3a'),_0x59fa('0x6b'),_0x59fa('0x66'));}break;case _0x59fa('0x6c'):if(_0x3676bf[_0x59fa('0x2d')]&&_0x3676bf[_0x59fa('0x2e')]){var _0x4bc7f6=util[_0x59fa('0x42')](_0x59fa('0x43'),_0x3676bf[_0x59fa('0x2d')],_0x3676bf[_0x59fa('0x2e')]);var _0x3363b9={'method':_0x59fa('0x44'),'uri':_0x59fa('0x6d')+_0x3676bf[_0x59fa('0x6e')]+_0x59fa('0x6f'),'body':{'to':[_0x50beb2[_0x59fa('0x25')]],'text':_0x50beb2['body'],'from':_0x3676bf[_0x59fa('0x25')],'applicationId':_0x3676bf[_0x59fa('0x70')]},'headers':{'Authorization':util[_0x59fa('0x42')](_0x59fa('0x46'),new Buffer(_0x4bc7f6)[_0x59fa('0x47')]('base64'))},'json':!![]};rp(_0x3363b9)[_0x59fa('0x1a')](function(_0x3e5139){if(_0x3e5139['id']){var _0x17e960={'messageId':_0x3e5139['id']};return _0x35313c[_0x59fa('0x1b')](_0x17e960);}else{logger[_0x59fa('0x1e')](_0x59fa('0x29'),_0x59fa('0x3a'),_0x59fa('0x6c'),util['inspect'](_0x3e5139,{'showHidden':![],'depth':null}));}})[_0x59fa('0x1d')](function(_0x529db8){logger[_0x59fa('0x1e')](_0x59fa('0x29'),_0x59fa('0x3a'),_0x59fa('0x6c'),util[_0x59fa('0x2b')](_0x529db8,{'showHidden':![],'depth':null}));});}else{logger[_0x59fa('0x1e')](_0x59fa('0x29'),'afterCreate',_0x59fa('0x6c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x59fa('0x71'):if(_0x3676bf[_0x59fa('0x59')]){var _0x2ba57a={};var _0x3d246e={'method':_0x59fa('0x44'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x59fa('0x72')+_0x3676bf[_0x59fa('0x59')],'Content-Type':'application/json'},'body':{'from':_0x3676bf[_0x59fa('0x25')],'to':_0x50beb2['phone'],'text':_0x50beb2[_0x59fa('0xe')]},'json':!![]};return rp(_0x3d246e)[_0x59fa('0x1a')](function(_0x526679){if(_0x526679[_0x59fa('0x73')]==0xca){_0x2ba57a[_0x59fa('0x74')]=_0x526679;var _0x235572={'method':_0x59fa('0x44'),'uri':_0x59fa('0x75'),'headers':{'Authorization':_0x59fa('0x72')+_0x3676bf[_0x59fa('0x59')],'Content-Type':'application/json'},'body':{'refid':_0x2ba57a[_0x59fa('0x74')][_0x59fa('0x76')]},'json':!![]};return rp(_0x235572)[_0x59fa('0x1a')](function(_0x49c9aa){_0x2ba57a['status']=_0x49c9aa;var _0x2c7e41={'messageId':_0x2ba57a[_0x59fa('0x74')][_0x59fa('0x76')],'read':!![]};return _0x35313c[_0x59fa('0x1b')](_0x2c7e41);});}else{return logger[_0x59fa('0x1e')](_0x59fa('0x29'),_0x59fa('0x3a'),_0x59fa('0x71'),util['inspect'](_0x526679,{'showHidden':![],'depth':null}));}})['catch'](function(_0x77658){return logger[_0x59fa('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util['inspect'](_0x77658,{'showHidden':![],'depth':null}));});}else{return logger[_0x59fa('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x59fa('0x3a'),_0x59fa('0x71'),'Token\x20not\x20received');}break;}}})[_0x59fa('0x77')](function(){_0x1734bc();});}else{_0x1734bc();}}},'charset':_0x59fa('0x78'),'collate':_0x59fa('0x79')});};