MMS: send images as MMS, send other types as link
This commit is contained in:
parent
6d06757e34
commit
b428f81a5e
22
main.js
22
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 = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user