Receiving MMS with 2-way command

Receiving MMS with 2-way command SearchSearch
Author Message
Mitch
New member
Username: Mitch

Post Number: 1
Registered: 06-2015
Posted on Monday, June 22, 2015 - 06:46 pm:   

How do I process a received MMS message that contains pictures with a 2-way command?
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 5325
Registered: 08-2008
Posted on Monday, June 22, 2015 - 07:06 pm:   

Hi Mitch,

There are three ways to do this.

1.) This technique is PHP specific. In this approach, when an MMS message is received, an HTTP post transaction is directed to a PHP script. There is no keyword support, all received MMS messages are processed by a single PHP script. This interface is described here: http://www.nowsms.com/doc/2-way-mms-support/receiving-mms-messages-with-a-php-script

2.) There is also a file/directory based technique. In this case, your application scans the MMS-IN directory to find received MMS messages. Here is an old post that describes this interface: http://support.nowsms.com/discus/messages/485/9651.html

3.) A new technique was added in 2014 and 2015 versions of NowSMS.

Based upon customer feedback, starting with the 2014.05.30 release of NowSMS, an additional option is available which allows MMS messages to be processed together with SMS messages using the same 2-way commands. This option is enabled when “Process Received MMS Messages” and “Use SMS 2-Way Commands” are both checked.

2wayconfig1.jpg

URL references to retrieve any images or other content objects will be added to the 2-way command automatically using variables AttachFile1, AttachFile2, AttachFile3, etc. The URL reference for the file attachment will contain a path only.

This is best explained with an example. Consider the following 2-way command:

http://nowsmslocal/php/log.php?sender=@@SENDER@@&text=@@FULLSMS@@

When an MMS message that includes an image is received, the resulting 2-way command will be similar to this:

http://nowsmslocal/php/log.php?sender=%2B447777777777&text=Test%20Message&AttachFile1=/SMSAttachFile/534E8AEE/IMG_6815.jpg

To retrieve this object, connect to the NowSMS web interface port, including the IP address or host name, such as:

http://localhost:8800/SMSAttachFile/534E8AEE/IMG_6815.jpg

If multiple files are attached, additional URL parameters will be added using the sequence AttachFile2, AttachFile3, etc.

--
Des
NowSMS Support
Mitch
New member
Username: Mitch

Post Number: 2
Registered: 06-2015
Posted on Monday, June 22, 2015 - 07:15 pm:   

Hi Des,

Wow, that is complicated.

Thank you for your detailed reply, but I am not sure where to start.

Which of these techniques do you recommend?

Thanks,

Mitch
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 5326
Registered: 08-2008
Posted on Monday, June 22, 2015 - 07:26 pm:   

Hi Mitch,

It depends, but here's the way I'd approach it.

Are you processing a mix of both SMS and MMS? If yes, technique #3 is what I'd recommend. It looks like I forgot to post a link that explains it, so please refer to this: http://www.nowsms.com/2-way-commands-for-sms-and-mms-processing-new-2014-feature s

Basically, a received SMS or MMS is going to trigger NowSMS to make an HTTP request to a script that you provide. All of the details about the received message are passed in the request. If the message is an MMS with an image or video, there will be a URL reference to allow your script to retrieve the image or video for processing.

If you are just processing MMS, then lots of people seem to use the file/directory scan interface.

Hope that helps.

--
Des
NowSMS Support
Mitch
New member
Username: Mitch

Post Number: 4
Registered: 06-2015
Posted on Tuesday, June 23, 2015 - 04:50 pm:   

Hi Des,

What about delivery reports?

If the "Use SMS 2-way commands" checkbox is NOT selected, I see delivery reports in the MMS-IN directory. They have "Message-type: m-delivery-ind " in the HDR file.

If I select the "Use SMS 2-way commands" checkbox, I cannot see them, and they are not sent to the 2-way command.

Why? Is this because I use Android phone as WiFi modem?

Thanks for your support,

Mitch
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 5328
Registered: 08-2008
Posted on Tuesday, June 23, 2015 - 05:02 pm:   

Hi Mitch,

What version of NowSMS are you running? If it is a version before 2014-08-11, this will be the case.

When we added this feature, initially it did not support delivery reports. If you go to our download page, and scroll down, you will find newer "Interim Development Releases". The version of NowSMS listed there does have support for delivering MMS delivery reports to a 2-way command.

The MMS delivery report gets converted to an SMS (SMPP) format, and starts with id: followed by the MMS message-id assigned by NowSMS.

--
Des
NowSMS Support