QXmppCallManager.h
/*
* Copyright (C) 2008-2014 The QXmpp developers
*
* Author:
* Jeremy Lainé
*
* Source:
* https://github.com/qxmpp-project/qxmpp
*
* This file is a part of QXmpp library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/
#ifndef QXMPPCALLMANAGER_H
#define QXMPPCALLMANAGER_H
#include <QObject>
#include <QIODevice>
#include <QMetaType>
#include "QXmppClientExtension.h"
#include "QXmppLogger.h"
class QHostAddress;
class QXmppCallPrivate;
class QXmppCallManager;
class QXmppCallManagerPrivate;
class QXmppIq;
class QXmppJingleCandidate;
class QXmppJingleIq;
class QXmppJinglePayloadType;
class QXmppPresence;
class QXmppRtpAudioChannel;
class QXmppRtpVideoChannel;
class QXMPP_EXPORT QXmppCall : public QXmppLoggable
{
Q_OBJECT
Q_ENUMS(Direction State)
Q_FLAGS(QIODevice::OpenModeFlag QIODevice::OpenMode)
Q_PROPERTY(Direction direction READ direction CONSTANT)
Q_PROPERTY(QString jid READ jid CONSTANT)
Q_PROPERTY(State state READ state NOTIFY stateChanged)
Q_PROPERTY(QIODevice::OpenMode audioMode READ audioMode NOTIFY audioModeChanged)
Q_PROPERTY(QIODevice::OpenMode videoMode READ videoMode NOTIFY videoModeChanged)
public:
enum Direction
{
IncomingDirection,
OutgoingDirection
};
enum State
{
ConnectingState = 0,
ActiveState = 1,
DisconnectingState = 2,
FinishedState = 3
};
~QXmppCall();
QXmppCall::Direction direction() const;
QString jid() const;
QString sid() const;
QXmppCall::State state() const;
QXmppRtpAudioChannel *audioChannel() const;
QIODevice::OpenMode audioMode() const;
QXmppRtpVideoChannel *videoChannel() const;
QIODevice::OpenMode videoMode() const;
signals:
void connected();
void finished();
void ringing();
void stateChanged(QXmppCall::State state);
void audioModeChanged(QIODevice::OpenMode mode);
void videoModeChanged(QIODevice::OpenMode mode);
public slots:
void accept();
void hangup();
void startVideo();
void stopVideo();
private slots:
void localCandidatesChanged();
void terminated();
void updateOpenMode();
private:
QXmppCall(const QString &jid, QXmppCall::Direction direction, QXmppCallManager *parent);
QXmppCallPrivate *d;
friend class QXmppCallManager;
friend class QXmppCallManagerPrivate;
friend class QXmppCallPrivate;
};
class QXMPP_EXPORT QXmppCallManager : public QXmppClientExtension
{
Q_OBJECT
public:
QXmppCallManager();
~QXmppCallManager();
void setStunServer(const QHostAddress &host, quint16 port = 3478);
void setTurnServer(const QHostAddress &host, quint16 port = 3478);
void setTurnUser(const QString &user);
void setTurnPassword(const QString &password);
QStringList discoveryFeatures() const;
bool handleStanza(const QDomElement &element);
signals:
void callReceived(QXmppCall *call);
void callStarted(QXmppCall *call);
public slots:
QXmppCall *call(const QString &jid);
protected:
void setClient(QXmppClient* client);
private slots:
void _q_callDestroyed(QObject *object);
void _q_disconnected();
void _q_iqReceived(const QXmppIq &iq);
void _q_jingleIqReceived(const QXmppJingleIq &iq);
void _q_presenceReceived(const QXmppPresence &presence);
private:
QXmppCallManagerPrivate *d;
friend class QXmppCall;
friend class QXmppCallPrivate;
friend class QXmppCallManagerPrivate;
};
Q_DECLARE_METATYPE(QXmppCall::State)
#endif
QXmppJingleIq
The QXmppJingleIq class represents an IQ used for initiating media sessions as specified by XEP-0166:...
Definition: QXmppJingleIq.h:154
QXmppJinglePayloadType
The QXmppJinglePayloadType class represents a payload type as specified by XEP-0167: Jingle RTP Sessi...
Definition: QXmppJingleIq.h:40
QXmppLoggable
The QXmppLoggable class represents a source of logging messages.
Definition: QXmppLogger.h:111
QXmppClientExtension::discoveryFeatures
virtual QStringList discoveryFeatures() const
Definition: QXmppClientExtension.cpp:54
QXmppCall::Direction
Direction
This enum is used to describe the direction of a call.
Definition: QXmppCallManager.h:66
QXmppCall::IncomingDirection
The call is incoming.
Definition: QXmppCallManager.h:68
QXmppRtpAudioChannel
The QXmppRtpAudioChannel class represents an RTP audio channel to a remote party. ...
Definition: QXmppRtpChannel.h:75
QXmppPresence
The QXmppPresence class represents an XMPP presence stanza.
Definition: QXmppPresence.h:36
QXmppClientExtension::handleStanza
virtual bool handleStanza(const QDomElement &stanza)=0
You need to implement this method to process incoming XMPP stanzas.
QXmppIq
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:42
QXmppJingleCandidate
The QXmppJingleCandidate class represents a transport candidate as specified by XEP-0176: Jingle ICE-...
Definition: QXmppJingleIq.h:84
QXmppClientExtension
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:47
QXmppCall
The QXmppCall class represents a Voice-Over-IP call to a remote party.
Definition: QXmppCallManager.h:53
QXmppCall::State
State
This enum is used to describe the state of a call.
Definition: QXmppCallManager.h:73
QXmppRtpVideoChannel
The QXmppRtpVideoChannel class represents an RTP video channel to a remote party. ...
Definition: QXmppRtpChannel.h:255
QXmppClientExtension::setClient
virtual void setClient(QXmppClient *client)
Definition: QXmppClientExtension.cpp:79
QXmppCallManager
The QXmppCallManager class provides support for making and receiving voice calls. ...
Definition: QXmppCallManager.h:160
QXmppClient
The QXmppClient class is the main class for using QXmpp.
Definition: QXmppClient.h:80