![]() |
AT&T API Platform SDK for Microsoft®
2.3.3
Wrapper classes that allow developers to build robust applications using .NET
|
This cookbook shows you how to develop a Multimedia Messaging Service (MMS) application using the Platform SDK for Microsoft.
The Platform SDK for Microsoft provides the following methods:
To use these methods in an application, perform the following steps:
To send an MMS message, invoke the SendMms method using the RequestFactory instance by passing the destination address (Mobile number), the message, and the list of files as arguments. This method sends an MMS message to the mobile device, as shown in the following code example.
string phoneNo = "xxxxxxxxxx"; string message = "xxxxxxxxxxxx xxxxxxxxxxxxx"; // If true, the application expects a delivery status notification. // The default value is null. bool notifyDeliveryStatus = true; List<string> attachments = null; attachments.Add("xxxxxxxxxxxxx.jpg"); attachments.Add("xxxxxxxxxxxxx.gif"); MmsResponse resp = this.requestFactory.SendMms(phoneNo, message, attachments, null, notifyDeliveryStatus);
To get the status of an MMS delivery request, invoke the GetMmsDeliveryResponse method using the RequestFactory instance, as shown in the following code example. This method enables applications to retrieve the status of a previously submitted MMS delivery request that was accepted by the AT&T Network for delivery to the destination mobile device. The identifier that is returned in the response of the corresponding call to the SendMms method must be provided as a parameter to the GetMmsDeliveryResponse method.
string mmsid = "xxxxxxxxxxxxxxx"; MmsDeliveryResponse resp = this.requestFactory.GetMmsDeliveryResponse(mmsid);
When you register an application with the AT&T Developer Program at https://developer.att.com, you receive a short code that identifies the application on the AT&T Mobile Network. Messages, like MMS, that are sent to your application over the network are sent to this short code. To process these messages in your application, you must retrieve them from the platform using the application short code in a callback listener mechanism.
To receive Mobile Originated MMS messages that were sent to your application short code instantaneously, register a callback listener application URL with the AT&T Developer Program at https://developer.att.com. The URL that you register is used by the AT&T Platform to forward the received messages to your application.
To receive MMS messages, invoke the GetMms method on the RequestFactory class by passing a System.IO.Stream object and a directory path where received MMS attachments must be saved as the arguments to the method, as shown in the following code example. This method retrieves the MMS content from the input stream.
// .NET Framework Request.InputStream // gets the contents of the incoming http entity body. System.IO.Stream inputStream = Request.InputStream; string directoryPath = "xxxx\\xxxx\\xxxx\\"; InboundMmsMessage inboundMmsMessage = RequestFactory.GetMms(inputStream, directoryPath);
To get the final delivery status of the MMS messages sent by your application, register a listener endpoint with the AT&T system during the application registration process or add a listener endpoint to the application profile during an update of the application. The endpoint is then associated with the short code assigned to the application. Your application must set the notifyDeliveryStatus parameter to true in the sendMms call to get delivery notifications.
To receive MMS Delivery Status, invoke the GetMMSDeliveryStatus method using the RequestFactory class by passing a System.IO.Stream object as an argument to the method, as shown in the following code example.
// .NET Framework Request.InputStream // gets the contents of the incoming http entity body. System.IO.Stream stream = Request.InputStream; MmsDeliveryStatus mmsDeliveryStatus = RequestFactory.GetMMSDeliveryStatus(stream);