Ring Daemon 16.0.0
|
#include <call.h>
Public Types | |
enum class | CallState : unsigned { INACTIVE , ACTIVE , HOLD , BUSY , PEER_BUSY , MERROR , OVER , COUNT__ } |
The Call State. More... | |
enum class | CallType : unsigned { INCOMING , OUTGOING , MISSED } |
This determines if the call originated from the local user (OUTGOING) or from some remote peer (INCOMING, MISSED). More... | |
enum class | ConnectionState : unsigned { DISCONNECTED , TRYING , PROGRESSING , RINGING , CONNECTED , COUNT__ } |
Tell where we're at with the call. More... | |
enum class | LinkType { GENERIC , SIP } |
using | OnReadyCb = std::function< void(bool)> |
using | StateListenerCb = std::function< bool(CallState, ConnectionState, int)> |
using | SubcallSet = std::set< std::shared_ptr< Call >, std::owner_less< std::shared_ptr< Call > > > |
Public Member Functions | |
void | addStateListener (StateListenerCb &&listener) |
void | addSubCall (Call &call) |
Attach subcall to this instance. | |
virtual void | answer ()=0 |
Answer the call. | |
virtual void | answer (const std::vector< libjami::MediaMap > &mediaList)=0 |
Answer a call with a list of media attributes. | |
virtual void | answerMediaChangeRequest (const std::vector< libjami::MediaMap > &mediaList, bool isRemote=false)=0 |
Answer to a media update request. | |
virtual bool | attendedTransfer (const std::string &to)=0 |
Attended transfer. | |
virtual void | carryingDTMFdigits (char code)=0 |
Send DTMF. | |
virtual bool | checkMediaChangeRequest (const std::vector< libjami::MediaMap > &remoteMediaList)=0 |
Check the media of an incoming media change request. | |
int | conferenceProtocolVersion () const |
virtual std::vector< libjami::MediaMap > | currentMediaList () const =0 |
Retrieve current medias list. | |
virtual void | enterConference (std::shared_ptr< Conference > conference)=0 |
virtual void | exitConference ()=0 |
std::weak_ptr< Account > | getAccount () const |
std::string | getAccountId () const |
virtual std::shared_ptr< SystemCodecInfo > | getAudioCodec () const |
virtual std::map< std::string, bool > | getAudioStreams () const =0 |
std::chrono::milliseconds | getCallDuration () const |
const std::string & | getCallId () const |
Return a reference on the call id. | |
CallType | getCallType () const |
std::shared_ptr< Conference > | getConference () const |
Return a reference on the conference id. | |
std::vector< std::map< std::string, std::string > > | getConferenceInfos () const |
ConnectionState | getConnectionState () const |
Get the connection state of the call (protected by mutex) | |
virtual std::map< std::string, std::string > | getDetails () const |
virtual LinkType | getLinkType () const |
virtual std::vector< MediaAttribute > | getMediaAttributeList () const =0 |
const std::string & | getPeerDisplayName () const |
Get the peer display name (caller in ingoing) not protected by mutex (when created) | |
const std::string & | getPeerNumber () const |
Get the peer number (destination on outgoing) not protected by mutex (when created) | |
CallState | getState () const |
Get the call state of the call (protected by mutex) | |
std::string | getStateStr () const |
virtual std::shared_ptr< SystemCodecInfo > | getVideoCodec () const |
virtual void | handleMediaChangeRequest (const std::vector< libjami::MediaMap > &remoteMediaList)=0 |
Process incoming media change request. | |
virtual void | hangup (int reason)=0 |
Hang up the call. | |
virtual bool | hasVideo () const =0 |
virtual bool | isCaptureDeviceMuted (const MediaType &mediaType) const =0 |
bool | isConferenceParticipant () const |
virtual bool | isIceEnabled () const =0 |
Check wether ICE is enabled for media. | |
bool | isIncoming () const |
Tell if the call is incoming. | |
bool | isSubcall () const |
Return true if this call instance is a subcall (internal call for multi-device handling) | |
virtual void | monitor () const =0 |
virtual void | muteMedia (const std::string &mediaType, bool isMuted)=0 |
mute/unmute a media of a call | |
virtual bool | offhold (OnReadyCb &&cb)=0 |
Resume a call from hold state. | |
virtual bool | onhold (OnReadyCb &&cb)=0 |
Put a call on hold. | |
void | onTextMessage (std::map< std::string, std::string > &&messages) |
virtual void | peerHungup () |
Peer has hung up a call. | |
virtual void | refuse ()=0 |
Refuse incoming call. | |
virtual void | removeCall () |
virtual bool | requestMediaChange (const std::vector< libjami::MediaMap > &mediaList)=0 |
Make a change request of the current media with the provided media. | |
void | resetConfInfo () |
virtual void | restartMediaSender ()=0 |
void | sendConfInfo (const std::string &json) |
void | sendConfOrder (const Json::Value &root) |
virtual void | sendKeyframe (int streamIdx=-1)=0 |
virtual void | sendTextMessage (const std::map< std::string, std::string > &messages, const std::string &from)=0 |
Send a message to a call identified by its callid. | |
void | setConferenceInfo (const std::string &msg) |
A Call can be in a conference. | |
void | setIPToIP (bool IPToIP) |
void | setPeerDisplayName (const std::string &name) |
Set the display name (caller in ingoing) not protected by mutex (when created) | |
void | setPeerNumber (const std::string &number) |
Set the peer number (destination on outgoing) not protected by mutex (when created) | |
bool | setState (CallState call_state, ConnectionState cnx_state, signed code=0) |
bool | setState (CallState call_state, signed code=0) |
Set the state of the call (protected by mutex) | |
bool | setState (ConnectionState cnx_state, signed code=0) |
virtual void | switchInput (const std::string &={}) |
virtual bool | toggleRecording () |
This method must be implemented for this interface as calls and conferences have different behavior. | |
const std::string & | toUsername () const |
Get "To" from the invite. | |
void | toUsername (const std::string &username) |
Updated by sipvoiplink, corresponds to the "To" in the invite. | |
virtual void | transfer (const std::string &to)=0 |
Transfer a call to specified URI. | |
virtual void | updateRecState (bool state)=0 |
Update recording state. | |
std::weak_ptr< Call > | weak () |
virtual | ~Call () |
![]() | |
virtual std::string | getPath () const |
Return the file path for this recording. | |
bool | isAudioOnly () const |
bool | isRecording () const |
Return recording state (true/false) | |
Recordable () | |
virtual bool | startRecording (const std::string &path) |
Start recording. | |
virtual void | stopRecording () |
Stop recording. | |
virtual | ~Recordable () |
![]() | |
virtual bool | hasPeerVoice () const |
virtual bool | isPeerMuted () const |
virtual bool | isPeerRecording () const |
virtual void | peerMuted (bool muted, int streamIdx)=0 |
PeerRecorder () | |
virtual void | peerRecording (bool state)=0 |
virtual void | peerVoice (bool voice)=0 |
virtual | ~PeerRecorder () |
Public Attributes | |
std::unique_ptr< AudioDeviceGuard > | audioGuard |
Protected Types | |
using | clock = std::chrono::steady_clock |
using | MsgList = std::list< std::pair< std::map< std::string, std::string >, std::string > > |
MultiDevice: message waiting to be sent (need a valid subcall) | |
using | time_point = clock::time_point |
Protected Member Functions | |
Call (const std::shared_ptr< Account > &account, const std::string &id, Call::CallType type, const std::map< std::string, std::string > &details={}) | |
Constructor of a call. | |
virtual void | merge (Call &scall) |
Replace current call data with ones from the given subcall. | |
Protected Attributes | |
std::weak_ptr< Account > | account_ |
Associate account ID. | |
std::recursive_mutex | callMutex_ {} |
Protect every attribute that can be changed by two threads. | |
CallState | callState_ {CallState::INACTIVE} |
Inactive/Active/Hold/Busy/Error. | |
std::weak_ptr< Conference > | conf_ {} |
Unique conference ID, used exclusively in case of a conference. | |
ConfInfo | confInfo_ {} |
std::mutex | confInfoMutex_ {} |
ConnectionState | connectionState_ {ConnectionState::DISCONNECTED} |
Disconnected/Progressing/Trying/Ringing/Connected. | |
time_point | duration_start_ {time_point::min()} |
const std::string | id_ {} |
MultiDevice: parent call, nullptr otherwise. Access protected by callMutex_. | |
bool | isIPToIP_ {false} |
Direct IP-to-IP or classic call. | |
std::shared_ptr< Call > | parent_ |
MultiDevice: list of attached subcall. | |
int | peerConfProtocol_ {0} |
Supported conference protocol version. | |
std::string | peerDisplayName_ {} |
Peer Display Name. | |
std::string | peerNumber_ {} |
Number of the peer. | |
MsgList | pendingInMessages_ |
MsgList | pendingOutMessages_ |
std::string | reason_ {} |
SubcallSet | subcalls_ |
time_t | timestamp_start_ {0} |
MultiDevice: message received by subcall to merged yet. | |
std::string | toUsername_ {} |
CallType | type_ |
Type of the call. | |
![]() | |
std::mutex | apiMutex_ |
bool | isAudioOnly_ {false} |
std::shared_ptr< MediaRecorder > | recorder_ |
bool | recording_ {false} |
![]() | |
bool | peerMuted_ {false} |
bool | peerRecording_ {false} |
bool | peerVoice_ {false} |
|
protected |
|
protected |
using jami::Call::StateListenerCb = std::function<bool(CallState, ConnectionState, int)> |
using jami::Call::SubcallSet = std::set<std::shared_ptr<Call>, std::owner_less<std::shared_ptr<Call> >> |
|
protected |
|
strong |
|
strong |
|
strong |
Tell where we're at with the call.
The call gets Connected when we know from the other end what happened with out call. A call can be 'Connected' even if the call state is Busy, or Error.
Audio should be transmitted when ConnectionState = Connected AND CallState = Active.
Enumerator | |
---|---|
DISCONNECTED | |
TRYING | |
PROGRESSING | |
RINGING | |
CONNECTED | |
COUNT__ |
|
strong |
|
protected |
Constructor of a call.
id | Unique identifier of the call |
type | set definitely this call as incoming/outgoing |
details | volatile details to customize the call creation |
Definition at line 77 of file call.cpp.
References addStateListener(), CONNECTED, DISCONNECTED, duration_start_, jami::emitSignal(), getAccount(), getCallDuration(), getCallType(), getPeerNumber(), jami::Manager::getRingingTimeout(), jami::hangupCalls(), INCOMING, jami::Manager::instance(), isSubcall(), JAMI_DBG, monitor(), OUTGOING, OVER, reason_, RINGING, jami::runOnMainThread(), jami::ScheduledExecutor::scheduleIn(), jami::Manager::scheduler(), toUsername(), type_, and weak().
|
inline |
Definition at line 330 of file call.h.
References callMutex_, and jami::emitSignal().
Referenced by addSubCall(), and Call().
Attach subcall to this instance.
If this subcall is answered, this subcall and this instance will be merged using merge().
Definition at line 430 of file call.cpp.
References addStateListener(), getCallId(), jami::getPtr(), JAMI_DBG, JAMI_ERR, parent_, removeCall(), sendTextMessage(), and weak().
|
pure virtual |
Answer a call with a list of media attributes.
mediaList | The list of the media attributes. The media attributes set by the caller of this method will determine the response sent to the peer and the configuration of the local media. If the media list is empty, the current media set when the call was created will be used. |
Implemented in jami::SIPCall.
|
pure virtual |
Answer to a media update request.
The media attributes set by the caller of this method will determine the response to send to the peer and the configuration of the local media.
mediaList | The list of media attributes. An empty media list means the media update request was not accepted, meaning the call continue with the current media. It's up to the implementation to determine wether an answer will be sent to the peer. |
isRemote | True if the media list is from the remote peer |
Implemented in jami::SIPCall.
Attended transfer.
The | target call id |
Implemented in jami::SIPCall.
|
pure virtual |
Check the media of an incoming media change request.
This method checks the new media against the current media. It determines if the differences are significant enough to require more processing. For instance, this can be used to check if the a change request must be reported to the client for confirmation or can be handled by the daemon. The conditions that cause this method to return true are implementation specific.
the | new media list from the remote |
Implemented in jami::SIPCall.
|
inline |
Definition at line 450 of file call.h.
References peerConfProtocol_.
|
pure virtual |
|
pure virtual |
Implemented in jami::SIPCall.
Implemented in jami::SIPCall.
|
inline |
Definition at line 141 of file call.h.
References account_.
Referenced by Call(), and jami::Manager::ManagerPimpl::processRemainingParticipants().
std::string jami::Call::getAccountId | ( | ) | const |
Definition at line 158 of file call.cpp.
References JAMI_ERR.
Referenced by jami::Manager::ManagerPimpl::bindCallToConference(), jami::Manager::detachParticipant(), jami::Manager::finish(), jami::Manager::ManagerPimpl::hangupConference(), and jami::transferCall().
|
inlinevirtual |
Reimplemented in jami::SIPCall.
|
inline |
Definition at line 354 of file call.h.
References duration_start_.
Referenced by Call().
|
inline |
Return a reference on the call id.
Definition at line 132 of file call.h.
References id_.
Referenced by jami::Manager::addAudio(), addSubCall(), jami::Manager::addSubCall(), jami::Manager::answerCall(), jami::Manager::ManagerPimpl::bindCallToConference(), jami::Manager::callBusy(), jami::Manager::callFailure(), jami::Manager::finish(), jami::Manager::getCallList(), jami::Manager::incomingCall(), jami::Manager::isCurrentCall(), merge(), jami::onRequestNotify(), jami::onRequestRefer(), jami::Manager::peerAnsweredCall(), jami::Manager::peerHungupCall(), jami::Manager::peerRingingCall(), jami::Manager::ManagerPimpl::processRemainingParticipants(), jami::Manager::removeAudio(), jami::CallFactory::removeCall(), jami::Manager::removeParticipant(), jami::Manager::sendCallTextMessage(), jami::SIPCall::SIPCall(), and jami::transferCall().
|
inline |
|
inline |
Return a reference on the conference id.
Definition at line 138 of file call.h.
References conf_.
Referenced by jami::Manager::addSubCall(), jami::Manager::answerCall(), jami::Manager::incomingMessage(), jami::Manager::removeParticipant(), and jami::Manager::sendCallTextMessage().
|
inline |
Definition at line 438 of file call.h.
References confInfo_, and jami::ConfInfo::toVectorMapStringString().
Call::ConnectionState jami::Call::getConnectionState | ( | ) | const |
Get the connection state of the call (protected by mutex)
Definition at line 167 of file call.cpp.
Referenced by jami::Manager::answerCall(), and merge().
|
virtual |
Reimplemented in jami::SIPCall.
Definition at line 368 of file call.cpp.
References libjami::Call::Details::ACCOUNTID, libjami::Call::Details::AUDIO_MUTED, libjami::Call::Details::AUDIO_ONLY, libjami::Call::Details::CALL_STATE, libjami::Call::Details::CALL_TYPE, libjami::Call::Details::CONF_ID, libjami::Call::Details::DISPLAY_NAME, libjami::Call::Details::PEER_NUMBER, libjami::Call::Details::TIMESTAMP_START, libjami::Call::Details::TO_USERNAME, and libjami::Call::Details::VIDEO_MUTED.
Reimplemented in jami::SIPCall.
Definition at line 126 of file call.h.
References GENERIC.
Referenced by jami::CallFactory::removeCall().
|
pure virtual |
Implemented in jami::SIPCall.
|
inline |
Get the peer display name (caller in ingoing) not protected by mutex (when created)
Definition at line 183 of file call.h.
References peerDisplayName_.
|
inline |
Get the peer number (destination on outgoing) not protected by mutex (when created)
Definition at line 158 of file call.h.
References peerNumber_.
Referenced by Call().
Call::CallState jami::Call::getState | ( | ) | const |
Get the call state of the call (protected by mutex)
Definition at line 174 of file call.cpp.
Referenced by merge(), and jami::SIPCall::SIPCall().
std::string jami::Call::getStateStr | ( | ) | const |
Definition at line 304 of file call.cpp.
Referenced by jami::Manager::ManagerPimpl::bindCallToConference(), jami::Manager::detachParticipant(), and jami::Manager::hasCurrentCall().
|
inlinevirtual |
Reimplemented in jami::SIPCall.
|
pure virtual |
Process incoming media change request.
the | new media list from the remote |
Implemented in jami::SIPCall.
Implemented in jami::SIPCall.
Implemented in jami::SIPCall.
|
inline |
Definition at line 139 of file call.h.
References conf_, jami::emitSignal(), and jami::is_uninitialized().
Referenced by jami::Manager::addAudio(), jami::Manager::ManagerPimpl::bindCallToConference(), jami::Manager::callFailure(), jami::Manager::incomingMessage(), jami::Manager::peerHungupCall(), jami::Manager::sendCallTextMessage(), and jami::Manager::transferCall().
Check wether ICE is enabled for media.
Implemented in jami::SIPCall.
|
inline |
|
inline |
Return true if this call instance is a subcall (internal call for multi-device handling)
Definition at line 345 of file call.h.
References callMutex_, jami::emitSignal(), and parent_.
Referenced by Call(), jami::Manager::callFailure(), jami::Manager::getCallList(), and jami::Manager::hasCurrentCall().
Replace current call data with ones from the given subcall.
Must be called while locked by subclass
Definition at line 562 of file call.cpp.
References getCallId(), getConnectionState(), getState(), JAMI_DBG, peerDisplayName_, peerNumber_, pendingInMessages_, and removeCall().
Implemented in jami::SIPCall.
Referenced by Call(), and jami::Manager::monitor().
mute/unmute a media of a call
mediaType | type of media |
isMuted | true for muting, false for unmuting |
Implemented in jami::SIPCall.
Resume a call from hold state.
cb | On hold can be queued if waiting for ICE. This callback will be called when ready |
Implemented in jami::SIPCall.
Put a call on hold.
cb | On hold can be queued if waiting for ICE. This callback will be called when ready |
Implemented in jami::SIPCall.
Referenced by jami::Manager::onHoldCall().
void jami::Call::onTextMessage | ( | std::map< std::string, std::string > && | messages | ) |
|
virtual |
Peer has hung up a call.
Reimplemented in jami::SIPCall.
Definition at line 422 of file call.cpp.
Referenced by jami::Manager::peerHungupCall().
|
virtual |
Reimplemented in jami::SIPCall.
Definition at line 144 of file call.cpp.
Referenced by addSubCall(), and merge().
|
pure virtual |
Make a change request of the current media with the provided media.
mediaList | the new media list |
Implemented in jami::SIPCall.
Implemented in jami::SIPCall.
Implemented in jami::SIPCall.
|
pure virtual |
Send a message to a call identified by its callid.
A | list of mimetype/payload pairs |
The | sender of this message (could be another participant of a conference) |
Implemented in jami::SIPCall.
Referenced by addSubCall(), and jami::Manager::sendCallTextMessage().
A Call can be in a conference.
If this is the case, the other side will send conference information describing the rendered image @msg A JSON object describing the conference
Definition at line 636 of file call.cpp.
References jami::emitSignal(), jami::ParticipantInfo::fromJson(), jami::ConfInfo::h, jami::ConfInfo::v, and jami::ConfInfo::w.
Definition at line 215 of file call.h.
References jami::emitSignal(), and isIPToIP_.
Set the display name (caller in ingoing) not protected by mutex (when created)
Definition at line 164 of file call.h.
References peerDisplayName_.
Set the peer number (destination on outgoing) not protected by mutex (when created)
number | peer number |
Definition at line 151 of file call.h.
References jami::emitSignal(), and peerNumber_.
bool jami::Call::setState | ( | CallState | call_state, |
ConnectionState | cnx_state, | ||
signed | code = 0 |
||
) |
bool jami::Call::setState | ( | ConnectionState | cnx_state, |
signed | code = 0 |
||
) |
Reimplemented in jami::SIPCall.
|
virtual |
This method must be implemented for this interface as calls and conferences have different behavior.
Implementations must call the super method.
Reimplemented from jami::Recordable.
Reimplemented in jami::SIPCall.
Definition at line 361 of file call.cpp.
Referenced by jami::Manager::answerCall(), and jami::Manager::peerAnsweredCall().
|
inline |
Get "To" from the invite.
Definition at line 171 of file call.h.
References toUsername_.
Referenced by Call().
Updated by sipvoiplink, corresponds to the "To" in the invite.
username | "To" |
Definition at line 176 of file call.h.
References toUsername_.
Transfer a call to specified URI.
to | The recipient of the call |
Implemented in jami::SIPCall.
Referenced by jami::Manager::transferCall().
Update recording state.
Typically used to send notifications to peers about the local recording session state
Implemented in jami::SIPCall.
|
inline |
Definition at line 124 of file call.h.
References jami::emitSignal().
Referenced by addSubCall(), and Call().
|
protected |
std::unique_ptr<AudioDeviceGuard> jami::Call::audioGuard |
Definition at line 443 of file call.h.
Referenced by jami::Manager::addAudio().
|
mutableprotected |
Protect every attribute that can be changed by two threads.
Definition at line 487 of file call.h.
Referenced by addStateListener(), isSubcall(), and jami::SIPCall::~SIPCall().
|
protected |
|
protected |
Unique conference ID, used exclusively in case of a conference.
Definition at line 508 of file call.h.
Referenced by getConference(), and isConferenceParticipant().
|
mutableprotected |
Definition at line 490 of file call.h.
Referenced by getConferenceInfos().
|
protected |
|
protected |
Definition at line 491 of file call.h.
Referenced by Call(), and getCallDuration().
|
protected |
MultiDevice: parent call, nullptr otherwise. Access protected by callMutex_.
Definition at line 473 of file call.h.
Referenced by getCallId().
|
mutableprotected |
MultiDevice: list of attached subcall.
Definition at line 476 of file call.h.
Referenced by addSubCall(), and isSubcall().
|
protected |
Supported conference protocol version.
Definition at line 539 of file call.h.
Referenced by conferenceProtocolVersion().
|
protected |
Peer Display Name.
Definition at line 531 of file call.h.
Referenced by getPeerDisplayName(), merge(), and setPeerDisplayName().
|
protected |
Number of the peer.
Definition at line 528 of file call.h.
Referenced by getPeerNumber(), merge(), and setPeerNumber().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Definition at line 540 of file call.h.
Referenced by toUsername(), and toUsername().
|
protected |
Type of the call.
Definition at line 511 of file call.h.
Referenced by Call(), getCallType(), isIncoming(), and jami::SIPCall::SIPCall().