Telephony API using Qt Mobile Extension

From Qt Wiki
Jump to navigation Jump to search

Template:ArticleMetaData Template:Abstract Template:Warning

Precondition[edit | edit source]

  • 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[edit | edit source]

  1. include <XQTelephony>

Making a Circuit-Switched Telephone Call[edit | edit source]

XQTelephony* telephony = new XQTelephony(this); telephony->call("+9190000000000");


Get Notification of the call status change[edit | edit source]

   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[edit | edit source]

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 
                          }
         }
}