Skip to content
Snippets Groups Projects
Commit 6f81927c authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Adrien Béraud
Browse files

sip: use correct status code for call refusal and call hangup

GitLab: #478

Change-Id: I4aed6f7b171a2194fd0070c5510ca1660adb6204
parent 8082fa33
No related branches found
No related tags found
No related merge requests found
/* /*
* Copyright (C) 2004-2021 Savoir-faire Linux Inc. * Copyright (C) 2004-2021 Savoir-faire Linux Inc.
* *
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
...@@ -578,13 +578,16 @@ SIPCall::hangup(int reason) ...@@ -578,13 +578,16 @@ SIPCall::hangup(int reason)
} }
route = route->next; route = route->next;
} }
const int status = reason ? reason
: inviteSession_->state <= PJSIP_INV_STATE_EARLY int status = PJSIP_SC_OK;
and inviteSession_->role != PJSIP_ROLE_UAC if (reason)
? PJSIP_SC_CALL_TSX_DOES_NOT_EXIST status = reason;
: inviteSession_->state >= PJSIP_INV_STATE_DISCONNECTED else if (inviteSession_->state <= PJSIP_INV_STATE_EARLY
? PJSIP_SC_DECLINE and inviteSession_->role != PJSIP_ROLE_UAC)
: 0; status = PJSIP_SC_CALL_TSX_DOES_NOT_EXIST;
else if (inviteSession_->state >= PJSIP_INV_STATE_DISCONNECTED)
status = PJSIP_SC_DECLINE;
// Notify the peer // Notify the peer
terminateSipSession(status); terminateSipSession(status);
} }
...@@ -607,7 +610,7 @@ SIPCall::refuse() ...@@ -607,7 +610,7 @@ SIPCall::refuse()
stopAllMedia(); stopAllMedia();
// Notify the peer // Notify the peer
terminateSipSession(PJSIP_SC_DECLINE); terminateSipSession(PJSIP_SC_BUSY_HERE);
setState(Call::ConnectionState::DISCONNECTED, ECONNABORTED); setState(Call::ConnectionState::DISCONNECTED, ECONNABORTED);
removeCall(); removeCall();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment