From 26c5d2dd02226bc0943033ce28e4d0324abc36a9 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 12 Oct 2012 10:56:32 +0200 Subject: [PATCH] ow: Change the way the image is started and configured --- Loader.st | 31 +---------------------- Makefile | 2 +- contrib/osmo-msc | 2 +- start.st | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 32 deletions(-) create mode 100644 start.st diff --git a/Loader.st b/Loader.st index 59ceb63..b378585 100644 --- a/Loader.st +++ b/Loader.st @@ -16,42 +16,13 @@ along with this program. If not, see . " " -I am helping to get things started on the first image resume +I am helping to create a unconfigured image " PackageLoader fileInPackage: #OsmoMSC. -Object subclass: Loader [ - - - - Loader class >> new [ - - - ^ super new - initialize; - yourself. - ] - - initialize [ - - ObjectMemory addDependent: self. - ] - - update: aSymbol [ - - - aSymbol = #returnFromSnapshot ifTrue: [ - OsmoMSC at: #MSC put: OsmoMSC.MSCApplication startExample. - ObjectMemory removeDependent: self. - ]. - ] -] - Eval [ | l | - l := Loader new. PackageLoader flush. ObjectMemory snapshot: Smalltalk arguments first. ] diff --git a/Makefile b/Makefile index 58f0795..65e4669 100644 --- a/Makefile +++ b/Makefile @@ -8,4 +8,4 @@ package: $(GST_PACKAGE) package.xml image: package - $(GST) -i -f Loader.st osmo_msc.img + $(GST) -i -f Loader.st osmo_msc_ow2.img diff --git a/contrib/osmo-msc b/contrib/osmo-msc index fbcbd38..abb8bf6 100755 --- a/contrib/osmo-msc +++ b/contrib/osmo-msc @@ -16,7 +16,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC=osmo-msc # Introduce a short description here NAME=osmo-msc # Introduce the short server's name here DAEMON=/usr/bin/gst-remote # Introduce the server's location here -DAEMON_ARGS="--daemon --server -I /var/lib/osmo-msc/osmo_msc.img 127.0.0.1" # Arguments to run the daemon with +DAEMON_ARGS="--daemon --server -I /var/lib/osmo-msc/osmo_msc.img -f /etc/default/osmo-msc.st 127.0.0.1" # Arguments to run the daemon with PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME diff --git a/start.st b/start.st new file mode 100644 index 0000000..a784527 --- /dev/null +++ b/start.st @@ -0,0 +1,66 @@ +" +Copyright (C) 2012 Holger Hans Peter Freyther +Configure and start a MSC +" + +"Load the MSC code" +PackageLoader fileInPackage: #OsmoMSC. + +"Fix some defaults in the openbsc" +OsmoMSC.GSMProcessor class extend [ + createAssignment: aMul timeslot: aTs [ + | ass | + + ass := IEMessage initWith: GSM0808Helper msgAssRequest. + ass + addIe: ((GSM0808ChannelTypeIE + initWith: GSM0808ChannelTypeIE speechSpeech + audio: GSM0808ChannelTypeIE chanSpeechFullPref) + audioCodecs: {GSM0808ChannelTypeIE speechFullRateVersion1}; + yourself); + addIe: (GSM0808CICIE initWithMultiplex: aMul timeslot: aTs). + ^ ass + ] +] + +OsmoMSC.MSCApplication extend [ + selectAudioRoute: aCon plan: aPlan leg: aLeg [ + | nr | + "TODO: Very simple and hardcoded rule" + nr := aPlan number. + + "No number, let us return" + nr isEmpty ifTrue: [^nil]. + + "No special number" + nr first = $* ifFalse: [^nil]. + + + ^ (SIPMTCall + fromUser: 'sip:1000@sip.zecke.osmocom.org' + host: '127.0.0.1' + port: 5060 + to: 'sip:1%1@127.0.0.1' % {nr allButFirst} + on: self sipGateway) + remoteLeg: aLeg; + yourself + ] +] + +"Now start the application" +Eval [ + | msc | + msc := OsmoMSC.MSCApplication new. + msc config + bscIP: '0.0.0.0'; + bscPort: 5000; + sipIP: '127.0.0.1'. + msc bscConfig + addBSC: '127.0.0.1' withName: 'test1' andLac: 4711 sendOsmoRSIP: true; + addBSC: '10.240.240.1' withName: 'test2' andLac: 4712 sendOsmoRSIP: true. + + "Start processing now" + msc returnedFromSnapshot. + + Smalltalk at: #MSC put: msc. +]