Просмотр исходного кода

Revert "cmake: Use components to install groups"

This reverts the following commits which were pushed by mistake:
* 5a32218ad8df5a93f6f707b4950454b847dff930
* 26982449b7dabe0413258a7602d88107c8f7e7d9
* e96fbdb3a543e2a8fb05bb487dffdf3410268f48
* 85b325c08becc7a58f34a00ec06ad354d1872e57
* e8f3c055fa6b8c6866ab056cee9386a201e82c20
* 17881e46f5a2bfdac99c01cd5569d59ac600fdc5
* f7b31f7914891e703a850741657911d246509bb2
Henning Westerholt 4 месяцев назад
Родитель
Сommit
da736ec06e

+ 179 - 0
.github/workflows/alpine.yml

@@ -0,0 +1,179 @@
+---
+name: alpine docker image
+on:
+  schedule:
+  - cron: '41 3 * * *'
+  push:
+    tags:
+    - '[0-9]+.[0-9]+.[0-9]+'
+  # Allows you to run this workflow manually from the Actions tab
+  workflow_dispatch:
+
+env:
+  IMAGE_NAME: kamailio-ci
+  SOURCE_BRANCH: ${{ github.ref_name }}
+  DOCKER_REPO: ghcr.io/kamailio/kamailio-ci
+
+jobs:
+  # is required nightly build?
+  # More info at https://stackoverflow.com/questions/63014786/how-to-schedule-a-github-actions-nightly-build-but-run-it-only-when-there-where
+  check:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+    steps:
+      - uses: octokit/[email protected]
+        id: check_last_run
+        with:
+          route: GET /repos/{owner}/{repo}/actions/workflows/alpine.yml/runs?per_page=1&status=success
+          owner: ${{ github.repository_owner }}
+          repo: kamailio
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      - name: Show last execution info
+        run: |
+          echo "Last daily build: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}"
+    outputs:
+      last_sha: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}
+  x86_64:
+    needs: [check]
+    if: needs.check.outputs.last_sha != github.sha
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      packages: write
+    steps:
+    - uses: actions/checkout@v4
+
+    - name: print latest_commit
+      run: echo ${{ github.sha }}
+
+    - name: Login to GitHub Container Registry
+      uses: docker/login-action@v3
+      with:
+        registry: ghcr.io
+        username: ${{ github.repository_owner }}
+        password: ${{ secrets.GITHUB_TOKEN }}
+
+    - name: Compile Kamailio source
+      run: |
+        git submodule init
+        git submodule update
+        cd pkg/docker/alpine
+        ./hooks/pre_build || true
+
+    - name: Docker meta
+      id: meta
+      uses: docker/metadata-action@v5
+      with:
+        # list of Docker images to use as base name for tags
+        images: |
+          ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
+        # generate Docker tags based on the following events/attributes
+        tags: |
+          type=pep440,pattern={{version}}
+          type=pep440,pattern={{major}}.{{minor}}
+          type=pep440,pattern={{major}}
+          type=ref,event=branch
+        flavor: |
+          suffix=
+          latest=auto
+
+    - name: Docker meta "-alpine"
+      id: meta-alpine
+      uses: docker/metadata-action@v5
+      with:
+        # list of Docker images to use as base name for tags
+        images: |
+          ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
+        # generate Docker tags based on the following events/attributes
+        tags: |
+          type=pep440,pattern={{version}}
+          type=pep440,pattern={{major}}.{{minor}}
+          type=pep440,pattern={{major}}
+          type=ref,event=branch
+        flavor: |
+          suffix=-alpine
+          latest=false
+
+    - name: Docker meta "-debug"
+      id: meta-debug
+      uses: docker/metadata-action@v5
+      with:
+        # list of Docker images to use as base name for tags
+        images: |
+          ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
+        # generate Docker tags based on the following events/attributes
+        tags: |
+          type=pep440,pattern={{version}}
+          type=pep440,pattern={{major}}.{{minor}}
+          type=pep440,pattern={{major}}
+          type=ref,event=branch
+        flavor: |
+          suffix=-debug
+          latest=false
+
+    - name: temporal workarround for "-alpine" and "-debug" builds
+      run: |
+        sudo chown -R ${USER}:${USER} ${{ github.workspace }}/pkg/docker/alpine
+        cd pkg/docker/alpine
+        mkdir repackage
+        tar xz --directory=repackage -f kamailio_min-without_os_files.tar.gz
+        rm -f kamailio_min-without_os_files.tar.gz
+        tar cz --directory=repackage -f kamailio_min-without_os_files.tar.gz $(ls -A repackage)
+
+    - name: Prepare local repo for "-debug" build
+      run: |
+        docker network create kamailio-build
+        docker run \
+               --detach \
+               --network kamailio-build \
+               --name local-repo \
+               --hostname local-repo \
+               --rm=true \
+               --volume=${{ github.workspace }}/pkg/docker/alpine/apk_files:/usr/share/nginx/html:ro \
+               nginx
+        LOCAL_REPO_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' local-repo)
+        sed -i -e "s/local-repo/${LOCAL_REPO_IP}/" pkg/docker/alpine/Dockerfile.debug
+
+    - name: Create custom builder for "-debug" build
+      id: local-repo
+      uses: docker/setup-buildx-action@v3
+      with:
+        driver-opts: |
+          network=kamailio-build
+
+    - name: Build and push "-debug" build
+      uses: docker/build-push-action@v6
+      with:
+        context: pkg/docker/alpine
+        file: pkg/docker/alpine/Dockerfile.debug
+        builder: ${{ steps.local-repo.outputs.name }}
+        push: ${{ github.event_name != 'pull_request' }}
+        tags: ${{ steps.meta-debug.outputs.tags }}
+        labels: ${{ steps.meta-debug.outputs.labels }}
+
+    - name: Cleanup after "-debug" build
+      run: |
+        docker buildx stop ${{ steps.local-repo.outputs.name }}
+        docker buildx rm ${{ steps.local-repo.outputs.name }}
+        docker stop local-repo
+        docker network rm kamailio-build
+
+    - name: Build and push "-alpine" build
+      uses: docker/build-push-action@v6
+      with:
+        context: pkg/docker/alpine
+        file: pkg/docker/alpine/Dockerfile.alpine
+        push: ${{ github.event_name != 'pull_request' }}
+        tags: ${{ steps.meta-alpine.outputs.tags }}
+        labels: ${{ steps.meta-alpine.outputs.labels }}
+
+    - name: Build and push
+      uses: docker/build-push-action@v6
+      with:
+        context: pkg/docker/alpine
+        file: pkg/docker/alpine/Dockerfile
+        push: ${{ github.event_name != 'pull_request' }}
+        tags: ${{ steps.meta.outputs.tags }}
+        labels: ${{ steps.meta.outputs.labels }}

+ 34 - 0
.github/workflows/cifuzz.yml

@@ -0,0 +1,34 @@
+name: CIFuzz
+on:
+  pull_request:
+    branches: [ "master" ]
+  schedule:
+    - cron: "30 0 * * *"
+  # Allows you to run this workflow manually from the Actions tab
+  workflow_dispatch:
+jobs:
+  Fuzzing:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+    steps:
+    - name: Build Fuzzers
+      id: build
+      uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
+      with:
+        oss-fuzz-project-name: 'kamailio'
+        dry-run: false
+        language: c
+    - name: Run Fuzzers
+      uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
+      with:
+        oss-fuzz-project-name: 'kamailio'
+        fuzz-seconds: 600
+        dry-run: false
+        language: c
+    - name: Upload Crash
+      uses: actions/upload-artifact@v4
+      if: failure() && steps.build.outcome == 'success'
+      with:
+        name: artifacts
+        path: ./out/artifacts

+ 72 - 0
.github/workflows/cmake_build.yml

@@ -0,0 +1,72 @@
+# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
+# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
+name: CMake on multiple platforms
+
+on:
+  # Allows you to run this workflow manually from the Actions tab
+  workflow_dispatch:
+  push:
+    branches: [ master ]
+  pull_request:
+    branches: [ master ]
+
+jobs:
+  build:
+    runs-on: ${{ matrix.os }}
+
+    strategy:
+      # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
+      fail-fast: false
+
+      # Set up a matrix to run the following 6 configurations:
+      # 1. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
+      # 2. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
+      # 3. <Linux, Release, latest GCC compiler toolchain on the default runner image, cross-compiled for aarch64>
+      # 4. <Linux, Release, latest Clang compiler toolchain on the default runner image, cross-compiled for aarch64>
+      # 5. <MacOS, Release, latest GCC compiler toolchain on the default runner image, default generator>
+      # 6. <MacOS, Release, latest Clang compiler toolchain on the default runner image, default generator>
+      matrix:
+        os: [ubuntu-latest, macos-latest]
+        # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
+        build_type: [Release]
+        c_compiler: [gcc, clang] 
+        kamailio_groups: [DEFAULT]
+        target_arch: [aarch64, x86_64]
+        exclude:
+          # Exclude combinations that are not supported
+          - os: macos-latest
+            target_arch: x86_64
+
+    steps:
+    - name: Checkout repository
+      uses: actions/checkout@v4
+
+
+    - name: Install cross-compiler
+      if: matrix.os == 'ubuntu-latest' && matrix.target_arch == 'aarch64'
+      run: |
+        sudo apt update
+        sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
+
+    - name: Build Project natively
+      uses: threeal/[email protected]
+      # Step runs for all except this combination
+      if: matrix.os != 'ubuntu-latest' || matrix.target_arch != 'aarch64'  
+      with:
+        build-dir: ${{github.workspace}}/build
+        build-args: -j8
+        options: |
+          CMAKE_BUILD_TYPE=${{matrix.build_type}}
+          MODULE_GROUP_NAME=${{matrix.kamailio_groups}}
+          CMAKE_C_COMPILER=${{matrix.c_compiler}}
+      
+    - name: Build Project with cross-compiler
+      if: matrix.os == 'ubuntu-latest' && matrix.target_arch == 'aarch64'
+      uses: threeal/[email protected]
+      with:
+        build-dir: ${{github.workspace}}/build
+        build-args: -j8
+        options: |
+          CMAKE_BUILD_TYPE=${{matrix.build_type}}
+          MODULE_GROUP_NAME=${{matrix.kamailio_groups}}
+          CMAKE_TOOLCHAIN_FILE=${{github.workspace}}/cmake/aarch64-toolchain.cmake

+ 83 - 0
.github/workflows/codeql.yml

@@ -0,0 +1,83 @@
+name: "CodeQL"
+
+on:
+  schedule:
+    - cron: "30 0 * * *"
+  # Allows you to run this workflow manually from the Actions tab
+  workflow_dispatch:
+jobs:
+  # is required nightly build?
+  # More info at https://stackoverflow.com/questions/63014786/how-to-schedule-a-github-actions-nightly-build-but-run-it-only-when-there-where
+  check:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+    steps:
+      - uses: octokit/[email protected]
+        id: check_last_run
+        with:
+          route: GET /repos/{owner}/{repo}/actions/workflows/codeql.yml/runs?per_page=1&status=success
+          owner: ${{ github.repository_owner }}
+          repo: kamailio
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      - name: Show last execution info
+        run: |
+          echo "Last daily build: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}"
+    outputs:
+      last_sha: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}
+  analyze:
+    needs: [check]
+    if: needs.check.outputs.last_sha != github.sha
+    name: Analyze
+    runs-on: [self-hosted, linux, x64, codeql]
+    permissions:
+      actions: read
+      contents: read
+      security-events: write
+
+    strategy:
+      fail-fast: false
+      matrix:
+        language: [ javascript, cpp, python ]
+
+    container:
+      image: ghcr.io/kamailio/pkg-kamailio-docker:${{ github.ref_name }}-bookworm
+      credentials:
+        username: ${{ github.actor }}
+        password: ${{ secrets.GITHUB_TOKEN }}
+      volumes:
+        - ${{ github.workspace }}:/code
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+        with:
+          submodules: recursive
+
+      - name: Configure (cpp)
+        if: ${{ matrix.language == 'cpp' }}
+        run: make include_modules='app_lua app_python3 cnxcc db_mysql db_postgres db_redis dialplan http_client jansson lcr ndb_redis presence presence_xml presence_dialoginfo pua pua_dialoginfo topos_redis uuid websocket xmlops' cfg
+
+      - name: After Prepare (cpp)
+        if: ${{ matrix.language == 'cpp' }}
+        run: export PKG_CONFIG_PATH=$RUNNER_TEMP/usr/lib/pkgconfig:$PKG_CONFIG_PATH && echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
+
+      - name: Initialize CodeQL
+        uses: github/codeql-action/init@v3
+        with:
+          languages: ${{ matrix.language }}
+          queries: +security-and-quality
+
+      - name: Autobuild
+        uses: github/codeql-action/autobuild@v3
+        if: ${{ matrix.language == 'javascript' || matrix.language == 'python' }}
+
+      - name: Build cpp
+        if: ${{ matrix.language == 'cpp' }}
+        run: make -j$(nproc) all
+
+      - name: Perform CodeQL Analysis
+        uses: github/codeql-action/analyze@v3
+        with:
+          category: "/language:${{ matrix.language }}"

+ 63 - 0
.github/workflows/devcontainer.yaml

@@ -0,0 +1,63 @@
+
+---
+name: build devcontainer image
+'on':
+  push:
+    branches:
+      - master
+  # Allows you to run this workflow manually from the Actions tab
+  workflow_dispatch:
+    inputs:
+      force:
+        required: true
+        type: boolean
+        default: false
+
+env:
+  DIST: bookworm
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      packages: write
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          fetch-depth: 2
+
+      - name: print latest_commit
+        run: echo ${{ github.sha }}
+
+      - name: Get changed files
+        if: ${{ ! inputs.force }}
+        id: changed-files
+        uses: tj-actions/changed-files@v46
+        with:
+          since_last_remote_commit: true
+
+      - name: changes in relevant files
+        if: ${{ ! inputs.force }}
+        id: changed-files-builder
+        uses: tj-actions/changed-files@v46
+        with:
+          files: |
+            .devcontainer/**
+            pkg/kamailio/deb/${{ env.DIST }}/**
+
+      - name: Login to GitHub Container Registry
+        if: steps.changed-files-builder.outputs.any_changed == 'true' || inputs.force
+        uses: docker/login-action@v3
+        with:
+          registry: ghcr.io
+          username: ${{ github.repository_owner }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Pre-build dev container image
+        if: steps.changed-files-builder.outputs.any_changed == 'true' || inputs.force
+        uses: devcontainers/[email protected]
+        with:
+          imageName: ghcr.io/${{ github.repository_owner }}/kamailio-${{ github.ref_name }}-devcontainer
+          cacheFrom: ghcr.io/${{ github.repository_owner }}/kamailio-${{ github.ref_name }}-devcontainer
+          push: always

+ 25 - 0
.github/workflows/issue_management.yml

@@ -0,0 +1,25 @@
+name: 'Close stale issues and PRs'
+on:
+  schedule:
+    - cron: '30 2 * * *'
+  # Allows you to run this workflow manually from the Actions tab
+  workflow_dispatch:
+permissions:
+  issues: write
+  pull-requests: write
+jobs:
+  stale:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/stale@v9
+        with:
+          stale-issue-message: 'This issue is stale because it has been open 6 weeks with no activity. Remove stale label or comment or this will be closed in 2 weeks.'
+          stale-pr-message: 'This PR is stale because it has been open 6 weeks with no activity. Remove stale label or comment or this will be closed in 2 weeks.'
+          days-before-stale: 42
+          days-before-close: 14
+          close-issue-label: expired
+          close-pr-label: expired
+          exempt-issue-labels: bug
+          remove-stale-when-updated: true
+          operations-per-run: 500
+          ascending: true

+ 54 - 0
.github/workflows/labels.yml

@@ -0,0 +1,54 @@
+name: manage labels from comments
+
+on: [issue_comment]
+
+jobs:
+  manage:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/github-script@v7
+        if: ${{ contains(github.event.comment.body, '/notstale') }}
+        with:
+          script: |
+            github.rest.issues.removeLabel({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number:context.issue.number,
+              name: "stale",
+            });
+      - uses: actions/github-script@v7
+        if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/notexpired') }}
+        with:
+          script: |
+            github.rest.issues.update({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: context.issue.number,
+              state: "open",
+            });
+      - uses: actions/github-script@v7
+        if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/notexpired') }}
+        with:
+          script: |
+            github.rest.pulls.update({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              pull_number: context.issue.number,
+              state: "open",
+            });
+      - uses: actions/github-script@v7
+        if: ${{ contains(github.event.comment.body, '/notexpired') }}
+        with:
+          script: |
+            github.rest.issues.removeLabel({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: context.issue.number,
+              name: "stale",
+            });
+            github.rest.issues.removeLabel({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: context.issue.number,
+              name: "expired",
+            });

+ 42 - 0
.github/workflows/main.yml

@@ -0,0 +1,42 @@
+---
+name: build
+'on':
+  push:
+    branches:
+      - master
+  # Allows you to run this workflow manually from the Actions tab
+  workflow_dispatch:
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read # to fetch code (actions/checkout)
+    container:
+      image: ghcr.io/kamailio/pkg-kamailio-docker:${{ github.ref_name }}-${{ matrix.distribution }}
+      credentials:
+        username: ${{ github.actor }}
+        password: ${{ secrets.GITHUB_TOKEN }}
+      volumes:
+        - ${{ github.workspace }}:/code
+      env:
+        DIST: ${{ matrix.distribution }}
+        CC: ${{ matrix.compilier }}
+    strategy:
+      matrix:
+        include:
+          - distribution: bookworm
+            compilier: gcc
+          - distribution: bookworm
+            compilier: clang
+          - distribution: sid
+            compilier: gcc
+          - distribution: sid
+            compilier: clang
+    steps:
+      - uses: actions/checkout@v4
+      - uses: ammaraskar/[email protected]
+      - name: build
+        run: |
+          cd /code
+          ./test/travis/build_travis.sh
+        shell: bash

+ 79 - 0
.github/workflows/pull_request.yml

@@ -0,0 +1,79 @@
+---
+name: checks_pr
+'on':
+  pull_request:
+    branches:
+      - master
+  # Allows you to run this workflow manually from the Actions tab
+  workflow_dispatch:
+jobs:
+  check-format:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read # to fetch code (actions/checkout)
+    steps:
+      - name: Check out the repository to the runner
+        uses: actions/checkout@v4
+      - name: Run clang-format check
+        uses: wolletd/[email protected]
+        with:
+          target-ref: master
+  check-cmake-format:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read # to fetch code (actions/checkout)
+    steps:
+      - name: Check out the repository to the runner
+        uses: actions/checkout@v4
+        with:
+          ref: ${{ github.event.pull_request.head.sha }}
+      - uses: awalsh128/[email protected]
+        with:
+          packages: cmake-format
+      - name: Run scripts/check-cmake-format.sh
+        run: ./.github/scripts/check-cmake-format.sh
+        env:
+          ref: ${{ github.event.pull_request.head.sha }}
+  check-commit:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read # to fetch code (actions/checkout)
+    steps:
+      - name: Check out the repository to the runner
+        uses: actions/checkout@v4
+        with:
+          ref: ${{ github.event.pull_request.head.sha }}
+      - name: Run scripts/check-commit.sh
+        run: ./.github/scripts/check-commit.sh
+        env:
+          ref: ${{ github.event.pull_request.head.sha }}
+  build:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read # to fetch code (actions/checkout)
+    container:
+      image: ghcr.io/kamailio/pkg-kamailio-docker:master-${{ matrix.distribution }}
+      credentials:
+        username: ${{ github.actor }}
+        password: ${{ secrets.GITHUB_TOKEN }}
+      volumes:
+        - ${{ github.workspace }}:/code
+      env:
+        DIST: ${{ matrix.distribution }}
+        CC: ${{ matrix.compilier }}
+    strategy:
+      matrix:
+        include:
+          - distribution: bookworm
+            compilier: gcc
+          - distribution: bookworm
+            compilier: clang
+    steps:
+      - name: Check out the repository to the runner
+        uses: actions/checkout@v4
+      - uses: ammaraskar/[email protected]
+      - name: build
+        run: |
+          cd /code
+          ./test/travis/build_travis.sh
+        shell: bash

+ 0 - 27
.github/workflows/rpm.yml

@@ -1,27 +0,0 @@
----
-name: build
-'on':
-  push:
-    branches:
-      - master
-  # Allows you to run this workflow manually from the Actions tab
-  workflow_dispatch:
-jobs:
-  build:
-    runs-on: [ubuntu-latest, ubuntu-24.04-arm]
-    permissions:
-      contents: read
-    strategy:
-      matrix:
-        os:
-        - centos-10
-        - rhel-10
-        - centos-9
-        - rhel-9
-        - centos-8
-        - rhel-8
-    steps:
-    - uses: addnab/docker-run-action@v3
-      with:
-        image: alpine:latest
-        run: uname -a

+ 3 - 3
cmake/modules-docs.cmake

@@ -77,7 +77,7 @@ set(DOCS_LYNX_FLAGS
     CACHE STRING "Lynx readme generator flags")
 
 # Function to add a module docs entry
-function(docs_add_module group_name module_name)
+function(docs_add_module module_name)
   # message(STATUS "Adding documentation for module ${MODULE_NAME}")
   set(module_path "${MODULES_DIR}/${module_name}")
   set(module_doc_path "${module_path}/doc")
@@ -174,12 +174,12 @@ function(docs_add_module group_name module_name)
       FILES ${CMAKE_CURRENT_SOURCE_DIR}/${module_name}/README
       RENAME README.${module_name}
       DESTINATION ${CMAKE_INSTALL_DOCDIR}/modules
-      COMPONENT ${group_name})
+      COMPONENT kamailio_docs)
 
     install(
       FILES ${CMAKE_CURRENT_SOURCE_DIR}/${module_name}/${module_name}.7
       DESTINATION ${CMAKE_INSTALL_DATADIR}/man/man7
-      COMPONENT ${group_name}
+      COMPONENT kamailio_docs
       OPTIONAL)
   endif()
 endfunction()

+ 298 - 236
pkg/kamailio/obs/kamailio.spec

@@ -251,19 +251,11 @@ Conflicts:  kamailio-utils < %ver, kamailio-websocket < %ver
 Conflicts:  kamailio-xhttp-pi < %ver, kamailio-xmlops < %ver
 Conflicts:  kamailio-xmlrpc < %ver, kamailio-xmpp < %ver
 Conflicts:  kamailio-uuid < %ver
+BuildRequires:  bison, flex, which, make, gcc, gcc-c++, pkgconfig, readline-devel
+%if 0%{?rhel} != 6
 Requires:  systemd
 BuildRequires:  systemd-devel
-BuildRequires: bison
-BuildRequires: flex
-BuildRequires: which
-BuildRequires: make
-BuildRequires: gcc
-BuildRequires: gcc-c++
-BuildRequires: pkgconfig
-BuildRequires: readline-devel
-BuildRequires: libxslt
-BuildRequires: lynx
-BuildRequires: docbook-style-xsl
+%endif
 
 %if 0%{?suse_version} == 1315 || 0%{?suse_version} == 1330
 Requires:  filesystem
@@ -289,8 +281,13 @@ like Asterisk™, FreeSWITCH™ or SEMS.
 Summary:    Account transaction information in a JSON dictionary
 Group:      %{PKGGROUP}
 Requires:   kamailio = %ver
+%if 0%{?rhel} == 6
+Requires:   libevent2
+BuildRequires:  libevent2-devel
+%else
 Requires:   libevent
 BuildRequires:  libevent-devel
+%endif
 %if 0%{?suse_version}
 Requires:   libjansson
 BuildRequires:  libjansson-devel
@@ -306,8 +303,14 @@ Account transaction information in a JSON dictionary.
 
 %package    auth-ephemeral
 Summary:    Functions for authentication using ephemeral credentials
+Group:      %{PKGGROUP}
+%if 0%{?rhel} == 7 && %{with openssl11}
+Requires:   openssl11, kamailio = %ver
+BuildRequires:  openssl11-devel
+%else
 Requires:   openssl, kamailio = %ver
 BuildRequires:  openssl-devel
+%endif
 
 %description    auth-ephemeral
 Functions for authentication using ephemeral credentials.
@@ -387,7 +390,20 @@ CPL (Call Processing Language) interpreter for Kamailio.
 Summary:    Module to support cryptographic extensions
 Group:      %{PKGGROUP}
 Requires:   kamailio = %ver
-%if 0%{?rhel} || 0%{?fedora}
+%if 0%{?rhel} == 6
+Requires:   openssl
+BuildRequires:  openssl-devel
+%endif
+%if 0%{?rhel} == 7
+%if %{with openssl11}
+Requires:   openssl11-libs
+BuildRequires:  openssl11-devel
+%else
+Requires:   openssl-libs
+BuildRequires:  openssl-devel
+%endif
+%endif
+%if 0%{?fedora}
 Requires:   openssl-libs
 BuildRequires:  openssl-devel
 %endif
@@ -471,8 +487,13 @@ Compressed body (SIP and HTTP) handling for kamailio.
 Summary:    Async HTTP client module for Kamailio
 Group:      %{PKGGROUP}
 Requires:   kamailio = %ver
+%if 0%{?rhel} == 6
+Requires:   libevent2
+BuildRequires:  libevent2-devel
+%else
 Requires:   libevent
 BuildRequires:  libevent-devel
+%endif
 %if 0%{?suse_version}
 Requires:   libcurl4
 BuildRequires:  libcurl-devel
@@ -518,8 +539,13 @@ IMS modules and extensions module for Kamailio.
 Summary:    JSON string handling and RPC modules for Kamailio using JANSSON library
 Group:      %{PKGGROUP}
 Requires:   kamailio = %ver
+%if 0%{?rhel} == 6
+Requires:   libevent2
+BuildRequires:  libevent2-devel
+%else
 Requires:   libevent
 BuildRequires:  libevent-devel
+%endif
 %if 0%{?suse_version}
 Requires:   libjson-c2
 BuildRequires:  libjansson-devel
@@ -538,8 +564,13 @@ JSON string handling and RPC modules for Kamailio using JANSSON library.
 Summary:    JSON string handling and RPC modules for Kamailio
 Group:      %{PKGGROUP}
 Requires:   kamailio = %ver
+%if 0%{?rhel} == 6
+Requires:   libevent2
+BuildRequires:  libevent2-devel
+%else
 Requires:   libevent
 BuildRequires:  libevent-devel
+%endif
 %if 0%{?suse_version}
 Requires:   libjson-c2
 BuildRequires:  libjson-c-devel
@@ -570,8 +601,13 @@ Summary:    Kazoo middle layer connector support for Kamailio
 Group:      %{PKGGROUP}
 Requires:   libuuid, librabbitmq, json-c, kamailio = %ver
 BuildRequires:  libuuid-devel, librabbitmq-devel, json-c-devel
+%if 0%{?rhel} == 6
+Requires:   libevent2
+BuildRequires:  libevent2-devel
+%else
 Requires:   libevent
 BuildRequires:  libevent-devel
+%endif
 
 %description    kazoo
 Kazoo module for Kamailio.
@@ -670,8 +706,12 @@ BuildRequires:  zlib-devel
 Requires:   libmysqlclient18
 BuildRequires:  libmysqlclient-devel
 %else
+%if 0%{?rhel} == 6
+BuildRequires:  mysql-devel
+%else
 BuildRequires:  mariadb-devel
 %endif
+%endif
 
 %description    mysql
 MySQL database connectivity for Kamailio.
@@ -692,8 +732,13 @@ The module provides an NATS consumer for Kamailio. NATS is a real time distribut
 %package    outbound
 Summary:    Outbound (RFC 5626) support for Kamailio
 Group:      %{PKGGROUP}
+%if 0%{?rhel} == 7 && %{with openssl11}
+Requires:   openssl11, kamailio = %ver
+BuildRequires:  openssl11-devel
+%else
 Requires:   openssl, kamailio = %ver
 BuildRequires:  openssl-devel
+%endif
 
 %description    outbound
 RFC 5626, "Managing Client-Initiated Connections in the Session Initiation
@@ -801,7 +846,7 @@ RabbitMQ module for Kamailio.
 Summary:    RADIUS modules for Kamailio
 Group:      %{PKGGROUP}
 Requires:   kamailio = %ver
-%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
+%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8
 Requires:   freeradius-client
 BuildRequires:  freeradius-client-devel
 %else
@@ -877,6 +922,18 @@ Requires:   kamailio = %ver
 Additional layer of security over our communications.
 
 
+%package    sipcapture-daemon-config
+Summary:    Reference config for sipcapture daemon
+Group:      %{PKGGROUP}
+Requires:   kamailio = %ver
+%if 0%{?suse_version}
+Requires:  filesystem
+%endif
+
+%description    sipcapture-daemon-config
+reference config for sipcapture daemon.
+
+
 %package    sipdump
 Summary:    This module writes SIP traffic and some associated details into local files
 Group:      %{PKGGROUP}
@@ -1050,8 +1107,13 @@ Non-SIP utitility functions for Kamailio.
 %package    websocket
 Summary:    WebSocket transport for Kamailio
 Group:      %{PKGGROUP}
+%if 0%{?rhel} == 7 && %{with openssl11}
+Requires:   libunistring, openssl11, kamailio = %ver
+BuildRequires:  libunistring-devel, openssl11-devel
+%else
 Requires:   libunistring, openssl, kamailio = %ver
 BuildRequires:  libunistring-devel, openssl-devel
+%endif
 
 %description    websocket
 WebSocket transport for Kamailio.
@@ -1123,223 +1185,287 @@ UUID module for Kamailio.
 
 %prep
 %setup -n %{name}-%{ver}
+# python3 does not exist in RHEL 6 and similar dist.
+%if 0%{?rhel} == 6
+sed -i -e 's/python3/python2/' utils/kamctl/dbtextdb/dbtextdb.py
+%endif
+
 # on latest dist need to add --atexit=no for Kamailio options. More details GH #2616
+%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8
 sed -i -e 's|/usr/sbin/kamailio|/usr/sbin/kamailio --atexit=no|' pkg/kamailio/obs/kamailio.service
 sed -i -e 's|/usr/sbin/kamailio|/usr/sbin/kamailio --atexit=no|' pkg/kamailio/obs/[email protected]
+%endif
+
 
 %build
-MODULES="\
-acc_json \
-acc_radius \
+%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8
+export FREERADIUS=1
+%endif
+make cfg prefix=/usr \
+    basedir=%{buildroot} \
+    cfg_prefix=%{buildroot} \
+    doc_prefix=%{buildroot} \
+    doc_dir=%{_docdir}/kamailio/ \
+    cfg_target=%{_sysconfdir}/kamailio/ modules_dirs="modules"
+make
+make every-module skip_modules="app_mono db_cassandra db_oracle iptrtpproxy \
+    jabber ndb_cassandra osp" \
+%if %{with openssl11}
+    SSL_BUILDER="pkg-config libssl11" \
+%endif
+%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8
+    FREERADIUS=1 \
+%endif
+%if 0%{?rhel} >= 8
+    PYTHON3=python3.12 \
+%endif
+    WOLFSSL_INTERNAL=no \
+    group_include="kstandard kautheph kberkeley kcarrierroute \
+%if %{with cnxcc}
+    kcnxcc \
+%endif
+    kcpl \
+%if %{with dnssec}
+    kdnssec \
+%endif
+%if %{with evapi}
+    kev \
+%endif
+    kgeoip2 \
+    kgzcompress \
+%if %{with http_async_client}
+    khttp_async \
+%endif
+    kxhttp_prom \
+%if %{with ims}
+    kims \
+%endif
+%if %{with jansson}
+    kjansson \
+%endif
+%if %{with json}
+    kjson \
+%endif
+    kjsonrpcs \
+    kjwt \
+%if %{with kazoo}
+    kkazoo \
+%endif
+    kldap \
 %if %{with lua}
-app_lua \
+    klua \
+%endif
+%if %{with lwsc}
+    klwsc \
+%endif
+%if %{with memcached}
+    kmemcached \
+%endif
+%if %{with xmlrpc}
+    kmi_xmlrpc \
+%endif
+%if %{with mongodb}
+    kmongodb \
+%endif
+    kmysql koutbound \
+%if %{with nats}
+    knats \
 %endif
 %if %{with perl}
-app_perl \
+    kperl \
 %endif
+%if %{with phonenum}
+    kphonenum \
+%endif
+    kpostgres kpresence \
 %if %{with python2}
-app_python \
+    kpython \
 %endif
 %if %{with python3}
-app_python3 \
-app_python3s \
+    kpython3 \
+%endif
+%if %{with rabbitmq}
+    krabbitmq \
+%endif
+    kradius \
+%if %{with redis}
+    kredis \
 %endif
 %if %{with ruby}
-app_ruby \
-app_ruby_proc \
+    kruby \
 %endif
-auth_ephemeral \
-auth_radius \
-cdp \
-cdp_avp \
-%if %{with cnxcc}
-cnxcc \
+%if %{with sctp}
+    ksctp \
 %endif
-cplc \
-crypto \
-db2_ldap \
-%if %{with mongodb}
-db_mongodb \
+    ksnmpstats ksqlite \
+%if "%{?_unitdir}" != ""
+    ksystemd \
 %endif
-db_mysql \
-%if %{with perl}
-db_perlvdb
+    ktls \
+%if %{with wolfssl}
+    ktls_wolfssl \
 %endif
-db_postgres \
-%if %{with redis}
-db_redis \
+    kunixodbc kutils \
+%if %{with websocket}
+    kwebsocket \
+%endif
+    kxml kxmpp kuuid"
+
+make utils
+
+
+
+%install
+rm -rf %{buildroot}
+
+make install
+make install-modules-all skip_modules="app_mono db_cassandra db_oracle \
+    iptrtpproxy jabber osp" \
+%if %{with openssl11}
+    SSL_BUILDER="pkg-config libssl11" \
 %endif
-db_sqlite \
-db_text \
-db_text \
-db_unixodbc \
-dialplan \
+%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8
+    FREERADIUS=1 \
+%endif
+%if 0%{?rhel} >= 8
+    PYTHON3=python3.12 \
+%endif
+    WOLFSSL_INTERNAL=no \
+    group_include="kstandard kautheph kberkeley kcarrierroute \
+%if %{with cnxcc}
+    kcnxcc \
+%endif
+    kcpl \
 %if %{with dnssec}
-dnssec \
+    kdnssec \
 %endif
 %if %{with evapi}
-evapi \
+    kev \
 %endif
-geoip2 \
-gzcompress \
-h350 \
+    kgeoip2 \
+    kgzcompress \
 %if %{with http_async_client}
-http_async_client \
+    khttp_async \
 %endif
-http_client \
+    kxhttp_prom \
 %if %{with ims}
-ims_auth \
-ims_charging \
-ims_dialog \
-ims_diameter_server \
-ims_icscf \
-ims_ipsec_pcscf \
-ims_isc \
-ims_ocs \
-ims_qos \
-ims_qos_npn \
-ims_registrar_pcscf \
-ims_registrar_scscf \
-ims_usrloc_pcscf \
-ims_usrloc_scscf \
+    kims \
 %endif
 %if %{with jansson}
-jansson db_berkeley \
-janssonrpcc \
+    kjansson \
 %endif
 %if %{with json}
-json \
+    kjson \
 %endif
-jsonrpcc \
-jwt \
+    kjsonrpcs \
+    kjwt \
 %if %{with kazoo}
-kazoo \
+    kkazoo \
 %endif
-lcr \
-ldap \
-%if "%{?_unitdir}" != ""
-log_systemd \
+    kldap \
+%if %{with lua}
+    klua \
 %endif
-lost \
 %if %{with lwsc}
-lwsc \
+    klwsc \
 %endif
 %if %{with memcached}
-memcached \
+    kmemcached \
 %endif
-misc_radius \
-%if %{with nats}
-nats \
+%if %{with xmlrpc}
+    kmi_xmlrpc \
 %endif
 %if %{with mongodb}
-ndb_mongodb \
+    kmongodb \
 %endif
-%if %{with redis}
-ndb_redis \
+    kmysql koutbound \
+%if %{with nats}
+    knats \
+%endif
+%if %{with perl}
+    kperl \
 %endif
-outbound \
-peering \
 %if %{with phonenum}
-phonenum \
-%endif
-presence \
-presence_conference \
-presence_dfks \
-presence_dialoginfo \
-presence_mwi \
-presence_profile \
-presence_reginfo \
-presence_xml \
-pua \
-pua_bla \
-pua_dialoginfo \
-pua_json \
-pua_reginfo \
-pua_rpc \
-pua_rpc \
-pua_usrloc \
-pua_xmpp \
-pvtpl \
+    kphonenum \
+%endif
+    kpostgres kpresence \
+%if %{with python2}
+    kpython \
+%endif
+%if %{with python3}
+    kpython3 \
+%endif
 %if %{with rabbitmq}
-rabbitmq \
+    krabbitmq \
+%endif
+    kradius \
+%if %{with redis}
+    kredis \
+%endif
+%if %{with ruby}
+    kruby \
 %endif
-regex \
-rls \
 %if %{with sctp}
-sctp \
+    ksctp \
 %endif
-siprepo \
-slack \
-snmpstats \
+    ksnmpstats ksqlite \
 %if "%{?_unitdir}" != ""
-systemdops \
+    ksystemd \
 %endif
-tls \
+    ktls \
 %if %{with wolfssl}
-tls_wolfssl \
+    ktls_wolfssl \
 %endif
-%if %{with redis}
-topos_redis \
-%endif
-utils \
-uuid \
+    kunixodbc kutils \
 %if %{with websocket}
-websocket \
+    kwebsocket \
 %endif
-xcap_client \
-xcap_server \
-xhttp_pi \
-xmlops \
-%if %{with xmlrpc}
-xmlrpc \
-%endif
-xmpp \
-"
-
-%{cmake} \
-  -DBUILD_DOC=ON \
-  -DUSE_TLS=ON \
-  -DRADIUSCLIENT="FREERADIUS" \
-  -DINCLUDE_MODULES="${MODULES}"
+    kxml kxmpp kuuid"
 
-%{cmake_build}
-%{cmake_build} --target dbschema
-%{cmake_build} --target man
-
-%install
-%{cmake_install}
-%{cmake_install} --component tls-cfg
-rm -f %{buildroot}%{_sysconfdir}/kamailio/tls.cfg.sample
-%{cmake_install} --component xhttp_pi-cfg
-rm -f %{buildroot}%{_sysconfdir}/kamailio/pi_framework.xml.sample
+make install-cfg-pkg
 
 install -d %{buildroot}%{_sharedstatedir}/kamailio
 
+%if "%{?_unitdir}" == ""
+# On RedHat 6 like
+install -d %{buildroot}%{_var}/run/kamailio
+install -d %{buildroot}%{_sysconfdir}/rc.d/init.d
+install -m755 pkg/kamailio/obs/kamailio.init \
+        %{buildroot}%{_sysconfdir}/rc.d/init.d/kamailio
+%else
+# systemd
 install -d %{buildroot}%{_unitdir}
 install -Dpm 0644 pkg/kamailio/obs/kamailio.service %{buildroot}%{_unitdir}/kamailio.service
 install -Dpm 0644 pkg/kamailio/obs/[email protected] %{buildroot}%{_unitdir}/[email protected]
+install -Dpm 0644 pkg/kamailio/obs/sipcapture.service %{buildroot}%{_unitdir}/sipcapture.service
 install -Dpm 0644 pkg/kamailio/obs/kamailio.tmpfiles %{buildroot}%{_tmpfilesdir}/kamailio.conf
+install -Dpm 0644 pkg/kamailio/obs/sipcapture.tmpfiles %{buildroot}%{_tmpfilesdir}/sipcapture.conf
+%endif
 
 %if 0%{?suse_version}
 install -d %{buildroot}%{_fillupdir}
 install -m644 pkg/kamailio/obs/kamailio.sysconfig \
         %{buildroot}%{_fillupdir}/sysconfig.kamailio
+install -m644 pkg/kamailio/obs/sipcapture.sysconfig \
+        %{buildroot}%{_fillupdir}/sysconfig.sipcapture
 %else
 install -d %{buildroot}%{_sysconfdir}/sysconfig
 install -m644 pkg/kamailio/obs/kamailio.sysconfig \
         %{buildroot}%{_sysconfdir}/sysconfig/kamailio
+install -m644 pkg/kamailio/obs/sipcapture.sysconfig \
+        %{buildroot}%{_sysconfdir}/sysconfig/sipcapture
 %endif
 
 %if 0%{?suse_version}
 %py_compile -O %{buildroot}%{_libdir}/kamailio/kamctl/dbtextdb
 %endif
-
+%if 0%{?fedora} || 0%{?rhel} >= 8
 %py_byte_compile %{__python3} %{buildroot}%{_libdir}/kamailio/kamctl/dbtextdb
+%endif
 
 # Removing devel files
 rm -f %{buildroot}%{_libdir}/kamailio/lib*.so
 
-
 %pre
 if ! /usr/bin/id kamailio &>/dev/null; then
        /usr/sbin/useradd --system \
@@ -1350,7 +1476,6 @@ if ! /usr/bin/id kamailio &>/dev/null; then
                 %logmsg "Unexpected error adding user \"kamailio\". Aborting installation."
 fi
 
-
 %clean
 rm -rf %{buildroot}
 
@@ -1364,6 +1489,13 @@ rm -rf %{buildroot}
 %endif
 
 
+%if "%{?_unitdir}" != ""
+%post sipcapture-daemon-config
+%tmpfiles_create sipcapture.conf
+/usr/bin/systemctl -q enable sipcapture.service
+%endif
+
+
 %preun
 if [ $1 = 0 ]; then
 %if "%{?_unitdir}" == ""
@@ -1734,7 +1866,7 @@ fi
 %files      bdb
 %defattr(-,root,root)
 %doc %{_docdir}/kamailio/modules/README.db_berkeley
-%{_sbindir}/kamdb_recover
+%{_sbindir}/kambdb_recover
 %{_libdir}/kamailio/modules/db_berkeley.so
 %{_libdir}/kamailio/kamctl/kamctl.db_berkeley
 %{_libdir}/kamailio/kamctl/kamdbctl.db_berkeley
@@ -1942,90 +2074,6 @@ fi
 %doc %{_docdir}/kamailio/modules/README.ndb_mongodb
 %{_libdir}/kamailio/modules/db_mongodb.so
 %{_libdir}/kamailio/modules/ndb_mongodb.so
-%{_datadir}/kamailio/mongodb/kamailio/acc_cdrs.json
-%{_datadir}/kamailio/mongodb/kamailio/acc.json
-%{_datadir}/kamailio/mongodb/kamailio/active_watchers.json
-%{_datadir}/kamailio/mongodb/kamailio/address.json
-%{_datadir}/kamailio/mongodb/kamailio/aliases.json
-%{_datadir}/kamailio/mongodb/kamailio/carrierfailureroute.json
-%{_datadir}/kamailio/mongodb/kamailio/carrier_name.json
-%{_datadir}/kamailio/mongodb/kamailio/carrierroute.json
-%{_datadir}/kamailio/mongodb/kamailio/contact.json
-%{_datadir}/kamailio/mongodb/kamailio/cpl.json
-%{_datadir}/kamailio/mongodb/kamailio/dbaliases.json
-%{_datadir}/kamailio/mongodb/kamailio/dialog_in.json
-%{_datadir}/kamailio/mongodb/kamailio/dialog.json
-%{_datadir}/kamailio/mongodb/kamailio/dialog_out.json
-%{_datadir}/kamailio/mongodb/kamailio/dialog_vars.json
-%{_datadir}/kamailio/mongodb/kamailio/dialplan.json
-%{_datadir}/kamailio/mongodb/kamailio/dispatcher.json
-%{_datadir}/kamailio/mongodb/kamailio/domain_attrs.json
-%{_datadir}/kamailio/mongodb/kamailio/domain.json
-%{_datadir}/kamailio/mongodb/kamailio/domain_name.json
-%{_datadir}/kamailio/mongodb/kamailio/domainpolicy.json
-%{_datadir}/kamailio/mongodb/kamailio/dr_gateways.json
-%{_datadir}/kamailio/mongodb/kamailio/dr_groups.json
-%{_datadir}/kamailio/mongodb/kamailio/dr_gw_lists.json
-%{_datadir}/kamailio/mongodb/kamailio/dr_rules.json
-%{_datadir}/kamailio/mongodb/kamailio/globalblocklist.json
-%{_datadir}/kamailio/mongodb/kamailio/grp.json
-%{_datadir}/kamailio/mongodb/kamailio/htable.json
-%{_datadir}/kamailio/mongodb/kamailio/imc_members.json
-%{_datadir}/kamailio/mongodb/kamailio/imc_rooms.json
-%{_datadir}/kamailio/mongodb/kamailio/impu_contact.json
-%{_datadir}/kamailio/mongodb/kamailio/impu.json
-%{_datadir}/kamailio/mongodb/kamailio/impu_subscriber.json
-%{_datadir}/kamailio/mongodb/kamailio/lcr_gw.json
-%{_datadir}/kamailio/mongodb/kamailio/lcr_rule.json
-%{_datadir}/kamailio/mongodb/kamailio/lcr_rule_target.json
-%{_datadir}/kamailio/mongodb/kamailio/location_attrs.json
-%{_datadir}/kamailio/mongodb/kamailio/location.json
-%{_datadir}/kamailio/mongodb/kamailio/matrix.json
-%{_datadir}/kamailio/mongodb/kamailio/missed_calls.json
-%{_datadir}/kamailio/mongodb/kamailio/mohqcalls.json
-%{_datadir}/kamailio/mongodb/kamailio/mohqueues.json
-%{_datadir}/kamailio/mongodb/kamailio/mtree.json
-%{_datadir}/kamailio/mongodb/kamailio/mtrees.json
-%{_datadir}/kamailio/mongodb/kamailio/nds_trusted_domains.json
-%{_datadir}/kamailio/mongodb/kamailio/pcscf_location.json
-%{_datadir}/kamailio/mongodb/kamailio/pdt.json
-%{_datadir}/kamailio/mongodb/kamailio/pl_pipes.json
-%{_datadir}/kamailio/mongodb/kamailio/presentity.json
-%{_datadir}/kamailio/mongodb/kamailio/pua.json
-%{_datadir}/kamailio/mongodb/kamailio/purplemap.json
-%{_datadir}/kamailio/mongodb/kamailio/re_grp.json
-%{_datadir}/kamailio/mongodb/kamailio/rls_presentity.json
-%{_datadir}/kamailio/mongodb/kamailio/rls_watchers.json
-%{_datadir}/kamailio/mongodb/kamailio/ro_session.json
-%{_datadir}/kamailio/mongodb/kamailio/rtpengine.json
-%{_datadir}/kamailio/mongodb/kamailio/rtpproxy.json
-%{_datadir}/kamailio/mongodb/kamailio/sca_subscriptions.json
-%{_datadir}/kamailio/mongodb/kamailio/s_cscf_capabilities.json
-%{_datadir}/kamailio/mongodb/kamailio/s_cscf.json
-%{_datadir}/kamailio/mongodb/kamailio/secfilter.json
-%{_datadir}/kamailio/mongodb/kamailio/silo.json
-%{_datadir}/kamailio/mongodb/kamailio/sip_trace.json
-%{_datadir}/kamailio/mongodb/kamailio/speed_dial.json
-%{_datadir}/kamailio/mongodb/kamailio/subscriber.json
-%{_datadir}/kamailio/mongodb/kamailio/subscriber_scscf.json
-%{_datadir}/kamailio/mongodb/kamailio/topos_d.json
-%{_datadir}/kamailio/mongodb/kamailio/topos_t.json
-%{_datadir}/kamailio/mongodb/kamailio/trusted.json
-%{_datadir}/kamailio/mongodb/kamailio/uacreg.json
-%{_datadir}/kamailio/mongodb/kamailio/uid_credentials.json
-%{_datadir}/kamailio/mongodb/kamailio/uid_domain_attrs.json
-%{_datadir}/kamailio/mongodb/kamailio/uid_domain.json
-%{_datadir}/kamailio/mongodb/kamailio/uid_global_attrs.json
-%{_datadir}/kamailio/mongodb/kamailio/uid_uri_attrs.json
-%{_datadir}/kamailio/mongodb/kamailio/uid_uri.json
-%{_datadir}/kamailio/mongodb/kamailio/uid_user_attrs.json
-%{_datadir}/kamailio/mongodb/kamailio/uri.json
-%{_datadir}/kamailio/mongodb/kamailio/userblocklist.json
-%{_datadir}/kamailio/mongodb/kamailio/usr_preferences.json
-%{_datadir}/kamailio/mongodb/kamailio/version.json
-%{_datadir}/kamailio/mongodb/kamailio/version-create.mongo
-%{_datadir}/kamailio/mongodb/kamailio/watchers.json
-%{_datadir}/kamailio/mongodb/kamailio/xcap.json
 %endif
 
 
@@ -2211,6 +2259,20 @@ fi
 %{_libdir}/kamailio/modules/rtjson.so
 
 
+%files      sipcapture-daemon-config
+%defattr(-,root,root)
+%config(noreplace) %{_sysconfdir}/kamailio/kamailio-sipcapture.cfg
+%if 0%{?suse_version}
+%{_fillupdir}/sysconfig.sipcapture
+%else
+%config(noreplace) %{_sysconfdir}/sysconfig/sipcapture
+%endif
+%if "%{?_unitdir}" != ""
+%{_unitdir}/sipcapture.service
+%{_tmpfilesdir}/sipcapture.conf
+%endif
+
+
 %if %{with ruby}
 %files      ruby
 %defattr(-,root,root)

+ 26 - 0
pkg/kamailio/obs/sipcapture.service

@@ -0,0 +1,26 @@
+[Unit]
+Description=Kamailio SIP router server daemon for sipcapture
+Wants=network-online.target
+After=network-online.target
+After=syslog.target
+After=auditd.service
+After=mysqld.service
+
+[Service]
+Type=simple
+User=kamailio
+Group=kamailio
+WorkingDirectory=/run/sipcapture
+Environment='CFGFILE=/etc/kamailio/kamailio-sipcapture.cfg'
+Environment='SHM_MEMORY=32'
+Environment='PKG_MEMORY=4'
+EnvironmentFile=-/etc/sysconfig/sipcapture
+# PIDFile requires a full absolute path
+PIDFile=/run/sipcapture/sipcapture.pid
+# ExecStart requires a full absolute path
+ExecStart=/usr/sbin/kamailio -DD -P /run/sipcapture/sipcapture.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
+Restart=on-failure
+
+
+[Install]
+WantedBy=multi-user.target

+ 12 - 0
pkg/kamailio/obs/sipcapture.sysconfig

@@ -0,0 +1,12 @@
+#
+# sipcapture startup options
+#
+
+# Amount of shared memory to allocate for the running Kamailio server (in Mb)
+#SHM_MEMORY=64
+
+# Amount of per-process (package) memory to allocate for Kamailio (in Mb)
+#PKG_MEMORY=4
+
+# sipcapture config file
+#CFGFILE=/etc/kamailio/kamailio-sipcapture.cfg

+ 1 - 0
pkg/kamailio/obs/sipcapture.tmpfiles

@@ -0,0 +1 @@
+D /run/sipcapture 0700 kamailio kamailio -

+ 7 - 6
src/CMakeLists.txt

@@ -127,13 +127,14 @@ target_compile_definitions(
 install(
   TARGETS kamailio
   DESTINATION ${CMAKE_INSTALL_SBINDIR}
-  COMPONENT kamailio-core)
+  COMPONENT kamailio-core
+)
 
 # Install the docs of core
 install(
   FILES ${CMAKE_SOURCE_DIR}/README ${CMAKE_SOURCE_DIR}/INSTALL
   DESTINATION ${CMAKE_INSTALL_DOCDIR}
-  COMPONENT kamailio-core)
+  COMPONENT kamailio-docs)
 
 # ----------
 # Create and install the man pages for kamailio
@@ -171,15 +172,14 @@ add_dependencies(man kamailio_docs_man)
 install(
   FILES ${CMAKE_CURRENT_BINARY_DIR}/${MAIN_NAME}.8
   DESTINATION ${CMAKE_INSTALL_MANDIR}/man8
-  COMPONENT kamailio-core
+  COMPONENT kamailio_man
   OPTIONAL)
 
 install(
   FILES ${CMAKE_CURRENT_BINARY_DIR}/${MAIN_NAME}.cfg.5
   DESTINATION ${CMAKE_INSTALL_MANDIR}/man5
-  COMPONENT kamailio-core
+  COMPONENT kamailio_man
   OPTIONAL)
-
 # ----------
 
 # Install the configuration file (kamailio.cfg) ${CFG_NAME} using a CODE block
@@ -206,4 +206,5 @@ install(
     endif()
 
 "
-  COMPONENT kamailio-core)
+  COMPONENT kamailio-utils-cfg
+)

+ 5 - 13
src/modules/CMakeLists.txt

@@ -49,10 +49,7 @@ set(EXCLUDE_MODULES
 include(${CMAKE_SOURCE_DIR}/cmake/modules-docs.cmake)
 
 # Function to add modules from a list
-function(add_module_group group_name group_modules)
-  # message(STATUS "Adding modules for group: ${group_name}")
-  # message(STATUS "Modules: ${group_modules}")
-
+function(add_module_group group_modules)
   foreach(module_name IN LISTS group_modules)
     # Check if the module has already been added
     get_property(ALREADY_ADDED GLOBAL PROPERTY ADDED_MODULES_LIST)
@@ -102,10 +99,10 @@ function(add_module_group group_name group_modules)
         install(
           TARGETS ${module_name}
           DESTINATION ${CMAKE_INSTALL_LIBDIR}/${MAIN_NAME}/modules
-          COMPONENT ${group_name})
+          COMPONENT kamailio_modules)
         # Add the module to the list of added modules
         set_property(GLOBAL APPEND PROPERTY ADDED_MODULES_LIST ${module_name})
-        docs_add_module(${group_name} ${module_name})
+        docs_add_module(${module_name})
         set_property(GLOBAL APPEND PROPERTY ALL_MODULE_DOC_TARGETS
                                             ${module_name}_doc)
       else()
@@ -143,14 +140,9 @@ foreach(group IN LISTS FULL_MODULE_GROUP_NAMES)
   if(VERBOSE)
     message(STATUS "Modules in ${group}: ${MODULES_IN_GROUP}")
   endif()
-  # remove module_group_prefix.
-  # TODO: This feels like a hack since user already provided
-  # the group name. Move the check above in these for maybe?
-  string(REPLACE "MODULE_GROUP_" "" group_name "${group}")
-  # message(WARNING "Adding module group: ${group_name}")
-  add_module_group("${group_name}" "${MODULES_IN_GROUP}")
+  add_module_group("${MODULES_IN_GROUP}")
 endforeach()
-add_module_group(" " "${USER_MODULES_LIST}")
+add_module_group("${USER_MODULES_LIST}")
 
 get_property(ADDED_MODULES_LIST GLOBAL PROPERTY ADDED_MODULES_LIST)
 message(STATUS "Modules to be built: ${ADDED_MODULES_LIST}")

+ 3 - 4
src/modules/app_perl/CMakeLists.txt

@@ -120,7 +120,6 @@ add_custom_target(
 )
 
 # Install nessecary files
-install(
-  DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/perl
-  DESTINATION ${CMAKE_INSTALL_LIBDIR}/${MAIN_NAME}
-  COMPONENT ${group_name})
+install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/perl
+        DESTINATION ${CMAKE_INSTALL_LIBDIR}/${MAIN_NAME}
+)

+ 1 - 2
src/modules/auth_radius/CMakeLists.txt

@@ -27,9 +27,8 @@ install(
             PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
     endif()
 "
-  COMPONENT ${group_name})
+  COMPONENT ${module_name}-cfg)
 
-# Custom target to install only the specific config file
 add_custom_target(
   ${module_name}-install-cfg
   COMMENT "Installing auth_radius dictionary.${CFG_NAME} configuration file"

+ 1 - 3
src/modules/snmpstats/CMakeLists.txt

@@ -8,9 +8,7 @@ find_package(NETSNMP REQUIRED)
 # TODO: Compiles fine but need to do some more verifcation
 target_link_libraries(${module_name} PRIVATE NETSNMP::NETSNMP)
 
-message(WARNING "group_name is: ${group_name}")
 install(
   DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mibs
   DESTINATION ${CMAKE_INSTALL_DATADIR}/snmp/
-  OPTIONAL
-  COMPONENT ${group_name})
+  OPTIONAL)

+ 1 - 1
src/modules/tls/CMakeLists.txt

@@ -58,7 +58,7 @@ install(
             PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
     endif()
 "
-  COMPONENT ${group_name})
+  COMPONENT tls-cfg)
 
 add_custom_command(
   OUTPUT tls.cfg.sample

+ 1 - 1
src/modules/xhttp_pi/CMakeLists.txt

@@ -26,7 +26,7 @@ install(
             PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
     endif()
 "
-  COMPONENT ${group_name})
+  COMPONENT xhttp_pi-cfg)
 
 add_custom_target(
   xhttp_pi-install-cfg

+ 1 - 2
utils/db_berkeley/CMakeLists.txt

@@ -9,5 +9,4 @@ target_link_libraries(kamdb_recover PRIVATE BerkeleyDB::BerkeleyDB)
 install(
   TARGETS kamdb_recover
   DESTINATION ${CMAKE_INSTALL_SBINDIR}
-  OPTIONAL
-  COMPONENT ${group_name})
+  OPTIONAL)

+ 2 - 5
utils/kamcmd/CMakeLists.txt

@@ -35,10 +35,7 @@ target_compile_definitions(
           RUN_DIR="/${CMAKE_INSTALL_LOCALSTATEDIR}/run/${MAIN_NAME}"
           __OS_${OS_LOWER})
 
-install(
-  TARGETS ${NAME}
-  DESTINATION ${CMAKE_INSTALL_SBINDIR}
-  COMPONENT kamailio-core)
+install(TARGETS ${NAME} DESTINATION ${CMAKE_INSTALL_SBINDIR})
 
 # Man page generation
 add_custom_command(
@@ -58,5 +55,5 @@ add_custom_target(kamcmd_man DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/kamcmd.8)
 install(
   FILES ${CMAKE_CURRENT_BINARY_DIR}/kamcmd.8
   DESTINATION ${CMAKE_INSTALL_MANDIR}/man8
-  COMPONENT kamailio-core
+  COMPONENT kamailio_man
   OPTIONAL)

+ 9 - 12
utils/kamctl/CMakeLists.txt

@@ -46,7 +46,7 @@ foreach(file IN LISTS KAMCTL_BASE_FILES KAMCTL_DB_FILES)
   install(
     PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${file}
     DESTINATION ${CMAKE_INSTALL_LIBDIR}/${MAIN_NAME}/kamctl
-    COMPONENT kamailio-core)
+    COMPONENT kamailio-utils-bin)
 endforeach()
 
 # Kamctl target to depend on all kamctl files
@@ -64,7 +64,7 @@ add_custom_target(
 install(
   PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/kamctl
   DESTINATION ${CMAKE_INSTALL_SBINDIR}
-  COMPONENT kamailio-core)
+  COMPONENT kamailio-utils-bin)
 
 # Setup and install kamdbctl stuff
 set(KAMDBCTL_BASE_FILES kamdbctl.base)
@@ -74,10 +74,8 @@ if("db_berkeley" IN_LIST FINAL_MODULES_LIST)
 endif()
 if("db_text" IN_LIST FINAL_MODULES_LIST)
   set(KAMDBCTL_DB_FILES ${KAMDBCTL_DB_FILES} kamdbctl.dbtext)
-  install(
-    PROGRAMS dbtextdb/dbtextdb.py
-    DESTINATION ${CMAKE_INSTALL_LIBDIR}/${MAIN_NAME}/kamctl/dbtextdb
-    COMPONENT kamailio-core)
+  install(PROGRAMS dbtextdb/dbtextdb.py
+          DESTINATION ${CMAKE_INSTALL_LIBDIR}/${MAIN_NAME}/kamctl/dbtextdb)
 endif()
 if("db_mysql" IN_LIST FINAL_MODULES_LIST)
   set(KAMDBCTL_DB_FILES ${KAMDBCTL_DB_FILES} kamdbctl.mysql)
@@ -109,7 +107,7 @@ foreach(file IN LISTS KAMDBCTL_BASE_FILES KAMDBCTL_DB_FILES)
   install(
     PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${file}
     DESTINATION ${CMAKE_INSTALL_LIBDIR}/${MAIN_NAME}/kamctl
-    COMPONENT kamailio-core)
+    COMPONENT kamailio-utils-bin)
 endforeach()
 
 add_custom_target(
@@ -125,7 +123,7 @@ add_custom_target(
 install(
   PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/kamdbctl
   DESTINATION ${CMAKE_INSTALL_SBINDIR}
-  COMPONENT kamailio-core)
+  COMPONENT kamailio-utils-bin)
 
 # Install the configuration file (kamctlrc) using a CODE block to check
 # existence at install time instead of configure time
@@ -147,7 +145,7 @@ install(
             PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
     endif()
 "
-  COMPONENT kamailio-core)
+  COMPONENT kamailio-utils-cfg)
 
 # Man pages generation and installation
 add_custom_command(
@@ -180,7 +178,7 @@ install(
   FILES ${CMAKE_CURRENT_BINARY_DIR}/kamctl.8
         ${CMAKE_CURRENT_BINARY_DIR}/kamdbctl.8
   DESTINATION ${CMAKE_INSTALL_MANDIR}/man8
-  COMPONENT kamailio-core
+  COMPONENT kamailio_man
   OPTIONAL)
 
 # Install targets
@@ -299,8 +297,7 @@ else()
     install(
       DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${db_name_folder}
       DESTINATION ${CMAKE_INSTALL_DATADIR}/${MAIN_NAME}
-      OPTIONAL
-      COMPONENT kamailio-core)
+      OPTIONAL)
 
     add_custom_target(
       dbschema_${db_name}_clean