aboutsummaryrefslogtreecommitdiffstats
path: root/start.st
blob: a78452778f2125ed8a336d706b547e445c43abcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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.
]