aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-10-12 10:56:32 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-11-20 19:09:43 +0100
commit26c5d2dd02226bc0943033ce28e4d0324abc36a9 (patch)
tree85182a83933faca69825cfa84eca046dc97c03f5
parent259976e68a21b67c0b648ce5c77fc94aacb517ac (diff)
ow: Change the way the image is started and configured
-rw-r--r--Loader.st31
-rw-r--r--Makefile2
-rwxr-xr-xcontrib/osmo-msc2
-rw-r--r--start.st66
4 files changed, 69 insertions, 32 deletions
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 <http://www.gnu.org/licenses/>.
"
"
-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 [
- <category: 'OsmoMSC-Loader'>
- <comment: 'I wait for the image to resume and then I start the
- MSC example application and put it into the OsmoMSC namespace.'>
-
- Loader class >> new [
- <category: 'creation'>
-
- ^ super new
- initialize;
- yourself.
- ]
-
- initialize [
- <category: 'creation'>
- ObjectMemory addDependent: self.
- ]
-
- update: aSymbol [
- <category: 'initialize'>
-
- 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 |
+ <category: 'audio-connect'>
+ 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.
+]