Mobile Caller ID feature in the Spokes SDK allows application developers to answer, end, reject mobile calls from their host application. They can also get caller ID for an incoming mobile call, make call and redial the last number dialed on the mobile phone.
Spokes SDK developers can access the IATDCommand interface by casting the HostCommand property in IDevice. If it returns a valid interface then the device supports caller ID. Applications can also register for mobile presence events by registering for the PresenceChanged event exposed in DeviceEvents property or by accessing the ATDStateChanged event exposed in DeviceListener property of IDevice.
Following interfaces IATDCommand, IMobilePresenceEvents, IDeviceListenerEvents will expose Mobile presence event and caller ID as part of the Spokes SDK. These interfaces can be accessed by applications that directly interface with the device manager or plug-ins that interface with the Spokes SDK. This feature is currently support only with BUA300 dongle and a Voyager Legend UC Headset which is multipoint paired and connected to a supported mobile phone.
IATDCommand Interface
publicinterfaceIATDCommand
{
bool AnswerMobileCall();
bool EndMobileCall();
bool MakeMobileCall(String callerID);
bool Redial();
bool GetMobileCallStatus();
String CallerID { get; }
bool MuteMobileCall(bool bMute); //NOT Supported
}
Method: bool AnswerMobileCall()
AnswerMobileCall() will answer an incoming mobile call when a multipoint BT dongle or base is paired with a headset and a mobile phone.
Method: bool EndMobileCall()
EndMobileCall() will end a mobile call when a multipoint BT dongle or base is paired with a headset and a mobile phone. This method can be used to reject an incoming mobile call.
Method: bool MakeMobileCall(String callerID)
MakeMobileCall() will dial the given caller using the mobile phone when a multipoint BT dongle or base is paired with a headset and a mobile phone.
Method: bool Redial()
Redial() will dial the last # dialed using the mobile phone when a multipoint BT dongle or base is paired with a headset and a mobile phone.
Method: bool GetMobileCallStatus()
GetMobileCallStatus() will report the current mobile status via the PresenceChanged and the ATDStateChanged event.
Property: String CallerID{ get; }
CallerID property returns the Mobile phone caller #. Initially, the callerID will be an empty string and while on an incoming/active call calling GetMobileCallStatus() will request the mobile call status and populate the CallerID based on the response from the device. CallerID when there is no active call will return the last calls callerID which can be use to redial using MakeMobileCall().
Method: bool MuteMobileCall(bool bMute)
MuteMobileCall() is used to MUTE or UnMUTE a mobile phone call when a multipoint BT dongle or base is paired with a headset and a mobile phone. This API is currently not supported.
IMobilePresenceEvents Interface
publicinterfaceIMobilePresenceEvents
{
eventMobilePresenceEventHandler PresenceChanged;
}
IDeviceListenerEvents Interface
publicinterfaceIDeviceListenerEvents
{
//Headset : Covers Corded, Cordless headsets events
eventDeviceListenerEventHandler HeadsetButtonPressed;
eventDeviceListenerEventHandler HeadsetStateChanged;
//Base: Covers Base, Hub, Handset events
eventDeviceListenerEventHandler BaseButtonPressed;
eventDeviceListenerEventHandler BaseStateChanged;
//ATD: Covers Mobile, PSTN and other ATD events
eventDeviceListenerEventHandler ATDStateChanged;
}
Code snippets:
Sample 1: Registering for Mobile Presence:
IDevice m_device = null;
IATDCommand m_atdCommand = null;
IDeviceListener m_devListener = null;
IMobilePresenceEvents m_mobileEvents = null;
//Get a valid device and init m_device
….
//Cast HostCommand and init m_atdCommand, m_devListener and m_mobileEvents
m_atdCommand = device.HostCommand asIATDCommand;
m_devListener = device.DeviceListener asIDeviceListener;
m_mobileEvents = device.DeviceEvents asIMobilePresenceEvents;
//Register for Mobile PresenceChanged event on Attach()to the device
if (m_mobileEvents != null)
{
m_mobileEvents.PresenceChanged += mobileEvents_PresenceChanged;
}
//Register for Mobile PresenceChanged event on Detach() to the device
if (m_mobileEvents != null)
m_mobileEvents.PresenceChanged -= mobileEvents_PresenceChanged;
void mobileEvents_PresenceChanged(object sender, MobilePresenceEventArgs e)
{
UpdateMobilePresence(e);
}
privatevoid UpdateMobilePresence(MobilePresenceEventArgs e)
{
StringBuilder strB = newStringBuilder();
strB.Append("Mobile Presence: ");
if ( e.State == MobileCallState.CallerID)
strB.Append(String.Format("{0} = {1}", e.State.ToString(), e.CallerID));
else
strB.Append(String.Format("{0}", e.State.ToString()));
strB.Append(String.Format(" ( {0} )", DateTime.Now.TimeOfDay.ToString()));
strB.AppendLine();
//Update UI after marshalling to Main GUI thread
richTextBoxTrace.AppendText(strB.ToString());
}
Sample 2: Make call using mobile phone
privatevoid radBMobileMakeCall_Click(object sender, EventArgs e)
{
try
{
if (m_atdCommand != null)
{
m_atdCommand.MakeMobileCall("8314581000");
}
}
catch (DeviceManagerException ex)
{
MessageBox.Show(ex.Message, "Spokes DM SDK");
}
}
Sample 3: Redial using CallerID
privatevoid radBMobileRedial_Click(object sender, EventArgs e)
{
try
{
if (m_atdCommand != null)
{
if ( m_atdCommand.CallerID != String.Empty)
m_atdCommand.MakeMobileCall(m_atdCommand.CallerID);
}
}
catch (DeviceManagerException ex)
{
MessageBox.Show(ex.Message, "Spokes DM SDK");
}
}