callagent: Add state transitions to the MGCPEndpoint
This commit is contained in:
parent
a87b29e094
commit
ab1e189087
|
@ -67,4 +67,64 @@ Object subclass: MGCPEndpoint [
|
|||
<category: 'state'>
|
||||
^ state = self class stateUsed.
|
||||
]
|
||||
|
||||
reserve [
|
||||
<category: 'allocation'>
|
||||
state = self class stateUnused ifFalse: [
|
||||
^ self error: 'MGCPEndpoint(%1) not unused.'
|
||||
% {self endpointName} area: #mgcp.
|
||||
].
|
||||
|
||||
state := self class stateReserved.
|
||||
]
|
||||
|
||||
used [
|
||||
<category: 'allocation'>
|
||||
state = self class stateReserved ifFalse: [
|
||||
^ self error: 'MGCPEndpoint(%1) not reserved.'
|
||||
% {self endpointName} area: #mgcp.
|
||||
].
|
||||
|
||||
state := self class stateUsed.
|
||||
]
|
||||
|
||||
free [
|
||||
<category: 'allocation'>
|
||||
state = self class stateUsed ifFalse: [
|
||||
^ self error: 'MGCPEndpoint(%1) not used.'
|
||||
% {self endpointName} area: #mgcp.
|
||||
].
|
||||
|
||||
state := self class stateUnused.
|
||||
]
|
||||
|
||||
tryBlock [
|
||||
<category: 'allocation'>
|
||||
state = self class stateUnused ifTrue: [
|
||||
state := self class stateBlocked.
|
||||
^ true
|
||||
].
|
||||
|
||||
^ false
|
||||
]
|
||||
|
||||
unblock [
|
||||
<category: 'allocation'>
|
||||
state = self class stateBlocked ifFalse: [
|
||||
^ self error: 'MGCPEndpoint(%1) not blocked.'
|
||||
% {self endpointName} area: #mgcp.
|
||||
].
|
||||
|
||||
state := self class stateUnused.
|
||||
]
|
||||
|
||||
sdp [
|
||||
<category: 'sdp'>
|
||||
^ sdp
|
||||
]
|
||||
|
||||
sdp: aSdp [
|
||||
<category: 'sdp'>
|
||||
sdp := aSdp.
|
||||
]
|
||||
]
|
||||
|
|
Reference in New Issue