Ozeki VoIP SDK - Product Guide
Did you know?
This SDK was used to build:Ozeki Phone System XE - VoIP PBX Software for Developers Which is a high performance PBX system supporting Mobile and Desktop phones.
It was also used to create Ozeki 3D VoIP softphone. A cool SIP client that allows 3D Video calls.
How to read Bluetooth Headset buttons
with Ozeki VoIP SIP SDK using C#?
This example demonstrates how to fetch events generated by pressing bluetooth buttons. You can connect these events to your C# application and catch them by an active window. If a window pops up it becomes active. It is a great way to accept or reject incoming calls.
Do not forget that your bluetooth headsets must be paired with the machine that runs Ozeki VoIP SIP SDK. You will know that it is paired from the constantly glowing blue LED. If the LED is flashing your device is turned on, although it is not paired. Use a bluetooth adapter to pair it.
Remember that you need to INVITE SIP requests to answer the call, which you can fully understand if you study How to register to a SIP PBX chapter and the How to accept incoming call chapter first. Keep in mind that you need to have Ozeki VoIP SIP SDK installed, and a reference to ozeki.dll should be added to your C# project. Try out this example with Visual Studio.
Figure 1 - How to accept a call with a Bluetooth Headset
A short reminder how to accept calls
Softphones created by the Ozeki VoIP SIP SDK can get notifications of incoming calls by
subscribing to the Incmoning Call event of the softphone's object.
You can accept the call if the event occurs with the Answer() method which you can
find in the call object. Answer() changes the call's state to 'InCall'.
Connect your Bluetooth Headset to Windows
Our example works on Microsoft Windows, but keep in mind to plug in an USB Bluetooth adapter before connecting your Bluetooth Headset. Turn on your headset and connect it to the operating system (Figure 2).
Figure 2 - Connect your Bluetooth Headset
Logging bluetooth buttons
Find a great example in Ozeki VoIP SIP SDK that logs any bluetooth keypress (Figure 3).
Figure 3 - Button events detected (example in VoIP SIP SDK)
- BluetoothHeadSetButtonHandling_WF (Workflow Foundation project)
- BluetoothHeadSetButtonHandling_WPF (Windows Presentation Foundation)
You can find them in the following directory:
C:\Users\user\Documents\Ozeki\Ozeki SDK\Examples\VoIP\06_DevelopersGuide\01_SoftphoneBasic
How does the C# example work
Look at 'MainForm.cs' from BluetoothHeadSetButtonHandling_WF (Figure 4)
This code renders an event to the button (button1.Click += Button1_Click;) By clicking it, you can open the 'Key Event Window' as seen on Figure 3. An '_eventWindow_OnMediaKeyPressed' event will be rendered to the window as well. If called, this event will generate an AddToLogBox(e) method, where 'e' contains the event args to be logged on 'MainWindow' (Figure 3, above).
'MainForm.cs' from BluetoothHeadSetButtonHandling_WFusing System; using System.Windows.Forms; using Ozeki.Media; namespace BluetoothHeadSetButtonHandling_WF { public partial class MainForm : Form { public MainForm() // is 'MainWindow' on Figure 3 { InitializeComponent(); button1.Click += Button1_Click; } private BluetoothHeadsetButtonListener_WF _eventWindow; private void Button1_Click(object sender, EventArgs e) { if(_eventWindow == null) { _eventWindow = new BluetoothHeadsetButtonListener_WF(this); _eventWindow.OnMediaKeyPressed += _eventWindow_OnMediaKeyPressed; _eventWindow.FormClosed += _eventWindow_FormClosed; } _eventWindow.Show(); _eventWindow.Activate(); _eventWindow.WindowState = FormWindowState.Normal; } private void _eventWindow_FormClosed(object sender, FormClosedEventArgs e) { _eventWindow.OnMediaKeyPressed -= _eventWindow_OnMediaKeyPressed; _eventWindow.FormClosed -= _eventWindow_FormClosed; } private void _eventWindow_OnMediaKeyPressed (object sender, Ozeki.Common.OzMediaButtonEventArgs e) { var action = new Action(() => AddToLogBox(e)); BeginInvoke(action); } private void AddToLogBox(Ozeki.Common.OzMediaButtonEventArgs e) { logBox.Items.Add(e); logBox.SelectedIndex = logBox.Items.Count - 1; } } }Figure 4 - The content of 'MainForm.cs'
BEGINNER
Getting started
Downloading VoIP SIP SDK
Installation steps
PBX configuration
Examples with source code
INTERMEDIATE
VoIP technology walkthrough
SIP softphone development
Webphone development
Mobile development
Voice recording
GETTING AROUND
Sitemap
Search the manual
API documentation
FAQ
Acknowledgements