From 2b233e68c5ceb99c2ad009005af0e4dcd9310225 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 8 Jan 2013 19:01:11 +0100 Subject: [PATCH] paging: Introduce a paging manager than can page on all BSCs --- Start.st | 1 + package.xml | 1 + src/BSCConfig.st | 5 +++ src/BSCIPAConnection.st | 9 +++++- src/MSC.st | 4 ++- src/PagingManager.st | 67 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 src/PagingManager.st diff --git a/Start.st b/Start.st index 29adb94..6b71751 100644 --- a/Start.st +++ b/Start.st @@ -13,6 +13,7 @@ Eval [ fileIn: 'src/GSMCMServiceRequest.st'; fileIn: 'src/GSMEmergencySetup.st'; fileIn: 'src/BSCIPAConnection.st'; + fileIn: 'src/PagingManager.st'; fileIn: 'src/MSC.st'; fileIn: 'src/SIPCall.st'. diff --git a/package.xml b/package.xml index 74ec9e5..7786ce0 100644 --- a/package.xml +++ b/package.xml @@ -17,6 +17,7 @@ src/GSMMOCall.st src/GSMLURequest.st src/GSMEmergencySetup.st + src/PagingManager.st src/BSCIPAConnection.st src/MSC.st src/SIPCall.st diff --git a/src/BSCConfig.st b/src/BSCConfig.st index 707cf45..6bfdb6c 100644 --- a/src/BSCConfig.st +++ b/src/BSCConfig.st @@ -70,6 +70,11 @@ peer address, the lac, if it is connected'> connection := aCon. ] + connection [ + + ^ connection + ] + sendOsmoRSIP [ ^ osmoExtension ] sendOsmoRSIP: useExtension [ diff --git a/src/BSCIPAConnection.st b/src/BSCIPAConnection.st index ccdde47..244dcff 100644 --- a/src/BSCIPAConnection.st +++ b/src/BSCIPAConnection.st @@ -1,5 +1,5 @@ " - (C) 2010-2011 by Holger Hans Peter Freyther + (C) 2010-2013 by Holger Hans Peter Freyther All Rights Reserved This program is free software: you can redistribute it and/or modify @@ -86,6 +86,13 @@ Object subclass: BSCConnection [ command: Osmo.MGCPOsmoRSIPCommand createRSIP; startSingleShot. ] + + sendUdt: aMsg [ + | udt addr | + addr := Osmo.SCCPAddress createWith: 254. + udt := Osmo.SCCPUDT initWith: addr calling: addr data: aMsg. + ^ self send: udt toMessage with:Osmo.IPAConstants protocolSCCP. + ] ] BSCConnection subclass: BSCIPAConnection [ diff --git a/src/MSC.st b/src/MSC.st index 79287d2..4da4883 100644 --- a/src/MSC.st +++ b/src/MSC.st @@ -160,7 +160,7 @@ Object subclass: MSCBSCConnectionHandler [ ] Object subclass: MSCApplication [ - | hlr vlr config bscListener bscConfig bscConHandler mgcp sip | + | hlr vlr config bscListener bscConfig bscConHandler mgcp sip paging | @@ -190,6 +190,8 @@ Object subclass: MSCApplication [ hlr [ ^ hlr ifNil: [HLRLocalCollection new]] vlr [ ^ vlr ifNil: [VLRLocalCollection new]] + pagingManager [ ^ paging ifNil: [paging := PagingManager initWith: self]] + config [ ^ config ifNil: [config := MSCConfig new]] bscConfig [ ^ bscConfig ifNil: [bscConfig := BSCConfig new]] bscConHandler [ ^ bscConHandler ifNil: [bscConHandler := MSCBSCConnectionHandler initWith: self]] diff --git a/src/PagingManager.st b/src/PagingManager.st new file mode 100644 index 0000000..544006b --- /dev/null +++ b/src/PagingManager.st @@ -0,0 +1,67 @@ +" + (C) 2013 by Holger Hans Peter Freyther + All Rights Reserved + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +" + +Object subclass: PagingManager [ + | msc | + + PagingManager class >> initWith: aMsc [ + ^ self new + instVarNamed: #msc put: aMsc; + yourself. + ] + + + pageAll: anImsi [ + + "Page a subscriber on all LACs of all BSCs" + msc bscConfig bscList do: [:bscConfig | + "This can race with a disconnect but that is fine." + bscConfig connected ifTrue: [ + OsmoDispatcher dispatchBlock: [ + self pageBSC: bscConfig with: anImsi]]]. + ] + + pageBSC: aBscConfig with: anImsi [ + | connection cmd | + + "Page a single BSC" + + "Is the bsc still connected?" + connection := aBscConfig connection. + connection ifNil: [ + ^ false + ]. + + cmd := self createPagingCommand: aBscConfig lac with: anImsi. + connection sendUdt: cmd toMessage asByteArray. + ] + + createPagingCommand: aLac with: anImsi [ + | cmd | + cmd := OsmoGSM.IEMessage initWith: OsmoGSM.GSM0808Helper msgPaging. + cmd + addIe: (OsmoGSM.GSM0808IMSI initWith: anImsi); + addIe: (OsmoGSM.GSM0808CellIdentifierList new + ident: OsmoGSM.GSM0808CellIdentifierList cellLocationAreaCode; + cells: (Array with: aLac); + yourself); + yourself. + + ^ OsmoGSM.BSSAPManagement initWith: cmd toMessage + ] +]