Platform SDK: Web Telephony Engine

Sending Notifications

Notifications are used to signal an application that the data in the persistent storage of an WTEVendorDataSet object has been modified.

COM-based programs typically use the Connection Point mechanism (the standard COM notifications mechanism) for a sink interface with a single method called OnChange.

The following example uses the onchange event to report the number of callers who received a busy signal. Notice the WithEvents statement that is used for an outgoing interface.

Dim WTE As New WTE
Dim WithEvents ps As WTEVendorDataSet
Set ps = WTE.Arrays(1).VendorsDataSets(NameOfMySet).Value(1)
 
Private Sub ps_OnChange()
    ps.Refresh
    MsgBox "BusySignal count is:" & ps("Statistics").Value("Busy Signal Count")
End Sub

The following example uses the WTEVendorDataSet.Name property to identify the current user.

Dim WTE As New WTE
Dim WithEvents pd As WTEVendorDataSet

Private Sub Start_Click()
    Set pd = WTE.Arrays(1).VendorDataSets(1).Name = "Adi"
    MsgBox "click - user is:" & pd("UserName")
    pd.Save
End Sub

Private Sub pd_OnChange()
    pd.Refresh
    MsgBox "pd_OnChange - user is:" & pd("UserName")
End Sub

C/C++ programmers who don't wish to write a COM sink interface, or don't have a message loop in their program, can use a simpler method for notifications. Pass the return value of the method WTEVendorDataSet.WaitForChanges to an event handle that is signaled whenever changes occur. You can also use the Microsoft Win32® API RegisterWaitForSingleObject function to wait for the event.

There are cases when it is better to use Connection Point, and cases where the WaitForChanges property works more efficiently. Here are some implementation details that may help you decide upon the best notification method for your purposes:

For more information on using connection points, see IConnectionPoint.