MMS: send images as MMS, send other types as link

This commit is contained in:
Skylar Ittner 2022-02-03 18:40:02 -07:00
parent 6d06757e34
commit b428f81a5e

22
main.js
View File

@ -353,11 +353,29 @@ function sendMMS(number, from, mediauri, mimetype, callback) {
httpmediaurl = httpmediaurl.replace("{{server-name}}", urichunks[2]);
httpmediaurl = httpmediaurl.replace("{{media-id}}", urichunks[3]);
var body = "";
var media = [httpmediaurl];
switch (mimetype) {
case "image/jpeg":
case "image/png":
case "image/gif":
case "image/bmp":
// These are likely to work, so don't include the URL
body = "";
break;
default:
// Send link to content as SMS, don't send actual content
body = httpmediaurl;
media = [];
}
var data = {
to: [number],
from: from,
body: httpmediaurl,
media: [httpmediaurl]
body: body,
media: media
};
const jsondata = JSON.stringify(data);
const options = {