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("{{server-name}}", urichunks[2]);
|
||||||
httpmediaurl = httpmediaurl.replace("{{media-id}}", urichunks[3]);
|
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 = {
|
var data = {
|
||||||
to: [number],
|
to: [number],
|
||||||
from: from,
|
from: from,
|
||||||
body: httpmediaurl,
|
body: body,
|
||||||
media: [httpmediaurl]
|
media: media
|
||||||
};
|
};
|
||||||
const jsondata = JSON.stringify(data);
|
const jsondata = JSON.stringify(data);
|
||||||
const options = {
|
const options = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user