cancel: Improve log messages, fix the cancelation of a call
The code changed the state and then compared it to the given state, remember the old state before changing it.
This commit is contained in:
parent
0e699fdee2
commit
bfd9a0c621
|
@ -231,6 +231,9 @@ will simply ignore everything but the first dialog.'>
|
|||
cancel [
|
||||
<category: 'call'>
|
||||
(self moveToState: self class stateCancel) ifTrue: [
|
||||
self logNotice: 'SIPCall(%1) going to cancel it.'
|
||||
% {self callId} area: #sip.
|
||||
|
||||
self unregisterDialog.
|
||||
invite cancel.
|
||||
^ true
|
||||
|
@ -242,6 +245,9 @@ will simply ignore everything but the first dialog.'>
|
|||
hangup [
|
||||
<category: 'call'>
|
||||
(self moveToState: self class stateHangup) ifTrue: [
|
||||
self logNotice: 'SIPCall(%1) going to hangup.'
|
||||
% {self callId} area: #sip.
|
||||
|
||||
self unregisterDialog.
|
||||
(SIPByeTransaction createWith: dialog on: ua cseq: self nextCSeq)
|
||||
onTimeout: [self hangupTimedOut];
|
||||
|
@ -356,8 +362,11 @@ will simply ignore everything but the first dialog.'>
|
|||
terminate [
|
||||
<category: 'public'>
|
||||
"I try to finish up things."
|
||||
self state = self class stateInvite ifTrue: [self cancel].
|
||||
self state = self class stateSession ifTrue: [self hangup].
|
||||
self state = self class stateInvite ifTrue: [^self cancel].
|
||||
self state = self class stateSession ifTrue: [^self hangup].
|
||||
|
||||
self logError: 'SIPCall(%1) terminate not possible in %2.'
|
||||
% {self callId. self state} area: #sip.
|
||||
]
|
||||
|
||||
sessionNew [
|
||||
|
|
|
@ -423,15 +423,18 @@ SIPTransaction subclass: SIPInviteTransaction [
|
|||
]
|
||||
|
||||
cancel [
|
||||
| old_state |
|
||||
<category: 'cancel'>
|
||||
canceled := true.
|
||||
self stopRetransmitTimer.
|
||||
|
||||
old_state := self state.
|
||||
self changeState: self class stateCanceled.
|
||||
|
||||
self state = self class stateProceeding ifTrue: [
|
||||
old_state = self class stateProceeding ifTrue: [
|
||||
self queueData: self createCancel asDatagram dialog: initial_dialog.
|
||||
].
|
||||
self state = self class stateCompleted ifTrue: [
|
||||
old_state = self class stateCompleted ifTrue: [
|
||||
self logError: 'SIPTransaction already completed.' area: #sip.
|
||||
].
|
||||
]
|
||||
|
|
Reference in New Issue