ow: Change the way the image is started and configured
This commit is contained in:
parent
259976e68a
commit
26c5d2dd02
31
Loader.st
31
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.
|
||||
]
|
||||
|
|
2
Makefile
2
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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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.
|
||||
]
|
Reference in New Issue