michaelkourlas / voipms-sms-client

Popular Android messaging app for VoIP.ms, a Canadian VoIP provider
https://play.google.com/store/apps/details?id=net.kourlas.voipms_sms
Apache License 2.0
218 stars 52 forks source link

Add MMS support #190

Open pat247 opened 5 years ago

pat247 commented 5 years ago

MMS on VoIP.ms to roll out for beta testing soon. https://www.dslreports.com/forum/r32442917- July 9

A major enhancement for the todo list.

michaelkourlas commented 4 years ago

When they add API access for MMS, feel free to let me know and I'll implement support for it!

varGeneric commented 4 years ago

Suggest reopening because it is now available. https://wiki.voip.ms/article/MMS

michaelkourlas commented 4 years ago

Feel free to reopen once it appears on this page: https://www.voip.ms/m/apidocs.php

smnc commented 4 years ago

MMS is now available in the API doccumentation. Request to reopen. https://www.voip.ms/m/apidocs.php image

murraydb commented 4 years ago

Feel free to reopen once it appears on this page: https://www.voip.ms/m/apidocs.php

I see 27 instances of MMS on the page including getMMS and getMediaMMS

smnc commented 4 years ago

Feel free to reopen once it appears on this page: https://www.voip.ms/m/apidocs.php

I see 27 instances of MMS on the page including getMMS and getMediaMMS

MMS has just been added to the API documentation in the last hour or so, and was not there when the previous comments were made 2 hours ago.

varGeneric commented 4 years ago

VoIP.ms had sent an email indicating API availability just prior to my earliest comment and I had incorrectly assumed that the doc's were up at that time.

oathzed commented 4 years ago

Feel free to reopen once it appears on this page: https://www.voip.ms/m/apidocs.php

I see 27 instances of MMS on the page including getMMS and getMediaMMS

MMS has just been added to the API documentation in the last hour or so, and was not there when the previous comments were made 2 hours ago.

This is correct. It was added to the documentation about 5 minutes ago. I told support it wasn't available and they said they'd add it to be viewable by all beta testers shortly :).

oathzed commented 4 years ago

@michaelkourlas Maybe after this is implimented, VoIP.ms SMS app can be renamed to something like VoIP.ms Chat or VoIP.ms Messages ☺️

michaelkourlas commented 4 years ago

The MMS documentation has been removed from https://www.voip.ms/m/apidocs.php.

smnc commented 4 years ago

I'm still seeing it... image image

michaelkourlas commented 4 years ago

Perhaps they're showing different versions of the documentation to different people. I'm sure it's not my cache -- I tested it with a different browser I never use.

Can you provide me with a copy of the docs?

smnc commented 4 years ago

Sure can.

michaelkourlas commented 4 years ago

I've also opened a ticket with them to ask about this.

smnc commented 4 years ago

deleteMMS.txt getMediaMMS.txt getMMS.txt sendMMS.txt

smnc commented 4 years ago

Might be part of the beta rollout?

michaelkourlas commented 4 years ago

The API itself doesn't make much sense to me. We have to supply a URI to the image when sending an MMS? Why can't we just provide the base64-encoded image directly, the same way that it is returned to us using getMediaMMS?

innovate-invent commented 4 years ago

does a data uri work? https://en.wikipedia.org/wiki/Data_URI_scheme

michaelkourlas commented 4 years ago

That would be acceptable, but I can't determine that at the moment -- the API simply returns mms_failed regardless of whether I use a data URI or a normal URI.

Either the API isn't ready for public use or the functionality isn't enabled for my account.

smnc commented 4 years ago

I'm betting that if you're not seeing the API documentation that you're not included in the beta for some reason.

JoshMedeiros commented 4 years ago

I believe that you need to join their Beta Access Program in order to use the API and see the documentation, which can be done here: https://voip.ms/m/beta.php

mathieucarbou commented 4 years ago

Here are my findings. Hope it will help.

API Access and Doc

I had to:

image

Note

Email option is nice because any MMS received will be redirected also to your email with the media inside. So even of the app is still not supported MMS, this option allows VOIP.MS users to still be able to receive MMS.

Get sent and received MMS

HTTP GET

https://voip.ms/api/v1/rest.php?api_username=<API_USERNAME>&api_password=<API_PASSWORD>&content_type=json&method=getMMS&from=2020-07-04

RESPONSE BODY

{
 "status": "success",
 "sms": [
   {
    "id": "15601",
    "date": "2020-07-04 16:31:30",
    "type": "0",
    "did": "5141234567",
    "contact": "4381234567",
    "message": "",
    "col_media1": "https://voip.ms/media.php?map=MTU5Mzg5NDY4OTVmMDBlNzIxY2UzMGQ1ZjAwZTcyMWNlMzVmfDF8aW1hZ2UvcG5nfE1NUw==",
    "col_media2": "",
    "col_media3": ""
  },
  {
   "id": "15589",
   "date": "2020-07-04 16:11:36",
   "type": "0",
   "did": "5141234567",
   "contact": "4381234567",
   "message": "",
   "col_media1": "https://voip.ms/media.php?map=MTU5Mzg5MzQ5NTVmMDBlMjc3NGM3Nzk1ZjAwZTI3NzRjN2IwfDF8aW1hZ2UvanBlZ3xNTVM=",
   "col_media2": "",
   "col_media3": ""
  },
  {
   "id": "15586",
   "date": "2020-07-04 16:04:06",
   "type": "0",
   "did": "5141234567",
   "contact": "4381234567",
   "message": "",
   "col_media1": "",
   "col_media2": "",
   "col_media3": ""
  },
  {
   "id": "15555",
   "date": "2020-07-04 15:26:23",
   "type": "1",
   "did": "5141234567",
   "contact": "7787641209",
   "message": "dGVzdCBtZXNzYWdl",
   "col_media1": "https://voip.ms/media.php?map=MTU5Mzg5MDc4MzVmMDBkN2RmYzYxMWM1ZjAwZDdkZmM2MTU1fDF8aW1hZ2UvanBlZ3xNTVM=",
   "col_media2": "",
   "col_media3": ""
  },
  {
   "id": "15368",
   "date": "2020-07-04 10:47:14",
   "type": "1",
   "did": "5141234567",
   "contact": "4381234567",
   "message": "Test",
   "col_media1": "https://voip.ms/media.php?map=MTU5Mzg5MDc4MzVmMDBkN2RmYzYxMWM1ZjAwZDdkZmM2MTU1fDF8aW1hZ2UvanBlZ3xNTVM=",
   "col_media2": "",
   "col_media3": ""
  }
 ]
}

Notes and issues:

Sending MMS

HTTP GET

Just a message:

https://voip.ms/api/v1/rest.php?api_username=<API_USERNAME>&api_password=<API_PASSWORD>&content_type=json&method=sendMMS&did=5146604287&dst=4389901711&message=Hello%20World

Message and a media link

https://voip.ms/api/v1/rest.php?api_username=<API_USERNAME>&api_password=<API_PASSWORD>&content_type=json&method=sendMMS&did=5146604287&dst=4389901711&message=Hello%20World&media1=https://voip.ms/media.php?map=MTU5Mzg5MDc4MzVmMDBkN2RmYzYxMWM1ZjAwZDdkZmM2MTU1fDF8aW1hZ2UvanBlZ3xNTVM=

Message and a media data url

https://voip.ms/api/v1/rest.php?api_username=<API_USERNAME>&api_password=<API_PASSWORD>&content_type=json&method=sendMMS&did=5146604287&dst=4389901711&message=Hello%20World&media1=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYC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zQw1ms0NDWZz07iGkJmIFH8xxkc3a/WWlubmFkv9AB2SEpDvKxbjidN2faseaNV3zoHXvv7wMODJdkOHAegweAfFPx4G67KluxzottCU9n8CUqXzcIQdXOytAHqXxomvykhEKN9EFutG22p//0rbNvHVxiJywa8yS2KDfV1dfbu31H8jF1RHiTKtWYeHxUvq3bn0pyjCRaiRU6aDO+gb3aEfEeVNsDgm8zzLy9egPa7Qt8TSJdwhjplk06HH43ZNJ3s91KKCHQ5x4sw1fRGYDZ0n1L4FKb9/BP5JLYxToheoFCVxz57PPS8UhhEpLBVeAAAAAElFTkSuQmCC

RESPONSE BODY

{
  "status": "success",
  "mms": 15601
}

Notes and issues:

michaelkourlas commented 4 years ago

Thanks -- the URI length limits may require the app to use SOAP in this case.

mathieucarbou commented 4 years ago

Thanks -- the URI length limits may require the app to use SOAP in this case.

Yes... This is sad 👎

I have contacted VOIP.MS support to get someone from their team follow this ticket. They should ideally add support for POST with the REST API.

Also, another problem is the storage of the media files: they only support links at the moment. Not event data urls. So that means any app would need to either pre-upload the media somewhere publicly accessible, or only accept public links (which can be verified easily when including a media I think, by doing a HEAD request on the media url)

michaelkourlas commented 4 years ago

My implementation is not going to upload files to any server - I don't think that's practical. I'll be using either data URIs (if they extend the maximum URI length) or more likely SOAP.

michaelkourlas commented 4 years ago

I unsubscribed from the beta and was still able to send an MMS using the API, so that's good. Looks like they fixed that issue.

smnc commented 4 years ago

Yeah, it was advertised in the most recent VOIP.ms newsletter, so one would assume it has been rolled out to all users.

michaelkourlas commented 4 years ago

So bad news -- sending an MMS doesn't actually seem to work, notwithstanding the success return code.

I have sent both a base64 encoded image and a publicly hosted image to both a VoIP.ms number and my carrier number. No image appears in either the VoIP.ms SMS message centre or on my own cell phone.

mathieucarbou commented 4 years ago

@michaelkourlas : like i said in my previous post, data URI are not working. The generated link by voip.ms points to an empty/broken image. I have asked them to get a developer follow this ticket so that they can fix. Sending a mms message with text plus a media link parameter from my did to a Canadian (Bell) number worked for me. I wasn't able to send a mms to myself though (same number In both did and dst

michaelkourlas commented 4 years ago

Even using a link to a hosted image didn't work for me. What do you mean by a "media link parameter" -- an image hosted by VoIP.ms and uploaded through the portal, I guess?

I have multiple DIDs for testing. I was able to send the message component from one DID to the other, but again no image.

mathieucarbou commented 4 years ago

Even using a link to a hosted image didn't work for me. What do you mean by a "media link parameter" -- an image hosted by VoIP.ms and uploaded through the portal, I guess?

I have multiple DIDs for testing. I was able to send the message component from one DID to the other, but again no image.

It works.

I suspect that is could be because image sizes are limited (like message length). I have tried with my avatar image for example and the MMS is not send to the mobile phone but I see it in the communication center. It think you would need to read the MMS specs probably to be sure.

Example: I am sending this message:

Hello World https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/google/241/grapes_1f347.png Link: https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/google/241/grapes_1f347.png

  1. first encode the URL parameter:

https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/google/241/grapes_1f347.png becomes https%3A%2F%2Femojipedia-us.s3.dualstack.us-west-1.amazonaws.com%2Fthumbs%2F240%2Fgoogle%2F241%2Fgrapes_1f347.png

  1. build the url with a media and message parameters:

https://voip.ms/api/v1/rest.php?api_username=%3CAPI_USERNAME%3E&api_password=%3CAPI_PASSWORD%3E&content_type=json&method=sendMMS&did=5146604287&dst=4389901711&message=Hello%20World&media1=https%3A%2F%2Femojipedia-us.s3.dualstack.us-west-1.amazonaws.com%2Fthumbs%2F240%2Fgoogle%2F241%2Fgrapes_1f347.png

  1. Then call it in a browser
{
status: "success",
mms: 15899
}
  1. Verify it worked at https://voip.ms/m/communications.php

image

Voip.MS bug: message is not displayed

  1. Verify it worked on destination phone:
  1. verify getMMS API call sees it:
{
   id: "15902",
   date: "2020-07-05 08:15:12",
   type: "0",
   did: "5146604287",
   contact: "4389901711",
   message: "",
   col_media1: "https://voip.ms/media.php?map=MTU5Mzk1MTMxMTVmMDFjNDRmMzBiMGM1ZjAxYzQ0ZjMwYjQyfDF8aW1hZ2UvcG5nfE1NUw==",
   col_media2: "",
   col_media3: ""
},

Voip.MS bug: message is not displayed

Important note:

You can see that Voip.ms is not using the link we are sending but generates another link.

Decoding MTU5Mzk1MTMxMTVmMDFjNDRmMzBiMGM1ZjAxYzQ0ZjMwYjQyfDF8aW1hZ2UvcG5nfE1NUw== leads to 15939513115f01c44f30b0c5f01c44f30b42|1|image/png|MMS

So I guess they have a database where each uuid is pointing to a either a media file or a link on internet that they are serving. I don't know. But there could be some file size limitations. We need to ask them because their API does not state what are the limitations.

mathieucarbou commented 4 years ago

Ok... This is all in their WIKI page: https://wiki.voip.ms/article/MMS

Additionally, please note of the following restrictions for sending MMS: • Permitted attachment types are JPG, GIF, JPEG, PNG, MP3, WAV, MIDI, MP4 and 3GP • The maximum size for each attachment is 1300 KB • You can attach up to 3 files • Maximum characters in a text message is 2048

I have tried to send several media at once:

https://voip.ms/api/v1/rest.php?api_username=%3CAPI_USERNAME%3E&api_password=%3CAPI_PASSWORD%3E&content_type=json&method=sendMMS&did=5146604287&dst=4389901711&message=Hello%20World&media1=https%3A%2F%2Femojipedia-us.s3.dualstack.us-west-1.amazonaws.com%2Fthumbs%2F240%2Fgoogle%2F241%2Fgrapes_1f347.png&media2=https%3A%2F%2Femojipedia-us.s3.dualstack.us-west-1.amazonaws.com%2Fthumbs%2F240%2Fgoogle%2F241%2Fgrapes_1f347.png

It works fine: I am receiving on the Bell mobile the message plus the 2 images.

michaelkourlas commented 4 years ago

I think you're right that it's an image size thing. I was able to send the grapes emoji, for example, using a hosted URI to a carrier number.

With that said, they shouldn't be returning "success" if the image could not be sent -- that's deceptive.

They also need to properly support base64-encoded images in order for the API to be usable by the app. (They could also provide a mechanism to upload an image and get a media link in return, which is probably what they do internally in the SMS message centre.)

mathieucarbou commented 4 years ago

Yes I agree their API is really wrong , buggy and incomplete at the moment.

For the return code, it depends because a larger image can be sent and received in the communication center, though, not be sent through a carrier. The image size limit is for sending to a carrier mobile phone I think perhaps ? Because i was able to see in the communication center the bigger images. So they do not validate when downloading (or serving) the link.

Anyway... In any case, what can be done:

The major benefit I see of MMS is to mainly get rid of the SMS text length limit which was cutting all SMS in several ones unordered. With MMS, just at least being able to send long uncut messages is very nice! And appending some small media is nice too.

michaelkourlas commented 4 years ago

I definitely plan to verify file size limitations, resizing images if necessary.

I'll give people the option as to whether to send an MMS or SMS if their message exceeds 160 characters. Oddly, it seems Google Messages doesn't give you that option -- you have to include multimedia content, a subject, an urgent marker or another MMS feature to force it to send an MMS.

I'm not going to give the user an option to decode base64, which I think would be confusing. Maybe the app could do so automatically as a temporary solution, but more likely I'll simply wait for VoIP.ms to fix that problem.

More importantly, I'm not going to upload content to a separate server, which I think creates unacceptable security and privacy risks. So I really hope they fix their API soon! I haven't tried base64-encoded images with SOAP yet -- maybe that will work. :P

michaelkourlas commented 4 years ago

I received a response from VoIP.ms:

Hello Michael,

Thanks for your feedback and reports, they allow us to improve our services.

About receiving Base64 in our sendMMS method, we are already working on it, it should be released very soon. We had to remove it temporarily because it was not working properly.

You are receiving a success response because we added the ability to send MMS without images attached, in case you wanted to send a long text to someone. What is happening right now is: We exclude anything that is not a URL and leave the media1, media2, media3 params empty.

In the next version, we will check for both URL and Base64 and send the image/media.

We will let you know via this ticket when support for base64 is ready.

Let us know if we can be of further assistance.

mathieucarbou commented 4 years ago

@michaelkourlas lol ;-) I have also communicated with them:

Hello Mathieu,

Thanks for contacting us.

After reviewing the URL you provided, it is a bit unclear what are the issues you are still facing with our API.

Here are some answers to that thread:

About receiving Base64 in our sendMMS method, we are already working on it, it should be released very soon.

About receiving POST in our API, it is already possible, please review the following section of our API documentation: PHP - Using cURL POST - Sample Code

If you have more problems or questions, please let us know so we can fix them or answer :)

They acknowledged the base64 issue, but not the 2 other ones yet:

  1. HTTP POST is not working according to their PHP sample: sending an HTTP POST with curl returns a SOAP error, and looking at their PHP example, we should get something else
  2. The message field is lost: the message field is lost in the communication panel and REST API when sending a MMS with both media and message: it is send to the destination carrier, but not shown in their website and not shown in the getMMS REST API.
michaelkourlas commented 4 years ago

Yeah, I just tested HTTP POST using their example (not in PHP, but using Postman). It doesn't work. I'll mention that in my ticket as well -- I would prefer to use HTTP POST with their REST JSON API then have to use SOAP.

michaelkourlas commented 4 years ago

VoIP.ms clarified that you have to use multipart/form-data, rather than application/x-www-form-urlencoded (the default for most applications).

They gave this as a curl example:

curl -X POST -F 'api_username=your@email.tld' -F 'api_password=#your#password#' -F 'method=getIP' https://voip.ms/api/v1/rest.php

I didn't test using that example, but I did start using multipart/form-data in Postman and it works correctly.

pat247 commented 4 years ago

VoIP.ms posted to the Developer Log:

July 8, 2020, 8:23 am

We just added new methods to our API to allow our customers to manage our new Multimedia Messaging Service (MMS) feature.

MMS Methods:

smnc commented 4 years ago

VoIP.ms posted to the Developer Log:

July 8, 2020, 8:23 am

We just added new methods to our API to allow our customers to manage our new Multimedia Messaging Service (MMS) feature.

MMS Methods:

  • deleteMMS
  • getMMS
  • getMediaMMS
  • sendMMS

Those are the same commands added to the API doccumentation back when the feature went live. Seems they were a bit tardy in updating the news page, lol. Michael and Matieu have been playing with them for over a week now.

mathieucarbou commented 4 years ago

Got an email from VoIP : their API supports base64 now.

Hello, Our sendMMS method is accepting Base64 files now.

oathzed commented 4 years ago

Got an email from VoIP : their API supports base64 now.

Hello, Our sendMMS method is accepting Base64 files now.

Is this the last puzzle piece to be able to properly impliment MMS into the app?

michaelkourlas commented 4 years ago

For now, yes.

oathzed commented 4 years ago

For now, yes.

Awesome

oathzed commented 4 years ago

@michaelkourlas Will group chats be possible when you implement mms support?

michaelkourlas commented 4 years ago

I don't think so. The API doesn't seem to support multiple destinations. I'll mention that in my ticket.

oathzed commented 4 years ago

I don't think so. The API doesn't seem to support multiple destinations. I'll mention that in my ticket.

Gotcha. Okay thanks, appreciate it.

michaelkourlas commented 4 years ago

I also tried sending a group MMS from the SMS message centre, and it appeared on my phone as an ordinary MMS. I don't think VoIP.ms properly supports group MMS at the moment.

oathzed commented 4 years ago

I also tried sending a group MMS from the SMS message centre, and it appeared on my phone as an ordinary MMS. I don't think VoIP.ms properly supports group MMS at the moment.

That's unfortunate. Hopefully they add support for it soon.