mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-07 22:02:12 +08:00
api: merge sipCallStateChanged with CallStateChanged
Refs #69086 Change-Id: I1e37a661a6db79b9ec8a11617d9d40b43eb2879d
This commit is contained in:
@ -505,6 +505,12 @@
|
||||
</ul>
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg type="i" name="code">
|
||||
<tp:docstring>
|
||||
The optional account-type specific message code. 0 if not set.
|
||||
</tp:docstring>
|
||||
<tp:added version="2.0.0" />
|
||||
</arg>
|
||||
</signal>
|
||||
|
||||
<signal name="conferenceChanged" tp:name-for-bindings="conferenceChanged">
|
||||
@ -633,25 +639,6 @@
|
||||
<arg type="s" name="filepath" direction="in"/>
|
||||
</method>
|
||||
|
||||
<signal name="sipCallStateChanged" tp:name-for-bindings="sipCallStateChanged">
|
||||
<tp:docstring>
|
||||
<p>Call state changed, Ring received a notification
|
||||
from registrar concerning this call.</p>
|
||||
</tp:docstring>
|
||||
<arg type="s" name="callID" />
|
||||
<tp:docstring>
|
||||
The call ID
|
||||
</tp:docstring>
|
||||
<arg type="s" name="state" />
|
||||
<tp:docstring>
|
||||
Description string
|
||||
</tp:docstring>
|
||||
<arg type="i" name="code" />
|
||||
<tp:docstring>
|
||||
The SIP or IAX2 message code
|
||||
</tp:docstring>
|
||||
</signal>
|
||||
|
||||
<signal name="voiceMailNotify" tp:name-for-bindings="voiceMailNotify">
|
||||
<tp:docstring>
|
||||
Notify the clients of the voicemail number for a specific account, if applicable.
|
||||
|
@ -151,7 +151,7 @@ DBusClient::initLibrary(int sflphFlags)
|
||||
|
||||
// Call event handlers
|
||||
const std::map<std::string, SharedCallback> callEvHandlers = {
|
||||
exportable_callback<CallSignal::StateChange>(bind(&DBusCallManager::callStateChanged, callM, _1, _2)),
|
||||
exportable_callback<CallSignal::StateChange>(bind(&DBusCallManager::callStateChanged, callM, _1, _2, _3)),
|
||||
exportable_callback<CallSignal::TransferFailed>(bind(&DBusCallManager::transferFailed, callM)),
|
||||
exportable_callback<CallSignal::TransferSucceeded>(bind(&DBusCallManager::transferSucceeded, callM)),
|
||||
exportable_callback<CallSignal::RecordPlaybackStopped>(bind(&DBusCallManager::recordPlaybackStopped, callM, _1)),
|
||||
@ -164,7 +164,6 @@ DBusClient::initLibrary(int sflphFlags)
|
||||
exportable_callback<CallSignal::UpdatePlaybackScale>(bind(&DBusCallManager::updatePlaybackScale, callM, _1, _2, _3)),
|
||||
exportable_callback<CallSignal::ConferenceRemoved>(bind(&DBusCallManager::conferenceRemoved, callM, _1)),
|
||||
exportable_callback<CallSignal::NewCallCreated>(bind(&DBusCallManager::newCallCreated, callM, _1, _2, _3)),
|
||||
exportable_callback<CallSignal::SipCallStateChanged>(bind(&DBusCallManager::sipCallStateChanged, callM, _1, _2, _3)),
|
||||
exportable_callback<CallSignal::RecordingStateChanged>(bind(&DBusCallManager::recordingStateChanged, callM, _1, _2)),
|
||||
exportable_callback<CallSignal::SecureSdesOn>(bind(&DBusCallManager::secureSdesOn, callM, _1)),
|
||||
exportable_callback<CallSignal::SecureSdesOff>(bind(&DBusCallManager::secureSdesOff, callM, _1)),
|
||||
|
@ -108,7 +108,7 @@ void sendTextMessage(const std::string& callID, const std::string& message, cons
|
||||
struct CallSignal {
|
||||
struct StateChange {
|
||||
constexpr static const char* name = "StateChange";
|
||||
using cb_type = void(const std::string&, const std::string&);
|
||||
using cb_type = void(const std::string&, const std::string&, int);
|
||||
};
|
||||
struct TransferFailed {
|
||||
constexpr static const char* name = "TransferFailed";
|
||||
|
@ -517,7 +517,7 @@ ManagerImpl::answerCall(const std::string& call_id)
|
||||
toggleRecordingCall(call_id);
|
||||
|
||||
//callStateChanged(call_id, "CURRENT");
|
||||
emitSignal<DRing::CallSignal::StateChange>(call_id, "CURRENT");
|
||||
emitSignal<DRing::CallSignal::StateChange>(call_id, "CURRENT", 0);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -542,7 +542,7 @@ ManagerImpl::hangupCall(const std::string& callId)
|
||||
stopTone();
|
||||
|
||||
RING_DBG("Send call state change (HUNGUP) for id %s", callId.c_str());
|
||||
emitSignal<DRing::CallSignal::StateChange>(callId, "HUNGUP");
|
||||
emitSignal<DRing::CallSignal::StateChange>(callId, "HUNGUP", 0);
|
||||
|
||||
/* We often get here when the call was hungup before being created */
|
||||
auto call = getCallFromCallID(callId);
|
||||
@ -631,7 +631,7 @@ ManagerImpl::onHoldCall(const std::string& callId)
|
||||
if (current_call_id == callId)
|
||||
unsetCurrentCall();
|
||||
|
||||
emitSignal<DRing::CallSignal::StateChange>(callId, "HOLD");
|
||||
emitSignal<DRing::CallSignal::StateChange>(callId, "HOLD", 0);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -672,7 +672,7 @@ ManagerImpl::offHoldCall(const std::string& callId)
|
||||
return false;
|
||||
}
|
||||
|
||||
emitSignal<DRing::CallSignal::StateChange>(callId, "UNHOLD");
|
||||
emitSignal<DRing::CallSignal::StateChange>(callId, "UNHOLD", 0);
|
||||
|
||||
if (isConferenceParticipant(callId))
|
||||
switchCall(getCallFromCallID(call->getConfId()));
|
||||
@ -747,7 +747,7 @@ ManagerImpl::refuseCall(const std::string& id)
|
||||
|
||||
removeWaitingCall(id);
|
||||
|
||||
emitSignal<DRing::CallSignal::StateChange>(id, "HUNGUP");
|
||||
emitSignal<DRing::CallSignal::StateChange>(id, "HUNGUP", 0);
|
||||
|
||||
// Disconnect streams
|
||||
removeStream(*call);
|
||||
@ -1710,7 +1710,7 @@ ManagerImpl::peerAnsweredCall(Call& call)
|
||||
if (audioPreference.getIsAlwaysRecording())
|
||||
toggleRecordingCall(call_id);
|
||||
|
||||
emitSignal<DRing::CallSignal::StateChange>(call_id, "CURRENT");
|
||||
emitSignal<DRing::CallSignal::StateChange>(call_id, "CURRENT", 0);
|
||||
}
|
||||
|
||||
//THREAD=VoIP Call=Outgoing
|
||||
@ -1723,7 +1723,7 @@ ManagerImpl::peerRingingCall(Call& call)
|
||||
if (isCurrentCall(call))
|
||||
ringback();
|
||||
|
||||
emitSignal<DRing::CallSignal::StateChange>(call_id, "RINGING");
|
||||
emitSignal<DRing::CallSignal::StateChange>(call_id, "RINGING", 0);
|
||||
}
|
||||
|
||||
//THREAD=VoIP Call=Outgoing/Ingoing
|
||||
@ -1742,7 +1742,7 @@ ManagerImpl::peerHungupCall(Call& call)
|
||||
|
||||
call.peerHungup();
|
||||
|
||||
emitSignal<DRing::CallSignal::StateChange>(call_id, "HUNGUP");
|
||||
emitSignal<DRing::CallSignal::StateChange>(call_id, "HUNGUP", 0);
|
||||
|
||||
checkAudio();
|
||||
removeWaitingCall(call_id);
|
||||
@ -1758,7 +1758,7 @@ ManagerImpl::callBusy(Call& call)
|
||||
{
|
||||
const auto call_id = call.getCallId();
|
||||
|
||||
emitSignal<DRing::CallSignal::StateChange>(call_id, "BUSY");
|
||||
emitSignal<DRing::CallSignal::StateChange>(call_id, "BUSY", 0);
|
||||
|
||||
if (isCurrentCall(call)) {
|
||||
playATone(Tone::TONE_BUSY);
|
||||
@ -1771,11 +1771,11 @@ ManagerImpl::callBusy(Call& call)
|
||||
|
||||
//THREAD=VoIP
|
||||
void
|
||||
ManagerImpl::callFailure(Call& call)
|
||||
ManagerImpl::callFailure(Call& call, int code)
|
||||
{
|
||||
const auto call_id = call.getCallId();
|
||||
|
||||
emitSignal<DRing::CallSignal::StateChange>(call_id, "FAILURE");
|
||||
emitSignal<DRing::CallSignal::StateChange>(call_id, "FAILURE", code);
|
||||
|
||||
if (isCurrentCall(call)) {
|
||||
playATone(Tone::TONE_BUSY);
|
||||
|
@ -700,7 +700,7 @@ class ManagerImpl {
|
||||
/**
|
||||
* Handle played sound when a failure occurs
|
||||
*/
|
||||
void callFailure(Call& call);
|
||||
void callFailure(Call& call, int code=0);
|
||||
|
||||
/**
|
||||
* Retrieve the current telephone tone
|
||||
|
@ -677,9 +677,9 @@ SIPCall::sendTextMessage(const std::string &message, const std::string &from)
|
||||
#endif // HAVE_INSTANT_MESSAGING
|
||||
|
||||
void
|
||||
SIPCall::onServerFailure()
|
||||
SIPCall::onServerFailure(int code)
|
||||
{
|
||||
Manager::instance().callFailure(*this);
|
||||
Manager::instance().callFailure(*this, code);
|
||||
removeCall();
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ class SIPCall : public Call
|
||||
* Handling 5XX/6XX error
|
||||
* @param
|
||||
*/
|
||||
void onServerFailure();
|
||||
void onServerFailure(int code=0);
|
||||
|
||||
/**
|
||||
* Peer close the connection
|
||||
|
@ -798,15 +798,10 @@ invite_session_state_changed_cb(pjsip_inv_session *inv, pjsip_event *ev)
|
||||
auto call = std::static_pointer_cast<SIPCall>(call_ptr->shared_from_this());
|
||||
|
||||
if (ev and inv->state != PJSIP_INV_STATE_CONFIRMED) {
|
||||
// Update UI with the current status code and description
|
||||
pjsip_transaction * tsx = ev->body.tsx_state.tsx;
|
||||
int statusCode = tsx ? tsx->status_code : 404;
|
||||
|
||||
if (statusCode) {
|
||||
const pj_str_t * description = pjsip_get_status_text(statusCode);
|
||||
std::string desc(description->ptr, description->slen);
|
||||
|
||||
emitSignal<DRing::CallSignal::SipCallStateChanged>(call->getCallId(), desc, statusCode);
|
||||
const auto tsx = ev->body.tsx_state.tsx;
|
||||
if (auto status_code = tsx ? tsx->status_code : 404) {
|
||||
const pj_str_t* description = pjsip_get_status_text(status_code);
|
||||
RING_DBG("SIP invite session state change: %d %.*s", status_code, description->slen, description->ptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -842,7 +837,7 @@ invite_session_state_changed_cb(pjsip_inv_session *inv, pjsip_event *ev)
|
||||
default:
|
||||
RING_WARN("PJSIP_INV_STATE_DISCONNECTED: %d %d",
|
||||
inv->cause, ev ? ev->type : -1);
|
||||
call->onServerFailure();
|
||||
call->onServerFailure(inv->cause);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user