From b428f81a5eeacca70ea8546af102e43808f25732 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Thu, 3 Feb 2022 18:40:02 -0700 Subject: [PATCH] MMS: send images as MMS, send other types as link --- main.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index c13e68b..3f9b7e6 100644 --- a/main.js +++ b/main.js @@ -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 = {