Add support for SMS over SGs interface

This commit is contained in:
herlesupreeth
2022-02-01 11:28:54 +01:00
parent 75380d7b1d
commit 4868af9ccd
11 changed files with 272 additions and 0 deletions

41
osmomsc/Dockerfile Normal file
View File

@@ -0,0 +1,41 @@
# BSD 2-Clause License
# Copyright (c) 2020, Supreeth Herle
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
FROM ubuntu:focal
ENV DEBIAN_FRONTEND=noninteractive
# Install updates and dependencies
RUN apt-get update && \
apt-get -y install wget gnupg telnet
RUN wget https://download.opensuse.org/repositories/network:/osmocom:/latest/xUbuntu_20.04/Release.key && \
apt-key add Release.key && \
echo "deb https://download.opensuse.org/repositories/network:/osmocom:/latest/xUbuntu_20.04/ ./" > /etc/apt/sources.list.d/osmocom-latest.list && \
apt-get update && apt-get -y install osmo-msc
CMD /mnt/osmomsc/osmomsc_init.sh && \
cd /mnt/osmomsc && /bin/osmo-msc -c /etc/osmocom/osmo-msc.cfg

34
osmomsc/osmo-msc.cfg Normal file
View File

@@ -0,0 +1,34 @@
!
! OsmoMSC configuration saved from vty
!
line vty
no login
bind 127.0.0.1
ctrl
bind 127.0.0.1
!
network
network country code MCC
mobile network code MNC
short name OsmoMSC
long name OsmoMSC
encryption a5 0
rrlp mode none
mm info 1
msc
assign-tmsi
auth-tuple-max-reuse-count 3
auth-tuple-reuse-on-error 1
sgs
local-ip OSMOMSC_IP
local-port 29118
vlr-name vlr.3GPP_REALM
hlr
! IP address of the remote HLR:
remote-ip OSMOHLR_IP
! default port is 4222, optionally configurable by:
remote-port 4222
smpp
local-tcp-ip OSMOMSC_IP 2775
policy accept-all
no smpp-first

40
osmomsc/osmomsc_init.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/bin/bash
# BSD 2-Clause License
# Copyright (c) 2020, Supreeth Herle
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[ ${#MNC} == 3 ] && 3GPP_REALM="mnc${MNC}.mcc${MCC}.3gppnetwork.org" || 3GPP_REALM="mnc0${MNC}.mcc${MCC}.3gppnetwork.org"
cp /mnt/osmomsc/osmo-msc.cfg /etc/osmocom
sed -i 's|OSMOMSC_IP|'$OSMOMSC_IP'|g' /etc/osmocom/osmo-msc.cfg
sed -i 's|OSMOHLR_IP|'$OSMOHLR_IP'|g' /etc/osmocom/osmo-msc.cfg
sed -i 's|MNC|'$MNC'|g' /etc/osmocom/osmo-msc.cfg
sed -i 's|MCC|'$MCC'|g' /etc/osmocom/osmo-msc.cfg
sed -i 's|3GPP_REALM|'$3GPP_REALM'|g' /etc/osmocom/osmo-msc.cfg
# Sync docker time
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone