Beispiel #1
0
/*!
  Accepts an incoming call.  Has no effect if there is no incoming call.
*/
void DialerControl::accept()
{
    QList<QPhoneCall> incomingCalls = findCalls( QPhoneCall::Incoming );
    if( incomingCalls.count() )
    {
        QPhoneCall incoming = incomingCalls.first();
        if ( incoming.incoming() ) {
            //put active calls on hold
            if ( incoming.callType() == "Voice" ) {   // No tr
                // GSM calls will be put on hold automatically by the accept().
                // Other call types need to be put on hold explicitly.
                if( hasActiveCalls() ) {
                    if ( activeCalls().first().callType() == "Voice" ) {  // No tr
                        incoming.accept();
                    } else {
                        hold();
                        incoming.accept();
                    }
                } else {
                    incoming.accept();
                }
            } else {
                if( hasActiveCalls() )
                    hold();
                incoming.accept();
                incoming.activate();
            }
        }
    }
}
Beispiel #2
0
/*!
  Joins the active calls and calls on hold to form a multiparty call,
  and then detaches the local user.
*/
void DialerControl::transfer()
{
    QList<QPhoneCall> coh = callsOnHold();
    if (  hasActiveCalls() && coh.count() ) {
        coh.first().join( true );
    }
}
Beispiel #3
0
/*!
  Places the active calls on hold.  If there were calls already on hold,
  they will become active.
*/
void DialerControl::hold()
{
    if ( hasActiveCalls() ) {
        emit callControlRequested();
        active().connectStateChanged( this, SLOT(checkHoldState(QPhoneCall)) );
        active().hold();
    }
}
Beispiel #4
0
/*!
  Joins the active calls and calls on hold to form a multiparty call.
*/
void DialerControl::join()
{
    QList<QPhoneCall> coh = callsOnHold();
    if ( hasActiveCalls() && coh.count() ) {
        emit callControlRequested();
        callsOnHold().first().connectStateChanged( this, SLOT(checkConnectedState(QPhoneCall)) );
        callsOnHold().first().join();
    }
}
Beispiel #5
0
void checkGlobalSettings(void *g_zrtp){
   
   if(g_Settings.iClearZRTPCaches && !hasActiveCalls()){
      g_Settings.iClearZRTPCaches=0;
      
      void clearZrtpCachesG(void *pZrtpGlobals);
      clearZrtpCachesG(g_zrtp);
      
      puts("caches cleared");
   }
}
Beispiel #6
0
/*!
  Dials a \a number if there are no currently active calls. If a
  \a contact is specified, it is used as the contact to display and
  insert into the call history. Before calling this function,
  you should check that there are no incoming calls, or active calls.
  If \a sendcallerid is true, then send the caller's identifier as part
  of the dial sequence.

  If \a callType is "Voice" a GSM call will be dialed.  If \a callType is
  "VoIP" a VoIP call will be dialed.
*/
void DialerControl::dial( const QString &number, bool sendcallerid, const QString& callType, const QUniqueId &contact )
{

    QUniqueId matchedContact;
    if (contact.isNull() && !number.isEmpty())
        matchedContact = ServerContactModel::instance()->matchPhoneNumber(number).uid();
    else
        matchedContact = contact;

    if ( isDialing() ) {
        //qWarning("BUG! Attempt to dial while there is already a dialing call");
    }
    if( !hasActiveCalls() && !isDialing() )
    {
        // Collect up the dial options.
        QDialOptions dialopts;
        dialopts.setNumber( number );
        if ( sendcallerid )
            dialopts.setCallerId( QDialOptions::SendCallerId );
        else
            dialopts.setCallerId( QDialOptions::DefaultCallerId );
        dialopts.setContact( matchedContact );

        // Allow other parts of the server (e.g. GsmKeyActions) to
        // modify the dial options to account for supplementary services.
        bool handledAlready = false;
        emit modifyDial( dialopts, handledAlready );
        if ( handledAlready )
            return;

        // Call the specified number.
        QPhoneCall call = createCall(callType);
        phoneValueSpace.setAttribute( "LastDialedCall", QVariant(number) );
        call.dial( dialopts );

        // cache call here to preserve the information even if the battery run out.
        cacheCall( call );
    }
}
Beispiel #7
0
void DialerControl::callStateChanged( const QPhoneCall& call )
{
    // Set value space appropriately
    // XXX Optimize for redundancy!
    if(hasIncomingCall()) {
        QPhoneCall icall = incomingCall();
        QString number = icall.number();
        QString name;
        QUniqueId contact = icall.contact();
        QContactModel *m = ServerContactModel::instance();
        if(!contact.isNull()) {
            QContact cnt = m->contact(contact);
            if (!cnt.uid().isNull())
                name = cnt.label();
        } else if(!number.isEmpty()) {
            QContact cnt = m->matchPhoneNumber(number);
            if (!cnt.uid().isNull())
                name = cnt.label();
        } else {
            number = tr("Unknown", "Unknown caller");
        }
        phoneValueSpace.setAttribute("Incoming/Number", QVariant(number.trimmed()));
        phoneValueSpace.setAttribute("Incoming/Name", QVariant(name));

        if(!aaTid && mProfiles->activeProfile().autoAnswer())
            aaTid = startTimer(auto_answer_gap);
    } else {
        if(aaTid)
            killTimer(aaTid);
        phoneValueSpace.removeAttribute("Incoming");
    }

    // emit useful signals
    if( call.state() == QPhoneCall::Connected )
    {
        emit callConnected( call );
        // update cached call info.
        updateCachedCall( call );
    }
    else if( call.state() == QPhoneCall::Hold )
    {
        emit callPutOnHold( call );
    }
    else if( call.dialing() )
    {
        emit callDialing( call );
    }
    else if( call.incoming() )
    {
        // Turn off screen saver so the incoming call will be visible.
        QtopiaPowerManager::setActive(false);

        emit callIncoming( call );
    }
    else if ( call.dropped()  )
    {
        emit callDropped( call );
    }
    doActiveCalls();

    // Disable screen saver if in a call
    if (hasIncomingCall() || hasActiveCalls() || hasCallsOnHold())
        QtopiaApplication::setPowerConstraint(QtopiaApplication::DisableLightOff);
    else
        QtopiaApplication::setPowerConstraint(QtopiaApplication::Enable);

    emit stateChanged();
}
Beispiel #8
0
/*!
  Returns true if there are any calls active or on hold.
*/
bool DialerControl::isConnected() const
{
    return hasActiveCalls() || hasCallsOnHold();
}