Telephony API using Qt Mobile Extension
Article Metadata
This article shows how you can use the Qt Telephony Mobile Extension (XQTelephony) to make circuit switched calls and get call status notifications.
Warning: Note that Archived:Mobile Extensions are deprecated, and cross platform Qt Mobility APIs should be used instead. However at time of writing Qt Mobility 1.1 does not have telephony support.
Contents |
Precondition
- In order to use an extension you need to add the source files of that extension to your project in your IDE and build them together as part of your application source codes.
- You can get more information about Mobile extension from Archived:Mobile Extensions
- Please read this Wiki article for How to use Mobile Extension APIs in Qt
Headers
#include <XQTelephony>Making a Circuit-Switched Telephone Call
XQTelephony* telephony = new XQTelephony(this);
telephony->call("+9190000000000");
Get Notification of the call status change
XQTelephony* telephony = new XQTelephony(this);
// Connect lineStatusChanged() Signal to handleStatusChange() Slot
connect(telephony, SIGNAL(lineStatusChanged(XQTelephony::LineStatus, QString)),this, SLOT(handleStatusChange(XQTelephony::LineStatus, QString)));
// Our slot for handling telephone line status changes
void MyTelephoneLineListener::handleLineStatusChange(XQTelephony::LineStatus status, QString number)
{
switch(status)
{
case XQTelephony::StatusRinging:
{
}
case XQTelephony::StatusIdle:
{
}
case XQTelephony::StatusDialling:
{
}
case XQTelephony::StatusConnecting:
{
}
case XQTelephony::StatusConnected:
{
}
case XQTelephony::StatusDisconnecting:
{
}
case XQTelephony::StatusHold:
{
}
case XQTelephony::StatusTransferring:
{
}
}
}
Get Notification for the Incoming call
To get notification for incoming call, the LineStatus of the call is StatusRinging
XQTelephony* telephony = new XQTelephony(this);
// Connect lineStatusChanged() Signal to handleStatusChange() Slot
connect(telephony, SIGNAL(lineStatusChanged(XQTelephony::LineStatus, QString)),this, SLOT(handleStatusChange(XQTelephony::LineStatus, QString)));
// Our slot for handling telephone line status changes
void MyTelephoneLineListener::handleLineStatusChange(XQTelephony::LineStatus status, QString number)
{
switch(status)
{
// get notification for incoming call
case XQTelephony::StatusRinging:
{
// Incoming call comes.
// add action
}
}
}


(no comments yet)