Share via


Using an InstantMessagingFlowTemplate

The InstantMessagingSettings property provides access to global configuration settings for instant message (IM) flows using an InstantMessagingFlowTemplate object.

The following code shows the settings that can be configured for IM flows (represented by InstantMessagingFlow objects) using the InstantMessagingFlowTemplate class.

Member

Description

InstantMessagingFlowTemplate()

Constructor. Create a new instance of the InstantMessagingFlowTemplate class.

InstantMessagingFlowTemplate()

InstantMessagingFlowTemplate(InstantMessagingFormat)

Constructor. Create a new instance of the InstantMessagingFlowTemplate class, specifying the formats that can be used.

InstantMessagingFlowTemplate(InstantMessagingFormat)

InstantMessagingFlowTemplate(InstantMessagingFlowTemplate)

Constructor. Create a new instance of the InstantMessagingFlowTemplate class, using values from the specified flow template.

InstantMessagingFlowTemplate(InstantMessagingFlowTemplate)

ComposingTimeoutValue

Property. Gets or sets the value (in seconds) for composing time-out.

This property is used to control the default value used for all instant messaging flows. The default value is 3 seconds, and the maximum value is 30 seconds.

int ComposingTimeoutValue {get; set;}

MessageConsumptionMode

Property. Gets or sets the value that an application can use to indicate how it intends to handle instant messages.

The incoming messages are handled accordingly. If the application consumes messages locally, incoming messages are automatically acknowledged with a 200 response code. If the application proxies the messages, the incoming messages are automatically acknowledged with a 202 response code (if the remote supports message delivery notifications) or if the response is delayed. The application is responsible for sending a delivery notification later for every message received. The default value is InstantMessageConsumptionMode.ConsumedLocally.

InstantMessageConsumptionMode MessageConsumptionMode {get; set;}

SupportedFormats

Property. Gets the value that indicates the consumption mode of the application.

InstantMessagingFormat SupportedFormats {get; set;}

ToastFormatSupport

Property. Gets or sets the toast format support value, a value of the CapabilitySupport enumeration.

CapabilitySupport ToastFormatSupport {get; set;}

WaitingForDeliveryNotificationDisabled

Property. Gets or sets the value that controls whether the BeginSendInstantMessage operation will wait for delivery notifications before completion.

bool WaitingForDeliveryNotificationDisabled {get; set;}

This property is new in Microsoft Unified Communications Managed API (UCMA) 3.0.

Applications specify their consumption mode using the InstantMessageConsumptionMode enumeration. The following table lists the enumeration values for this type.

Enumeration value

Description

ConsumedLocally

The message is consumed locally as soon as it is delivered. This is the default consumption mode.

ProxiedToRemoteEntity

The message is proxied to a remote entity. The success or failure of the delivery is known only later.

If the application hosts a remote client, there can be a delay when the client sends the typing indications to a backend server. For this reason, the default value of three seconds for the idle time-out period may not be long enough. The application can set the idle time-out period to a larger value using flow settings.

The SupportedFormats property lists the content types that the application supports for consuming messages received in the flow.

The internal IM media provider supports the sending and receiving of delivery notification messages that are sent by applications that do not directly consume messages, but serve as proxies for delivering the received messages to remote entities. A user-created Web server application is an example of such an application. If an application configures the flow as ProxiedToRemoteEntity, the application must register for the MessageReceived event on the flow, and must send message delivery notifications with the BeginSendSuccessDeliveryNotification(InstantMessageId, AsyncCallback, Object) or BeginSendFailureDeliveryNotification(InstantMessageId, Int32, AsyncCallback, Object) method. Because the messages are serialized, there might be an impact on application performance.

InstantMessagingFlow exposes the DeliveryNotificationReceived event, which is raised when an incoming delivery notification message is received. InstantMessagingFlow also exposes two methods to send delivery notifications to the message sender: BeginSendFailureDeliveryNotification and BeginSendSuccessDeliveryNotification.

An application that uses either of the overloaded BeginSendInstantMessage methods has no need to use the DeliveryNotificationReceived event, unless WaitingForDeliveryNotificationDisabled is set to true. The BeginSendInstantMessage methods automatically match incoming delivery notification messages to pending “SendMessage” operations that wait for them.