Skip to content

Commit

Permalink
fix: be more explicit for handling BYE
Browse files Browse the repository at this point in the history
  • Loading branch information
emiago committed Nov 25, 2024
1 parent 737227c commit 5411099
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions dialog_server_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,10 @@ func (d *DialogServerSession) answerSession(rtpSess *media.RTPSession) error {

func (d *DialogServerSession) Hangup(ctx context.Context) error {
state := d.LoadState()
if state < sip.DialogStateConfirmed {
return d.Respond(sip.StatusTemporarilyUnavailable, "Temporarly unavailable", nil)
if state == sip.DialogStateConfirmed {
return d.Bye(ctx)
}

return d.Bye(ctx)
return d.Respond(sip.StatusTemporarilyUnavailable, "Temporarly unavailable", nil)
}

func (d *DialogServerSession) ReInvite(ctx context.Context) error {
Expand Down

0 comments on commit 5411099

Please sign in to comment.