Removed vonr features from roaming branch
This commit is contained in:
		
				
					committed by
					
						
						Supreeth Herle
					
				
			
			
				
	
			
			
			
						parent
						
							82aad4e2bd
						
					
				
				
					commit
					9c17ece29a
				
			
							
								
								
									
										10
									
								
								.env
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								.env
									
									
									
									
									
								
							@@ -8,8 +8,8 @@ MCC_R=001
 | 
				
			|||||||
MNC_R=03
 | 
					MNC_R=03
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST_NETWORK=172.22.0.0/24
 | 
					TEST_NETWORK=172.22.0.0/24
 | 
				
			||||||
DOCKER_HOST_IP=10.0.23.250
 | 
					DOCKER_HOST_IP=192.168.1.223
 | 
				
			||||||
DOCKER_HOST_IP_R=10.0.22.222
 | 
					DOCKER_HOST_IP_R=192.168.1.224
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# MONGODB
 | 
					# MONGODB
 | 
				
			||||||
MONGO_IP=172.22.0.2
 | 
					MONGO_IP=172.22.0.2
 | 
				
			||||||
@@ -33,7 +33,7 @@ SMF_DNS2=8.8.4.4
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# UPF
 | 
					# UPF
 | 
				
			||||||
UPF_IP=172.22.0.8
 | 
					UPF_IP=172.22.0.8
 | 
				
			||||||
UPF_ADVERTISE_IP=10.0.23.250
 | 
					UPF_ADVERTISE_IP=172.22.0.8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# MME
 | 
					# MME
 | 
				
			||||||
MME_IP=172.22.0.9
 | 
					MME_IP=172.22.0.9
 | 
				
			||||||
@@ -135,10 +135,10 @@ SRS_GNB_IP=172.22.0.37
 | 
				
			|||||||
SEPP_IP=172.22.0.38
 | 
					SEPP_IP=172.22.0.38
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# UE IPv4 Subnet Range for APN=internet
 | 
					# UE IPv4 Subnet Range for APN=internet
 | 
				
			||||||
UE_IPV4_INTERNET=10.46.0.0/24
 | 
					UE_IPV4_INTERNET=192.168.100.0/24
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# UE IPv4 Subnet Range for APN=ims
 | 
					# UE IPv4 Subnet Range for APN=ims
 | 
				
			||||||
UE_IPV4_IMS=10.45.0.0/24
 | 
					UE_IPV4_IMS=192.168.101.0/24
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Maximum Number of UEs
 | 
					# Maximum Number of UEs
 | 
				
			||||||
MAX_NUM_UE=1024
 | 
					MAX_NUM_UE=1024
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,9 +31,9 @@ services:
 | 
				
			|||||||
      - /etc/timezone:/etc/timezone:ro
 | 
					      - /etc/timezone:/etc/timezone:ro
 | 
				
			||||||
      - /etc/localtime:/etc/localtime:ro
 | 
					      - /etc/localtime:/etc/localtime:ro
 | 
				
			||||||
    expose:
 | 
					    expose:
 | 
				
			||||||
      - "9999/tcp"
 | 
					      - "3000/tcp"
 | 
				
			||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
      - "9999:9999/tcp"
 | 
					      - "3000:3000/tcp"
 | 
				
			||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${WEBUI_IP}
 | 
					        ipv4_address: ${WEBUI_IP}
 | 
				
			||||||
@@ -319,23 +319,6 @@ services:
 | 
				
			|||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${METRICS_IP}
 | 
					        ipv4_address: ${METRICS_IP}
 | 
				
			||||||
  grafana:
 | 
					 | 
				
			||||||
    build: ./grafana
 | 
					 | 
				
			||||||
    image: docker_grafana
 | 
					 | 
				
			||||||
    container_name: grafana
 | 
					 | 
				
			||||||
    env_file:
 | 
					 | 
				
			||||||
      - .env
 | 
					 | 
				
			||||||
    volumes:
 | 
					 | 
				
			||||||
      - ./grafana:/mnt/grafana
 | 
					 | 
				
			||||||
      - /etc/timezone:/etc/timezone:ro
 | 
					 | 
				
			||||||
      - /etc/localtime:/etc/localtime:ro
 | 
					 | 
				
			||||||
    expose:
 | 
					 | 
				
			||||||
      - "3000/tcp"
 | 
					 | 
				
			||||||
    ports:
 | 
					 | 
				
			||||||
      - "3000:3000/tcp"
 | 
					 | 
				
			||||||
    networks:
 | 
					 | 
				
			||||||
      default:
 | 
					 | 
				
			||||||
        ipv4_address: ${GRAFANA_IP}
 | 
					 | 
				
			||||||
networks:
 | 
					networks:
 | 
				
			||||||
  default:
 | 
					  default:
 | 
				
			||||||
    ipam:
 | 
					    ipam:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,9 +31,9 @@ services:
 | 
				
			|||||||
      - /etc/timezone:/etc/timezone:ro
 | 
					      - /etc/timezone:/etc/timezone:ro
 | 
				
			||||||
      - /etc/localtime:/etc/localtime:ro
 | 
					      - /etc/localtime:/etc/localtime:ro
 | 
				
			||||||
    expose:
 | 
					    expose:
 | 
				
			||||||
      - "9999/tcp"
 | 
					      - "3000/tcp"
 | 
				
			||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
      - "9999:9999/tcp"
 | 
					      - "3000:3000/tcp"
 | 
				
			||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${WEBUI_IP}
 | 
					        ipv4_address: ${WEBUI_IP}
 | 
				
			||||||
@@ -455,23 +455,6 @@ services:
 | 
				
			|||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${METRICS_IP}
 | 
					        ipv4_address: ${METRICS_IP}
 | 
				
			||||||
  grafana:
 | 
					 | 
				
			||||||
    build: ./grafana
 | 
					 | 
				
			||||||
    image: docker_grafana
 | 
					 | 
				
			||||||
    container_name: grafana
 | 
					 | 
				
			||||||
    env_file:
 | 
					 | 
				
			||||||
      - .env
 | 
					 | 
				
			||||||
    volumes:
 | 
					 | 
				
			||||||
      - ./grafana:/mnt/grafana
 | 
					 | 
				
			||||||
      - /etc/timezone:/etc/timezone:ro
 | 
					 | 
				
			||||||
      - /etc/localtime:/etc/localtime:ro
 | 
					 | 
				
			||||||
    expose:
 | 
					 | 
				
			||||||
      - "3000/tcp"
 | 
					 | 
				
			||||||
    ports:
 | 
					 | 
				
			||||||
      - "3000:3000/tcp"
 | 
					 | 
				
			||||||
    networks:
 | 
					 | 
				
			||||||
      default:
 | 
					 | 
				
			||||||
        ipv4_address: ${GRAFANA_IP}
 | 
					 | 
				
			||||||
networks:
 | 
					networks:
 | 
				
			||||||
  default:
 | 
					  default:
 | 
				
			||||||
    ipam:
 | 
					    ipam:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,7 +54,7 @@ amf:
 | 
				
			|||||||
        integrity_order : [ NIA2, NIA1, NIA0 ]
 | 
					        integrity_order : [ NIA2, NIA1, NIA0 ]
 | 
				
			||||||
        ciphering_order : [ NEA0, NEA1, NEA2 ]
 | 
					        ciphering_order : [ NEA0, NEA1, NEA2 ]
 | 
				
			||||||
    network_name:
 | 
					    network_name:
 | 
				
			||||||
        full: NAP
 | 
					        full: Open5GS
 | 
				
			||||||
    amf_name: open5gs-amf0
 | 
					    amf_name: open5gs-amf0
 | 
				
			||||||
    metrics:
 | 
					    metrics:
 | 
				
			||||||
      server:
 | 
					      server:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,9 +31,9 @@ services:
 | 
				
			|||||||
      - /etc/timezone:/etc/timezone:ro
 | 
					      - /etc/timezone:/etc/timezone:ro
 | 
				
			||||||
      - /etc/localtime:/etc/localtime:ro
 | 
					      - /etc/localtime:/etc/localtime:ro
 | 
				
			||||||
    expose:
 | 
					    expose:
 | 
				
			||||||
      - "9999/tcp"
 | 
					      - "3000/tcp"
 | 
				
			||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
      - "9999:9999/tcp"
 | 
					      - "3000:3000/tcp"
 | 
				
			||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${WEBUI_IP}
 | 
					        ipv4_address: ${WEBUI_IP}
 | 
				
			||||||
@@ -663,23 +663,6 @@ services:
 | 
				
			|||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${METRICS_IP}
 | 
					        ipv4_address: ${METRICS_IP}
 | 
				
			||||||
  grafana:
 | 
					 | 
				
			||||||
    build: ./grafana
 | 
					 | 
				
			||||||
    image: docker_grafana
 | 
					 | 
				
			||||||
    container_name: grafana
 | 
					 | 
				
			||||||
    env_file:
 | 
					 | 
				
			||||||
      - .env
 | 
					 | 
				
			||||||
    volumes:
 | 
					 | 
				
			||||||
      - ./grafana:/mnt/grafana
 | 
					 | 
				
			||||||
      - /etc/timezone:/etc/timezone:ro
 | 
					 | 
				
			||||||
      - /etc/localtime:/etc/localtime:ro
 | 
					 | 
				
			||||||
    expose:
 | 
					 | 
				
			||||||
      - "3000/tcp"
 | 
					 | 
				
			||||||
    ports:
 | 
					 | 
				
			||||||
      - "3000:3000/tcp"
 | 
					 | 
				
			||||||
    networks:
 | 
					 | 
				
			||||||
      default:
 | 
					 | 
				
			||||||
        ipv4_address: ${GRAFANA_IP}
 | 
					 | 
				
			||||||
networks:
 | 
					networks:
 | 
				
			||||||
  default:
 | 
					  default:
 | 
				
			||||||
    ipam:
 | 
					    ipam:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,39 +0,0 @@
 | 
				
			|||||||
# 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:jammy
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
ENV DEBIAN_FRONTEND=noninteractive
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
RUN apt-get update && \
 | 
					 | 
				
			||||||
    apt-get install -y --no-install-recommends apt-transport-https software-properties-common wget && \
 | 
					 | 
				
			||||||
    mkdir -p /etc/apt/keyrings/ && \
 | 
					 | 
				
			||||||
    wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | tee /etc/apt/keyrings/grafana.gpg && \
 | 
					 | 
				
			||||||
    echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | tee -a /etc/apt/sources.list.d/grafana.list && \
 | 
					 | 
				
			||||||
    apt-get update && \
 | 
					 | 
				
			||||||
    apt-get install -y --no-install-recommends grafana 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
CMD /mnt/grafana/grafana_init.sh
 | 
					 | 
				
			||||||
@@ -1,43 +0,0 @@
 | 
				
			|||||||
#!/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.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Sync docker time
 | 
					 | 
				
			||||||
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export GRAFANA_WORK_DIR=/usr/share/grafana
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
cd $GRAFANA_WORK_DIR 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
cp /mnt/grafana/prometheus_open5gs.yml ./conf/provisioning/datasources
 | 
					 | 
				
			||||||
cp /mnt/grafana/open5gs_dashboard.yml ./conf/provisioning/dashboards
 | 
					 | 
				
			||||||
mkdir -p /var/lib/grafana/dashboards
 | 
					 | 
				
			||||||
cp /mnt/grafana/open5gs_dashboard.json /var/lib/grafana/dashboards
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
sed -i 's|METRICS_IP|'$METRICS_IP'|g' ./conf/provisioning/datasources/prometheus_open5gs.yml
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
./bin/grafana server -homepath $GRAFANA_WORK_DIR
 | 
					 | 
				
			||||||
@@ -1,452 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  "annotations": {
 | 
					 | 
				
			||||||
    "list": [
 | 
					 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
        "builtIn": 1,
 | 
					 | 
				
			||||||
        "datasource": {
 | 
					 | 
				
			||||||
          "type": "grafana",
 | 
					 | 
				
			||||||
          "uid": "-- Grafana --"
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        "enable": true,
 | 
					 | 
				
			||||||
        "hide": true,
 | 
					 | 
				
			||||||
        "iconColor": "rgba(0, 211, 255, 1)",
 | 
					 | 
				
			||||||
        "name": "Annotations & Alerts",
 | 
					 | 
				
			||||||
        "type": "dashboard"
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    ]
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "editable": true,
 | 
					 | 
				
			||||||
  "fiscalYearStartMonth": 0,
 | 
					 | 
				
			||||||
  "graphTooltip": 0,
 | 
					 | 
				
			||||||
  "links": [],
 | 
					 | 
				
			||||||
  "panels": [
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      "datasource": {
 | 
					 | 
				
			||||||
        "type": "prometheus",
 | 
					 | 
				
			||||||
        "uid": "PA240B69645956401"
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "fieldConfig": {
 | 
					 | 
				
			||||||
        "defaults": {
 | 
					 | 
				
			||||||
          "color": {
 | 
					 | 
				
			||||||
            "mode": "palette-classic"
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          "custom": {
 | 
					 | 
				
			||||||
            "axisBorderShow": false,
 | 
					 | 
				
			||||||
            "axisCenteredZero": false,
 | 
					 | 
				
			||||||
            "axisColorMode": "text",
 | 
					 | 
				
			||||||
            "axisLabel": "",
 | 
					 | 
				
			||||||
            "axisPlacement": "auto",
 | 
					 | 
				
			||||||
            "barAlignment": 0,
 | 
					 | 
				
			||||||
            "drawStyle": "line",
 | 
					 | 
				
			||||||
            "fillOpacity": 0,
 | 
					 | 
				
			||||||
            "gradientMode": "none",
 | 
					 | 
				
			||||||
            "hideFrom": {
 | 
					 | 
				
			||||||
              "legend": false,
 | 
					 | 
				
			||||||
              "tooltip": false,
 | 
					 | 
				
			||||||
              "viz": false
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            "insertNulls": false,
 | 
					 | 
				
			||||||
            "lineInterpolation": "linear",
 | 
					 | 
				
			||||||
            "lineWidth": 1,
 | 
					 | 
				
			||||||
            "pointSize": 5,
 | 
					 | 
				
			||||||
            "scaleDistribution": {
 | 
					 | 
				
			||||||
              "type": "linear"
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            "showPoints": "auto",
 | 
					 | 
				
			||||||
            "spanNulls": false,
 | 
					 | 
				
			||||||
            "stacking": {
 | 
					 | 
				
			||||||
              "group": "A",
 | 
					 | 
				
			||||||
              "mode": "none"
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            "thresholdsStyle": {
 | 
					 | 
				
			||||||
              "mode": "off"
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          "mappings": [],
 | 
					 | 
				
			||||||
          "thresholds": {
 | 
					 | 
				
			||||||
            "mode": "absolute",
 | 
					 | 
				
			||||||
            "steps": [
 | 
					 | 
				
			||||||
              {
 | 
					 | 
				
			||||||
                "color": "green",
 | 
					 | 
				
			||||||
                "value": null
 | 
					 | 
				
			||||||
              },
 | 
					 | 
				
			||||||
              {
 | 
					 | 
				
			||||||
                "color": "red",
 | 
					 | 
				
			||||||
                "value": 80
 | 
					 | 
				
			||||||
              }
 | 
					 | 
				
			||||||
            ]
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        "overrides": []
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "gridPos": {
 | 
					 | 
				
			||||||
        "h": 8,
 | 
					 | 
				
			||||||
        "w": 12,
 | 
					 | 
				
			||||||
        "x": 0,
 | 
					 | 
				
			||||||
        "y": 0
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "id": 5,
 | 
					 | 
				
			||||||
      "options": {
 | 
					 | 
				
			||||||
        "legend": {
 | 
					 | 
				
			||||||
          "calcs": [],
 | 
					 | 
				
			||||||
          "displayMode": "list",
 | 
					 | 
				
			||||||
          "placement": "bottom",
 | 
					 | 
				
			||||||
          "showLegend": true
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        "tooltip": {
 | 
					 | 
				
			||||||
          "mode": "single",
 | 
					 | 
				
			||||||
          "sort": "none"
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "targets": [
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          "datasource": {
 | 
					 | 
				
			||||||
            "type": "prometheus",
 | 
					 | 
				
			||||||
            "uid": "PA240B69645956401"
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          "disableTextWrap": false,
 | 
					 | 
				
			||||||
          "editorMode": "builder",
 | 
					 | 
				
			||||||
          "expr": "fivegs_ep_n3_gtp_indatapktn3upf",
 | 
					 | 
				
			||||||
          "fullMetaSearch": false,
 | 
					 | 
				
			||||||
          "includeNullMetadata": true,
 | 
					 | 
				
			||||||
          "instant": false,
 | 
					 | 
				
			||||||
          "legendFormat": "__auto",
 | 
					 | 
				
			||||||
          "range": true,
 | 
					 | 
				
			||||||
          "refId": "A",
 | 
					 | 
				
			||||||
          "useBackend": false
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          "datasource": {
 | 
					 | 
				
			||||||
            "type": "prometheus",
 | 
					 | 
				
			||||||
            "uid": "PA240B69645956401"
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          "disableTextWrap": false,
 | 
					 | 
				
			||||||
          "editorMode": "builder",
 | 
					 | 
				
			||||||
          "expr": "fivegs_ep_n3_gtp_outdatapktn3upf",
 | 
					 | 
				
			||||||
          "fullMetaSearch": false,
 | 
					 | 
				
			||||||
          "hide": false,
 | 
					 | 
				
			||||||
          "includeNullMetadata": true,
 | 
					 | 
				
			||||||
          "instant": false,
 | 
					 | 
				
			||||||
          "legendFormat": "__auto",
 | 
					 | 
				
			||||||
          "range": true,
 | 
					 | 
				
			||||||
          "refId": "B",
 | 
					 | 
				
			||||||
          "useBackend": false
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      ],
 | 
					 | 
				
			||||||
      "title": "UPF - GTP Packets",
 | 
					 | 
				
			||||||
      "type": "timeseries"
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      "datasource": {
 | 
					 | 
				
			||||||
        "type": "prometheus",
 | 
					 | 
				
			||||||
        "uid": "PA240B69645956401"
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "fieldConfig": {
 | 
					 | 
				
			||||||
        "defaults": {
 | 
					 | 
				
			||||||
          "color": {
 | 
					 | 
				
			||||||
            "mode": "palette-classic"
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          "custom": {
 | 
					 | 
				
			||||||
            "axisBorderShow": false,
 | 
					 | 
				
			||||||
            "axisCenteredZero": false,
 | 
					 | 
				
			||||||
            "axisColorMode": "text",
 | 
					 | 
				
			||||||
            "axisLabel": "",
 | 
					 | 
				
			||||||
            "axisPlacement": "auto",
 | 
					 | 
				
			||||||
            "barAlignment": 0,
 | 
					 | 
				
			||||||
            "drawStyle": "line",
 | 
					 | 
				
			||||||
            "fillOpacity": 0,
 | 
					 | 
				
			||||||
            "gradientMode": "none",
 | 
					 | 
				
			||||||
            "hideFrom": {
 | 
					 | 
				
			||||||
              "legend": false,
 | 
					 | 
				
			||||||
              "tooltip": false,
 | 
					 | 
				
			||||||
              "viz": false
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            "insertNulls": false,
 | 
					 | 
				
			||||||
            "lineInterpolation": "linear",
 | 
					 | 
				
			||||||
            "lineWidth": 1,
 | 
					 | 
				
			||||||
            "pointSize": 5,
 | 
					 | 
				
			||||||
            "scaleDistribution": {
 | 
					 | 
				
			||||||
              "type": "linear"
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            "showPoints": "auto",
 | 
					 | 
				
			||||||
            "spanNulls": false,
 | 
					 | 
				
			||||||
            "stacking": {
 | 
					 | 
				
			||||||
              "group": "A",
 | 
					 | 
				
			||||||
              "mode": "none"
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            "thresholdsStyle": {
 | 
					 | 
				
			||||||
              "mode": "off"
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          "mappings": [],
 | 
					 | 
				
			||||||
          "thresholds": {
 | 
					 | 
				
			||||||
            "mode": "absolute",
 | 
					 | 
				
			||||||
            "steps": [
 | 
					 | 
				
			||||||
              {
 | 
					 | 
				
			||||||
                "color": "green",
 | 
					 | 
				
			||||||
                "value": null
 | 
					 | 
				
			||||||
              },
 | 
					 | 
				
			||||||
              {
 | 
					 | 
				
			||||||
                "color": "red",
 | 
					 | 
				
			||||||
                "value": 80
 | 
					 | 
				
			||||||
              }
 | 
					 | 
				
			||||||
            ]
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        "overrides": []
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "gridPos": {
 | 
					 | 
				
			||||||
        "h": 8,
 | 
					 | 
				
			||||||
        "w": 12,
 | 
					 | 
				
			||||||
        "x": 12,
 | 
					 | 
				
			||||||
        "y": 0
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "id": 4,
 | 
					 | 
				
			||||||
      "options": {
 | 
					 | 
				
			||||||
        "legend": {
 | 
					 | 
				
			||||||
          "calcs": [],
 | 
					 | 
				
			||||||
          "displayMode": "list",
 | 
					 | 
				
			||||||
          "placement": "bottom",
 | 
					 | 
				
			||||||
          "showLegend": true
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        "tooltip": {
 | 
					 | 
				
			||||||
          "mode": "single",
 | 
					 | 
				
			||||||
          "sort": "none"
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "targets": [
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          "datasource": {
 | 
					 | 
				
			||||||
            "type": "prometheus",
 | 
					 | 
				
			||||||
            "uid": "PA240B69645956401"
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          "disableTextWrap": false,
 | 
					 | 
				
			||||||
          "editorMode": "builder",
 | 
					 | 
				
			||||||
          "expr": "fivegs_upffunction_upf_sessionnbr",
 | 
					 | 
				
			||||||
          "fullMetaSearch": false,
 | 
					 | 
				
			||||||
          "includeNullMetadata": true,
 | 
					 | 
				
			||||||
          "instant": false,
 | 
					 | 
				
			||||||
          "legendFormat": "__auto",
 | 
					 | 
				
			||||||
          "range": true,
 | 
					 | 
				
			||||||
          "refId": "A",
 | 
					 | 
				
			||||||
          "useBackend": false
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      ],
 | 
					 | 
				
			||||||
      "title": "UPF - Active Sessions",
 | 
					 | 
				
			||||||
      "type": "timeseries"
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      "datasource": {
 | 
					 | 
				
			||||||
        "type": "prometheus",
 | 
					 | 
				
			||||||
        "uid": "PA240B69645956401"
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "fieldConfig": {
 | 
					 | 
				
			||||||
        "defaults": {
 | 
					 | 
				
			||||||
          "color": {
 | 
					 | 
				
			||||||
            "mode": "palette-classic"
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          "custom": {
 | 
					 | 
				
			||||||
            "axisBorderShow": false,
 | 
					 | 
				
			||||||
            "axisCenteredZero": false,
 | 
					 | 
				
			||||||
            "axisColorMode": "text",
 | 
					 | 
				
			||||||
            "axisLabel": "",
 | 
					 | 
				
			||||||
            "axisPlacement": "auto",
 | 
					 | 
				
			||||||
            "barAlignment": 0,
 | 
					 | 
				
			||||||
            "drawStyle": "line",
 | 
					 | 
				
			||||||
            "fillOpacity": 0,
 | 
					 | 
				
			||||||
            "gradientMode": "none",
 | 
					 | 
				
			||||||
            "hideFrom": {
 | 
					 | 
				
			||||||
              "legend": false,
 | 
					 | 
				
			||||||
              "tooltip": false,
 | 
					 | 
				
			||||||
              "viz": false
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            "insertNulls": false,
 | 
					 | 
				
			||||||
            "lineInterpolation": "linear",
 | 
					 | 
				
			||||||
            "lineWidth": 1,
 | 
					 | 
				
			||||||
            "pointSize": 5,
 | 
					 | 
				
			||||||
            "scaleDistribution": {
 | 
					 | 
				
			||||||
              "type": "linear"
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            "showPoints": "auto",
 | 
					 | 
				
			||||||
            "spanNulls": false,
 | 
					 | 
				
			||||||
            "stacking": {
 | 
					 | 
				
			||||||
              "group": "A",
 | 
					 | 
				
			||||||
              "mode": "none"
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            "thresholdsStyle": {
 | 
					 | 
				
			||||||
              "mode": "off"
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          "mappings": [],
 | 
					 | 
				
			||||||
          "thresholds": {
 | 
					 | 
				
			||||||
            "mode": "absolute",
 | 
					 | 
				
			||||||
            "steps": [
 | 
					 | 
				
			||||||
              {
 | 
					 | 
				
			||||||
                "color": "green",
 | 
					 | 
				
			||||||
                "value": null
 | 
					 | 
				
			||||||
              },
 | 
					 | 
				
			||||||
              {
 | 
					 | 
				
			||||||
                "color": "red",
 | 
					 | 
				
			||||||
                "value": 80
 | 
					 | 
				
			||||||
              }
 | 
					 | 
				
			||||||
            ]
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        "overrides": []
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "gridPos": {
 | 
					 | 
				
			||||||
        "h": 8,
 | 
					 | 
				
			||||||
        "w": 12,
 | 
					 | 
				
			||||||
        "x": 0,
 | 
					 | 
				
			||||||
        "y": 8
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "id": 3,
 | 
					 | 
				
			||||||
      "options": {
 | 
					 | 
				
			||||||
        "legend": {
 | 
					 | 
				
			||||||
          "calcs": [],
 | 
					 | 
				
			||||||
          "displayMode": "list",
 | 
					 | 
				
			||||||
          "placement": "bottom",
 | 
					 | 
				
			||||||
          "showLegend": true
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        "tooltip": {
 | 
					 | 
				
			||||||
          "mode": "single",
 | 
					 | 
				
			||||||
          "sort": "none"
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "targets": [
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          "datasource": {
 | 
					 | 
				
			||||||
            "type": "prometheus",
 | 
					 | 
				
			||||||
            "uid": "PA240B69645956401"
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          "disableTextWrap": false,
 | 
					 | 
				
			||||||
          "editorMode": "builder",
 | 
					 | 
				
			||||||
          "expr": "enb",
 | 
					 | 
				
			||||||
          "fullMetaSearch": false,
 | 
					 | 
				
			||||||
          "includeNullMetadata": true,
 | 
					 | 
				
			||||||
          "instant": false,
 | 
					 | 
				
			||||||
          "legendFormat": "__auto",
 | 
					 | 
				
			||||||
          "range": true,
 | 
					 | 
				
			||||||
          "refId": "A",
 | 
					 | 
				
			||||||
          "useBackend": false
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      ],
 | 
					 | 
				
			||||||
      "title": "MME - eNBs",
 | 
					 | 
				
			||||||
      "type": "timeseries"
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      "datasource": {
 | 
					 | 
				
			||||||
        "type": "prometheus",
 | 
					 | 
				
			||||||
        "uid": "PA240B69645956401"
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "fieldConfig": {
 | 
					 | 
				
			||||||
        "defaults": {
 | 
					 | 
				
			||||||
          "color": {
 | 
					 | 
				
			||||||
            "mode": "palette-classic"
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          "custom": {
 | 
					 | 
				
			||||||
            "axisBorderShow": false,
 | 
					 | 
				
			||||||
            "axisCenteredZero": false,
 | 
					 | 
				
			||||||
            "axisColorMode": "text",
 | 
					 | 
				
			||||||
            "axisLabel": "",
 | 
					 | 
				
			||||||
            "axisPlacement": "auto",
 | 
					 | 
				
			||||||
            "barAlignment": 0,
 | 
					 | 
				
			||||||
            "drawStyle": "line",
 | 
					 | 
				
			||||||
            "fillOpacity": 0,
 | 
					 | 
				
			||||||
            "gradientMode": "none",
 | 
					 | 
				
			||||||
            "hideFrom": {
 | 
					 | 
				
			||||||
              "legend": false,
 | 
					 | 
				
			||||||
              "tooltip": false,
 | 
					 | 
				
			||||||
              "viz": false
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            "insertNulls": false,
 | 
					 | 
				
			||||||
            "lineInterpolation": "linear",
 | 
					 | 
				
			||||||
            "lineWidth": 1,
 | 
					 | 
				
			||||||
            "pointSize": 5,
 | 
					 | 
				
			||||||
            "scaleDistribution": {
 | 
					 | 
				
			||||||
              "type": "linear"
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            "showPoints": "auto",
 | 
					 | 
				
			||||||
            "spanNulls": false,
 | 
					 | 
				
			||||||
            "stacking": {
 | 
					 | 
				
			||||||
              "group": "A",
 | 
					 | 
				
			||||||
              "mode": "none"
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            "thresholdsStyle": {
 | 
					 | 
				
			||||||
              "mode": "off"
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          "mappings": [],
 | 
					 | 
				
			||||||
          "thresholds": {
 | 
					 | 
				
			||||||
            "mode": "absolute",
 | 
					 | 
				
			||||||
            "steps": [
 | 
					 | 
				
			||||||
              {
 | 
					 | 
				
			||||||
                "color": "green",
 | 
					 | 
				
			||||||
                "value": null
 | 
					 | 
				
			||||||
              },
 | 
					 | 
				
			||||||
              {
 | 
					 | 
				
			||||||
                "color": "red",
 | 
					 | 
				
			||||||
                "value": 80
 | 
					 | 
				
			||||||
              }
 | 
					 | 
				
			||||||
            ]
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        "overrides": []
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "gridPos": {
 | 
					 | 
				
			||||||
        "h": 8,
 | 
					 | 
				
			||||||
        "w": 12,
 | 
					 | 
				
			||||||
        "x": 12,
 | 
					 | 
				
			||||||
        "y": 8
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "id": 2,
 | 
					 | 
				
			||||||
      "options": {
 | 
					 | 
				
			||||||
        "legend": {
 | 
					 | 
				
			||||||
          "calcs": [],
 | 
					 | 
				
			||||||
          "displayMode": "list",
 | 
					 | 
				
			||||||
          "placement": "bottom",
 | 
					 | 
				
			||||||
          "showLegend": true
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        "tooltip": {
 | 
					 | 
				
			||||||
          "mode": "single",
 | 
					 | 
				
			||||||
          "sort": "none"
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "targets": [
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          "datasource": {
 | 
					 | 
				
			||||||
            "type": "prometheus",
 | 
					 | 
				
			||||||
            "uid": "PA240B69645956401"
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          "disableTextWrap": false,
 | 
					 | 
				
			||||||
          "editorMode": "builder",
 | 
					 | 
				
			||||||
          "expr": "enb_ue",
 | 
					 | 
				
			||||||
          "fullMetaSearch": false,
 | 
					 | 
				
			||||||
          "includeNullMetadata": true,
 | 
					 | 
				
			||||||
          "instant": false,
 | 
					 | 
				
			||||||
          "legendFormat": "__auto",
 | 
					 | 
				
			||||||
          "range": true,
 | 
					 | 
				
			||||||
          "refId": "A",
 | 
					 | 
				
			||||||
          "useBackend": false
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      ],
 | 
					 | 
				
			||||||
      "title": "MME - Sessions",
 | 
					 | 
				
			||||||
      "type": "timeseries"
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  ],
 | 
					 | 
				
			||||||
  "schemaVersion": 39,
 | 
					 | 
				
			||||||
  "tags": [],
 | 
					 | 
				
			||||||
  "templating": {
 | 
					 | 
				
			||||||
    "list": []
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "time": {
 | 
					 | 
				
			||||||
    "from": "now-6h",
 | 
					 | 
				
			||||||
    "to": "now"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "timepicker": {},
 | 
					 | 
				
			||||||
  "timezone": "browser",
 | 
					 | 
				
			||||||
  "title": "Open5Gs",
 | 
					 | 
				
			||||||
  "uid": "fdg9t0npkjj7ka",
 | 
					 | 
				
			||||||
  "version": 1,
 | 
					 | 
				
			||||||
  "weekStart": ""
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,8 +0,0 @@
 | 
				
			|||||||
apiVersion: 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
providers:
 | 
					 | 
				
			||||||
  - name: Open5Gs # A uniquely identifiable name for the provider
 | 
					 | 
				
			||||||
    folder: Services # The folder where to place the dashboards
 | 
					 | 
				
			||||||
    type: file
 | 
					 | 
				
			||||||
    options:
 | 
					 | 
				
			||||||
      path: /var/lib/grafana/dashboards
 | 
					 | 
				
			||||||
@@ -1,6 +0,0 @@
 | 
				
			|||||||
apiVersion: 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
datasources:
 | 
					 | 
				
			||||||
  - name: Open5Gs
 | 
					 | 
				
			||||||
    type: prometheus
 | 
					 | 
				
			||||||
    url: http://METRICS_IP:9090
 | 
					 | 
				
			||||||
@@ -1,12 +1,9 @@
 | 
				
			|||||||
db_uri: mongodb://MONGO_IP/open5gs
 | 
					db_uri: mongodb://MONGO_IP/open5gs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
logger:
 | 
					logger:
 | 
				
			||||||
    file:
 | 
					    file: /open5gs/install/var/log/open5gs/hss.log
 | 
				
			||||||
      path: /open5gs/install/var/log/open5gs/hss.log
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
global:
 | 
					parameter:
 | 
				
			||||||
  max:
 | 
					 | 
				
			||||||
    ue: MAX_NUM_UE
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
hss:
 | 
					hss:
 | 
				
			||||||
    freeDiameter: /open5gs/install/etc/freeDiameter/hss.conf
 | 
					    freeDiameter: /open5gs/install/etc/freeDiameter/hss.conf
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,9 +32,6 @@ export IP_ADDR=$(awk 'END{print $1}' /etc/hosts)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[ ${#MNC} == 3 ] && EPC_DOMAIN="epc.mnc${MNC}.mcc${MCC}.3gppnetwork.org" || EPC_DOMAIN="epc.mnc0${MNC}.mcc${MCC}.3gppnetwork.org"
 | 
					[ ${#MNC} == 3 ] && EPC_DOMAIN="epc.mnc${MNC}.mcc${MCC}.3gppnetwork.org" || EPC_DOMAIN="epc.mnc0${MNC}.mcc${MCC}.3gppnetwork.org"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ln -s /usr/bin/mongo /usr/bin/mongosh
 | 
					 | 
				
			||||||
sed -i "s|localhost|$MONGO_IP|" /open5gs/misc/db/open5gs-dbctl
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
cp /mnt/hss/hss.yaml install/etc/open5gs
 | 
					cp /mnt/hss/hss.yaml install/etc/open5gs
 | 
				
			||||||
cp /mnt/hss/hss.conf install/etc/freeDiameter
 | 
					cp /mnt/hss/hss.conf install/etc/freeDiameter
 | 
				
			||||||
cp /mnt/hss/make_certs.sh install/etc/freeDiameter
 | 
					cp /mnt/hss/make_certs.sh install/etc/freeDiameter
 | 
				
			||||||
@@ -45,7 +42,6 @@ sed -i 's|EPC_DOMAIN|'$EPC_DOMAIN'|g' install/etc/freeDiameter/hss.conf
 | 
				
			|||||||
sed -i 's|LD_LIBRARY_PATH|'$LD_LIBRARY_PATH'|g' install/etc/freeDiameter/hss.conf
 | 
					sed -i 's|LD_LIBRARY_PATH|'$LD_LIBRARY_PATH'|g' install/etc/freeDiameter/hss.conf
 | 
				
			||||||
sed -i 's|EPC_DOMAIN|'$EPC_DOMAIN'|g' install/etc/freeDiameter/make_certs.sh
 | 
					sed -i 's|EPC_DOMAIN|'$EPC_DOMAIN'|g' install/etc/freeDiameter/make_certs.sh
 | 
				
			||||||
sed -i 's|MONGO_IP|'$MONGO_IP'|g' install/etc/open5gs/hss.yaml
 | 
					sed -i 's|MONGO_IP|'$MONGO_IP'|g' install/etc/open5gs/hss.yaml
 | 
				
			||||||
sed -i 's|MAX_NUM_UE|'$MAX_NUM_UE'|g' install/etc/open5gs/hss.yaml
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Generate TLS certificates
 | 
					# Generate TLS certificates
 | 
				
			||||||
./install/etc/freeDiameter/make_certs.sh install/etc/freeDiameter
 | 
					./install/etc/freeDiameter/make_certs.sh install/etc/freeDiameter
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,12 +34,12 @@ RUN apt-get update && \
 | 
				
			|||||||
					gcc flex bison libmysqlclient-dev make libssl-dev libcurl4-openssl-dev \
 | 
										gcc flex bison libmysqlclient-dev make libssl-dev libcurl4-openssl-dev \
 | 
				
			||||||
					libxml2-dev libpcre2-dev bash-completion g++ autoconf libmnl-dev \
 | 
										libxml2-dev libpcre2-dev bash-completion g++ autoconf libmnl-dev \
 | 
				
			||||||
					libsctp-dev libradcli-dev libradcli4 libjson-c-dev pkg-config iproute2 net-tools \
 | 
										libsctp-dev libradcli-dev libradcli4 libjson-c-dev pkg-config iproute2 net-tools \
 | 
				
			||||||
					iputils-ping libgcrypt20-dev libjansson-dev libevent-dev libnghttp2-dev uuid-dev
 | 
										iputils-ping
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Fetch Kamailio code
 | 
					# Fetch Kamailio code (branch 5.3)
 | 
				
			||||||
RUN mkdir -p /usr/local/src/ && cd /usr/local/src/ && \
 | 
					RUN mkdir -p /usr/local/src/ && cd /usr/local/src/ && \
 | 
				
			||||||
	git clone https://github.com/kamailio/kamailio && \
 | 
						git clone https://github.com/kamailio/kamailio && \
 | 
				
			||||||
	cd kamailio && git checkout 0da3eb3f94c087b272ebbe19c42fd933146482f8
 | 
						cd kamailio && git checkout 4df92312166d8aad700007ef0898d0a7c6ba40b7
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Build and Install Kamailio
 | 
					# Build and Install Kamailio
 | 
				
			||||||
RUN cd /usr/local/src/kamailio && make cfg
 | 
					RUN cd /usr/local/src/kamailio && make cfg
 | 
				
			||||||
@@ -50,4 +50,4 @@ RUN cd /usr/local/src/kamailio && \
 | 
				
			|||||||
	ldconfig
 | 
						ldconfig
 | 
				
			||||||
 | 
					
 | 
				
			||||||
COPY kamailio_init.sh /
 | 
					COPY kamailio_init.sh /
 | 
				
			||||||
CMD ["/kamailio_init.sh"]
 | 
					CMD /kamailio_init.sh
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ modules_dirs:=modules
 | 
				
			|||||||
cfg_group_include=
 | 
					cfg_group_include=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# the list of extra modules to compile
 | 
					# the list of extra modules to compile
 | 
				
			||||||
include_modules= cdp cdp_avp db_mysql dialplan enum http_async_client http_client ims_auth ims_charging ims_dialog ims_diameter_server ims_icscf ims_ipsec_pcscf ims_isc ims_ocs ims_qos ims_registrar_pcscf ims_registrar_scscf ims_usrloc_pcscf ims_usrloc_scscf jansson json nghttp2 outbound presence presence_conference presence_dialoginfo presence_mwi presence_profile presence_reginfo presence_xml pua pua_bla pua_dialoginfo pua_reginfo pua_rpc pua_usrloc pua_xmpp sctp tls utils uuid xcap_client xcap_server xmlops xmlrpc
 | 
					include_modules= cdp cdp_avp db_mysql dialplan enum json http_client ims_auth ims_charging ims_dialog ims_diameter_server ims_icscf ims_ipsec_pcscf ims_isc ims_ocs ims_qos ims_registrar_pcscf ims_registrar_scscf ims_usrloc_pcscf ims_usrloc_scscf outbound presence presence_conference presence_dialoginfo presence_mwi presence_profile presence_reginfo presence_xml pua pua_bla pua_dialoginfo pua_reginfo pua_rpc pua_usrloc pua_xmpp sctp tls utils xcap_client xcap_server xmlops xmlrpc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# the list of static modules
 | 
					# the list of static modules
 | 
				
			||||||
static_modules= 
 | 
					static_modules= 
 | 
				
			||||||
@@ -16,7 +16,7 @@ static_modules=
 | 
				
			|||||||
skip_modules= 
 | 
					skip_modules= 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# the list of modules to exclude from compile list
 | 
					# the list of modules to exclude from compile list
 | 
				
			||||||
exclude_modules= malloc_test app_sqlang acc_json acc_radius app_java app_lua app_lua_sr app_mono app_perl app_python app_python3 app_python3s app_ruby app_ruby_proc auth_ephemeral auth_identity auth_radius cnxcc cplc crypto db2_ldap db_berkeley db_cassandra db_mongodb db_oracle db_perlvdb db_postgres db_redis db_sqlite db_unixodbc dnssec erlang evapi geoip geoip2 gzcompress h350 janssonrpcc jsonrpcc jwt kafka kazoo lcr ldap log_systemd lost lwsc memcached microhttpd misc_radius mqtt nats ndb_cassandra ndb_mongodb ndb_redis nsq osp peering phonenum rabbitmq regex rls rtp_media_server ruxc secsipid secsipid_proc slack snmpstats stirshaken systemdops tls_wolfssl tlsa topos_redis websocket xhttp_pi xmpp $(skip_modules)
 | 
					exclude_modules= malloc_test app_sqlang acc_json acc_radius app_java app_lua app_lua_sr app_mono app_perl app_python app_python3 app_python3s app_ruby app_ruby_proc auth_ephemeral auth_identity auth_radius cnxcc cplc crypto db2_ldap db_berkeley db_cassandra db_mongodb db_oracle db_perlvdb db_postgres db_redis db_sqlite db_unixodbc dnssec erlang evapi geoip geoip2 gzcompress h350 http_async_client http_client jansson janssonrpcc json jsonrpcc jwt kafka kazoo lcr ldap log_systemd lost lwsc memcached microhttpd misc_radius mqtt nats ndb_cassandra ndb_mongodb ndb_redis nsq osp peering phonenum rabbitmq regex rls rtp_media_server ruxc secsipid secsipid_proc slack snmpstats stirshaken systemdops tls_wolfssl tlsa topos_redis uuid websocket xhttp_pi xmpp $(skip_modules)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
modules_all= $(filter-out modules/CVS,$(wildcard modules/*))
 | 
					modules_all= $(filter-out modules/CVS,$(wildcard modules/*))
 | 
				
			||||||
modules_noinc= $(filter-out $(addprefix modules/, $(exclude_modules) $(static_modules)), $(modules_all)) 
 | 
					modules_noinc= $(filter-out $(addprefix modules/, $(exclude_modules) $(static_modules)), $(modules_all)) 
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,4 +39,4 @@ RUN wget $OSMOCOM_REPO/Release.key && \
 | 
				
			|||||||
    apt-get update && apt-get install -f && apt-get --install-suggests -y install osmo-hlr
 | 
					    apt-get update && apt-get install -f && apt-get --install-suggests -y install osmo-hlr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CMD /mnt/osmohlr/osmohlr_init.sh && \
 | 
					CMD /mnt/osmohlr/osmohlr_init.sh && \
 | 
				
			||||||
    cd /mnt/osmohlr && /usr/bin/osmo-hlr -c /etc/osmocom/osmo-hlr.cfg --db-upgrade
 | 
					    cd /mnt/osmohlr && /usr/bin/osmo-hlr -c /etc/osmocom/osmo-hlr.cfg
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,6 +16,5 @@ line vty
 | 
				
			|||||||
ctrl
 | 
					ctrl
 | 
				
			||||||
 bind 127.0.0.1
 | 
					 bind 127.0.0.1
 | 
				
			||||||
hlr
 | 
					hlr
 | 
				
			||||||
 subscriber-create-on-demand 5 cs+ps
 | 
					 | 
				
			||||||
 gsup
 | 
					 gsup
 | 
				
			||||||
  bind ip OSMOHLR_IP
 | 
					  bind ip OSMOHLR_IP
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,17 +1,11 @@
 | 
				
			|||||||
!
 | 
					!
 | 
				
			||||||
! OsmoMSC configuration saved from vty
 | 
					! OsmoMSC configuration saved from vty
 | 
				
			||||||
!
 | 
					!
 | 
				
			||||||
log stderr
 | 
					 | 
				
			||||||
 logging filter all 1
 | 
					 | 
				
			||||||
 logging color 1
 | 
					 | 
				
			||||||
 logging print category 1
 | 
					 | 
				
			||||||
 logging timestamp 1
 | 
					 | 
				
			||||||
 logging print extended-timestamp 1
 | 
					 | 
				
			||||||
 logging level all debug
 | 
					 | 
				
			||||||
 logging level linp error
 | 
					 | 
				
			||||||
!
 | 
					 | 
				
			||||||
line vty
 | 
					line vty
 | 
				
			||||||
 no login
 | 
					 no login
 | 
				
			||||||
 | 
					 bind 127.0.0.1
 | 
				
			||||||
 | 
					ctrl
 | 
				
			||||||
 | 
					 bind 127.0.0.1
 | 
				
			||||||
!
 | 
					!
 | 
				
			||||||
network
 | 
					network
 | 
				
			||||||
 network country code MCC
 | 
					 network country code MCC
 | 
				
			||||||
@@ -21,17 +15,6 @@ network
 | 
				
			|||||||
 encryption a5 0
 | 
					 encryption a5 0
 | 
				
			||||||
 rrlp mode none
 | 
					 rrlp mode none
 | 
				
			||||||
 mm info 1
 | 
					 mm info 1
 | 
				
			||||||
 mgw 0
 | 
					 | 
				
			||||||
  remote-ip 127.0.0.1
 | 
					 | 
				
			||||||
  remote-port 2427
 | 
					 | 
				
			||||||
  local-port 2728
 | 
					 | 
				
			||||||
cs7 instance 0
 | 
					 | 
				
			||||||
 point-code 0.23.1
 | 
					 | 
				
			||||||
 asp asp-clnt-OsmoMSC-A-Iu 2905 0 m3ua
 | 
					 | 
				
			||||||
  ! where to reach the STP:
 | 
					 | 
				
			||||||
  remote-ip 127.0.0.5
 | 
					 | 
				
			||||||
  role asp
 | 
					 | 
				
			||||||
  sctp-role client
 | 
					 | 
				
			||||||
msc
 | 
					msc
 | 
				
			||||||
 assign-tmsi
 | 
					 assign-tmsi
 | 
				
			||||||
 auth-tuple-max-reuse-count 3
 | 
					 auth-tuple-max-reuse-count 3
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										36
									
								
								pcf/pcf.yaml
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								pcf/pcf.yaml
									
									
									
									
									
								
							@@ -53,41 +53,5 @@ pcf:
 | 
				
			|||||||
                  priority_level: 8
 | 
					                  priority_level: 8
 | 
				
			||||||
                  pre_emption_vulnerability: 1
 | 
					                  pre_emption_vulnerability: 1
 | 
				
			||||||
                  pre_emption_capability: 1
 | 
					                  pre_emption_capability: 1
 | 
				
			||||||
            - name: ims
 | 
					 | 
				
			||||||
              type: 3  # 1:IPv4, 2:IPv6, 3:IPv4v6
 | 
					 | 
				
			||||||
              ambr:
 | 
					 | 
				
			||||||
                downlink:
 | 
					 | 
				
			||||||
                  value: 1
 | 
					 | 
				
			||||||
                  unit: 3  # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
 | 
					 | 
				
			||||||
                uplink:
 | 
					 | 
				
			||||||
                  value: 1
 | 
					 | 
				
			||||||
                  unit: 3  # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
 | 
					 | 
				
			||||||
              qos:
 | 
					 | 
				
			||||||
                index: 5  # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86
 | 
					 | 
				
			||||||
                arp:
 | 
					 | 
				
			||||||
                  priority_level: 1  # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
 | 
					 | 
				
			||||||
                  pre_emption_vulnerability: 1  # 1: Disabled, 2:Enabled
 | 
					 | 
				
			||||||
                  pre_emption_capability: 1  # 1: Disabled, 2:Enabled
 | 
					 | 
				
			||||||
              pcc_rule:
 | 
					 | 
				
			||||||
                - qos:
 | 
					 | 
				
			||||||
                    index: 1  # 1, 2, 3, 4, 65, 66, 67, 75, 71, 72, 73, 74, 76, 5, 6, 7, 8, 9, 69, 70, 79, 80, 82, 83, 84, 85, 86
 | 
					 | 
				
			||||||
                    arp:
 | 
					 | 
				
			||||||
                      priority_level: 2  # 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
 | 
					 | 
				
			||||||
                      pre_emption_vulnerability: 1   # 1: Disabled, 2:Enabled
 | 
					 | 
				
			||||||
                      pre_emption_capability: 1   # 1: Disabled, 2:Enabled
 | 
					 | 
				
			||||||
                    mbr:
 | 
					 | 
				
			||||||
                      downlink:
 | 
					 | 
				
			||||||
                        value: 82
 | 
					 | 
				
			||||||
                        unit: 1  # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
 | 
					 | 
				
			||||||
                      uplink:
 | 
					 | 
				
			||||||
                        value: 82
 | 
					 | 
				
			||||||
                        unit: 1  # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
 | 
					 | 
				
			||||||
                    gbr:
 | 
					 | 
				
			||||||
                      downlink:
 | 
					 | 
				
			||||||
                        value: 82
 | 
					 | 
				
			||||||
                        unit: 1  # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
 | 
					 | 
				
			||||||
                      uplink:
 | 
					 | 
				
			||||||
                        value: 82
 | 
					 | 
				
			||||||
                        unit: 1  # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
@@ -1,12 +1,9 @@
 | 
				
			|||||||
db_uri: mongodb://MONGO_IP/open5gs
 | 
					db_uri: mongodb://MONGO_IP/open5gs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
logger:
 | 
					logger:
 | 
				
			||||||
    file:
 | 
					    file: /open5gs/install/var/log/open5gs/pcrf.log
 | 
				
			||||||
      path: /open5gs/install/var/log/open5gs/pcrf.log
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
global:
 | 
					parameter:
 | 
				
			||||||
  max:
 | 
					 | 
				
			||||||
    ue: MAX_NUM_UE
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
pcrf:
 | 
					pcrf:
 | 
				
			||||||
    freeDiameter: /open5gs/install/etc/freeDiameter/pcrf.conf
 | 
					    freeDiameter: /open5gs/install/etc/freeDiameter/pcrf.conf
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,7 +37,6 @@ cp /mnt/pcrf/pcrf.conf install/etc/freeDiameter
 | 
				
			|||||||
cp /mnt/pcrf/make_certs.sh install/etc/freeDiameter
 | 
					cp /mnt/pcrf/make_certs.sh install/etc/freeDiameter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sed -i 's|MONGO_IP|'$MONGO_IP'|g' install/etc/open5gs/pcrf.yaml
 | 
					sed -i 's|MONGO_IP|'$MONGO_IP'|g' install/etc/open5gs/pcrf.yaml
 | 
				
			||||||
sed -i 's|MAX_NUM_UE|'$MAX_NUM_UE'|g' install/etc/open5gs/pcrf.yaml
 | 
					 | 
				
			||||||
sed -i 's|PCRF_IP|'$PCRF_IP'|g' install/etc/freeDiameter/pcrf.conf
 | 
					sed -i 's|PCRF_IP|'$PCRF_IP'|g' install/etc/freeDiameter/pcrf.conf
 | 
				
			||||||
sed -i 's|SMF_IP|'$SMF_IP'|g' install/etc/freeDiameter/pcrf.conf
 | 
					sed -i 's|SMF_IP|'$SMF_IP'|g' install/etc/freeDiameter/pcrf.conf
 | 
				
			||||||
sed -i 's|EPC_DOMAIN|'$EPC_DOMAIN'|g' install/etc/freeDiameter/pcrf.conf
 | 
					sed -i 's|EPC_DOMAIN|'$EPC_DOMAIN'|g' install/etc/freeDiameter/pcrf.conf
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -228,13 +228,6 @@ loadmodule "cdp_avp"
 | 
				
			|||||||
loadmodule "ims_qos"
 | 
					loadmodule "ims_qos"
 | 
				
			||||||
#!endif
 | 
					#!endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#!ifdef WITH_N5
 | 
					 | 
				
			||||||
loadmodule "http_client"
 | 
					 | 
				
			||||||
loadmodule "jansson"
 | 
					 | 
				
			||||||
loadmodule "nghttp2"
 | 
					 | 
				
			||||||
loadmodule "uuid"
 | 
					 | 
				
			||||||
#!endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#!ifdef CAPTURE_NODE
 | 
					#!ifdef CAPTURE_NODE
 | 
				
			||||||
loadmodule "siptrace"
 | 
					loadmodule "siptrace"
 | 
				
			||||||
#!endif
 | 
					#!endif
 | 
				
			||||||
@@ -315,7 +308,7 @@ modparam("uac","restore_mode","none")
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# ----------------- Settings for RTimer ---------------
 | 
					# ----------------- Settings for RTimer ---------------
 | 
				
			||||||
# time interval set to 60 seconds
 | 
					# time interval set to 60 seconds
 | 
				
			||||||
modparam("rtimer", "timer", "name=NATPING;interval=5;mode=1;")
 | 
					modparam("rtimer", "timer", "name=NATPING;interval=60;mode=1;")
 | 
				
			||||||
modparam("rtimer", "exec", "timer=NATPING;route=NATPING")
 | 
					modparam("rtimer", "exec", "timer=NATPING;route=NATPING")
 | 
				
			||||||
#!endif
 | 
					#!endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -421,7 +414,6 @@ modparam("ims_ipsec_pcscf", "ipsec_client_port", IPSEC_CLIENT_PORT)
 | 
				
			|||||||
modparam("ims_ipsec_pcscf", "ipsec_server_port", IPSEC_SERVER_PORT)
 | 
					modparam("ims_ipsec_pcscf", "ipsec_server_port", IPSEC_SERVER_PORT)
 | 
				
			||||||
modparam("ims_ipsec_pcscf", "ipsec_spi_id_start", 4096)
 | 
					modparam("ims_ipsec_pcscf", "ipsec_spi_id_start", 4096)
 | 
				
			||||||
modparam("ims_ipsec_pcscf", "ipsec_max_connections", IPSEC_MAX_CONN)
 | 
					modparam("ims_ipsec_pcscf", "ipsec_max_connections", IPSEC_MAX_CONN)
 | 
				
			||||||
modparam("ims_ipsec_pcscf", "ipsec_preferred_ealg", "null")
 | 
					 | 
				
			||||||
modparam("htable", "htable", "ipsec_clients=>size=8;autoexpire=600000;")
 | 
					modparam("htable", "htable", "ipsec_clients=>size=8;autoexpire=600000;")
 | 
				
			||||||
#!endif
 | 
					#!endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -440,36 +432,6 @@ modparam("ims_qos", "recv_mode", 1)
 | 
				
			|||||||
modparam("ims_qos", "dialog_direction", RX_IMS_REG_DIALOG_DIRECTION)
 | 
					modparam("ims_qos", "dialog_direction", RX_IMS_REG_DIALOG_DIRECTION)
 | 
				
			||||||
#!endif
 | 
					#!endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#!ifdef WITH_N5
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Tables to store users and their session details
 | 
					 | 
				
			||||||
modparam("htable", "htable", "user_data=>size=8;autoexpire=3600;")
 | 
					 | 
				
			||||||
modparam("htable", "htable", "user_ids=>size=8;autoexpire=3600;")
 | 
					 | 
				
			||||||
modparam("htable", "htable", "user_sdps_ip=>size=8;autoexpire=3600;")
 | 
					 | 
				
			||||||
modparam("htable", "htable", "user_sdps_port=>size=8;autoexpire=3600;")
 | 
					 | 
				
			||||||
modparam("htable", "htable", "user_sdps_rtcp_port=>size=8;autoexpire=3600;")
 | 
					 | 
				
			||||||
modparam("htable", "htable", "user_sip_ips=>size=8;autoexpire=3600;")
 | 
					 | 
				
			||||||
modparam("htable", "htable", "user_sip_ports=>size=8;autoexpire=3600;")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# HTTP2 for 5G -- Modules Parameters
 | 
					 | 
				
			||||||
modparam("http_client", "httpredirect", 1)
 | 
					 | 
				
			||||||
modparam("http_client", "useragent", "PCSCF")
 | 
					 | 
				
			||||||
modparam("http_client", "maxdatasize", 64535)
 | 
					 | 
				
			||||||
modparam("http_client", "connection_timeout", 2)
 | 
					 | 
				
			||||||
modparam("http_client", "keep_connections", 1)
 | 
					 | 
				
			||||||
modparam("http_client", "response_headers", 1)
 | 
					 | 
				
			||||||
modparam("http_client", "query_result", 1)
 | 
					 | 
				
			||||||
# modparam("http_client", "httpcon", "pcfapi=>http://N5_BIND_IP:N5_BIND_PORT")
 | 
					 | 
				
			||||||
modparam("nghttp2", "listen_addr", "N5_BIND_IP")
 | 
					 | 
				
			||||||
modparam("nghttp2", "listen_port", "N5_BIND_PORT")
 | 
					 | 
				
			||||||
# Replace the following with your own Key and Cert
 | 
					 | 
				
			||||||
# modparam("nghttp2", "tls_private_key", "/mnt/pcscf/http2_key.pem")
 | 
					 | 
				
			||||||
# modparam("nghttp2", "tls_public_key", "/mnt/pcscf/http2_tr.pem")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
modparam("rtimer", "timer", "name=NRF_NFM;interval=5;mode=1;")
 | 
					 | 
				
			||||||
modparam("rtimer", "exec", "timer=NRF_NFM;route=NRF_NFM")
 | 
					 | 
				
			||||||
#!endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# -- pua params --
 | 
					# -- pua params --
 | 
				
			||||||
#!ifdef WITH_REGINFO
 | 
					#!ifdef WITH_REGINFO
 | 
				
			||||||
#!ifdef DB_URL
 | 
					#!ifdef DB_URL
 | 
				
			||||||
@@ -511,6 +473,9 @@ modparam("statistics", "variable", "register_success")
 | 
				
			|||||||
modparam("statistics", "variable", "register_failed")
 | 
					modparam("statistics", "variable", "register_failed")
 | 
				
			||||||
modparam("statistics", "variable", "register_time")
 | 
					modparam("statistics", "variable", "register_time")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					####### Routing Logic ########
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Main SIP request routing logic
 | 
					# Main SIP request routing logic
 | 
				
			||||||
# - processing of any incoming SIP request starts with this route
 | 
					# - processing of any incoming SIP request starts with this route
 | 
				
			||||||
route {
 | 
					route {
 | 
				
			||||||
@@ -927,7 +892,7 @@ route[NATPING] {
 | 
				
			|||||||
	sht_lock("natping=>natpinglock");
 | 
						sht_lock("natping=>natpinglock");
 | 
				
			||||||
	sht_iterator_start("nat_iterator", "natping");
 | 
						sht_iterator_start("nat_iterator", "natping");
 | 
				
			||||||
	while(sht_iterator_next("nat_iterator")) {
 | 
						while(sht_iterator_next("nat_iterator")) {
 | 
				
			||||||
		xnotice("OPTIONS to $shtitval(nat_iterator) via $shtitkey(nat_iterator)...\n");
 | 
							xlog("OPTIONS to $shtitval(nat_iterator) via $shtitkey(nat_iterator)...\n");
 | 
				
			||||||
		$uac_req(method) = "OPTIONS";
 | 
							$uac_req(method) = "OPTIONS";
 | 
				
			||||||
		$uac_req(ruri) = $shtitval(nat_iterator);
 | 
							$uac_req(ruri) = $shtitval(nat_iterator);
 | 
				
			||||||
		$uac_req(furi) = PCSCF_URL;
 | 
							$uac_req(furi) = PCSCF_URL;
 | 
				
			||||||
@@ -943,7 +908,7 @@ route[NATPING] {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
event_route[uac:reply] {
 | 
					event_route[uac:reply] {
 | 
				
			||||||
##!ifdef WITH_DEBUG
 | 
					##!ifdef WITH_DEBUG
 | 
				
			||||||
	xnotice("request sent to $uac_req(ruri) completed with code: $uac_req(evcode), Type $uac_req(evtype)\n");
 | 
						xlog("request sent to $uac_req(ruri) completed with code: $uac_req(evcode), Type $uac_req(evtype)\n");
 | 
				
			||||||
##!endif
 | 
					##!endif
 | 
				
			||||||
	if (($uac_req(evtype) != 1) || ($uac_req(evcode) != 200)) {
 | 
						if (($uac_req(evtype) != 1) || ($uac_req(evcode) != 200)) {
 | 
				
			||||||
		if ($sht(natpingfail=>$uac_req(ouri)) == $null) {
 | 
							if ($sht(natpingfail=>$uac_req(ouri)) == $null) {
 | 
				
			||||||
@@ -952,7 +917,7 @@ event_route[uac:reply] {
 | 
				
			|||||||
			$sht(natpingfail=>$uac_req(ouri)) = $sht(natpingfail=>$uac_req(ouri)) + 1;
 | 
								$sht(natpingfail=>$uac_req(ouri)) = $sht(natpingfail=>$uac_req(ouri)) + 1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		xlog("  request sent to $uac_req(ruri): Fail Counter is $sht(natpingfail=>$uac_req(ouri))\n");
 | 
							xlog("  request sent to $uac_req(ruri): Fail Counter is $sht(natpingfail=>$uac_req(ouri))\n");
 | 
				
			||||||
		if ($sht(natpingfail=>$uac_req(ouri)) > 10) {
 | 
							if ($sht(natpingfail=>$uac_req(ouri)) > 30) {
 | 
				
			||||||
			if ($(uac_req(ouri){uri.transport}) == "tcp") {
 | 
								if ($(uac_req(ouri){uri.transport}) == "tcp") {
 | 
				
			||||||
				$var(alias) = "alias="+$(uac_req(ouri){uri.host})+"~"+$(uac_req(ouri){uri.port})+"~2";
 | 
									$var(alias) = "alias="+$(uac_req(ouri){uri.host})+"~"+$(uac_req(ouri){uri.port})+"~2";
 | 
				
			||||||
			} else if ($(uac_req(ouri){uri.transport}) == "tls") {
 | 
								} else if ($(uac_req(ouri){uri.transport}) == "tls") {
 | 
				
			||||||
@@ -995,7 +960,7 @@ route[preload_pcscf] {
 | 
				
			|||||||
	$shv(preload_pcscf) = 1;
 | 
						$shv(preload_pcscf) = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sql_query("pcscf", "select aor, received, received_port, received_proto from location;", "resultset");
 | 
						sql_query("pcscf", "select aor, received, received_port, received_proto from location;", "resultset");
 | 
				
			||||||
	xlog("L_INFO", "Preloading NAT-PING. Rows: $dbr(resultset=>rows)\n");
 | 
						xlog("Preloading NAT-PING. Rows: $dbr(resultset=>rows)\n");
 | 
				
			||||||
	if($dbr(resultset=>rows)>0) {
 | 
						if($dbr(resultset=>rows)>0) {
 | 
				
			||||||
		$var(i) = 0;
 | 
							$var(i) = 0;
 | 
				
			||||||
		while($var(i) < $dbr(resultset=>rows)) {
 | 
							while($var(i) < $dbr(resultset=>rows)) {
 | 
				
			||||||
@@ -1017,177 +982,6 @@ route[preload_pcscf] {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
#!endif
 | 
					#!endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#!ifdef WITH_N5
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# 5G N5 HTTP2 Server routing script basic code
 | 
					 | 
				
			||||||
event_route[nghttp2:request] {
 | 
					 | 
				
			||||||
	xinfo("request: $nghttp2(method) - url: $nghttp2(path) - data: [$nghttp2(data)]\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    // Check if the requested URL is /nf-status-notify
 | 
					 | 
				
			||||||
    if ($nghttp2(path) == "/nf-status-notify") {
 | 
					 | 
				
			||||||
        nghttp2_reply_header("Content-Type", "text/html");
 | 
					 | 
				
			||||||
        nghttp2_reply_header("Server:", "PCSCF");
 | 
					 | 
				
			||||||
        nghttp2_reply("200", "<html><body>PCF registered at PCSCF</body></html>");
 | 
					 | 
				
			||||||
    } else if ($nghttp2(path) == "/terminate") {
 | 
					 | 
				
			||||||
       nghttp2_reply_header("accept", "application/json");
 | 
					 | 
				
			||||||
       nghttp2_reply_header("accept", "application/problem+json");
 | 
					 | 
				
			||||||
       nghttp2_reply_header("Content-Type", "application/json");
 | 
					 | 
				
			||||||
       nghttp2_reply_header("Server", "PCSCF");
 | 
					 | 
				
			||||||
       nghttp2_reply("204", "No Content");
 | 
					 | 
				
			||||||
   } else {
 | 
					 | 
				
			||||||
       // Optionally handle other URLs or do nothing
 | 
					 | 
				
			||||||
       nghttp2_reply_header("accept", "application/json");
 | 
					 | 
				
			||||||
       nghttp2_reply_header("accept", "application/problem+json");
 | 
					 | 
				
			||||||
       nghttp2_reply_header("Content-Type", "application/json");
 | 
					 | 
				
			||||||
       nghttp2_reply_header("Server", "PCSCF");       
 | 
					 | 
				
			||||||
       nghttp2_reply("404", "Not Found");
 | 
					 | 
				
			||||||
   }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
route[NRF_NFM] {
 | 
					 | 
				
			||||||
	if ($var(n5_hb_fail_count) > 5) {
 | 
					 | 
				
			||||||
		xlog("L_ERR", "PCSCF NF no longer registered at SCP. Re-attempting registration!!\n");
 | 
					 | 
				
			||||||
		$var(n5_initalized) = 0;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	$var(time_now) = $_s($timef(%a, %d %b %Y %H:%M:%S %Z));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# TODO: Send at heartbeat intervals received in reponse to NF registration  
 | 
					 | 
				
			||||||
	if ($var(n5_initalized) == 1) {
 | 
					 | 
				
			||||||
		# Send Heartbeat
 | 
					 | 
				
			||||||
		$var(nf_hb_headers) = "content-type: application/json-patch+json\r\n";
 | 
					 | 
				
			||||||
		$var(nf_hb_headers) = $var(nf_hb_headers) + "accept: application/json,application/problem+json\r\n";
 | 
					 | 
				
			||||||
		$var(nf_hb_headers) = $var(nf_hb_headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
 | 
					 | 
				
			||||||
		$var(nf_hb_headers) = $var(nf_hb_headers) + "3gpp-sbi-max-rsp-time: 10000\r\n";
 | 
					 | 
				
			||||||
		$var(nf_hb_headers) = $var(nf_hb_headers) + "3gpp-sbi-discovery-service-names: nnrf-nfm\r\n";
 | 
					 | 
				
			||||||
		$var(nf_hb_headers) = $var(nf_hb_headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		$var(nf_hb_json_body) ='[]';
 | 
					 | 
				
			||||||
		$var(nf_hb_body) = '{
 | 
					 | 
				
			||||||
			"op": "replace",
 | 
					 | 
				
			||||||
			"path": "/nfStatus",
 | 
					 | 
				
			||||||
			"value": "REGISTERED"
 | 
					 | 
				
			||||||
		}';
 | 
					 | 
				
			||||||
		jansson_append("obj", "", $var(nf_hb_body), "$var(nf_hb_json_body)");
 | 
					 | 
				
			||||||
		$var(nf_hb_body) = '{
 | 
					 | 
				
			||||||
			"op": "replace",
 | 
					 | 
				
			||||||
			"path": "/load",
 | 
					 | 
				
			||||||
			"value": 0
 | 
					 | 
				
			||||||
		}';
 | 
					 | 
				
			||||||
		jansson_append("obj", "", $var(nf_hb_body), "$var(nf_hb_json_body)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		http_client_request_v2pk("PATCH", "http://SCP_BIND_IP:SCP_BIND_PORT/nnrf-nfm/v1/nf-instances/$var(pcscf_uuid)", "$var(nf_hb_json_body)", "$var(nf_hb_headers)", "$var(nf_hb_result)");
 | 
					 | 
				
			||||||
		switch ($rc) {
 | 
					 | 
				
			||||||
			case 204:
 | 
					 | 
				
			||||||
				$var(n5_hb_fail_count) = 0;
 | 
					 | 
				
			||||||
				break;
 | 
					 | 
				
			||||||
			default:
 | 
					 | 
				
			||||||
				$var(n5_hb_fail_count) = $var(n5_hb_fail_count) + 1;
 | 
					 | 
				
			||||||
				return;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# Generate UUID for PCSCF
 | 
					 | 
				
			||||||
	$var(pcscf_uuid) = $uuid(g);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# Register NF
 | 
					 | 
				
			||||||
	$var(nf_reg_headers) = "content-type: application/json\r\n";
 | 
					 | 
				
			||||||
	$var(nf_reg_headers) = $var(nf_reg_headers) + "accept: application/json,application/problem+json\r\n";
 | 
					 | 
				
			||||||
	$var(nf_reg_headers) = $var(nf_reg_headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
 | 
					 | 
				
			||||||
	$var(nf_reg_headers) = $var(nf_reg_headers) + "3gpp-sbi-max-rsp-time: 10000\r\n";
 | 
					 | 
				
			||||||
	$var(nf_reg_headers) = $var(nf_reg_headers) + "3gpp-sbi-discovery-service-names: nnrf-nfm\r\n";
 | 
					 | 
				
			||||||
	$var(nf_reg_headers) = $var(nf_reg_headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	$var(nf_reg_body) = '{
 | 
					 | 
				
			||||||
		"nfInstanceId": "PCSCF_UUID",
 | 
					 | 
				
			||||||
		"nfType":   "PCSCF",
 | 
					 | 
				
			||||||
		"nfStatus": "REGISTERED",
 | 
					 | 
				
			||||||
		"ipv4Addresses": ["N5_BIND_IP"],
 | 
					 | 
				
			||||||
		"allowedNfTypes": ["SCP", "PCF"],
 | 
					 | 
				
			||||||
		"priority": 0,
 | 
					 | 
				
			||||||
		"capacity": 100,
 | 
					 | 
				
			||||||
		"load": 0,
 | 
					 | 
				
			||||||
		"nfServiceList": {
 | 
					 | 
				
			||||||
			"PCSCF_UUID": {
 | 
					 | 
				
			||||||
				"serviceInstanceId": "PCSCF_UUID",
 | 
					 | 
				
			||||||
				"serviceName": "npcf-policyauthorization",
 | 
					 | 
				
			||||||
				"versions": [
 | 
					 | 
				
			||||||
					{
 | 
					 | 
				
			||||||
						"apiVersionInUri": "v2",
 | 
					 | 
				
			||||||
						"apiFullVersion": "2.0.0"
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				],
 | 
					 | 
				
			||||||
				"scheme": "http",
 | 
					 | 
				
			||||||
				"nfServiceStatus": "REGISTERED",
 | 
					 | 
				
			||||||
				"ipEndPoints": [
 | 
					 | 
				
			||||||
					{
 | 
					 | 
				
			||||||
						"ipv4Address": "N5_BIND_IP",
 | 
					 | 
				
			||||||
						"port": N5_BIND_PORT
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				],
 | 
					 | 
				
			||||||
				"allowedNfTypes": [
 | 
					 | 
				
			||||||
					"PCF"
 | 
					 | 
				
			||||||
				],
 | 
					 | 
				
			||||||
				"priority": 0,
 | 
					 | 
				
			||||||
				"capacity": 100,
 | 
					 | 
				
			||||||
				"load": 0
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		"nfProfileChangesSupportInd": true
 | 
					 | 
				
			||||||
	}';
 | 
					 | 
				
			||||||
	$var(nf_reg_body) = $(var(nf_reg_body){re.subst,/PCSCF_UUID/$var(pcscf_uuid)/g});
 | 
					 | 
				
			||||||
	jansson_append("obj", "", "$var(nf_reg_body)", "$var(nf_reg_json_body)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	http_client_request_v2pk("PUT", "http://SCP_BIND_IP:SCP_BIND_PORT/nnrf-nfm/v1/nf-instances/$var(pcscf_uuid)", "$var(nf_reg_json_body)", "$var(nf_reg_headers)", "$var(nf_reg_result)");
 | 
					 | 
				
			||||||
	switch ($rc) {
 | 
					 | 
				
			||||||
		case 201:
 | 
					 | 
				
			||||||
			xlog("L_INFO", "P-CSCF NF registered successfully at SCP\n");
 | 
					 | 
				
			||||||
			$var(n5_initalized) = 1;
 | 
					 | 
				
			||||||
			$var(n5_hb_fail_count) = 0;
 | 
					 | 
				
			||||||
			route(NRF_NFM_SUBSCRIBE_PCF);
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		default:
 | 
					 | 
				
			||||||
			xlog("L_ERR", "P-CSCF NF failed to register at SCP with code=$rc\n");
 | 
					 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
route[NRF_NFM_SUBSCRIBE_PCF] {
 | 
					 | 
				
			||||||
	# Subscribe to PCF NF registration notification
 | 
					 | 
				
			||||||
	$var(time_now) = $_s($timef(%a, %d %b %Y %H:%M:%S %Z));
 | 
					 | 
				
			||||||
	$var(pcf_subc_headers) = "content-type: application/json\r\n";
 | 
					 | 
				
			||||||
	$var(pcf_subc_headers) = $var(pcf_subc_headers) + "accept: application/json,application/problem+json\r\n";
 | 
					 | 
				
			||||||
	$var(pcf_subc_headers) = $var(pcf_subc_headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
 | 
					 | 
				
			||||||
	$var(pcf_subc_headers) = $var(pcf_subc_headers) + "3gpp-sbi-callback: Nnrf_NFManagement_NFStatusNotify\r\n";
 | 
					 | 
				
			||||||
	$var(pcf_subc_headers) = $var(pcf_subc_headers) + "3gpp-sbi-max-rsp-time: 10000\r\n";
 | 
					 | 
				
			||||||
	$var(pcf_subc_headers) = $var(pcf_subc_headers) + "3gpp-sbi-discovery-service-names: nnrf-nfm\r\n";
 | 
					 | 
				
			||||||
	$var(pcf_subc_headers) = $var(pcf_subc_headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	$var(pcf_subc_body) = '{
 | 
					 | 
				
			||||||
		"nfStatusNotificationUri": "http://N5_BIND_IP:N5_BIND_PORT/nnrf-nfm/v1/nf-status-notify",
 | 
					 | 
				
			||||||
		"reqNfInstanceId": "PCSCF_UUID",
 | 
					 | 
				
			||||||
		"subscrCond": {
 | 
					 | 
				
			||||||
			"nfType": "PCF"
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		"reqNfType": "PCSCF",
 | 
					 | 
				
			||||||
		"requesterFeatures": "1"
 | 
					 | 
				
			||||||
	}';
 | 
					 | 
				
			||||||
	$var(pcf_subc_body) = $(var(pcf_subc_body){re.subst,/PCSCF_UUID/$var(pcscf_uuid)/g});
 | 
					 | 
				
			||||||
	jansson_append("obj", "", "$var(pcf_subc_body)", "$var(pcf_subc_json_body)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	http_client_request_v2pk("POST", "http://SCP_BIND_IP:SCP_BIND_PORT/nnrf-nfm/v1/subscriptions", "$var(pcf_subc_json_body)", "$var(pcf_subc_headers)", "$var(pcf_subc_result)");
 | 
					 | 
				
			||||||
	switch ($rc) {
 | 
					 | 
				
			||||||
		case 201:
 | 
					 | 
				
			||||||
			xlog("L_INFO", "P-CSCF NF subscribed for PCF NF registration notification\n");
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		default:
 | 
					 | 
				
			||||||
			xlog("L_ERR", "P-CSCF NF failed to subscribe for PCF NF registration notification\n");
 | 
					 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
#!endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#!ifdef WITH_XMLRPC
 | 
					#!ifdef WITH_XMLRPC
 | 
				
			||||||
include_file "route/xmlrpc.cfg"
 | 
					include_file "route/xmlrpc.cfg"
 | 
				
			||||||
#!endif
 | 
					#!endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,15 +36,6 @@ listen=tcp:PCSCF_IP:5060
 | 
				
			|||||||
# Uncomment the below line only when UE is behind double NAT (e.g. VoIP calling over WiFi/ CN behind a NAT)
 | 
					# Uncomment the below line only when UE is behind double NAT (e.g. VoIP calling over WiFi/ CN behind a NAT)
 | 
				
			||||||
##!define RX_AF_SIGNALING_IP "PCSCF_PUB_IP"
 | 
					##!define RX_AF_SIGNALING_IP "PCSCF_PUB_IP"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
# IP and Port for incoming requests over N5 from 5G Core
 | 
					 | 
				
			||||||
#!substdef "/N5_BIND_IP/PCSCF_IP/g"
 | 
					 | 
				
			||||||
#!substdef "/N5_BIND_PORT/7777/g"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# SCP IP and Port for NF registration and heartbeat
 | 
					 | 
				
			||||||
#!substdef "/SCP_BIND_IP/SCP_IP/g"
 | 
					 | 
				
			||||||
#!substdef "/SCP_BIND_PORT/7777/g"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
alias=pcscf.IMS_DOMAIN
 | 
					alias=pcscf.IMS_DOMAIN
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#!define MY_WS_PORT 80
 | 
					#!define MY_WS_PORT 80
 | 
				
			||||||
@@ -54,9 +45,9 @@ alias=pcscf.IMS_DOMAIN
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#!define TCP_PROCESSES 8
 | 
					#!define TCP_PROCESSES 8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#!subst "/NETWORKNAME/IMS_DOMAIN/g"
 | 
					#!subst "/NETWORKNAME/IMS_DOMAIN/"
 | 
				
			||||||
#!subst "/HOSTNAME/pcscf.IMS_DOMAIN/g"
 | 
					#!subst "/HOSTNAME/pcscf.IMS_DOMAIN/"
 | 
				
			||||||
#!subst "/PCRF_REALM/EPC_DOMAIN/g"
 | 
					#!subst "/PCRF_REALM/EPC_DOMAIN/"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# SIP-Address of capturing node, if not set, capturing is disabled.
 | 
					# SIP-Address of capturing node, if not set, capturing is disabled.
 | 
				
			||||||
##!define CAPTURE_NODE "sip:127.0.0.1:9060"
 | 
					##!define CAPTURE_NODE "sip:127.0.0.1:9060"
 | 
				
			||||||
@@ -134,7 +125,8 @@ alias=pcscf.IMS_DOMAIN
 | 
				
			|||||||
##!define WITH_IPBLOCK
 | 
					##!define WITH_IPBLOCK
 | 
				
			||||||
##!define WITH_ANTIFLOOD
 | 
					##!define WITH_ANTIFLOOD
 | 
				
			||||||
#!define WITH_RX
 | 
					#!define WITH_RX
 | 
				
			||||||
##!define WITH_N5
 | 
					#!define WITH_RX_REG
 | 
				
			||||||
 | 
					#!define WITH_RX_CALL
 | 
				
			||||||
#!define WITH_TCP
 | 
					#!define WITH_TCP
 | 
				
			||||||
##!define WITH_RTPIPV4
 | 
					##!define WITH_RTPIPV4
 | 
				
			||||||
##!define WITH_SBC
 | 
					##!define WITH_SBC
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -70,11 +70,11 @@ fi
 | 
				
			|||||||
if [[ ${DEPLOY_MODE} == 5G ]];
 | 
					if [[ ${DEPLOY_MODE} == 5G ]];
 | 
				
			||||||
then
 | 
					then
 | 
				
			||||||
    sed -i 's|#!define WITH_RX\b|##!define WITH_RX|g' /etc/kamailio_pcscf/pcscf.cfg
 | 
					    sed -i 's|#!define WITH_RX\b|##!define WITH_RX|g' /etc/kamailio_pcscf/pcscf.cfg
 | 
				
			||||||
	sed -i 's|##!define WITH_N5\b|#!define WITH_N5|g' /etc/kamailio_pcscf/pcscf.cfg
 | 
					    sed -i 's|#!define WITH_RX_REG\b|##!define WITH_RX_REG|g' /etc/kamailio_pcscf/pcscf.cfg
 | 
				
			||||||
 | 
					    sed -i 's|#!define WITH_RX_CALL\b|##!define WITH_RX_CALL|g' /etc/kamailio_pcscf/pcscf.cfg
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sed -i 's|PCSCF_IP|'$PCSCF_IP'|g' /etc/kamailio_pcscf/pcscf.cfg
 | 
					sed -i 's|PCSCF_IP|'$PCSCF_IP'|g' /etc/kamailio_pcscf/pcscf.cfg
 | 
				
			||||||
sed -i 's|SCP_IP|'$SCP_IP'|g' /etc/kamailio_pcscf/pcscf.cfg
 | 
					 | 
				
			||||||
sed -i 's|PCSCF_PUB_IP|'$PCSCF_PUB_IP'|g' /etc/kamailio_pcscf/pcscf.cfg
 | 
					sed -i 's|PCSCF_PUB_IP|'$PCSCF_PUB_IP'|g' /etc/kamailio_pcscf/pcscf.cfg
 | 
				
			||||||
sed -i 's|IMS_DOMAIN|'$IMS_DOMAIN'|g' /etc/kamailio_pcscf/pcscf.cfg
 | 
					sed -i 's|IMS_DOMAIN|'$IMS_DOMAIN'|g' /etc/kamailio_pcscf/pcscf.cfg
 | 
				
			||||||
sed -i 's|EPC_DOMAIN|'$EPC_DOMAIN'|g' /etc/kamailio_pcscf/pcscf.cfg
 | 
					sed -i 's|EPC_DOMAIN|'$EPC_DOMAIN'|g' /etc/kamailio_pcscf/pcscf.cfg
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -75,14 +75,6 @@ route[MO]
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
	remove_hf("Security-Verify");
 | 
						remove_hf("Security-Verify");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#Route N5 Request 
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
      if(is_method("INVITE")) {
 | 
					 | 
				
			||||||
          route(N5_INIT_REQ);   
 | 
					 | 
				
			||||||
                 }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#!ifdef TRF_FUNCTION
 | 
					#!ifdef TRF_FUNCTION
 | 
				
			||||||
	$var(trf) = TRF_FUNCTION;
 | 
						$var(trf) = TRF_FUNCTION;
 | 
				
			||||||
	# Check for "sec-agree" in the Proxy-Require header:
 | 
						# Check for "sec-agree" in the Proxy-Require header:
 | 
				
			||||||
@@ -105,239 +97,10 @@ route[MO]
 | 
				
			|||||||
	t_on_reply("MO_reply");
 | 
						t_on_reply("MO_reply");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
#################################
 | 
					 | 
				
			||||||
## Route Logic for N5 Requests ##
 | 
					 | 
				
			||||||
#################################
 | 
					 | 
				
			||||||
route[N5_INIT_REQ] {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Storing IDs and IPs from UE into variables to use them later in the N5 Request:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   
 | 
					 | 
				
			||||||
    $var(orig_ue_ip) = $si;
 | 
					 | 
				
			||||||
    $var(orig_ue_port) = $sp;
 | 
					 | 
				
			||||||
    $var(pcscf_ip) = $Ri;
 | 
					 | 
				
			||||||
    $var(pcscf_port) = $Rp;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
# now checking it on console if I got what I wanted :
 | 
					 | 
				
			||||||
    xlog("L_INFO", "connection Info for UE $var(orig_ue_ip) $var(orig_ue_port)\n");
 | 
					 | 
				
			||||||
    xlog("L_INFO", "connection Info for P-CSCF is: $var(pcscf_ip) $var(pcscf_port)\n");    
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# now trying some way to store IP of Orig UE
 | 
					 | 
				
			||||||
    $var(user_id_req_ip) = $fU; # should get the user part of the Orig UE from request
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Store the IP in the hash table associated with the UE
 | 
					 | 
				
			||||||
    $sht(user_sip_ips=>$var(user_id_req_ip)) = $var(orig_ue_ip);
 | 
					 | 
				
			||||||
    xlog("L_INFO", "IP Info for UE MSISDN $var(user_id_req_ip): $var(orig_ue_ip)\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
# now trying some way to store Port of Orig UE
 | 
					 | 
				
			||||||
    $var(user_id_req_port) = $fU; # should get the user part of the Orig UE from request
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Store the Port in the hash table associated with the UE
 | 
					 | 
				
			||||||
    $sht(user_sip_ports=>$var(user_id_req_port)) = $var(orig_ue_port);
 | 
					 | 
				
			||||||
    xlog("L_INFO", "Port Info for UE MSISDN $var(user_id_req_port): $var(orig_ue_port)\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
## now saving SDP Info from UE to variables to use them later in the N5 Flow Fdecs :
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$var(sdp_src_ip) = $sdp(c:ip);
 | 
					 | 
				
			||||||
$var(sdp_src_port) = $sdp(m0:rtp:port);
 | 
					 | 
				
			||||||
$var(sdp_src_rtcp_port) = $sdp(m0:rtcp:port);
 | 
					 | 
				
			||||||
$var(sdp_mline_raw) = $sdp(m0:raw);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
xlog("L_INFO", "SDP Info : Connection IP is $var(sdp_src_ip) Port is $var(sdp_src_port) Mline dump $var(sdp_mline_raw) \n");  
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# now trying some way to store SDP SRC_IP of Orig UE
 | 
					 | 
				
			||||||
    $var(user_id_sdp_ip) = $fU; # should get the user part of the Orig UE from request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Store the AppSession in the hash table associated with the UE
 | 
					 | 
				
			||||||
    $sht(user_sdps_ip=>$var(user_id_sdp_ip)) = $var(sdp_src_ip);
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP SRC_IP of Orig UE $var(user_id_sdp_ip): $var(sdp_src_ip)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# now trying some way to store SDP Media_Port of Orig UE
 | 
					 | 
				
			||||||
    $var(user_id_sdp_port) = $fU; # should get the user part of the Orig UE from request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # store SDP Media_Port in the hash table associated with the UE
 | 
					 | 
				
			||||||
    $sht(user_sdps_port=>$var(user_id_sdp_port)) = $var(sdp_src_port);
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP Media_Port of Orig UE $var(user_id_sdp_port): $var(sdp_src_port)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# now trying some way to store SDP RTCP_Media_Port of Orig UE
 | 
					 | 
				
			||||||
    $var(user_id_sdp_rtcp_port) = $fU; # should get the user part of the Orig UE from request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Store the RTCP_Media_Port in the hash table associated with the UE
 | 
					 | 
				
			||||||
    $sht(user_sdps_rtcp_port=>$var(user_id_sdp_rtcp_port)) = $var(sdp_src_rtcp_port);
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP RTCP_Media_Port of Orig UE $var(user_id_sdp_rtcp_port): $var(sdp_src_rtcp_port)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### 5G VoNR N5 NPCF Authorization reuqest 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   if(is_method("INVITE")){
 | 
					 | 
				
			||||||
		xlog("L_DBG", "IMS: INVITE ORIG TO $tU\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Getting the IP/Port of UE 
 | 
					 | 
				
			||||||
    $var(orig_ue_ip) = $fU; # User Part of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_ip_addr) = $sht(user_sip_ips=>$var(orig_ue_ip));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "IP for UE  $var(orig_ue_ip) is: $var(ue_ip_addr)\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    $var(orig_ue_port) = $fU; # User Part of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_port_sip) = $sht(user_sip_ports=>$var(orig_ue_port));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "IP for UE  $var(orig_ue_port) is: $var(ue_port_sip)\n");    
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
## retrieving SDP Connection Info and Media Port for UE 
 | 
					 | 
				
			||||||
    $var(sdp_id_ue) = $fU; # User Part of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_sdp_ip) = $sht(user_sdps_ip=>$var(sdp_id_ue));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP IP for UE with MSISDN $var(sdp_id_ue) is: $var(ue_sdp_ip)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    $var(sdp_id_ue_port) = $fU; # User Port of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_sdp_port) = $sht(user_sdps_port=>$var(sdp_id_ue_port));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP Port for UE with MSISDN $var(sdp_id_ue_port) is: $var(ue_sdp_port)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    $var(sdp_id_ue_rtcp_port) = $fU; # User Port of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_sdp_rtcp_port) = $sht(user_sdps_rtcp_port=>$var(sdp_id_ue_rtcp_port));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP Port for UE with MSISDN $var(sdp_id_ue_rtcp_port) is: $var(ue_sdp_rtcp_port)\n");    
 | 
					 | 
				
			||||||
   
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### now start to build the N5 Request 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   xlog("L_ALERT","DEBUG: Preparing QoS N5 Message to PCF for the INVITE\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Initialize empty arrays and objects\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Initialize empty arrays and objects
 | 
					 | 
				
			||||||
    $var(events) = '[]';
 | 
					 | 
				
			||||||
    $var(medComponents) = '{}';
 | 
					 | 
				
			||||||
    $var(medSubComps) = '{}';
 | 
					 | 
				
			||||||
    $var(evSubsc) = '{}';
 | 
					 | 
				
			||||||
    $var(payload) = '{}';
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set afAppId and dnn in payload
 | 
					 | 
				
			||||||
    jansson_set("string", "afAppId", "+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel\"", "$var(payload)");  # adding a note that this could be improved in future to get the value SIP Header
 | 
					 | 
				
			||||||
    jansson_set("string", "dnn", "ims", "$var(payload)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set medComponents
 | 
					 | 
				
			||||||
    jansson_set("integer", "medCompN", 1, "$var(medComp)");
 | 
					 | 
				
			||||||
    jansson_set("string", "qosReference", "qosVoNR", "$var(medComp)");  
 | 
					 | 
				
			||||||
    jansson_set("string", "medType", "AUDIO", "$var(medComp)");
 | 
					 | 
				
			||||||
    jansson_set("array", "codecs", "[\"downlink\\noffer\\n\", \"uplink\\nanswer\\n\"]", "$var(medComp)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    ### RTP
 | 
					 | 
				
			||||||
    jansson_set("integer", "fNum", 1, "$var(medSubComp1)");
 | 
					 | 
				
			||||||
    jansson_set("array", "fDescs", "[\"permit out 17 from any to $var(ue_sdp_ip) $var(ue_sdp_port)\", \"permit in 17 from $var(ue_sdp_ip) $var(ue_sdp_port) to any\"]", "$var(medSubComp1)");
 | 
					 | 
				
			||||||
    jansson_set("string", "fStatus", "ENABLED", "$var(medSubComp1)");
 | 
					 | 
				
			||||||
    jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp1)");  
 | 
					 | 
				
			||||||
    jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp1)"); 
 | 
					 | 
				
			||||||
    jansson_set("string", "flowUsage", "NO_INFO", "$var(medSubComp1)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
   
 | 
					 | 
				
			||||||
    ### RTCP
 | 
					 | 
				
			||||||
    jansson_set("integer", "fNum", 2, "$var(medSubComp2)");
 | 
					 | 
				
			||||||
    jansson_set("array", "fDescs", "[\"permit out 17 from any to $var(ue_sdp_ip) $var(ue_sdp_rtcp_port)\", \"permit in 17 from $var(ue_sdp_ip) $var(ue_sdp_rtcp_port) to any\"]", "$var(medSubComp2)");
 | 
					 | 
				
			||||||
    jansson_set("string", "fStatus", "ENABLED", "$var(medSubComp2)");
 | 
					 | 
				
			||||||
    jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp2)");  
 | 
					 | 
				
			||||||
    jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp2)");  
 | 
					 | 
				
			||||||
    jansson_set("string", "flowUsage", "RTCP", "$var(medSubComp2)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Merging the flows under MediaSubComponent
 | 
					 | 
				
			||||||
    jansson_set("obj", "0", "$var(medSubComp1)", "$var(medSubComps)");
 | 
					 | 
				
			||||||
    jansson_set("obj", "1", "$var(medSubComp2)", "$var(medSubComps)");
 | 
					 | 
				
			||||||
    jansson_set("obj", "medSubComps", "$var(medSubComps)", "$var(medComp)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    jansson_set("obj", "0", "$var(medComp)", "$var(medComponents)");
 | 
					 | 
				
			||||||
    jansson_set("obj", "medComponents", "$var(medComponents)", "$var(payload)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Set evSubsc\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set evSubsc
 | 
					 | 
				
			||||||
    jansson_set("string", "event", "QOS_NOTIF", "$var(event1)");
 | 
					 | 
				
			||||||
    jansson_set("string", "notifMethod", "PERIODIC", "$var(event1)");  
 | 
					 | 
				
			||||||
    jansson_append("obj", "", "$var(event1)", "$var(events)");
 | 
					 | 
				
			||||||
    jansson_set("string", "event", "ANI_REPORT", "$var(event2)");
 | 
					 | 
				
			||||||
    jansson_set("string", "notifMethod", "ONE_TIME", "$var(event2)");
 | 
					 | 
				
			||||||
    jansson_append("obj", "", "$var(event2)", "$var(events)");
 | 
					 | 
				
			||||||
    jansson_set("array", "events", "$var(events)", "$var(evSubsc)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    jansson_set("obj", "evSubsc", "$var(evSubsc)", "$var(payload)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set other parameters in payload
 | 
					 | 
				
			||||||
    jansson_set("string", "notifUri", "http://172.22.0.21:8284", "$var(payload)");
 | 
					 | 
				
			||||||
    jansson_set("string", "sponStatus", "SPONSOR_DISABLED", "$var(payload)");
 | 
					 | 
				
			||||||
    jansson_set("string", "gpsi", "msisdn-$fU", "$var(payload)");
 | 
					 | 
				
			||||||
    jansson_set("string", "suppFeat", "4", "$var(payload)");
 | 
					 | 
				
			||||||
    jansson_set("string", "ueIpv4", "$var(ue_ip_addr)", "$var(payload)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    ### Assemble the final JSON request
 | 
					 | 
				
			||||||
    jansson_set("obj", "ascReqData", "$var(payload)", "$var(json_request)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Set headers for the HTTP2 Request\n");    
 | 
					 | 
				
			||||||
### Set headers    
 | 
					 | 
				
			||||||
    $var(time_now)=$_s($timef(%a, %d %b %Y %H:%M:%S %Z));
 | 
					 | 
				
			||||||
    xlog("Today is $var(time_now)\n");
 | 
					 | 
				
			||||||
     
 | 
					 | 
				
			||||||
    $var(headers) = "Content-Type: application/json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/problem+json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-max-rsp-time: 10000\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-service-names: npcf-policyauthorization\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Sending the request to PCF\n");    
 | 
					 | 
				
			||||||
### Send the request to PCF
 | 
					 | 
				
			||||||
    http_client_request_v2pk("POST", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions", "$var(json_request)", "$var(headers)", "$var(result)" );
 | 
					 | 
				
			||||||
    xlog("HTTP response: $var(result)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $curlerror(error)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $var(response_code)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $httprhdr(location)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Now I will retrieve the AppSessionID out of the location Header it should be always at the end 
 | 
					 | 
				
			||||||
# Example URL: "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/(someSessionID)"
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
# Firt store the url of the lcoation Header in var
 | 
					 | 
				
			||||||
    $var(url) = $httprhdr(location);
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Get the length of the URL
 | 
					 | 
				
			||||||
    $var(len) = $(var(url){s.len});
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Initialize the position variable to the length of the URL
 | 
					 | 
				
			||||||
    $var(pos) = $var(len);
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Find the position of the last slash by iterating backwards
 | 
					 | 
				
			||||||
    while ($var(pos) > 0) {
 | 
					 | 
				
			||||||
      $var(pos) = $var(pos) - 1;
 | 
					 | 
				
			||||||
      if ($(var(url){s.substr,$var(pos),1}) == "/") {
 | 
					 | 
				
			||||||
          # We've found the last slash
 | 
					 | 
				
			||||||
          break;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
# Extract the substring after the last slash
 | 
					 | 
				
			||||||
# now doing some magic
 | 
					 | 
				
			||||||
    $var(start_pos) = $var(pos) + 1;
 | 
					 | 
				
			||||||
    $var(end_pos) = $var(len) - $var(start_pos);
 | 
					 | 
				
			||||||
    $var(app_session) = $(var(url){s.substr,$var(start_pos),$var(end_pos)});
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
# now checking it on console if I got what I wanted :
 | 
					 | 
				
			||||||
    xlog("L_INFO", "AppSession for user $fU is: $var(app_session)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# now trying some way to store AppSession with the registred UE
 | 
					 | 
				
			||||||
    $var(user_id) = $fU; # should get the user part of the Orig UE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Store the AppSession in the hash table associated with the UE
 | 
					 | 
				
			||||||
    $sht(user_data=>$var(user_id)) = $var(app_session);
 | 
					 | 
				
			||||||
    xlog("L_INFO", "Stored AppSession for user $var(user_id): $var(app_session)\n");
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#####################################
 | 
					 | 
				
			||||||
##### END OF N5 VoNR Request logic ##
 | 
					 | 
				
			||||||
#####################################
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
######################################################################
 | 
					######################################################################
 | 
				
			||||||
# Replies to Originating Initial Requests
 | 
					# Replies to Originating Initial Requests
 | 
				
			||||||
######################################################################
 | 
					######################################################################
 | 
				
			||||||
onreply_route[MO_reply] {
 | 
					onreply_route[MO_reply] {
 | 
				
			||||||
 | 
					 | 
				
			||||||
	xnotice("PCSCF MO_reply: \n Destination URI: $du\n Request URI: $ru\n");
 | 
						xnotice("PCSCF MO_reply: \n Destination URI: $du\n Request URI: $ru\n");
 | 
				
			||||||
    xnotice("Source IP and Port: ($si:$sp)\n Route-URI: $route_uri\n");
 | 
					    xnotice("Source IP and Port: ($si:$sp)\n Route-URI: $route_uri\n");
 | 
				
			||||||
    xnotice("Received IP and Port: ($Ri:$Rp)\n");
 | 
					    xnotice("Received IP and Port: ($Ri:$Rp)\n");
 | 
				
			||||||
@@ -347,20 +110,12 @@ onreply_route[MO_reply] {
 | 
				
			|||||||
		remove_hf("C-Params");	
 | 
							remove_hf("C-Params");	
 | 
				
			||||||
		append_hf("Contact: $ct;$hdr(C-Params)\r\n");
 | 
							append_hf("Contact: $ct;$hdr(C-Params)\r\n");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 ## N5 PATCH Request
 | 
					 | 
				
			||||||
    if (t_check_status("183|200|180") && has_body("application/sdp")){
 | 
					 | 
				
			||||||
    xlog("L_ALERT","Proccessing QoS N5 Request for SDP Answer on INVITE\n"); 
 | 
					 | 
				
			||||||
    route(N5_PATCH_REQ);
 | 
					 | 
				
			||||||
       }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
#!ifdef WITH_IPSEC
 | 
					#!ifdef WITH_IPSEC
 | 
				
			||||||
	ipsec_forward("location", IPSEC_FORWARD_FLAGS);
 | 
						ipsec_forward("location", IPSEC_FORWARD_FLAGS);
 | 
				
			||||||
#!endif
 | 
					#!endif
 | 
				
			||||||
	# In case of 1xx and 2xx do NAT
 | 
						# In case of 1xx and 2xx do NAT
 | 
				
			||||||
	if(status=~"[12][0-9][0-9]")
 | 
						if(status=~"[12][0-9][0-9]")
 | 
				
			||||||
		route(NATMANAGE);
 | 
							route(NATMANAGE);
 | 
				
			||||||
 | 
					 | 
				
			||||||
#!ifdef WITH_RX
 | 
					#!ifdef WITH_RX
 | 
				
			||||||
        if (t_check_status("183|200") && has_body("application/sdp")){
 | 
					        if (t_check_status("183|200") && has_body("application/sdp")){
 | 
				
			||||||
		xlog("L_DBG", "IMS: Received 183/200 inside orig_initial_reply\n");
 | 
							xlog("L_DBG", "IMS: Received 183/200 inside orig_initial_reply\n");
 | 
				
			||||||
@@ -379,9 +134,6 @@ onreply_route[MO_reply] {
 | 
				
			|||||||
            exit;
 | 
					            exit;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
					 | 
				
			||||||
## 
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
route[MO_aar_reply]
 | 
					route[MO_aar_reply]
 | 
				
			||||||
@@ -405,45 +157,11 @@ route[MO_aar_reply]
 | 
				
			|||||||
#!endif
 | 
					#!endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
######################################################################
 | 
					######################################################################
 | 
				
			||||||
# In-Dialog-Mo-Requests
 | 
					# In-Dialog-Mo-Requests
 | 
				
			||||||
######################################################################
 | 
					######################################################################
 | 
				
			||||||
route[MO_indialog] {
 | 
					route[MO_indialog] {
 | 
				
			||||||
 | 
					 | 
				
			||||||
## N5 PATCH Request
 | 
					 | 
				
			||||||
       
 | 
					 | 
				
			||||||
        if(is_method("INVITE")){
 | 
					 | 
				
			||||||
        xlog("L_ALERT"," InDialog SDP Answer N5 Request for reINVITE\n"); 
 | 
					 | 
				
			||||||
    route(N5_PATCH_REQ);
 | 
					 | 
				
			||||||
       }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Terminating N5 AppSession after BYE##
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if(is_method("BYE"))
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
    xlog("L_ALERT","Terminating AppSession For Call fom User $fu due to call END\n"); 
 | 
					 | 
				
			||||||
    # Retrieveing
 | 
					 | 
				
			||||||
    $var(user_id_call_rel) = $fU; # User Part of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(user_appsess_call_rel) = $sht(user_data=>$var(user_id_call_rel));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "Terminating Stored AppSession for user $var(user_id_call_rel): $var(user_id_call_rel)\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    $var(headers) = "X-SIP-Status: De-Registration\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/problem+json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-max-rsp-time: 10000\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-service-names: npcf-policyauthorization\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    http_client_request_v2pk("POST", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/$var(user_appsess_call_rel)/delete", "$var(json_request)", "$var(headers)", "$var(result)" );
 | 
					 | 
				
			||||||
    xlog("Termination resuls: $var(result)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $curlerror(error)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $var(response_code)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $httprhdr(location)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	xnotice("PCSCF MO_indialog: \n Destination URI: $du\n Request URI: $ru\n");
 | 
						xnotice("PCSCF MO_indialog: \n Destination URI: $du\n Request URI: $ru\n");
 | 
				
			||||||
    xnotice("Source IP and Port: ($si:$sp)\n Route-URI: $route_uri\n");
 | 
					    xnotice("Source IP and Port: ($si:$sp)\n Route-URI: $route_uri\n");
 | 
				
			||||||
    xnotice("Received IP and Port: ($Ri:$Rp)\n");
 | 
					    xnotice("Received IP and Port: ($Ri:$Rp)\n");
 | 
				
			||||||
@@ -471,18 +189,6 @@ onreply_route[MO_indialog_reply] {
 | 
				
			|||||||
    xnotice("Received IP and Port: ($Ri:$Rp)\n");
 | 
					    xnotice("Received IP and Port: ($Ri:$Rp)\n");
 | 
				
			||||||
    xnotice("Contact header: $ct\n");
 | 
					    xnotice("Contact header: $ct\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
   if (t_check_status("200") && has_body("application/sdp")){
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    		if (t_is_retr_async_reply()) {
 | 
					 | 
				
			||||||
	                xlog("L_DBG", "Dropping retransmitted reply which is still currently suspended\n");
 | 
					 | 
				
			||||||
                	drop();
 | 
					 | 
				
			||||||
	        }
 | 
					 | 
				
			||||||
                 
 | 
					 | 
				
			||||||
    xlog("L_ALERT"," InDialog SDP Answer N5 Request for 200OK reINVITE\n"); 
 | 
					 | 
				
			||||||
    route(N5_PATCH_REQ);
 | 
					 | 
				
			||||||
       }
 | 
					 | 
				
			||||||
	# In case of 1xx and 2xx do NAT
 | 
						# In case of 1xx and 2xx do NAT
 | 
				
			||||||
	if(status=~"[12][0-9][0-9]")
 | 
						if(status=~"[12][0-9][0-9]")
 | 
				
			||||||
		route(NATMANAGE);
 | 
							route(NATMANAGE);
 | 
				
			||||||
@@ -526,145 +232,3 @@ route[MO_indialog_aar_reply]
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
#!endif
 | 
					#!endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
###################################################
 | 
					 | 
				
			||||||
#### 5G VoNR N5 NPCF Authorization PATCH reuqest ##
 | 
					 | 
				
			||||||
###################################################
 | 
					 | 
				
			||||||
route[N5_PATCH_REQ] {
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
		xlog("L_DBG", "IMS: Received 183/200 inside orig_initial_reply\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
### Getting the IP/Port of UE 
 | 
					 | 
				
			||||||
    $var(orig_id_ue_ip) = $fU; # User Part of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_sip_ip_addr) = $sht(user_sip_ips=>$var(orig_id_ue_ip));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "IP for UE  $var(orig_id_ue_ip) is: $var(ue_sip_ip_addr)\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    $var(orig_ue_port) = $fU; # User Part of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_port_sip) = $sht(user_sip_ports=>$var(orig_ue_port));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "IP for UE  $var(orig_ue_port) is: $var(ue_port_sip)\n");    
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
## retrieving SDP Connection Info and Media Port for UE 
 | 
					 | 
				
			||||||
    $var(sdp_id_ue) = $fU; # User Part of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_sdp_ip) = $sht(user_sdps_ip=>$var(sdp_id_ue));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP IP for UE with MSISDN $var(sdp_id_ue) is: $var(ue_sdp_ip)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    $var(sdp_id_ue_port) = $fU; # User Port of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_sdp_port) = $sht(user_sdps_port=>$var(sdp_id_ue_port));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP Port for UE with MSISDN $var(sdp_id_ue_port) is: $var(ue_sdp_port)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    $var(sdp_id_ue_rtcp_port) = $fU; # User Port of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_sdp_rtcp_port) = $sht(user_sdps_rtcp_port=>$var(sdp_id_ue_rtcp_port));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP Port for UE with MSISDN $var(sdp_id_ue_rtcp_port) is: $var(ue_sdp_rtcp_port)\n");    
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
## retrieving SDP Connection Info from SDP Answer 
 | 
					 | 
				
			||||||
    $var(sdp_answ_ip) = $sdp(c:ip);
 | 
					 | 
				
			||||||
    $var(sdp_answ_port) = $sdp(m0:rtp:port);
 | 
					 | 
				
			||||||
    $var(sdp_answ_rtcp_port) = $sdp(m0:rtcp:port);
 | 
					 | 
				
			||||||
    $var(sdp_answ_codec) = $(rb{line.sw,a=rtpmap}{s.select,1, });
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "SDP Answer connection Info is: $var(sdp_answ_ip), RTP port $var(sdp_answ_port), RTCP Port $var(sdp_answ_rtcp_port) and codec is $var(sdp_answ_codec)\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
## Retrieveing AppSession from initial INVITE N5 Request
 | 
					 | 
				
			||||||
    $var(user_id_inv_rep) = $fU; # User Part of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(user_appsess_inv_rep) = $sht(user_data=>$var(user_id_inv_rep));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "Terminating Stored AppSession for user $var(user_id_inv_rep): $var(user_appsess_inv_rep)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### now start to build the N5 Request 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   xlog("L_ALERT","DEBUG: Preparing PATCH N5 Message for SDP Answer\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Initialize empty arrays and objects\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Initialize empty arrays and objects
 | 
					 | 
				
			||||||
    $var(events) = '[]';
 | 
					 | 
				
			||||||
    $var(medComponents) = '{}';
 | 
					 | 
				
			||||||
    $var(medSubComps) = '{}';
 | 
					 | 
				
			||||||
    $var(evSubsc) = '{}';
 | 
					 | 
				
			||||||
    $var(payload) = '{}';
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set afAppId and dnn in payload
 | 
					 | 
				
			||||||
    jansson_set("string", "afAppId", "+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel\"", "$var(payload)");
 | 
					 | 
				
			||||||
    jansson_set("string", "dnn", "ims", "$var(payload)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set medComponents
 | 
					 | 
				
			||||||
    jansson_set("integer", "medCompN", 1, "$var(medComp)");
 | 
					 | 
				
			||||||
#    jansson_set("string", "qosReference", "qosVoNR", "$var(medComp)");  # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed 
 | 
					 | 
				
			||||||
    jansson_set("string", "medType", "AUDIO", "$var(medComp)");
 | 
					 | 
				
			||||||
    jansson_set("array", "codecs", "[\"downlink\\n$var(sdp_answ_codec)\\n\", \"uplink\\n$var(sdp_answ_codec)\\n\"]", "$var(medComp)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
     ### RTP
 | 
					 | 
				
			||||||
    jansson_set("integer", "fNum", 1, "$var(medSubComp1)");
 | 
					 | 
				
			||||||
    jansson_set("array", "fDescs", "[\"permit out 17 from $var(sdp_answ_ip) $var(sdp_answ_port) to $var(ue_sdp_ip) $var(ue_sdp_port)\", \"permit in 17 from $var(ue_sdp_ip) $var(ue_sdp_port) to $var(sdp_answ_ip) $var(sdp_answ_port)\"]", "$var(medSubComp1)");
 | 
					 | 
				
			||||||
    jansson_set("string", "fStatus", "ENABLED", "$var(medSubComp1)");
 | 
					 | 
				
			||||||
#    jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp1)");  # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
 | 
					 | 
				
			||||||
#    jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp1)");  # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
 | 
					 | 
				
			||||||
    jansson_set("string", "flowUsage", "NO_INFO", "$var(medSubComp1)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
   
 | 
					 | 
				
			||||||
    ### RTCP
 | 
					 | 
				
			||||||
    jansson_set("integer", "fNum", 2, "$var(medSubComp2)");
 | 
					 | 
				
			||||||
    jansson_set("array", "fDescs", "[\"permit out 17 from $var(sdp_answ_ip) $var(sdp_answ_rtcp_port) to $var(ue_sdp_ip) $var(ue_sdp_rtcp_port)\", \"permit in 17 from $var(ue_sdp_ip) $var(ue_sdp_rtcp_port) to $var(sdp_answ_ip) $var(sdp_answ_rtcp_port)\"]", "$var(medSubComp2)");
 | 
					 | 
				
			||||||
    jansson_set("string", "fStatus", "ENABLED", "$var(medSubComp2)");
 | 
					 | 
				
			||||||
#    jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp2)");  # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
 | 
					 | 
				
			||||||
#    jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp2)");  # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
 | 
					 | 
				
			||||||
    jansson_set("string", "flowUsage", "RTCP", "$var(medSubComp2)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Merging the flows under MediaSubComponent
 | 
					 | 
				
			||||||
    jansson_set("obj", "0", "$var(medSubComp1)", "$var(medSubComps)");
 | 
					 | 
				
			||||||
    jansson_set("obj", "1", "$var(medSubComp2)", "$var(medSubComps)");
 | 
					 | 
				
			||||||
    jansson_set("obj", "medSubComps", "$var(medSubComps)", "$var(medComp)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    jansson_set("obj", "0", "$var(medComp)", "$var(medComponents)");
 | 
					 | 
				
			||||||
    jansson_set("obj", "medComponents", "$var(medComponents)", "$var(payload)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Set evSubsc\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set evSubsc
 | 
					 | 
				
			||||||
    jansson_set("string", "event", "QOS_NOTIF", "$var(event1)");
 | 
					 | 
				
			||||||
    jansson_set("string", "notifMethod", "PERIODIC", "$var(event1)");  
 | 
					 | 
				
			||||||
    jansson_append("obj", "", "$var(event1)", "$var(events)");
 | 
					 | 
				
			||||||
    jansson_set("string", "event", "ANI_REPORT", "$var(event2)");
 | 
					 | 
				
			||||||
    jansson_set("string", "notifMethod", "ONE_TIME", "$var(event2)");
 | 
					 | 
				
			||||||
    jansson_append("obj", "", "$var(event2)", "$var(events)");
 | 
					 | 
				
			||||||
    jansson_set("array", "events", "$var(events)", "$var(evSubsc)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    jansson_set("obj", "evSubsc", "$var(evSubsc)", "$var(payload)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set other parameters in payload
 | 
					 | 
				
			||||||
    jansson_set("string", "notifUri", "http://172.22.0.21:8284", "$var(payload)");
 | 
					 | 
				
			||||||
#    jansson_set("string", "sponStatus", "SPONSOR_DISABLED", "$var(payload)");  # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
 | 
					 | 
				
			||||||
#    jansson_set("string", "gpsi", "msisdn-$fU", "$var(payload)");              # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed 
 | 
					 | 
				
			||||||
#    jansson_set("string", "suppFeat", "4", "$var(payload)");                   # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed 
 | 
					 | 
				
			||||||
#    jansson_set("string", "ueIpv4", "$var(ue_sip_ip_addr)", "$var(payload)");  # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed 
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    ### Assemble the final JSON request
 | 
					 | 
				
			||||||
    jansson_set("obj", "ascReqData", "$var(payload)", "$var(json_request)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Set headers for the HTTP2 Request\n");    
 | 
					 | 
				
			||||||
### Set headers    
 | 
					 | 
				
			||||||
    $var(time_now)=$_s($timef(%a, %d %b %Y %H:%M:%S %Z));
 | 
					 | 
				
			||||||
    xlog("Today is $var(time_now)\n");
 | 
					 | 
				
			||||||
     
 | 
					 | 
				
			||||||
    $var(headers) = "Content-Type: application/merge-patch+json\r\n"; # added content-type an set it to "application/merge-patch+json" fo compatibility with RFC7386 for JSON PATCH/Merge
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/problem+json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-max-rsp-time: 10000\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-service-names: npcf-policyauthorization\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Sending the request to PCF\n");    
 | 
					 | 
				
			||||||
### Send the request to PCF
 | 
					 | 
				
			||||||
    http_client_request_v2pk("PATCH", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/$var(user_appsess_inv_rep)", "$var(json_request)", "$var(headers)", "$var(result)" );
 | 
					 | 
				
			||||||
    xlog("HTTP response: $var(result)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $curlerror(error)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $var(response_code)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $httprhdr(location)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
########################################
 | 
					 | 
				
			||||||
######### END of 5G VoNR N5 Request ####
 | 
					 | 
				
			||||||
########################################
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,22 +6,7 @@ route[MT] {
 | 
				
			|||||||
    xnotice("Source IP and Port: ($si:$sp)\n Route-URI: $route_uri\n");
 | 
					    xnotice("Source IP and Port: ($si:$sp)\n Route-URI: $route_uri\n");
 | 
				
			||||||
    xnotice("Received IP and Port: ($Ri:$Rp)\n");
 | 
					    xnotice("Received IP and Port: ($Ri:$Rp)\n");
 | 
				
			||||||
    xnotice("Contact header: $ct\n");
 | 
					    xnotice("Contact header: $ct\n");
 | 
				
			||||||
    xnotice("Term UE connection information : IP is $dd and Port is $rp \n");
 | 
					 | 
				
			||||||
    xnotice("Term P-CSCF connection information : IP is $RAi and Port is $RAp \n");
 | 
					 | 
				
			||||||
    set_dlg_profile("term");
 | 
					    set_dlg_profile("term");
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
#Route N5 Request 
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
      if(is_method("INVITE")) {
 | 
					 | 
				
			||||||
          route(N5_INIT_MT_REQ);   
 | 
					 | 
				
			||||||
                 }
 | 
					 | 
				
			||||||
## not sure why on CANCEL its not triggered maybe I'm missing something ?
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if(is_method("CANCEL"))
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
                  route(N5_MTC_TERM); 
 | 
					 | 
				
			||||||
   }  
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
#!ifdef WITH_IPSEC
 | 
					#!ifdef WITH_IPSEC
 | 
				
			||||||
    ipsec_forward("location", IPSEC_FORWARD_FLAGS);
 | 
					    ipsec_forward("location", IPSEC_FORWARD_FLAGS);
 | 
				
			||||||
#!endif
 | 
					#!endif
 | 
				
			||||||
@@ -43,25 +28,6 @@ onreply_route[MT_reply] {
 | 
				
			|||||||
	# In case of 1xx and 2xx do NAT
 | 
						# In case of 1xx and 2xx do NAT
 | 
				
			||||||
	if(status=~"[12][0-9][0-9]")
 | 
						if(status=~"[12][0-9][0-9]")
 | 
				
			||||||
		route(NATMANAGE);
 | 
							route(NATMANAGE);
 | 
				
			||||||
   
 | 
					 | 
				
			||||||
### N5 PATCH Request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (t_check_status("180|183|200") && has_body("application/sdp")){
 | 
					 | 
				
			||||||
        xlog("L_DBG", "About to test if this is a retransmitted reply which is still currently suspended\n");
 | 
					 | 
				
			||||||
        if (t_is_retr_async_reply()) {
 | 
					 | 
				
			||||||
	                xlog("L_DBG", "Dropping retransmitted reply which is still currently suspended\n");
 | 
					 | 
				
			||||||
       		         drop();
 | 
					 | 
				
			||||||
       		           }
 | 
					 | 
				
			||||||
                  route(N5_PATCH_MT_REQ);   
 | 
					 | 
				
			||||||
                 }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## not sure why on CANCEL its not triggered maybe I'm missing something ?
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if(is_method("CANCEL"))
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
                  route(N5_MTC_TERM); 
 | 
					 | 
				
			||||||
   } 
 | 
					 | 
				
			||||||
   
 | 
					 | 
				
			||||||
#!ifdef WITH_RX
 | 
					#!ifdef WITH_RX
 | 
				
			||||||
        if (t_check_status("183|200") && has_body("application/sdp")){
 | 
					        if (t_check_status("183|200") && has_body("application/sdp")){
 | 
				
			||||||
        xnotice("PCSCF MT_reply: \n Destination URI: $du\n Request URI: $ru\n");
 | 
					        xnotice("PCSCF MT_reply: \n Destination URI: $du\n Request URI: $ru\n");
 | 
				
			||||||
@@ -115,24 +81,6 @@ route[MT_aar_reply]
 | 
				
			|||||||
# In-Dialog-MT-Requests
 | 
					# In-Dialog-MT-Requests
 | 
				
			||||||
######################################################################
 | 
					######################################################################
 | 
				
			||||||
route[MT_indialog] {
 | 
					route[MT_indialog] {
 | 
				
			||||||
 | 
					 | 
				
			||||||
## N5 PATCH Request
 | 
					 | 
				
			||||||
       
 | 
					 | 
				
			||||||
        if(is_method("INVITE")){
 | 
					 | 
				
			||||||
        xlog("L_ALERT"," InDialog SDP Answer N5 Request for reINVITE\n"); 
 | 
					 | 
				
			||||||
    route(N5_PATCH_REQ);
 | 
					 | 
				
			||||||
       }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Terminating N5 AppSession after BYE##
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if(is_method("BYE|CANCEL"))
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
                  route(N5_MTC_TERM); 
 | 
					 | 
				
			||||||
   }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### END of N5 Request 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    xnotice("PCSCF MT_indialog: \n Destination URI: $du\n Request URI: $ru\n");
 | 
					    xnotice("PCSCF MT_indialog: \n Destination URI: $du\n Request URI: $ru\n");
 | 
				
			||||||
    xnotice("Source IP and Port: ($si:$sp)\n Route-URI: $route_uri\n");
 | 
					    xnotice("Source IP and Port: ($si:$sp)\n Route-URI: $route_uri\n");
 | 
				
			||||||
    xnotice("Received IP and Port: ($Ri:$Rp)\n");
 | 
					    xnotice("Received IP and Port: ($Ri:$Rp)\n");
 | 
				
			||||||
@@ -202,401 +150,3 @@ route[MT_indialog_aar_reply]
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
#!endif
 | 
					#!endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
#################################
 | 
					 | 
				
			||||||
## Route Logic for N5 Requests ##
 | 
					 | 
				
			||||||
#################################
 | 
					 | 
				
			||||||
route[N5_INIT_MT_REQ] {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Storing IDs and IPs from UE into variables to use them later in the N5 Request:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   
 | 
					 | 
				
			||||||
    $var(term_ue_ip) = $dd;
 | 
					 | 
				
			||||||
    $var(term_ue_port) = $rp;
 | 
					 | 
				
			||||||
    $var(pcscf_ip) = $Ri;
 | 
					 | 
				
			||||||
    $var(pcscf_port) = $Rp;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
# now checking it on console if I got what I wanted :
 | 
					 | 
				
			||||||
    xlog("L_INFO", "connection Info for Term UE $var(term_ue_ip) $var(term_ue_port)\n");
 | 
					 | 
				
			||||||
    xlog("L_INFO", "connection Info for P-CSCF is: $var(pcscf_ip) $var(pcscf_port)\n");    
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# now trying some way to store IP of Term UE
 | 
					 | 
				
			||||||
    $var(term_user_id_req_ip) = $tU; # should get the user part of the Orig UE from request
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Store the IP in the hash table associated with the UE
 | 
					 | 
				
			||||||
    $sht(user_sip_ips=>$var(term_user_id_req_ip)) = $var(term_ue_ip);
 | 
					 | 
				
			||||||
    xlog("L_INFO", "IP Info for Term UE MSISDN $var(term_user_id_req_ip): $var(term_ue_ip)\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
# now trying some way to store Port of Term UE
 | 
					 | 
				
			||||||
    $var(term_user_id_req_port) = $tU; # should get the user part of the Orig UE from request
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Store the Port in the hash table associated with the UE
 | 
					 | 
				
			||||||
    $sht(user_sip_ports=>$var(user_id_req_port)) = $var(term_ue_port);
 | 
					 | 
				
			||||||
    xlog("L_INFO", "Port Info for UE MSISDN $var(term_user_id_req_port): $var(term_ue_port)\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
#### 5G VoNR N5 NPCF Authorization reuqest 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   if(is_method("INVITE")){
 | 
					 | 
				
			||||||
		xlog("L_DBG", "IMS: MTC INVITE TO $tU\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
## retrieving SDP Connection Info and Media Port for Orig UE ( in case we will start with INVITE), the values should be already there if the call fom UE registred to this P-CSCF, in case the call coming from outside then we need to get them from the initial INVITE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### due to the current limitation on SRS-gNodeB we will not use the values below, they are there just in case the limitation are fixed.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$var(sdp_src_ip) = $sdp(c:ip);
 | 
					 | 
				
			||||||
$var(sdp_src_port) = $sdp(m0:rtp:port);
 | 
					 | 
				
			||||||
$var(sdp_src_rtcp_port) = $sdp(m0:rtcp:port);
 | 
					 | 
				
			||||||
$var(sdp_mline_raw) = $sdp(m0:raw);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# SDP IP Orig Party 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    $var(orig_sdp_id_ue) = $fU; # User Part of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_sdp_ip) = $sht(user_sdps_ip=>$var(sdp_id_ue));
 | 
					 | 
				
			||||||
    if $var(ue_sdp_ip) == 0 {
 | 
					 | 
				
			||||||
        xlog("L_INFO", "SDP RTP IP for Orig Party is 0, need to get it from the INVITE, happend if INVITE coming from outside\n");
 | 
					 | 
				
			||||||
# now trying some way to store SDP SRC_IP of Orig Party
 | 
					 | 
				
			||||||
    $var(user_id_sdp_ip) = $fU; # should get the user part of the Orig UE from request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Store the AppSession in the hash table associated with the UE
 | 
					 | 
				
			||||||
    $sht(user_sdps_ip=>$var(user_id_sdp_ip)) = $var(sdp_src_ip);
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP SRC_IP of External UE $var(user_id_sdp_ip): $var(sdp_src_ip)\n");
 | 
					 | 
				
			||||||
                                   } else {
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP IP for UE with MSISDN $var(sdp_id_ue) is: $var(ue_sdp_ip)\n");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# SDP Port Orig Party
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    $var(sdp_id_ue_port) = $fU; # User Port of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_sdp_port) = $sht(user_sdps_port=>$var(sdp_id_ue_port));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if $var(ue_sdp_port) == 0 {
 | 
					 | 
				
			||||||
        xlog("L_INFO", "SDP RTP port for Orig Party is 0, need to get it from the INVITE, happend if INVITE coming from outside\n");
 | 
					 | 
				
			||||||
# now trying some way to store SDP Media_Port of Orig UE
 | 
					 | 
				
			||||||
    $var(user_id_sdp_port) = $fU; # should get the user part of the Orig UE from request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # store SDP Media_Port in the hash table associated with the UE
 | 
					 | 
				
			||||||
    $sht(user_sdps_port=>$var(user_id_sdp_port)) = $var(sdp_src_port);
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP Media_Port of External UE $var(user_id_sdp_port): $var(sdp_src_port)\n");        
 | 
					 | 
				
			||||||
                                   } else {
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP Port for UE with MSISDN $var(sdp_id_ue_port) is: $var(ue_sdp_port)\n");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    $var(sdp_id_ue_rtcp_port) = $fU; # User Port of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_sdp_rtcp_port) = $sht(user_sdps_rtcp_port=>$var(sdp_id_ue_rtcp_port));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if $var(ue_sdp_port) == 0 {
 | 
					 | 
				
			||||||
        xlog("L_INFO", "SDP RTCP port for Orig Party is 0, need to get it from the INVITE, happend if INVITE coming from outside\n");
 | 
					 | 
				
			||||||
# now trying some way to store SDP RTCP_Media_Port of Orig UE
 | 
					 | 
				
			||||||
    $var(user_id_sdp_rtcp_port) = $fU; # should get the user part of the Orig UE from request
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Store the RTCP_Media_Port in the hash table associated with the UE
 | 
					 | 
				
			||||||
    $sht(user_sdps_rtcp_port=>$var(user_id_sdp_rtcp_port)) = $var(sdp_src_rtcp_port);
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP RTCP_Media_Port of External UE $var(user_id_sdp_rtcp_port): $var(sdp_src_rtcp_port)\n");        
 | 
					 | 
				
			||||||
                                   } else {
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP Port for UE with MSISDN $var(sdp_id_ue_rtcp_port) is: $var(ue_sdp_rtcp_port)\n");    
 | 
					 | 
				
			||||||
    }                                   
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### now start to build the N5 Request 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   xlog("L_ALERT","DEBUG: Preparing QoS N5 Message to PCF for 18x Response from term UE\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Initialize empty arrays and objects\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Initialize empty arrays and objects
 | 
					 | 
				
			||||||
    $var(events) = '[]';
 | 
					 | 
				
			||||||
    $var(medComponents) = '{}';
 | 
					 | 
				
			||||||
    $var(medSubComps) = '{}';
 | 
					 | 
				
			||||||
    $var(evSubsc) = '{}';
 | 
					 | 
				
			||||||
    $var(payload) = '{}';
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set afAppId and dnn in payload
 | 
					 | 
				
			||||||
    jansson_set("string", "afAppId", "+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel\"", "$var(payload)");  # adding a note that this could be improved in future to get the value SIP Header
 | 
					 | 
				
			||||||
    jansson_set("string", "dnn", "ims", "$var(payload)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set medComponents
 | 
					 | 
				
			||||||
    jansson_set("integer", "medCompN", 1, "$var(medComp)");
 | 
					 | 
				
			||||||
    jansson_set("string", "qosReference", "qosVoNR", "$var(medComp)");  
 | 
					 | 
				
			||||||
    jansson_set("string", "medType", "AUDIO", "$var(medComp)");
 | 
					 | 
				
			||||||
    jansson_set("array", "codecs", "[\"downlink\\noffer\\n\", \"uplink\\nanswer\\n\"]", "$var(medComp)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    ### RTP
 | 
					 | 
				
			||||||
    jansson_set("integer", "fNum", 1, "$var(medSubComp1)");
 | 
					 | 
				
			||||||
    jansson_set("array", "fDescs", "[\"permit out 17 from any to any\", \"permit in 17 from any to any\"]", "$var(medSubComp1)");  ### setting the values to "any" untill SRS-gNodeB supports PDUSessionRessourceModification 
 | 
					 | 
				
			||||||
    jansson_set("string", "fStatus", "ENABLED", "$var(medSubComp1)");
 | 
					 | 
				
			||||||
    jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp1)");  
 | 
					 | 
				
			||||||
    jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp1)"); 
 | 
					 | 
				
			||||||
    jansson_set("string", "flowUsage", "NO_INFO", "$var(medSubComp1)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
   
 | 
					 | 
				
			||||||
    ### RTCP
 | 
					 | 
				
			||||||
    jansson_set("integer", "fNum", 2, "$var(medSubComp2)");
 | 
					 | 
				
			||||||
    jansson_set("array", "fDescs", "[\"permit out 17 from any to any\", \"permit in 17 from any to any\"]", "$var(medSubComp2)"); ### setting the values to "any" untill SRS-gNodeB supports PDUSessionRessourceModification
 | 
					 | 
				
			||||||
    jansson_set("string", "fStatus", "ENABLED", "$var(medSubComp2)");
 | 
					 | 
				
			||||||
    jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp2)");  
 | 
					 | 
				
			||||||
    jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp2)");  
 | 
					 | 
				
			||||||
    jansson_set("string", "flowUsage", "RTCP", "$var(medSubComp2)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Merging the flows under MediaSubComponent
 | 
					 | 
				
			||||||
    jansson_set("obj", "0", "$var(medSubComp1)", "$var(medSubComps)");
 | 
					 | 
				
			||||||
    jansson_set("obj", "1", "$var(medSubComp2)", "$var(medSubComps)");
 | 
					 | 
				
			||||||
    jansson_set("obj", "medSubComps", "$var(medSubComps)", "$var(medComp)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    jansson_set("obj", "0", "$var(medComp)", "$var(medComponents)");
 | 
					 | 
				
			||||||
    jansson_set("obj", "medComponents", "$var(medComponents)", "$var(payload)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Set evSubsc\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set evSubsc
 | 
					 | 
				
			||||||
    jansson_set("string", "event", "QOS_NOTIF", "$var(event1)");
 | 
					 | 
				
			||||||
    jansson_set("string", "notifMethod", "PERIODIC", "$var(event1)");  
 | 
					 | 
				
			||||||
    jansson_append("obj", "", "$var(event1)", "$var(events)");
 | 
					 | 
				
			||||||
    jansson_set("string", "event", "ANI_REPORT", "$var(event2)");
 | 
					 | 
				
			||||||
    jansson_set("string", "notifMethod", "ONE_TIME", "$var(event2)");
 | 
					 | 
				
			||||||
    jansson_append("obj", "", "$var(event2)", "$var(events)");
 | 
					 | 
				
			||||||
    jansson_set("array", "events", "$var(events)", "$var(evSubsc)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    jansson_set("obj", "evSubsc", "$var(evSubsc)", "$var(payload)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set other parameters in payload
 | 
					 | 
				
			||||||
    jansson_set("string", "notifUri", "http://172.22.0.21:7777", "$var(payload)");
 | 
					 | 
				
			||||||
    jansson_set("string", "sponStatus", "SPONSOR_DISABLED", "$var(payload)");
 | 
					 | 
				
			||||||
    jansson_set("string", "gpsi", "msisdn-$tU", "$var(payload)");
 | 
					 | 
				
			||||||
    jansson_set("string", "suppFeat", "2", "$var(payload)");
 | 
					 | 
				
			||||||
    jansson_set("string", "ueIpv4", "$dd", "$var(payload)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    ### Assemble the final JSON request
 | 
					 | 
				
			||||||
    jansson_set("obj", "ascReqData", "$var(payload)", "$var(json_request)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Set headers for the HTTP2 Request\n");    
 | 
					 | 
				
			||||||
### Set headers    
 | 
					 | 
				
			||||||
    $var(time_now)=$_s($timef(%a, %d %b %Y %H:%M:%S %Z));
 | 
					 | 
				
			||||||
    xlog("Today is $var(time_now)\n");
 | 
					 | 
				
			||||||
     
 | 
					 | 
				
			||||||
    $var(headers) = "Content-Type: application/json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/problem+json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-max-rsp-time: 10000\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-service-names: npcf-policyauthorization\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Sending the request to PCF\n");    
 | 
					 | 
				
			||||||
### Send the request to PCF
 | 
					 | 
				
			||||||
    http_client_request_v2pk("POST", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions", "$var(json_request)", "$var(headers)", "$var(result)" );
 | 
					 | 
				
			||||||
    xlog("HTTP response: $var(result)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $curlerror(error)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $var(response_code)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $httprhdr(location)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Now I will retrieve the AppSessionID out of the location Header it should be always at the end 
 | 
					 | 
				
			||||||
# Example URL: "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/(someSessionID)"
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
# Firt store the url of the lcoation Header in var
 | 
					 | 
				
			||||||
    $var(url) = $httprhdr(location);
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Get the length of the URL
 | 
					 | 
				
			||||||
    $var(len) = $(var(url){s.len});
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Initialize the position variable to the length of the URL
 | 
					 | 
				
			||||||
    $var(pos) = $var(len);
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Find the position of the last slash by iterating backwards
 | 
					 | 
				
			||||||
    while ($var(pos) > 0) {
 | 
					 | 
				
			||||||
      $var(pos) = $var(pos) - 1;
 | 
					 | 
				
			||||||
      if ($(var(url){s.substr,$var(pos),1}) == "/") {
 | 
					 | 
				
			||||||
          # We've found the last slash
 | 
					 | 
				
			||||||
          break;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
# Extract the substring after the last slash
 | 
					 | 
				
			||||||
# now doing some magic
 | 
					 | 
				
			||||||
    $var(start_pos) = $var(pos) + 1;
 | 
					 | 
				
			||||||
    $var(end_pos) = $var(len) - $var(start_pos);
 | 
					 | 
				
			||||||
    $var(mtc_app_session) = $(var(url){s.substr,$var(start_pos),$var(end_pos)});
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
# now checking it on console if I got what I wanted :
 | 
					 | 
				
			||||||
    xlog("L_INFO", "AppSession for user $tU is: $var(mtc_app_session)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# now trying some way to store AppSession with the registred UE
 | 
					 | 
				
			||||||
    $var(term_user_id) = $tU; # should get the user part of the Orig UE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Store the AppSession in the hash table associated with the UE
 | 
					 | 
				
			||||||
    $sht(user_data=>$var(term_user_id)) = $var(mtc_app_session);
 | 
					 | 
				
			||||||
    xlog("L_INFO", "Stored AppSession for user $var(term_user_id): $var(mtc_app_session)\n");
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
############
 | 
					 | 
				
			||||||
#############
 | 
					 | 
				
			||||||
#############
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
route[N5_PATCH_MT_REQ] {
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
		xlog("L_DBG", "IMS: Received 183/200 from Term UE\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## retrieving SDP Connection Info and Media Port for UE 
 | 
					 | 
				
			||||||
    $var(sdp_id_ue) = $fU; # User Part of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_sdp_ip) = $sht(user_sdps_ip=>$var(sdp_id_ue));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP IP for UE with MSISDN $var(sdp_id_ue) is: $var(ue_sdp_ip)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    $var(sdp_id_ue_port) = $fU; # User Port of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_sdp_port) = $sht(user_sdps_port=>$var(sdp_id_ue_port));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP Port for UE with MSISDN $var(sdp_id_ue_port) is: $var(ue_sdp_port)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    $var(sdp_id_ue_rtcp_port) = $fU; # User Port of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(ue_sdp_rtcp_port) = $sht(user_sdps_rtcp_port=>$var(sdp_id_ue_rtcp_port));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "SDP Port for UE with MSISDN $var(sdp_id_ue_rtcp_port) is: $var(ue_sdp_rtcp_port)\n");    
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
## retrieving SDP Connection Info from SDP Answer 
 | 
					 | 
				
			||||||
    $var(sdp_answ_ip) = $sdp(c:ip);
 | 
					 | 
				
			||||||
    $var(sdp_answ_port) = $sdp(m0:rtp:port);
 | 
					 | 
				
			||||||
    $var(sdp_answ_rtcp_port) = $sdp(m0:rtcp:port);
 | 
					 | 
				
			||||||
    $var(sdp_answ_codec) = $(rb{line.sw,a=rtpmap}{s.select,1, });
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "SDP Answer connection Info is: $var(sdp_answ_ip), RTP port $var(sdp_answ_port), RTCP Port $var(sdp_answ_rtcp_port) and codec is $var(sdp_answ_codec)\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
## Retrieveing AppSession from initial INVITE N5 Request
 | 
					 | 
				
			||||||
    $var(mtc_resp_app_id) = $tU; # User Part of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(user_appsess_mtc_rep) = $sht(user_data=>$var(mtc_resp_app_id));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "Stored MTC AppSession for user $var(mtc_resp_app_id): $var(user_appsess_mtc_rep)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### now start to build the N5 Request 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   xlog("L_ALERT","DEBUG: Preparing PATCH N5 Message for SDP Answer\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Initialize empty arrays and objects\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Initialize empty arrays and objects
 | 
					 | 
				
			||||||
    $var(events) = '[]';
 | 
					 | 
				
			||||||
    $var(medComponents) = '{}';
 | 
					 | 
				
			||||||
    $var(medSubComps) = '{}';
 | 
					 | 
				
			||||||
    $var(evSubsc) = '{}';
 | 
					 | 
				
			||||||
    $var(payload) = '{}';
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set afAppId and dnn in payload
 | 
					 | 
				
			||||||
    jansson_set("string", "afAppId", "+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel\"", "$var(payload)");
 | 
					 | 
				
			||||||
    jansson_set("string", "dnn", "ims", "$var(payload)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set medComponents
 | 
					 | 
				
			||||||
    jansson_set("integer", "medCompN", 1, "$var(medComp)");
 | 
					 | 
				
			||||||
#    jansson_set("string", "qosReference", "qosVoNR", "$var(medComp)");  # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed 
 | 
					 | 
				
			||||||
    jansson_set("string", "medType", "AUDIO", "$var(medComp)");
 | 
					 | 
				
			||||||
    jansson_set("array", "codecs", "[\"downlink\\n$var(sdp_answ_codec)\\n\", \"uplink\\n$var(sdp_answ_codec)\\n\"]", "$var(medComp)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
     ### RTP
 | 
					 | 
				
			||||||
    jansson_set("integer", "fNum", 1, "$var(medSubComp1)");
 | 
					 | 
				
			||||||
    jansson_set("array", "fDescs", "[\"permit out 17 from any to $var(sdp_answ_ip) $var(sdp_answ_port)\", \"permit in 17 from $var(sdp_answ_ip) $var(sdp_answ_port) to any\"]", "$var(medSubComp1)");
 | 
					 | 
				
			||||||
    jansson_set("string", "fStatus", "ENABLED", "$var(medSubComp1)");
 | 
					 | 
				
			||||||
#    jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp1)");  # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
 | 
					 | 
				
			||||||
#    jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp1)");  # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
 | 
					 | 
				
			||||||
    jansson_set("string", "flowUsage", "NO_INFO", "$var(medSubComp1)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
   
 | 
					 | 
				
			||||||
    ### RTCP
 | 
					 | 
				
			||||||
    jansson_set("integer", "fNum", 2, "$var(medSubComp2)");
 | 
					 | 
				
			||||||
    jansson_set("array", "fDescs", "[\"permit out 17 from any to $var(sdp_answ_ip) $var(sdp_answ_rtcp_port)\", \"permit in 17 from $var(sdp_answ_ip) $var(sdp_answ_rtcp_port) to any\"]", "$var(medSubComp2)");
 | 
					 | 
				
			||||||
    jansson_set("string", "fStatus", "ENABLED", "$var(medSubComp2)");
 | 
					 | 
				
			||||||
#    jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp2)");  # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
 | 
					 | 
				
			||||||
#    jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp2)");  # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
 | 
					 | 
				
			||||||
    jansson_set("string", "flowUsage", "RTCP", "$var(medSubComp2)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Merging the flows under MediaSubComponent
 | 
					 | 
				
			||||||
    jansson_set("obj", "0", "$var(medSubComp1)", "$var(medSubComps)");
 | 
					 | 
				
			||||||
    jansson_set("obj", "1", "$var(medSubComp2)", "$var(medSubComps)");
 | 
					 | 
				
			||||||
    jansson_set("obj", "medSubComps", "$var(medSubComps)", "$var(medComp)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    jansson_set("obj", "0", "$var(medComp)", "$var(medComponents)");
 | 
					 | 
				
			||||||
    jansson_set("obj", "medComponents", "$var(medComponents)", "$var(payload)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Set evSubsc\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set evSubsc
 | 
					 | 
				
			||||||
    jansson_set("string", "event", "QOS_NOTIF", "$var(event1)");
 | 
					 | 
				
			||||||
    jansson_set("string", "notifMethod", "PERIODIC", "$var(event1)");  
 | 
					 | 
				
			||||||
    jansson_append("obj", "", "$var(event1)", "$var(events)");
 | 
					 | 
				
			||||||
    jansson_set("string", "event", "ANI_REPORT", "$var(event2)");
 | 
					 | 
				
			||||||
    jansson_set("string", "notifMethod", "ONE_TIME", "$var(event2)");
 | 
					 | 
				
			||||||
    jansson_append("obj", "", "$var(event2)", "$var(events)");
 | 
					 | 
				
			||||||
    jansson_set("array", "events", "$var(events)", "$var(evSubsc)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    jansson_set("obj", "evSubsc", "$var(evSubsc)", "$var(payload)");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
### Set other parameters in payload
 | 
					 | 
				
			||||||
    jansson_set("string", "notifUri", "http://172.22.0.21:7777", "$var(payload)");
 | 
					 | 
				
			||||||
#    jansson_set("string", "sponStatus", "SPONSOR_DISABLED", "$var(payload)");  # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
 | 
					 | 
				
			||||||
#    jansson_set("string", "gpsi", "msisdn-$tU", "$var(payload)");              # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed 
 | 
					 | 
				
			||||||
    jansson_set("string", "suppFeat", "2", "$var(payload)");                   # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed 
 | 
					 | 
				
			||||||
#    jansson_set("string", "ueIpv4", "$si", "$var(payload)");  # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed 
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    ### Assemble the final JSON request
 | 
					 | 
				
			||||||
    jansson_set("obj", "ascReqData", "$var(payload)", "$var(json_request)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Set headers for the HTTP2 Request\n");    
 | 
					 | 
				
			||||||
### Set headers    
 | 
					 | 
				
			||||||
    $var(time_now)=$_s($timef(%a, %d %b %Y %H:%M:%S %Z));
 | 
					 | 
				
			||||||
    xlog("Today is $var(time_now)\n");
 | 
					 | 
				
			||||||
     
 | 
					 | 
				
			||||||
    $var(headers) = "Content-Type: application/merge-patch+json\r\n"; # added content-type an set it to "application/merge-patch+json" fo compatibility with RFC7386 for JSON PATCH/Merge
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/problem+json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-max-rsp-time: 10000\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-service-names: npcf-policyauthorization\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Sending the request to PCF\n");    
 | 
					 | 
				
			||||||
### Send the request to PCF
 | 
					 | 
				
			||||||
    http_client_request_v2pk("PATCH", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/$var(user_appsess_mtc_rep)", "$var(json_request)", "$var(headers)", "$var(result)" );
 | 
					 | 
				
			||||||
    xlog("HTTP response: $var(result)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $curlerror(error)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $var(response_code)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $httprhdr(location)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
########################################
 | 
					 | 
				
			||||||
######### END of 5G VoNR N5 Request ####
 | 
					 | 
				
			||||||
########################################
 | 
					 | 
				
			||||||
route[N5_MTC_TERM] {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## something need to be clear here about BYE ;( To/From Headers!!!
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    xlog("L_ALERT","Terminating AppSession For Call fom User $fu due to call END\n"); 
 | 
					 | 
				
			||||||
    # Retrieveing and paying attention to whom ended teh call
 | 
					 | 
				
			||||||
    $var(mtc_resp_app_id) = $tU; # User Part of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(user_appsess_mtc_rep) = $sht(user_data=>$var(mtc_resp_app_id));
 | 
					 | 
				
			||||||
    if $var(user_appsess_mtc_rep) == 0 {
 | 
					 | 
				
			||||||
    xlog("L_INFO", "BYE sent from Term UE, doing alternative Method\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Retrieveing and paying attention to whom ended teh call
 | 
					 | 
				
			||||||
    $var(mtc_resp_app_id) = $fU; # User Part of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(user_appsess_mtc_rep) = $sht(user_data=>$var(mtc_resp_app_id));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "Alt-Method : Terminating Stored AppSession for user $var(mtc_resp_app_id): $var(user_appsess_mtc_rep)\n");    
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
    xlog("L_INFO", "BYE sent from Orig UE, doing normal Method\n");
 | 
					 | 
				
			||||||
    xlog("L_INFO", "Normal Method : Stored MTC AppSession for user $var(mtc_resp_app_id): $var(user_appsess_mtc_rep)\n");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    $var(headers) = "X-SIP-Status: De-Registration\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/problem+json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-max-rsp-time: 10000\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-service-names: npcf-policyauthorization\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    http_client_request_v2pk("POST", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/$var(user_appsess_mtc_rep)/delete", "$var(json_request)", "$var(headers)", "$var(result)" );
 | 
					 | 
				
			||||||
    xlog("Termination resuls: $var(result)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $curlerror(error)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $var(response_code)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $httprhdr(location)\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
}    
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,21 +21,6 @@ route[REGISTER] {
 | 
				
			|||||||
		exit;
 | 
							exit;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### N5 Request create and terminate
 | 
					 | 
				
			||||||
    xlog("L_ALERT","Checking if its a Registration and not a De-Reg for $fu\n");  
 | 
					 | 
				
			||||||
    $var(reg_exp) =   $expires(min);
 | 
					 | 
				
			||||||
    xlog("L_ALERT","Checking Expire  $fu and it is : $var(reg_exp)\n");   
 | 
					 | 
				
			||||||
     
 | 
					 | 
				
			||||||
     # tying a dirty workaround to make it only excute after IPSec tunnel to prevent double excution 
 | 
					 | 
				
			||||||
    	if ($expires(min) != 0 && is_present_hf("Security-Verify")) {
 | 
					 | 
				
			||||||
     route(REGISTER_N5_Req);
 | 
					 | 
				
			||||||
     }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if ($expires(min) == 0 ) {
 | 
					 | 
				
			||||||
       xlog("L_ALERT","delete N5 Session for $fu due to de-register\n");  
 | 
					 | 
				
			||||||
       route(REG_N5_TERMINATE);
 | 
					 | 
				
			||||||
     }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#!ifdef WITH_IPSEC
 | 
					#!ifdef WITH_IPSEC
 | 
				
			||||||
	$sht(ipsec_clients=>$(ct{nameaddr.uri})) = $null;
 | 
						$sht(ipsec_clients=>$(ct{nameaddr.uri})) = $null;
 | 
				
			||||||
	if ($hdr(Security-Client) =~ ".*ipsec-3gpp.*") {
 | 
						if ($hdr(Security-Client) =~ ".*ipsec-3gpp.*") {
 | 
				
			||||||
@@ -309,13 +294,6 @@ onreply_route[REGISTER_reply]
 | 
				
			|||||||
######################################################################
 | 
					######################################################################
 | 
				
			||||||
failure_route[REGISTER_failure]
 | 
					failure_route[REGISTER_failure]
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					 | 
				
			||||||
# Terminate N5 Session on Reg Failure
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 	if (t_check_status("403|408|[5-6][0-9][0-9]")) {
 | 
					 | 
				
			||||||
         route(REG_N5_TERMINATE);
 | 
					 | 
				
			||||||
     }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#!ifdef WITH_IPBLOCK
 | 
					#!ifdef WITH_IPBLOCK
 | 
				
			||||||
	if (t_check_status("403|[5-6][0-9][0-9]")) {
 | 
						if (t_check_status("403|[5-6][0-9][0-9]")) {
 | 
				
			||||||
		if ($sht(failedauth=>$si) != $null)
 | 
							if ($sht(failedauth=>$si) != $null)
 | 
				
			||||||
@@ -335,180 +313,4 @@ failure_route[REGISTER_failure]
 | 
				
			|||||||
                update_stat("register_failed", "+1");
 | 
					                update_stat("register_failed", "+1");
 | 
				
			||||||
		exit;
 | 
							exit;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#############################################   
 | 
					 | 
				
			||||||
##### 5G Experemntal PCF N5 Interface  Reg ##
 | 
					 | 
				
			||||||
#############################################
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
route[REGISTER_N5_Req] 
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
   
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    xlog("L_ALERT","its a Registration, starting N5 Auth for $fu\n"); 
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Initialize empty arrays and objects\n");
 | 
					 | 
				
			||||||
### Initialize empty arrays and objects
 | 
					 | 
				
			||||||
  $var(events) = '[]';
 | 
					 | 
				
			||||||
  $var(medComponents) = '{}';
 | 
					 | 
				
			||||||
  $var(medSubComps) = '{}';
 | 
					 | 
				
			||||||
  $var(evSubsc) = '{}';
 | 
					 | 
				
			||||||
  $var(payload) = '{}';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Set afAppId and dnn in payload
 | 
					 | 
				
			||||||
  jansson_set("string", "afAppId", "+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel\"", "$var(payload)");  # adding a note that this could be improved in future to get the value SIP Header
 | 
					 | 
				
			||||||
  jansson_set("string", "dnn", "ims", "$var(payload)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Set medComponents
 | 
					 | 
				
			||||||
  jansson_set("integer", "medCompN", 0, "$var(medComp)");
 | 
					 | 
				
			||||||
  jansson_set("string", "qosReference", "qosVoNR", "$var(medComp)");  
 | 
					 | 
				
			||||||
  jansson_set("string", "medType", "CONTROL", "$var(medComp)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  jansson_set("integer", "fNum", 0, "$var(medSubComp)");
 | 
					 | 
				
			||||||
  jansson_set("array", "fDescs", "[\"permit out ip from $RAi $RAp to $si $sp\", \"permit in ip from $si $sp to $RAi $RAp\"]", "$var(medSubComp)");
 | 
					 | 
				
			||||||
  jansson_set("string", "fStatus", "ENABLED", "$var(medSubComp)");  
 | 
					 | 
				
			||||||
  jansson_set("string", "flowUsage", "AF_SIGNALLING", "$var(medSubComp)");
 | 
					 | 
				
			||||||
#  jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp)");  
 | 
					 | 
				
			||||||
#  jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp)");
 | 
					 | 
				
			||||||
  jansson_set("obj", "0", "$var(medSubComp)", "$var(medSubComps)");
 | 
					 | 
				
			||||||
  jansson_set("obj", "medSubComps", "$var(medSubComps)", "$var(medComp)");
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  jansson_set("obj", "0", "$var(medComp)", "$var(medComponents)");
 | 
					 | 
				
			||||||
  jansson_set("obj", "medComponents", "$var(medComponents)", "$var(payload)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
xlog("L_ALERT","DEBUG: Set evSubsc\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Set evSubsc
 | 
					 | 
				
			||||||
  jansson_set("string", "event", "QOS_NOTIF", "$var(event1)");
 | 
					 | 
				
			||||||
  jansson_set("string", "notifMethod", "PERIODIC", "$var(event1)");  
 | 
					 | 
				
			||||||
  jansson_append("obj", "", "$var(event1)", "$var(events)");
 | 
					 | 
				
			||||||
  jansson_set("string", "event", "ANI_REPORT", "$var(event2)");
 | 
					 | 
				
			||||||
  jansson_set("string", "notifMethod", "ONE_TIME", "$var(event2)");
 | 
					 | 
				
			||||||
  jansson_append("obj", "", "$var(event2)", "$var(events)");
 | 
					 | 
				
			||||||
  jansson_set("array", "events", "$var(events)", "$var(evSubsc)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  jansson_set("obj", "evSubsc", "$var(evSubsc)", "$var(payload)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Set other parameters in payload
 | 
					 | 
				
			||||||
  jansson_set("string", "notifUri", "http://172.22.0.21:8284", "$var(payload)");
 | 
					 | 
				
			||||||
  jansson_set("string", "sponStatus", "SPONSOR_DISABLED", "$var(payload)");
 | 
					 | 
				
			||||||
  jansson_set("string", "supi", "imsi-$au", "$var(payload)");
 | 
					 | 
				
			||||||
  jansson_set("string", "suppFeat", "2", "$var(payload)");
 | 
					 | 
				
			||||||
  jansson_set("string", "ueIpv4", "$si", "$var(payload)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Assemble the final JSON request
 | 
					 | 
				
			||||||
  jansson_set("obj", "ascReqData", "$var(payload)", "$var(json_request)");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Set headers for the HTTP2 Request\n");    
 | 
					 | 
				
			||||||
### Set headers    
 | 
					 | 
				
			||||||
    $var(time_now)=$_s($timef(%a, %d %b %Y %H:%M:%S %Z));
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "Today is $var(time_now)\n");
 | 
					 | 
				
			||||||
     
 | 
					 | 
				
			||||||
    $var(headers) = "Content-Type: application/json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/problem+json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-max-rsp-time: 10000\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-service-names: npcf-policyauthorization\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    xlog("L_ALERT","DEBUG: Sending the request to PCF\n");    
 | 
					 | 
				
			||||||
### Send the request to PCF
 | 
					 | 
				
			||||||
    http_client_request_v2pk("POST", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions", "$var(json_request)", "$var(headers)", "$var(result)" );
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "HTTP response: $var(result)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $curlerror(error)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $var(response_code)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $httprhdr(location)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    xlog("L_ALERT","Saving AppSessionID to HTABLE\n"); 
 | 
					 | 
				
			||||||
# Now I will retrieve the AppSessionID out of the location Header it should be always at the end 
 | 
					 | 
				
			||||||
# Example URL: "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/(someSessionID)"
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
# Firt store the url of the lcoation Header in var
 | 
					 | 
				
			||||||
    $var(url) = $httprhdr(location);
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Get the length of the URL
 | 
					 | 
				
			||||||
    $var(len) = $(var(url){s.len});
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Initialize the position variable to the length of the URL
 | 
					 | 
				
			||||||
    $var(pos) = $var(len);
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Find the position of the last slash by iterating backwards
 | 
					 | 
				
			||||||
    while ($var(pos) > 0) {
 | 
					 | 
				
			||||||
      $var(pos) = $var(pos) - 1;
 | 
					 | 
				
			||||||
      if ($(var(url){s.substr,$var(pos),1}) == "/") {
 | 
					 | 
				
			||||||
          # We've found the last slash
 | 
					 | 
				
			||||||
          break;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
# Extract the substring after the last slash
 | 
					 | 
				
			||||||
# now doing some magic
 | 
					 | 
				
			||||||
    $var(start_pos) = $var(pos) + 1;
 | 
					 | 
				
			||||||
    $var(end_pos) = $var(len) - $var(start_pos);
 | 
					 | 
				
			||||||
    $var(app_session) = $(var(url){s.substr,$var(start_pos),$var(end_pos)});
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
# now checking it on console if I got what I wanted :
 | 
					 | 
				
			||||||
    xlog("L_INFO", "AppSession for user $au is: $var(app_session)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# now trying some way to store AppSession with the registred UE
 | 
					 | 
				
			||||||
    $var(user_id) = $au; # should get the user part of the registred UE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Store the AppSession in the hash table associated with the UE
 | 
					 | 
				
			||||||
    $sht(user_data=>$var(user_id)) = $var(app_session);
 | 
					 | 
				
			||||||
    xlog("L_INFO", "Stored AppSession for user $var(user_id): $var(app_session)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#######
 | 
					 | 
				
			||||||
## Storing IMSI for later use :
 | 
					 | 
				
			||||||
######
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    xlog("L_ALERT","Storing User IMSI to HTABLE for later use\n"); 
 | 
					 | 
				
			||||||
    $var(ue_imsi) = $au;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
# now checking it on console if I got what I wanted :
 | 
					 | 
				
			||||||
    xlog("L_INFO", "IP for UE is: $var(ue_imsi)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# now trying some way to store AppSession with the registred UE
 | 
					 | 
				
			||||||
    $var(ue_imsi_reg_ip) = $si; # should get the user part of the registred UE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Store the AppSession in the hash table associated with the UE
 | 
					 | 
				
			||||||
    $sht(user_ids=>$var(ue_imsi_reg_ip)) = $var(ue_imsi);
 | 
					 | 
				
			||||||
    xlog("L_INFO", "Stored IMSI for IP $var(ue_imsi_reg_ip) is: $var(ue_imsi)\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # now contiue with Reg Proccess 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### N5 REQ Route END
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
###########################
 | 
					 | 
				
			||||||
## Terminating AppSession #
 | 
					 | 
				
			||||||
###########################
 | 
					 | 
				
			||||||
route[REG_N5_TERMINATE]
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    xlog("L_ALERT","its a De-Registration for $fu, terminating N5 AppSession\n"); 
 | 
					 | 
				
			||||||
    # Retrieveing
 | 
					 | 
				
			||||||
    $var(user_id_dereg) = $fU; # User Part of the from Header to get the USER 
 | 
					 | 
				
			||||||
    $var(user_appsess_dereg) = $sht(user_data=>$var(user_id_dereg));
 | 
					 | 
				
			||||||
    xlog("L_INFO", "Terminating Stored AppSession for user $var(user_id_dereg): $var(user_appsess_dereg)\n");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    $var(headers) = "X-SIP-Status: De-Registration\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "accept: application/problem+json\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-max-rsp-time: 10000\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-discovery-service-names: npcf-policyauthorization\r\n";
 | 
					 | 
				
			||||||
    $var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    http_client_request_v2pk("POST", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/$var(user_appsess_dereg)/delete", "$var(json_request)", "$var(headers)", "$var(result)" );
 | 
					 | 
				
			||||||
    xlog("Termination resuls: $var(result)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $curlerror(error)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $var(response_code)\n");
 | 
					 | 
				
			||||||
    xlog("L_ALERT", "response header: $httprhdr(location)\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,22 +39,13 @@ RUN apt-get update && \
 | 
				
			|||||||
        pkg-config \
 | 
					        pkg-config \
 | 
				
			||||||
        libsystemd-dev \
 | 
					        libsystemd-dev \
 | 
				
			||||||
        libmysqlclient-dev \
 | 
					        libmysqlclient-dev \
 | 
				
			||||||
        libsctp-dev \
 | 
					 | 
				
			||||||
        gcc \
 | 
					        gcc \
 | 
				
			||||||
        mysql-server \
 | 
					        mysql-server
 | 
				
			||||||
        lsb-release \
 | 
					        
 | 
				
			||||||
        curl \
 | 
					 | 
				
			||||||
        gpg
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
RUN curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg && \
 | 
					 | 
				
			||||||
    echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list && \
 | 
					 | 
				
			||||||
    apt-get update && \
 | 
					 | 
				
			||||||
    apt-get install -y --no-install-recommends redis
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Get pyhss code and install
 | 
					# Get pyhss code and install
 | 
				
			||||||
RUN git clone https://github.com/nickvsnetworking/pyhss && \
 | 
					RUN git clone https://github.com/nickvsnetworking/pyhss && \
 | 
				
			||||||
    cd pyhss && git checkout tags/1.0.2
 | 
					    cd pyhss && git checkout fa059d56330f6e565a9b546d5a9ed4071c2c9ab6
 | 
				
			||||||
RUN cd pyhss && pip3 install -r requirements.txt
 | 
					RUN cd pyhss && pip3 install -r requirements.txt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN mkdir -p /pyhss/log/
 | 
					RUN mkdir -p /pyhss/log/
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,5 @@
 | 
				
			|||||||
## HSS Parameters
 | 
					## HSS Parameters
 | 
				
			||||||
hss:
 | 
					hss:
 | 
				
			||||||
  # Transport Type. "TCP" and "SCTP" are valid options.
 | 
					 | 
				
			||||||
  # Note: SCTP works but is still experimental. TCP has been load-tested and performs in a production environment.
 | 
					 | 
				
			||||||
  transport: "TCP"
 | 
					  transport: "TCP"
 | 
				
			||||||
  #IP Addresses to bind on (List) - For TCP only the first IP is used, for SCTP all used for Transport (Multihomed).
 | 
					  #IP Addresses to bind on (List) - For TCP only the first IP is used, for SCTP all used for Transport (Multihomed).
 | 
				
			||||||
  bind_ip: ["PYHSS_IP"]
 | 
					  bind_ip: ["PYHSS_IP"]
 | 
				
			||||||
@@ -32,14 +30,17 @@ hss:
 | 
				
			|||||||
  #IMSI of Test Subscriber for Unit Checks (Optional)
 | 
					  #IMSI of Test Subscriber for Unit Checks (Optional)
 | 
				
			||||||
  test_sub_imsi: '001021234567890'
 | 
					  test_sub_imsi: '001021234567890'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #Device Watchdog Request Interval (In Seconds - If set to 0 disabled)
 | 
				
			||||||
 | 
					  device_watchdog_request_interval: 5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #Async Queue Check Interval (In Seconds - If set to 0 disabled)
 | 
				
			||||||
 | 
					  async_check_interval: 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  #The maximum time to wait, in seconds, before disconnecting a client when no data is received.
 | 
					  #The maximum time to wait, in seconds, before disconnecting a client when no data is received.
 | 
				
			||||||
  client_socket_timeout: 120
 | 
					  client_socket_timeout: 120
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  #The maximum time to wait, in seconds, before discarding a diameter request.
 | 
					  #The maximum amount of times a failed diameter response/query should be resent before considering the peer offline and terminating their connection
 | 
				
			||||||
  diameter_request_timeout: 3
 | 
					  diameter_max_retries: 1
 | 
				
			||||||
 | 
					 | 
				
			||||||
  #The amount of time, in seconds, before purging a disconnected client from the Active Diameter Peers key in redis.
 | 
					 | 
				
			||||||
  active_diameter_peers_timeout: 10
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  #Prevent updates from being performed without a valid 'Provisioning-Key' in the header
 | 
					  #Prevent updates from being performed without a valid 'Provisioning-Key' in the header
 | 
				
			||||||
  lock_provisioning: False
 | 
					  lock_provisioning: False
 | 
				
			||||||
@@ -55,50 +56,34 @@ hss:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  #Default Initial Filter Criteria for IMS Subscribers
 | 
					  #Default Initial Filter Criteria for IMS Subscribers
 | 
				
			||||||
  #Jinja Formatted Template, see the example for variables passed to it.
 | 
					  #Jinja Formatted Template, see the example for variables passed to it.
 | 
				
			||||||
  Default_iFC: 'INSTALL_PREFIX/default_ifc.xml'
 | 
					  Default_iFC: 'default_ifc.xml'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  #Default Sh User Data
 | 
					  #Default Sh User Data
 | 
				
			||||||
  Default_Sh_UserData: 'INSTALL_PREFIX/default_sh_user_data.xml'
 | 
					  Default_Sh_UserData: 'default_sh_user_data.xml'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  #S-CSCF Pool
 | 
					  #S-CSCF Pool
 | 
				
			||||||
  scscf_pool:
 | 
					  scscf_pool:
 | 
				
			||||||
    - 'sip:scscf.IMS_DOMAIN:6060'
 | 
					    - 'sip:scscf.IMS_DOMAIN:6060'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  roaming:
 | 
					 | 
				
			||||||
    outbound:
 | 
					 | 
				
			||||||
      # Whether or not to a subscriber to connect to an undefined network when outbound roaming.
 | 
					 | 
				
			||||||
      allow_undefined_networks: True
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  # SCTP Socket Parameters
 | 
					 | 
				
			||||||
  sctp:
 | 
					 | 
				
			||||||
    rtoMax: 5000
 | 
					 | 
				
			||||||
    rtoMin: 500
 | 
					 | 
				
			||||||
    rtoInitial: 1000
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
api:
 | 
					api:
 | 
				
			||||||
  page_size: 200
 | 
					  page_size: 200
 | 
				
			||||||
  # Whether or not to return key-based data when querying the AUC. Disable in production systems.
 | 
					 | 
				
			||||||
  enable_insecure_auc: True
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
benchmarking:
 | 
					external:
 | 
				
			||||||
  # Whether to enable benchmark logging
 | 
					  external_webhook_notification_enabled: False
 | 
				
			||||||
  enabled: True
 | 
					  external_webhook_notification_url: https://api.example.com/webhook
 | 
				
			||||||
  # How often to report, in seconds. Not all benchmarking supports interval reporting.
 | 
					 | 
				
			||||||
  reporting_interval: 3600
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
eir:
 | 
					eir:
 | 
				
			||||||
  imsi_imei_logging: True    #Store current IMEI / IMSI pair in backend
 | 
					  imsi_imei_logging: True    #Store current IMEI / IMSI pair in backend
 | 
				
			||||||
 | 
					  sim_swap_notify_webhook:  http://PYHSS_IP:5000/webhooks/sim_swap_notify/
 | 
				
			||||||
  no_match_response: 2       #Greylist
 | 
					  no_match_response: 2       #Greylist
 | 
				
			||||||
  store_offnet_imsi: False  # Whether or not to store an IMEI / IMSI pair that doesn't exist in the AUC
 | 
					  tac_database_csv: '/etc/pyhss/tac_database_Nov2022.csv'
 | 
				
			||||||
  simSwapNotification: False # If the IMEI for a stored IMSI/IMEI combo changes, notify the webhook endpoint
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
logging:
 | 
					logging:
 | 
				
			||||||
  level: INFO
 | 
					  level: WARNING
 | 
				
			||||||
  logfiles:
 | 
					  logfiles:
 | 
				
			||||||
    hss_logging_file: INSTALL_PREFIX/log/hss.log
 | 
					    hss_logging_file: log/hss.log
 | 
				
			||||||
    diameter_logging_file: INSTALL_PREFIX/log/diameter.log
 | 
					    diameter_logging_file: log/diameter.log
 | 
				
			||||||
    geored_logging_file: INSTALL_PREFIX/log/geored.log
 | 
					    database_logging_file: log/db.log
 | 
				
			||||||
    metric_logging_file: INSTALL_PREFIX/log/metrics.log
 | 
					 | 
				
			||||||
  log_to_terminal: True
 | 
					  log_to_terminal: True
 | 
				
			||||||
  sqlalchemy_sql_echo: True
 | 
					  sqlalchemy_sql_echo: True
 | 
				
			||||||
  sqlalchemy_pool_recycle: 15
 | 
					  sqlalchemy_pool_recycle: 15
 | 
				
			||||||
@@ -112,14 +97,6 @@ database:
 | 
				
			|||||||
  username: pyhss
 | 
					  username: pyhss
 | 
				
			||||||
  password: ims_db_pass
 | 
					  password: ims_db_pass
 | 
				
			||||||
  database: ims_hss_db
 | 
					  database: ims_hss_db
 | 
				
			||||||
  readCacheEnabled: True
 | 
					 | 
				
			||||||
  readCacheInterval: 60
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## External Webhook Notifications
 | 
					 | 
				
			||||||
webhooks:
 | 
					 | 
				
			||||||
  enabled: False
 | 
					 | 
				
			||||||
  endpoints:
 | 
					 | 
				
			||||||
    - 'http://127.0.0.1:8181'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Geographic Redundancy Parameters
 | 
					## Geographic Redundancy Parameters
 | 
				
			||||||
geored:
 | 
					geored:
 | 
				
			||||||
@@ -129,22 +106,17 @@ geored:
 | 
				
			|||||||
    - 'http://hss01.mnc001.mcc001.3gppnetwork.org:8080'
 | 
					    - 'http://hss01.mnc001.mcc001.3gppnetwork.org:8080'
 | 
				
			||||||
    - 'http://hss02.mnc001.mcc001.3gppnetwork.org:8080'
 | 
					    - 'http://hss02.mnc001.mcc001.3gppnetwork.org:8080'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#Redis is required to run PyHSS. An instance running on a local network is recommended for production.
 | 
					## Stats Parameters
 | 
				
			||||||
redis:
 | 
					redis:
 | 
				
			||||||
  # Which connection type to attempt. Valid options are: tcp, unix, sentinel
 | 
					  enabled: False
 | 
				
			||||||
  # tcp - Connection via a standard TCP socket to a given host and port.
 | 
					  clear_stats_on_boot: True
 | 
				
			||||||
  # unix - Connect to redis via a unix socket, provided by unixSocketPath.
 | 
					  host: PYHSS_IP
 | 
				
			||||||
  # sentinel - Connect to one or more redis sentinel hosts.
 | 
					 | 
				
			||||||
  connectionType: "tcp"
 | 
					 | 
				
			||||||
  unixSocketPath: '/var/run/redis/redis-server.sock'
 | 
					 | 
				
			||||||
  host: 127.0.0.1
 | 
					 | 
				
			||||||
  port: 6379
 | 
					  port: 6379
 | 
				
			||||||
 | 
					
 | 
				
			||||||
prometheus:
 | 
					prometheus:
 | 
				
			||||||
  enabled: False
 | 
					  enabled: False
 | 
				
			||||||
  port: 8081    #If the API is run the API runs on the next port number up from this
 | 
					  port: 8081    #If the API is run the API runs on the next port number up from this
 | 
				
			||||||
  async_subscriber_count: False    #If enabled the subscriber count will be updated asynchronously for Prometheus
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
snmp:
 | 
					snmp:
 | 
				
			||||||
  port: 1161
 | 
					  port: 1161
 | 
				
			||||||
  listen_address: 127.0.0.1
 | 
					  listen_address: PYHSS_IP
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,6 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 | 
					<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 | 
				
			||||||
<!--This is the default iFC template used by PyHSS, variables come from the Jinja2 template passed inside diameter.py where you can additional variables if required -->
 | 
					<!--This is the default iFC template used by PyHSS, variables come from the Jinja2 template passed inside diameter.py where you can additional variables if required -->
 | 
				
			||||||
<Sh-Data>
 | 
					<Sh-Data>
 | 
				
			||||||
    <IMSPrivateUserIdentity>{{ Sh_template_vars['imsi'] }}@ims.mnc{{ Sh_template_vars['mnc'] }}.mcc{{ Sh_template_vars['mcc'] }}.3gppnetwork.org</IMSPrivateUserIdentity>
 | 
					 | 
				
			||||||
    <!-- This provides the Public Identifiers to the Application Server -->
 | 
					    <!-- This provides the Public Identifiers to the Application Server -->
 | 
				
			||||||
    <PublicIdentifiers>
 | 
					    <PublicIdentifiers>
 | 
				
			||||||
        <IMSPublicIdentity>sip:{{ Sh_template_vars['msisdn'] }}@ims.mnc{{ Sh_template_vars['mnc'] }}.mcc{{ Sh_template_vars['mcc'] }}.3gppnetwork.org</IMSPublicIdentity>
 | 
					        <IMSPublicIdentity>sip:{{ Sh_template_vars['msisdn'] }}@ims.mnc{{ Sh_template_vars['mnc'] }}.mcc{{ Sh_template_vars['mcc'] }}.3gppnetwork.org</IMSPublicIdentity>
 | 
				
			||||||
@@ -21,9 +20,9 @@
 | 
				
			|||||||
        </EPSLocationInformation>
 | 
					        </EPSLocationInformation>
 | 
				
			||||||
    </Extension>
 | 
					    </Extension>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <Sh-IMS-Data>
 | 
					    <!-- This container for the XCAP Data for the Subscriber -->
 | 
				
			||||||
        <S-CSCFName>{{ Sh_template_vars['scscf'] }}</S-CSCFName>
 | 
					 | 
				
			||||||
        <IMSUserState>{{ Sh_template_vars['imsUserState'] }}</IMSUserState>
 | 
					 | 
				
			||||||
    </Sh-IMS-Data>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
</Sh-Data>
 | 
					    <!-- XCAP data from Database -->
 | 
				
			||||||
 | 
					    {{ Sh_template_vars['sh_profile'] }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</Sh-Data>
 | 
				
			||||||
@@ -51,26 +51,17 @@ cp /mnt/pyhss/config.yaml ./
 | 
				
			|||||||
cp /mnt/pyhss/default_ifc.xml ./
 | 
					cp /mnt/pyhss/default_ifc.xml ./
 | 
				
			||||||
cp /mnt/pyhss/default_sh_user_data.xml ./
 | 
					cp /mnt/pyhss/default_sh_user_data.xml ./
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INSTALL_PREFIX="/pyhss"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
sed -i 's|PYHSS_IP|'$PYHSS_IP'|g' ./config.yaml
 | 
					sed -i 's|PYHSS_IP|'$PYHSS_IP'|g' ./config.yaml
 | 
				
			||||||
sed -i 's|PYHSS_BIND_PORT|'$PYHSS_BIND_PORT'|g' ./config.yaml
 | 
					sed -i 's|PYHSS_BIND_PORT|'$PYHSS_BIND_PORT'|g' ./config.yaml
 | 
				
			||||||
sed -i 's|IMS_DOMAIN|'$IMS_DOMAIN'|g' ./config.yaml
 | 
					sed -i 's|IMS_DOMAIN|'$IMS_DOMAIN'|g' ./config.yaml
 | 
				
			||||||
sed -i 's|OP_MCC|'$MCC'|g' ./config.yaml
 | 
					sed -i 's|OP_MCC|'$MCC'|g' ./config.yaml
 | 
				
			||||||
sed -i 's|OP_MNC|'$MNC'|g' ./config.yaml
 | 
					sed -i 's|OP_MNC|'$MNC'|g' ./config.yaml
 | 
				
			||||||
sed -i 's|MYSQL_IP|'$MYSQL_IP'|g' ./config.yaml
 | 
					sed -i 's|MYSQL_IP|'$MYSQL_IP'|g' ./config.yaml
 | 
				
			||||||
sed -i 's|INSTALL_PREFIX|'$INSTALL_PREFIX'|g' ./config.yaml
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Sync docker time
 | 
					# Sync docker time
 | 
				
			||||||
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 | 
					#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 | 
				
			||||||
 | 
					
 | 
				
			||||||
redis-server --daemonize yes
 | 
					export FLASK_APP=PyHSS_API.py
 | 
				
			||||||
 | 
					flask run --host=$PYHSS_IP --port=8080 &
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd services
 | 
					python3 hss.py
 | 
				
			||||||
python3 apiService.py --host=$PYHSS_IP --port=8080 &
 | 
					 | 
				
			||||||
# Sleep is needed to let db be populated in a non-overlapping fashion
 | 
					 | 
				
			||||||
sleep 5
 | 
					 | 
				
			||||||
python3 diameterService.py &
 | 
					 | 
				
			||||||
# Sleep is needed to let db be populated in a non-overlapping fashion
 | 
					 | 
				
			||||||
sleep 5
 | 
					 | 
				
			||||||
python3 hssService.py
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
version: '3'
 | 
					version: '3'
 | 
				
			||||||
services:
 | 
					services:
 | 
				
			||||||
  mongo:
 | 
					  mongo:
 | 
				
			||||||
    image: mongo:6.0
 | 
					    image: mongo:4.2
 | 
				
			||||||
    container_name: mongo
 | 
					    container_name: mongo
 | 
				
			||||||
    command: --bind_ip 0.0.0.0
 | 
					    command: --bind_ip 0.0.0.0
 | 
				
			||||||
    env_file:
 | 
					    env_file:
 | 
				
			||||||
@@ -40,6 +40,7 @@ services:
 | 
				
			|||||||
  nrf:
 | 
					  nrf:
 | 
				
			||||||
    image: docker_open5gs
 | 
					    image: docker_open5gs
 | 
				
			||||||
    container_name: nrf
 | 
					    container_name: nrf
 | 
				
			||||||
 | 
					    dns: ${DNS_IP}
 | 
				
			||||||
    env_file:
 | 
					    env_file:
 | 
				
			||||||
      - .env
 | 
					      - .env
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
@@ -54,6 +55,8 @@ services:
 | 
				
			|||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${NRF_IP}
 | 
					        ipv4_address: ${NRF_IP}
 | 
				
			||||||
 | 
					        aliases:
 | 
				
			||||||
 | 
					          - nrf.5gc.mnc0${MNC}.mcc${MCC}.3gppnetwork.org
 | 
				
			||||||
  scp:
 | 
					  scp:
 | 
				
			||||||
    image: docker_open5gs
 | 
					    image: docker_open5gs
 | 
				
			||||||
    container_name: scp
 | 
					    container_name: scp
 | 
				
			||||||
@@ -68,6 +71,7 @@ services:
 | 
				
			|||||||
      - /etc/localtime:/etc/localtime:ro
 | 
					      - /etc/localtime:/etc/localtime:ro
 | 
				
			||||||
    expose:
 | 
					    expose:
 | 
				
			||||||
      - "7777/tcp"
 | 
					      - "7777/tcp"
 | 
				
			||||||
 | 
					      - "80/tcp"
 | 
				
			||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${SCP_IP}
 | 
					        ipv4_address: ${SCP_IP}
 | 
				
			||||||
@@ -77,6 +81,7 @@ services:
 | 
				
			|||||||
      - nrf
 | 
					      - nrf
 | 
				
			||||||
      - scp
 | 
					      - scp
 | 
				
			||||||
    container_name: ausf
 | 
					    container_name: ausf
 | 
				
			||||||
 | 
					    dns: ${DNS_IP}
 | 
				
			||||||
    env_file:
 | 
					    env_file:
 | 
				
			||||||
      - .env
 | 
					      - .env
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
@@ -91,6 +96,8 @@ services:
 | 
				
			|||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${AUSF_IP}
 | 
					        ipv4_address: ${AUSF_IP}
 | 
				
			||||||
 | 
					        aliases:
 | 
				
			||||||
 | 
					          - ausf.5gc.mnc0${MNC}.mcc${MCC}.3gppnetwork.org
 | 
				
			||||||
  udr:
 | 
					  udr:
 | 
				
			||||||
    image: docker_open5gs
 | 
					    image: docker_open5gs
 | 
				
			||||||
    depends_on:
 | 
					    depends_on:
 | 
				
			||||||
@@ -118,6 +125,7 @@ services:
 | 
				
			|||||||
      - nrf
 | 
					      - nrf
 | 
				
			||||||
      - scp
 | 
					      - scp
 | 
				
			||||||
    container_name: udm
 | 
					    container_name: udm
 | 
				
			||||||
 | 
					    dns: ${DNS_IP}
 | 
				
			||||||
    env_file:
 | 
					    env_file:
 | 
				
			||||||
      - .env
 | 
					      - .env
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
@@ -132,6 +140,8 @@ services:
 | 
				
			|||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${UDM_IP}
 | 
					        ipv4_address: ${UDM_IP}
 | 
				
			||||||
 | 
					        aliases:
 | 
				
			||||||
 | 
					          - udm.5gc.mnc0${MNC}.mcc${MCC}.3gppnetwork.org
 | 
				
			||||||
  smf:
 | 
					  smf:
 | 
				
			||||||
    image: docker_open5gs
 | 
					    image: docker_open5gs
 | 
				
			||||||
    depends_on:
 | 
					    depends_on:
 | 
				
			||||||
@@ -183,8 +193,8 @@ services:
 | 
				
			|||||||
      - "2152/udp"
 | 
					      - "2152/udp"
 | 
				
			||||||
      - "8805/udp"
 | 
					      - "8805/udp"
 | 
				
			||||||
      - "9091/tcp"
 | 
					      - "9091/tcp"
 | 
				
			||||||
    # ports:
 | 
					    ports:
 | 
				
			||||||
    #   - "2152:2152/udp"
 | 
					      - "2152:2152/udp"
 | 
				
			||||||
    cap_add:
 | 
					    cap_add:
 | 
				
			||||||
      - NET_ADMIN
 | 
					      - NET_ADMIN
 | 
				
			||||||
    privileged: true
 | 
					    privileged: true
 | 
				
			||||||
@@ -218,8 +228,8 @@ services:
 | 
				
			|||||||
      - "38412/sctp"
 | 
					      - "38412/sctp"
 | 
				
			||||||
      - "7777/tcp"
 | 
					      - "7777/tcp"
 | 
				
			||||||
      - "9091/tcp"
 | 
					      - "9091/tcp"
 | 
				
			||||||
    # ports:
 | 
					    ports:
 | 
				
			||||||
    #   - "38412:38412/sctp"
 | 
					      - "38412:38412/sctp"
 | 
				
			||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${AMF_IP}
 | 
					        ipv4_address: ${AMF_IP}
 | 
				
			||||||
@@ -287,44 +297,54 @@ services:
 | 
				
			|||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${NSSF_IP}
 | 
					        ipv4_address: ${NSSF_IP}
 | 
				
			||||||
  metrics:
 | 
					  sepp:
 | 
				
			||||||
    build: ./metrics
 | 
					    image: docker_open5gs
 | 
				
			||||||
    image: docker_metrics
 | 
					    depends_on:
 | 
				
			||||||
    container_name: metrics
 | 
					      - nrf
 | 
				
			||||||
 | 
					      - scp
 | 
				
			||||||
 | 
					      - dns
 | 
				
			||||||
 | 
					    container_name: sepp
 | 
				
			||||||
 | 
					    dns: ${DNS_IP}
 | 
				
			||||||
    env_file:
 | 
					    env_file:
 | 
				
			||||||
      - .env
 | 
					      - .env
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - COMPONENT_NAME=sepp-1
 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - ./metrics:/mnt/metrics
 | 
					      - ./sepp:/mnt/sepp
 | 
				
			||||||
 | 
					      - ./log:/open5gs/install/var/log/open5gs
 | 
				
			||||||
      - /etc/timezone:/etc/timezone:ro
 | 
					      - /etc/timezone:/etc/timezone:ro
 | 
				
			||||||
      - /etc/localtime:/etc/localtime:ro
 | 
					      - /etc/localtime:/etc/localtime:ro
 | 
				
			||||||
    expose:
 | 
					    expose:
 | 
				
			||||||
      - "9090/tcp"
 | 
					      - "7777/tcp"
 | 
				
			||||||
 | 
					      - "7779/tcp"
 | 
				
			||||||
 | 
					      - "7780/tcp"
 | 
				
			||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
      - "9090:9090/tcp"
 | 
					      # - "7779:7779/tcp"
 | 
				
			||||||
 | 
					      - "7777:7777/tcp"
 | 
				
			||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${METRICS_IP}
 | 
					        ipv4_address: ${SEPP_IP}
 | 
				
			||||||
  grafana:
 | 
					        aliases:
 | 
				
			||||||
    build: ./grafana
 | 
					          - sepp.5gc.mnc0${MNC}.mcc${MCC}.3gppnetwork.org
 | 
				
			||||||
    image: docker_grafana
 | 
					  dns:
 | 
				
			||||||
    container_name: grafana
 | 
					    build: ./dns
 | 
				
			||||||
 | 
					    image: docker_dns
 | 
				
			||||||
 | 
					    container_name: dns
 | 
				
			||||||
    env_file:
 | 
					    env_file:
 | 
				
			||||||
      - .env
 | 
					      - .env
 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - ./grafana:/mnt/grafana
 | 
					      - ./dns:/mnt/dns
 | 
				
			||||||
      - /etc/timezone:/etc/timezone:ro
 | 
					      - /etc/timezone:/etc/timezone:ro
 | 
				
			||||||
      - /etc/localtime:/etc/localtime:ro
 | 
					      - /etc/localtime:/etc/localtime:ro
 | 
				
			||||||
    expose:
 | 
					    expose:
 | 
				
			||||||
      - "3000/tcp"
 | 
					      - "53/udp"
 | 
				
			||||||
    ports:
 | 
					 | 
				
			||||||
      - "3000:3000/tcp"
 | 
					 | 
				
			||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${GRAFANA_IP}
 | 
					        ipv4_address: ${DNS_IP}
 | 
				
			||||||
networks:
 | 
					networks:
 | 
				
			||||||
  default:
 | 
					  default:
 | 
				
			||||||
    ipam:
 | 
					    ipam:
 | 
				
			||||||
      config:
 | 
					      config:
 | 
				
			||||||
        - subnet: ${TEST_NETWORK}
 | 
					        - subnet: ${TEST_NETWORK}
 | 
				
			||||||
volumes:
 | 
					volumes:
 | 
				
			||||||
  mongodbdata: {}
 | 
					  mongodbdata: {}
 | 
				
			||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
version: '3'
 | 
					version: '3'
 | 
				
			||||||
services:
 | 
					services:
 | 
				
			||||||
  mongo:
 | 
					  mongo:
 | 
				
			||||||
    image: mongo:4.2
 | 
					    image: mongo:6.0
 | 
				
			||||||
    container_name: mongo
 | 
					    container_name: mongo
 | 
				
			||||||
    command: --bind_ip 0.0.0.0
 | 
					    command: --bind_ip 0.0.0.0
 | 
				
			||||||
    env_file:
 | 
					    env_file:
 | 
				
			||||||
@@ -31,16 +31,15 @@ services:
 | 
				
			|||||||
      - /etc/timezone:/etc/timezone:ro
 | 
					      - /etc/timezone:/etc/timezone:ro
 | 
				
			||||||
      - /etc/localtime:/etc/localtime:ro
 | 
					      - /etc/localtime:/etc/localtime:ro
 | 
				
			||||||
    expose:
 | 
					    expose:
 | 
				
			||||||
      - "9999/tcp"
 | 
					      - "3000/tcp"
 | 
				
			||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
      - "9999:9999/tcp"
 | 
					      - "3000:3000/tcp"
 | 
				
			||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${WEBUI_IP}
 | 
					        ipv4_address: ${WEBUI_IP}
 | 
				
			||||||
  nrf:
 | 
					  nrf:
 | 
				
			||||||
    image: docker_open5gs
 | 
					    image: docker_open5gs
 | 
				
			||||||
    container_name: nrf
 | 
					    container_name: nrf
 | 
				
			||||||
    dns: ${DNS_IP}
 | 
					 | 
				
			||||||
    env_file:
 | 
					    env_file:
 | 
				
			||||||
      - .env
 | 
					      - .env
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
@@ -55,8 +54,6 @@ services:
 | 
				
			|||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${NRF_IP}
 | 
					        ipv4_address: ${NRF_IP}
 | 
				
			||||||
        aliases:
 | 
					 | 
				
			||||||
          - nrf.5gc.mnc0${MNC}.mcc${MCC}.3gppnetwork.org
 | 
					 | 
				
			||||||
  scp:
 | 
					  scp:
 | 
				
			||||||
    image: docker_open5gs
 | 
					    image: docker_open5gs
 | 
				
			||||||
    container_name: scp
 | 
					    container_name: scp
 | 
				
			||||||
@@ -71,7 +68,6 @@ services:
 | 
				
			|||||||
      - /etc/localtime:/etc/localtime:ro
 | 
					      - /etc/localtime:/etc/localtime:ro
 | 
				
			||||||
    expose:
 | 
					    expose:
 | 
				
			||||||
      - "7777/tcp"
 | 
					      - "7777/tcp"
 | 
				
			||||||
      - "80/tcp"
 | 
					 | 
				
			||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${SCP_IP}
 | 
					        ipv4_address: ${SCP_IP}
 | 
				
			||||||
@@ -81,7 +77,6 @@ services:
 | 
				
			|||||||
      - nrf
 | 
					      - nrf
 | 
				
			||||||
      - scp
 | 
					      - scp
 | 
				
			||||||
    container_name: ausf
 | 
					    container_name: ausf
 | 
				
			||||||
    dns: ${DNS_IP}
 | 
					 | 
				
			||||||
    env_file:
 | 
					    env_file:
 | 
				
			||||||
      - .env
 | 
					      - .env
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
@@ -96,8 +91,6 @@ services:
 | 
				
			|||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${AUSF_IP}
 | 
					        ipv4_address: ${AUSF_IP}
 | 
				
			||||||
        aliases:
 | 
					 | 
				
			||||||
          - ausf.5gc.mnc0${MNC}.mcc${MCC}.3gppnetwork.org
 | 
					 | 
				
			||||||
  udr:
 | 
					  udr:
 | 
				
			||||||
    image: docker_open5gs
 | 
					    image: docker_open5gs
 | 
				
			||||||
    depends_on:
 | 
					    depends_on:
 | 
				
			||||||
@@ -125,7 +118,6 @@ services:
 | 
				
			|||||||
      - nrf
 | 
					      - nrf
 | 
				
			||||||
      - scp
 | 
					      - scp
 | 
				
			||||||
    container_name: udm
 | 
					    container_name: udm
 | 
				
			||||||
    dns: ${DNS_IP}
 | 
					 | 
				
			||||||
    env_file:
 | 
					    env_file:
 | 
				
			||||||
      - .env
 | 
					      - .env
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
@@ -140,8 +132,6 @@ services:
 | 
				
			|||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${UDM_IP}
 | 
					        ipv4_address: ${UDM_IP}
 | 
				
			||||||
        aliases:
 | 
					 | 
				
			||||||
          - udm.5gc.mnc0${MNC}.mcc${MCC}.3gppnetwork.org
 | 
					 | 
				
			||||||
  smf:
 | 
					  smf:
 | 
				
			||||||
    image: docker_open5gs
 | 
					    image: docker_open5gs
 | 
				
			||||||
    depends_on:
 | 
					    depends_on:
 | 
				
			||||||
@@ -193,8 +183,8 @@ services:
 | 
				
			|||||||
      - "2152/udp"
 | 
					      - "2152/udp"
 | 
				
			||||||
      - "8805/udp"
 | 
					      - "8805/udp"
 | 
				
			||||||
      - "9091/tcp"
 | 
					      - "9091/tcp"
 | 
				
			||||||
    ports:
 | 
					    # ports:
 | 
				
			||||||
      - "2152:2152/udp"
 | 
					    #   - "2152:2152/udp"
 | 
				
			||||||
    cap_add:
 | 
					    cap_add:
 | 
				
			||||||
      - NET_ADMIN
 | 
					      - NET_ADMIN
 | 
				
			||||||
    privileged: true
 | 
					    privileged: true
 | 
				
			||||||
@@ -228,8 +218,8 @@ services:
 | 
				
			|||||||
      - "38412/sctp"
 | 
					      - "38412/sctp"
 | 
				
			||||||
      - "7777/tcp"
 | 
					      - "7777/tcp"
 | 
				
			||||||
      - "9091/tcp"
 | 
					      - "9091/tcp"
 | 
				
			||||||
    ports:
 | 
					    # ports:
 | 
				
			||||||
      - "38412:38412/sctp"
 | 
					    #   - "38412:38412/sctp"
 | 
				
			||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${AMF_IP}
 | 
					        ipv4_address: ${AMF_IP}
 | 
				
			||||||
@@ -297,52 +287,23 @@ services:
 | 
				
			|||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${NSSF_IP}
 | 
					        ipv4_address: ${NSSF_IP}
 | 
				
			||||||
  sepp:
 | 
					  metrics:
 | 
				
			||||||
    image: docker_open5gs
 | 
					    build: ./metrics
 | 
				
			||||||
    depends_on:
 | 
					    image: docker_metrics
 | 
				
			||||||
      - nrf
 | 
					    container_name: metrics
 | 
				
			||||||
      - scp
 | 
					 | 
				
			||||||
      - dns
 | 
					 | 
				
			||||||
    container_name: sepp
 | 
					 | 
				
			||||||
    dns: ${DNS_IP}
 | 
					 | 
				
			||||||
    env_file:
 | 
					    env_file:
 | 
				
			||||||
      - .env
 | 
					      - .env
 | 
				
			||||||
    environment:
 | 
					 | 
				
			||||||
      - COMPONENT_NAME=sepp-1
 | 
					 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - ./sepp:/mnt/sepp
 | 
					      - ./metrics:/mnt/metrics
 | 
				
			||||||
      - ./log:/open5gs/install/var/log/open5gs
 | 
					 | 
				
			||||||
      - /etc/timezone:/etc/timezone:ro
 | 
					      - /etc/timezone:/etc/timezone:ro
 | 
				
			||||||
      - /etc/localtime:/etc/localtime:ro
 | 
					      - /etc/localtime:/etc/localtime:ro
 | 
				
			||||||
    expose:
 | 
					    expose:
 | 
				
			||||||
      - "7777/tcp"
 | 
					      - "9090/tcp"
 | 
				
			||||||
      - "7779/tcp"
 | 
					 | 
				
			||||||
      - "7780/tcp"
 | 
					 | 
				
			||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
      # - "7779:7779/tcp"
 | 
					      - "9090:9090/tcp"
 | 
				
			||||||
      - "7777:7777/tcp"
 | 
					 | 
				
			||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${SEPP_IP}
 | 
					        ipv4_address: ${METRICS_IP}
 | 
				
			||||||
        aliases:
 | 
					 | 
				
			||||||
          - sepp.5gc.mnc0${MNC}.mcc${MCC}.3gppnetwork.org
 | 
					 | 
				
			||||||
  # metrics:
 | 
					 | 
				
			||||||
  #   build: ./metrics
 | 
					 | 
				
			||||||
  #   image: docker_metrics
 | 
					 | 
				
			||||||
  #   container_name: metrics
 | 
					 | 
				
			||||||
  #   env_file:
 | 
					 | 
				
			||||||
  #     - .env
 | 
					 | 
				
			||||||
  #   volumes:
 | 
					 | 
				
			||||||
  #     - ./metrics:/mnt/metrics
 | 
					 | 
				
			||||||
  #     - /etc/timezone:/etc/timezone:ro
 | 
					 | 
				
			||||||
  #     - /etc/localtime:/etc/localtime:ro
 | 
					 | 
				
			||||||
  #   expose:
 | 
					 | 
				
			||||||
  #     - "9090/tcp"
 | 
					 | 
				
			||||||
  #   ports:
 | 
					 | 
				
			||||||
  #     - "9090:9090/tcp"
 | 
					 | 
				
			||||||
  #   networks:
 | 
					 | 
				
			||||||
  #     default:
 | 
					 | 
				
			||||||
  #       ipv4_address: ${METRICS_IP}
 | 
					 | 
				
			||||||
  dns:
 | 
					  dns:
 | 
				
			||||||
    build: ./dns
 | 
					    build: ./dns
 | 
				
			||||||
    image: docker_dns
 | 
					    image: docker_dns
 | 
				
			||||||
@@ -528,23 +489,6 @@ services:
 | 
				
			|||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        ipv4_address: ${SMSC_IP}
 | 
					        ipv4_address: ${SMSC_IP}
 | 
				
			||||||
  # grafana:
 | 
					 | 
				
			||||||
  #   build: ./grafana
 | 
					 | 
				
			||||||
  #   image: docker_grafana
 | 
					 | 
				
			||||||
  #   container_name: grafana
 | 
					 | 
				
			||||||
  #   env_file:
 | 
					 | 
				
			||||||
  #     - .env
 | 
					 | 
				
			||||||
  #   volumes:
 | 
					 | 
				
			||||||
  #     - ./grafana:/mnt/grafana
 | 
					 | 
				
			||||||
  #     - /etc/timezone:/etc/timezone:ro
 | 
					 | 
				
			||||||
  #     - /etc/localtime:/etc/localtime:ro
 | 
					 | 
				
			||||||
  #   expose:
 | 
					 | 
				
			||||||
  #     - "3000/tcp"
 | 
					 | 
				
			||||||
  #   ports:
 | 
					 | 
				
			||||||
  #     - "3000:3000/tcp"
 | 
					 | 
				
			||||||
  #   networks:
 | 
					 | 
				
			||||||
  #     default:
 | 
					 | 
				
			||||||
  #       ipv4_address: ${GRAFANA_IP}
 | 
					 | 
				
			||||||
networks:
 | 
					networks:
 | 
				
			||||||
  default:
 | 
					  default:
 | 
				
			||||||
    ipam:
 | 
					    ipam:
 | 
				
			||||||
@@ -552,4 +496,4 @@ networks:
 | 
				
			|||||||
        - subnet: ${TEST_NETWORK}
 | 
					        - subnet: ${TEST_NETWORK}
 | 
				
			||||||
volumes:
 | 
					volumes:
 | 
				
			||||||
  mongodbdata: {}
 | 
					  mongodbdata: {}
 | 
				
			||||||
  dbdata: {}
 | 
					  dbdata: {}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -455,12 +455,10 @@ route {
 | 
				
			|||||||
		if (!is_method("REGISTER|SUBSCRIBE")) {
 | 
							if (!is_method("REGISTER|SUBSCRIBE")) {
 | 
				
			||||||
			# sip:xxx;phone-context=xxxx@xxx format is not desired
 | 
								# sip:xxx;phone-context=xxxx@xxx format is not desired
 | 
				
			||||||
			if (($ru =~ ".*phone-context.*") && ($ru =~ "sip:.*")) {
 | 
								if (($ru =~ ".*phone-context.*") && ($ru =~ "sip:.*")) {
 | 
				
			||||||
				$var(old_ruri) = $ru;
 | 
					 | 
				
			||||||
				$ru = $(ru{re.subst,/sip:/tel:/g});
 | 
									$ru = $(ru{re.subst,/sip:/tel:/g});
 | 
				
			||||||
				$ru = $(ru{re.subst,/;phone-context=[A-Za-z.0-9+-@]*;user=phone//g});
 | 
									$ru = $(ru{re.subst,/;phone-context=[A-Za-z.0-9+-@]*;user=phone//g});
 | 
				
			||||||
				$ru = $ru + ";phone-context=" + NETWORKNAME;
 | 
									$ru = $ru + ";phone-context=" + NETWORKNAME;
 | 
				
			||||||
				msg_apply_changes();
 | 
									msg_apply_changes();
 | 
				
			||||||
				xnotice("SCSCF: Changed R-URI from $var(old_ruri) to $ru\n");
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -726,7 +724,7 @@ route[XMLRPC] {
 | 
				
			|||||||
# Route for handling Registrations:
 | 
					# Route for handling Registrations:
 | 
				
			||||||
######################################################################
 | 
					######################################################################
 | 
				
			||||||
route[REGISTER] {
 | 
					route[REGISTER] {
 | 
				
			||||||
        xnotice("ALGORITHM IS [$aa] and User-Agent is [$ua]\n");
 | 
					        xlog("ALGORITHM IS [$aa] and User-Agent is [$ua]\n");
 | 
				
			||||||
        $var(alg) = $aa;
 | 
					        $var(alg) = $aa;
 | 
				
			||||||
        if ($aa == $null) {
 | 
					        if ($aa == $null) {
 | 
				
			||||||
                $var(alg) = "MD5";      #force to MD5 for zoiper.... non-ims
 | 
					                $var(alg) = "MD5";      #force to MD5 for zoiper.... non-ims
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,7 @@
 | 
				
			|||||||
logger:
 | 
					logger:
 | 
				
			||||||
    file:
 | 
					    file: /open5gs/install/var/log/open5gs/sgwc.log
 | 
				
			||||||
      path: /open5gs/install/var/log/open5gs/sgwc.log
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
global:
 | 
					parameter:
 | 
				
			||||||
  max:
 | 
					 | 
				
			||||||
    ue: MAX_NUM_UE
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
sgwc:
 | 
					sgwc:
 | 
				
			||||||
    gtpc:
 | 
					    gtpc:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,6 @@ export IF_NAME=$(ip r | awk '/default/ { print $5 }')
 | 
				
			|||||||
cp /mnt/sgwc/sgwc.yaml install/etc/open5gs
 | 
					cp /mnt/sgwc/sgwc.yaml install/etc/open5gs
 | 
				
			||||||
sed -i 's|SGWC_IP|'$SGWC_IP'|g' install/etc/open5gs/sgwc.yaml
 | 
					sed -i 's|SGWC_IP|'$SGWC_IP'|g' install/etc/open5gs/sgwc.yaml
 | 
				
			||||||
sed -i 's|SGWU_IP|'$SGWU_IP'|g' install/etc/open5gs/sgwc.yaml
 | 
					sed -i 's|SGWU_IP|'$SGWU_IP'|g' install/etc/open5gs/sgwc.yaml
 | 
				
			||||||
sed -i 's|MAX_NUM_UE|'$MAX_NUM_UE'|g' install/etc/open5gs/sgwc.yaml
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Sync docker time
 | 
					# Sync docker time
 | 
				
			||||||
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 | 
					#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,7 @@
 | 
				
			|||||||
logger:
 | 
					logger:
 | 
				
			||||||
    file:
 | 
					    file: /open5gs/install/var/log/open5gs/sgwu.log
 | 
				
			||||||
      path: /open5gs/install/var/log/open5gs/sgwu.log
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
global:
 | 
					parameter:
 | 
				
			||||||
  max:
 | 
					 | 
				
			||||||
    ue: MAX_NUM_UE
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
sgwu:
 | 
					sgwu:
 | 
				
			||||||
    gtpu:
 | 
					    gtpu:
 | 
				
			||||||
@@ -17,4 +14,3 @@ sgwu:
 | 
				
			|||||||
      client:
 | 
					      client:
 | 
				
			||||||
        sgwc:
 | 
					        sgwc:
 | 
				
			||||||
          - address: SGWC_IP
 | 
					          - address: SGWC_IP
 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,6 @@ cp /mnt/sgwu/sgwu.yaml install/etc/open5gs
 | 
				
			|||||||
sed -i 's|SGWU_IP|'$SGWU_IP'|g' install/etc/open5gs/sgwu.yaml
 | 
					sed -i 's|SGWU_IP|'$SGWU_IP'|g' install/etc/open5gs/sgwu.yaml
 | 
				
			||||||
sed -i 's|SGWC_IP|'$SGWC_IP'|g' install/etc/open5gs/sgwu.yaml
 | 
					sed -i 's|SGWC_IP|'$SGWC_IP'|g' install/etc/open5gs/sgwu.yaml
 | 
				
			||||||
sed -i 's|SGWU_ADVERTISE_IP|'$SGWU_ADVERTISE_IP'|g' install/etc/open5gs/sgwu.yaml
 | 
					sed -i 's|SGWU_ADVERTISE_IP|'$SGWU_ADVERTISE_IP'|g' install/etc/open5gs/sgwu.yaml
 | 
				
			||||||
sed -i 's|MAX_NUM_UE|'$MAX_NUM_UE'|g' install/etc/open5gs/sgwu.yaml
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Sync docker time
 | 
					# Sync docker time
 | 
				
			||||||
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 | 
					#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,7 +34,7 @@ RUN apt-get update && \
 | 
				
			|||||||
    libzmq3-dev libboost-system-dev libboost-test-dev libboost-thread-dev libqwt-qt5-dev qtbase5-dev \
 | 
					    libzmq3-dev libboost-system-dev libboost-test-dev libboost-thread-dev libqwt-qt5-dev qtbase5-dev \
 | 
				
			||||||
    software-properties-common g++ make pkg-config libpython2-dev python-numpy swig libi2c-dev \
 | 
					    software-properties-common g++ make pkg-config libpython2-dev python-numpy swig libi2c-dev \
 | 
				
			||||||
    libboost-program-options-dev libconfig++-dev net-tools iputils-ping libusb-1.0-0-dev libpython3-dev python3-numpy swig \
 | 
					    libboost-program-options-dev libconfig++-dev net-tools iputils-ping libusb-1.0-0-dev libpython3-dev python3-numpy swig \
 | 
				
			||||||
    python3-distutils iproute2 wget
 | 
					    python3-distutils iproute2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Get SoapySDR, compile and install
 | 
					# Get SoapySDR, compile and install
 | 
				
			||||||
RUN git clone https://github.com/pothosware/SoapySDR.git && \
 | 
					RUN git clone https://github.com/pothosware/SoapySDR.git && \
 | 
				
			||||||
@@ -52,22 +52,6 @@ RUN git clone https://github.com/myriadrf/LimeSuite.git && \
 | 
				
			|||||||
    cmake ../ && make && make install && \
 | 
					    cmake ../ && make && make install && \
 | 
				
			||||||
    ldconfig
 | 
					    ldconfig
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Get BladeRF, compile and install
 | 
					 | 
				
			||||||
RUN git clone https://github.com/Nuand/bladeRF.git && \
 | 
					 | 
				
			||||||
    cd bladeRF/host/ && git checkout tags/2024.05 && \
 | 
					 | 
				
			||||||
    mkdir build && cd build && \
 | 
					 | 
				
			||||||
    cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DINSTALL_UDEV_RULES=ON -DBLADERF_GROUP=plugdev ../ && make && make install && \
 | 
					 | 
				
			||||||
    ldconfig && \
 | 
					 | 
				
			||||||
    mkdir -p /etc/Nuand/bladeRF/ && \
 | 
					 | 
				
			||||||
    wget https://www.nuand.com/fpga/hostedxA4-latest.rbf --output-document /etc/Nuand/bladeRF/hostedxA4-latest.rbf
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Get SoapySDR for BladeRF, compile and install
 | 
					 | 
				
			||||||
RUN git clone https://github.com/pothosware/SoapyBladeRF.git && \
 | 
					 | 
				
			||||||
    cd SoapyBladeRF && \
 | 
					 | 
				
			||||||
    mkdir build && cd build && \
 | 
					 | 
				
			||||||
    cmake ../ && make && make install && \
 | 
					 | 
				
			||||||
    ldconfig
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# UHD drivers for USRP
 | 
					# UHD drivers for USRP
 | 
				
			||||||
RUN add-apt-repository ppa:ettusresearch/uhd && \
 | 
					RUN add-apt-repository ppa:ettusresearch/uhd && \
 | 
				
			||||||
    apt update && apt -y install libuhd-dev uhd-host && \
 | 
					    apt update && apt -y install libuhd-dev uhd-host && \
 | 
				
			||||||
@@ -84,7 +68,7 @@ RUN git clone https://github.com/srsran/srsGUI && \
 | 
				
			|||||||
# Get srsLTE, compile and install
 | 
					# Get srsLTE, compile and install
 | 
				
			||||||
RUN git clone https://github.com/srsran/srsRAN_4G.git && \
 | 
					RUN git clone https://github.com/srsran/srsRAN_4G.git && \
 | 
				
			||||||
    cd srsRAN_4G && \
 | 
					    cd srsRAN_4G && \
 | 
				
			||||||
    git checkout ec29b0c1ff79cebcbe66caa6d6b90778261c42b8 && \
 | 
					    git checkout 4eb990c9c6ad9b0af943bba71d0f8355b3ebb259 && \
 | 
				
			||||||
    mkdir build && cd build && \
 | 
					    mkdir build && cd build && \
 | 
				
			||||||
    cmake ../ && make -j`nproc` && make install && \
 | 
					    cmake ../ && make -j`nproc` && make install && \
 | 
				
			||||||
    ldconfig
 | 
					    ldconfig
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,7 +40,7 @@ RUN add-apt-repository ppa:ettusresearch/uhd && \
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Get srsRAN_Project, compile and install
 | 
					# Get srsRAN_Project, compile and install
 | 
				
			||||||
RUN git clone https://github.com/srsran/srsRAN_Project.git && \
 | 
					RUN git clone https://github.com/srsran/srsRAN_Project.git && \
 | 
				
			||||||
    cd srsRAN_Project && git checkout 4ac5300d4927b5199af69e6bc2e55d061fc33652 && \
 | 
					    cd srsRAN_Project && git checkout 55c984b55736d0dd2d2ee328f1ae8d9de97e3e19 && \
 | 
				
			||||||
    mkdir build && cd build && \
 | 
					    mkdir build && cd build && \
 | 
				
			||||||
    cmake ../ -DENABLE_EXPORT=ON -DENABLE_ZEROMQ=ON && make -j`nproc` && make install && \
 | 
					    cmake ../ -DENABLE_EXPORT=ON -DENABLE_ZEROMQ=ON && make -j`nproc` && make install && \
 | 
				
			||||||
    ldconfig
 | 
					    ldconfig
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,5 +36,5 @@ pcap:
 | 
				
			|||||||
  e1ap_filename: /mnt/srsran/gnb_e1ap.pcap                        # Path where the E1AP PCAP is stored.
 | 
					  e1ap_filename: /mnt/srsran/gnb_e1ap.pcap                        # Path where the E1AP PCAP is stored.
 | 
				
			||||||
  e2ap_enable: false                                              # Set to true to enable E2AP PCAPs.
 | 
					  e2ap_enable: false                                              # Set to true to enable E2AP PCAPs.
 | 
				
			||||||
  e2ap_filename: /mnt/srsran/gnb_e2ap.pcap                        # Path where the E2AP PCAP is stored.
 | 
					  e2ap_filename: /mnt/srsran/gnb_e2ap.pcap                        # Path where the E2AP PCAP is stored.
 | 
				
			||||||
  n3_enable: false                                                # Set to true to enable N3 PCAPs.
 | 
					  gtpu_enable: false                                              # Set to true to enable GTP-U PCAPs.
 | 
				
			||||||
  n3_filename: /mnt/srsran/gnb_n3.pcap                            # Path where the N3 PCAP is stored.
 | 
					  gtpu_filename: /mnt/srsran/gnb_gtpu.pcap                        # Path where the GTP-U PCAP is stored.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,5 +42,5 @@ pcap:
 | 
				
			|||||||
  e1ap_filename: /mnt/srsran/gnb_e1ap.pcap                                                    # Path where the E1AP PCAP is stored.
 | 
					  e1ap_filename: /mnt/srsran/gnb_e1ap.pcap                                                    # Path where the E1AP PCAP is stored.
 | 
				
			||||||
  e2ap_enable: false                                                                          # Set to true to enable E2AP PCAPs.
 | 
					  e2ap_enable: false                                                                          # Set to true to enable E2AP PCAPs.
 | 
				
			||||||
  e2ap_filename: /mnt/srsran/gnb_e2ap.pcap                                                    # Path where the E2AP PCAP is stored.
 | 
					  e2ap_filename: /mnt/srsran/gnb_e2ap.pcap                                                    # Path where the E2AP PCAP is stored.
 | 
				
			||||||
  n3_enable: false                                                                            # Set to true to enable N3 PCAPs.
 | 
					  gtpu_enable: false                                                                          # Set to true to enable GTP-U PCAPs.
 | 
				
			||||||
  n3_filename: /mnt/srsran/gnb_n3.pcap                                                        # Path where the N3 PCAP is stored.
 | 
					  gtpu_filename: /mnt/srsran/gnb_gtpu.pcap                                                    # Path where the GTP-U PCAP is stored.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@
 | 
				
			|||||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 | 
					# 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.
 | 
					# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM ubuntu:jammy as builder
 | 
					FROM ubuntu:focal as builder
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ENV DEBIAN_FRONTEND=noninteractive
 | 
					ENV DEBIAN_FRONTEND=noninteractive
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -43,8 +43,19 @@ RUN apt-get update && \
 | 
				
			|||||||
        ifupdown \
 | 
					        ifupdown \
 | 
				
			||||||
        iputils-ping \
 | 
					        iputils-ping \
 | 
				
			||||||
        wget \
 | 
					        wget \
 | 
				
			||||||
        libssl-dev \
 | 
					        libssl-dev
 | 
				
			||||||
        cmake
 | 
					
 | 
				
			||||||
 | 
					RUN version=3.20 && \
 | 
				
			||||||
 | 
					    build=0 && \
 | 
				
			||||||
 | 
					    mkdir ~/temp && \
 | 
				
			||||||
 | 
					    cd ~/temp && \
 | 
				
			||||||
 | 
					    wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz && \
 | 
				
			||||||
 | 
					    tar -xzvf cmake-$version.$build.tar.gz && \
 | 
				
			||||||
 | 
					    cd cmake-$version.$build/ && \
 | 
				
			||||||
 | 
					    ./bootstrap && \
 | 
				
			||||||
 | 
					    make -j`nproc` && \
 | 
				
			||||||
 | 
					    make install && ldconfig && \
 | 
				
			||||||
 | 
					    cmake --version
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Clone and build UERANSIM
 | 
					# Clone and build UERANSIM
 | 
				
			||||||
RUN git clone https://github.com/aligungr/UERANSIM && \
 | 
					RUN git clone https://github.com/aligungr/UERANSIM && \
 | 
				
			||||||
@@ -52,7 +63,7 @@ RUN git clone https://github.com/aligungr/UERANSIM && \
 | 
				
			|||||||
    make -j`nproc`
 | 
					    make -j`nproc`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Build final image
 | 
					# Build final image
 | 
				
			||||||
FROM ubuntu:jammy
 | 
					FROM ubuntu:focal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ENV DEBIAN_FRONTEND=noninteractive
 | 
					ENV DEBIAN_FRONTEND=noninteractive
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user