sip: Assign an MSC identity to a call
For some usecases we have a list of identities and when selecting a route an unused identity/line needs to be used. Keep track of which lines/identities we are using. The code might release a line too early. There should probably be another call in Osmo.SIPCall to inform the code when the call has "terminated" in one way or another (busy, cancel, failure, remote hangup, local hangup, redirected, etc). Right now it could still happen than an identity remains used.
This commit is contained in:
parent
547b7e1531
commit
333d67ef4f
|
@ -17,7 +17,7 @@
|
|||
"
|
||||
|
||||
Osmo.SIPCall subclass: SIPMTCall [
|
||||
| remoteLeg sdp_alert msc |
|
||||
| remoteLeg sdp_alert msc mscIdentity |
|
||||
|
||||
<category: 'OsmoMSC-Call'>
|
||||
<comment: 'I represent a SIP terminated call. It is called Mobile
|
||||
|
@ -28,6 +28,11 @@ Osmo.SIPCall subclass: SIPMTCall [
|
|||
msc := aMsc
|
||||
]
|
||||
|
||||
mscIdentity: anIdentity [
|
||||
mscIdentity := anIdentity
|
||||
mscIdentity usedBy: self.
|
||||
]
|
||||
|
||||
remoteLeg: aLeg [
|
||||
<category: 'creation'>
|
||||
remoteLeg := aLeg.
|
||||
|
@ -43,6 +48,7 @@ Osmo.SIPCall subclass: SIPMTCall [
|
|||
clean up things."
|
||||
|
||||
remoteLeg := nil.
|
||||
self releaseMscIdentity.
|
||||
self terminate.
|
||||
]
|
||||
|
||||
|
@ -50,6 +56,7 @@ Osmo.SIPCall subclass: SIPMTCall [
|
|||
| newLeg |
|
||||
remoteLeg ifNil: [^self].
|
||||
|
||||
self releaseMscIdentity.
|
||||
newLeg := msc selectRedirectFor: self to: aContact.
|
||||
remoteLeg changeRemoteLeg: newLeg.
|
||||
remoteLeg := nil.
|
||||
|
@ -72,6 +79,11 @@ Osmo.SIPCall subclass: SIPMTCall [
|
|||
self terminateRemote.
|
||||
]
|
||||
|
||||
terminate [
|
||||
self releaseMscIdentity.
|
||||
^super terminate
|
||||
]
|
||||
|
||||
sessionNotification: aNot [
|
||||
| code |
|
||||
"The session has some information. We will use it to tell
|
||||
|
@ -86,6 +98,7 @@ Osmo.SIPCall subclass: SIPMTCall [
|
|||
terminateRemote [
|
||||
remoteLeg isNil
|
||||
ifFalse: [remoteLeg netTerminate. remoteLeg := nil].
|
||||
self releaseMscIdentity.
|
||||
]
|
||||
|
||||
sdp [
|
||||
|
@ -97,4 +110,8 @@ Osmo.SIPCall subclass: SIPMTCall [
|
|||
<category: 'audio'>
|
||||
^ sdp_alert
|
||||
]
|
||||
|
||||
releaseMscIdentity [
|
||||
mscIdentity ifNotNil: [mscIdentity usedBy: nil. mscIdentity := nil].
|
||||
]
|
||||
]
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
"
|
||||
|
||||
Osmo.SIPIdentity subclass: MSCSIPIdentity [
|
||||
| available manager registerTimer |
|
||||
| available manager registerTimer usedBy |
|
||||
<category: 'OsmoMSC-SIP'>
|
||||
<comment: 'I add timers and others to the plain identity. This
|
||||
way we can keep track if something is available or not.'>
|
||||
|
@ -81,4 +81,13 @@ Osmo.SIPIdentity subclass: MSCSIPIdentity [
|
|||
isAvailable [
|
||||
^available
|
||||
]
|
||||
|
||||
usedBy: aCall [
|
||||
"A SIPCall is using this identity right now."
|
||||
usedBy := aCall
|
||||
]
|
||||
|
||||
isUnused [
|
||||
^usedBy isNil
|
||||
]
|
||||
]
|
||||
|
|
|
@ -59,4 +59,8 @@ Object subclass: SIPIdentityManager [
|
|||
available [
|
||||
^identities select: [:each | each isAvailable]
|
||||
]
|
||||
|
||||
availableAndUnused [
|
||||
^identities select: [:each | each isAvailable and: [each isUnused]]
|
||||
]
|
||||
]
|
||||
|
|
Reference in New Issue