smalltalk
/
osmo-st-sip
Archived
1
0
Fork 0

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:
Holger Hans Peter Freyther 2011-07-20 21:07:55 +02:00
parent 0e699fdee2
commit bfd9a0c621
2 changed files with 16 additions and 4 deletions

View File

@ -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 [

View File

@ -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.
].
]