mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
sip: use correct status code for call refusal and call hangup
GitLab: #478 Change-Id: I4aed6f7b171a2194fd0070c5510ca1660adb6204
This commit is contained in:

committed by
Adrien Béraud

parent
8082fa33b8
commit
6f81927c70
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (C) 2004-2021 Savoir-faire Linux Inc.
|
||||
*
|
||||
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
|
||||
@ -578,13 +578,16 @@ SIPCall::hangup(int reason)
|
||||
}
|
||||
route = route->next;
|
||||
}
|
||||
const int status = reason ? reason
|
||||
: inviteSession_->state <= PJSIP_INV_STATE_EARLY
|
||||
and inviteSession_->role != PJSIP_ROLE_UAC
|
||||
? PJSIP_SC_CALL_TSX_DOES_NOT_EXIST
|
||||
: inviteSession_->state >= PJSIP_INV_STATE_DISCONNECTED
|
||||
? PJSIP_SC_DECLINE
|
||||
: 0;
|
||||
|
||||
int status = PJSIP_SC_OK;
|
||||
if (reason)
|
||||
status = reason;
|
||||
else if (inviteSession_->state <= PJSIP_INV_STATE_EARLY
|
||||
and inviteSession_->role != PJSIP_ROLE_UAC)
|
||||
status = PJSIP_SC_CALL_TSX_DOES_NOT_EXIST;
|
||||
else if (inviteSession_->state >= PJSIP_INV_STATE_DISCONNECTED)
|
||||
status = PJSIP_SC_DECLINE;
|
||||
|
||||
// Notify the peer
|
||||
terminateSipSession(status);
|
||||
}
|
||||
@ -607,7 +610,7 @@ SIPCall::refuse()
|
||||
stopAllMedia();
|
||||
|
||||
// Notify the peer
|
||||
terminateSipSession(PJSIP_SC_DECLINE);
|
||||
terminateSipSession(PJSIP_SC_BUSY_HERE);
|
||||
|
||||
setState(Call::ConnectionState::DISCONNECTED, ECONNABORTED);
|
||||
removeCall();
|
||||
|
Reference in New Issue
Block a user