From 889e86d488f71b102e17c94cd7ce9119d74cf25d Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 6 Apr 2012 19:20:51 +0200 Subject: [PATCH] bsc: Send the Osmo RSIP extension to our bsc to reset the mediagateway --- src/BSCConfig.st | 18 +++++++++++++----- src/BSCIPAConnection.st | 17 ++++++++++++++--- src/MSC.st | 4 ++-- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/BSCConfig.st b/src/BSCConfig.st index 6de800d..322ee68 100644 --- a/src/BSCConfig.st +++ b/src/BSCConfig.st @@ -1,5 +1,5 @@ " - (C) 2010 by Holger Hans Peter Freyther + (C) 2010-2012 by Holger Hans Peter Freyther All Rights Reserved This program is free software: you can redistribute it and/or modify @@ -19,7 +19,7 @@ PackageLoader fileInPackage: #Sockets. Object subclass: BSCConfigItem [ - | peer token name lac connected | + | peer token name lac connected osmoExtension | connected := aState. ] + + sendOsmoRSIP [ ^ osmoExtension ] + sendOsmoRSIP: useExtension [ + + osmoExtension := useExtension + ] ] Object subclass: BSCConfig [ @@ -78,14 +84,16 @@ Object subclass: BSCConfig [ self bscList removeAllSuchThat: [:element | element lac = aLac]. ] - addBSC: ip withName: aName andLac: aLac [ + addBSC: ip withName: aName andLac: aLac sendOsmoRSIP: aRSIP [ | addr bsc | "Make sure that no one with the same IP or LAC registers" addr := Sockets.SocketAddress byName: ip. - bsc := BSCConfigItem initWith: addr name: aName. - bsc lac: aLac. + bsc := (BSCConfigItem initWith: addr name: aName) + lac: aLac; + sendOsmoRSIP: aRSIP; + yourself. (self bscList anySatisfy: [:each | each peer = addr ]) ifTrue: [ diff --git a/src/BSCIPAConnection.st b/src/BSCIPAConnection.st index 1a94d28..cd29fbd 100644 --- a/src/BSCIPAConnection.st +++ b/src/BSCIPAConnection.st @@ -54,11 +54,13 @@ Object subclass: BSCConnection [ initialize [ - "I try to initialize the trunk. Right now I force the usage - of UDP to the given port and do not support the nat traversal. I - also hardcode the kind of audio." + "I try to initialize the trunk to the remote BSC. Right now I force + the usage of UDP." trunk := Osmo.MGCPDSTrunk createWithDest: config peer printString trunkNr: 1. (trunk endpointAt: 1) tryBlock. + + "Osmo Extension" + config sendOsmoRSIP ifTrue: [self sendOsmoRSIP]. ] config [ @@ -75,6 +77,15 @@ Object subclass: BSCConnection [ ^ trunk ] + + sendOsmoRSIP [ + + + "Send the RSIP in a fire and forget style." + (Osmo.MGCPTransaction on: (trunk endpointAt: 2) of: msc mgcpCallAgent) + command: Osmo.MGCPOsmoRSIPCommand createRSIP; + startSingleShot. + ] ] BSCConnection subclass: BSCIPAConnection [ diff --git a/src/MSC.st b/src/MSC.st index a58b21b..f30ab35 100644 --- a/src/MSC.st +++ b/src/MSC.st @@ -230,8 +230,8 @@ Object subclass: MSCApplication [ bscPort: 5000; sipIP: '127.0.0.1'. msc bscConfig - addBSC: '127.0.0.1' withName: 'test1' andLac: 4711; - addBSC: '10.240.240.1' withName: 'test2' andLac: 4712. + addBSC: '127.0.0.1' withName: 'test1' andLac: 4711 sendOsmoRSIP: true; + addBSC: '10.240.240.1' withName: 'test2' andLac: 4712 sendOsmoRSIP: true. "Make sure MGCP is running" msc mgcpCallAgent.