Skip to content

NethVoice: Add RTSP protocol to NethVoice CTI Streaming #7535

Done
1 of 1 issue completed
Done

Description

@andrea-marchionni

In NethVoice CTI, I want to implement the following functionalities:

  • Video Streaming: Display video streams from devices such as video intercoms.
  • Gate Controls: Enable interaction with gate openings, supporting multiple gates per video intercom. Interaction can occur through a call to the gate using DTMF tones or via an Action URL (preferred, as it does not require a phone call). However, it is important always to evaluate reachability, possibly using the NethLink core as the click-to-call function.
  • Streaming Previews: Provide a streaming preview within the incoming call notification.
  • User Permissions: Allow administrators to decide which users can access this feature.

In the previous version, streaming support was limited to unauthenticated JPEG formats.
However, modern video intercoms, such as certain Fanvil models, utilize both authenticated and unauthenticated RTSP streaming.

Gate control can be managed via DTMF tones during calls or through action URLs.

This implementation should start with specific video intercom models, such as those from Fanvil, and expand as needed for RTSP protocol.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    nethvoice
    on Jun 30, 2025
  2. added
    nethvoice-cti
    on Jun 30, 2025
  3. changed the title [-]NethVoice: Add RSTP protocol to NethVoice CTI Streaming[/-] [+]NethVoice: Add RTSP protocol to NethVoice CTI Streaming[/+] on Oct 13, 2025
  4. gsanchietti commented on Nov 11, 2025

    @gsanchietti
    Member

    After some experiments, I've found this promising Open Source software: https://mediamtx.org/
    It can be used into 2 different modes:

    • expose the RTSP flows directly to WebSocket
    • create a JPEG snapshot of the RTSP flows on fixed intervals and fallback to existing image-based flow

    Example of a script that takes a snapshot using the official container:

    #!/usr/bin/env bash
    set -euo pipefail
    
    # Simple snapshotter using the jrottenberg/ffmpeg container (podman)
    # - Pulls the container image
    # - Reads config.csv (header: source_name,source_address)
    # - Creates/updates snapshots/<source_name>.jpg using ffmpeg
    # - Sleeps 10s and repeats; if config.csv changes it's reloaded
    
    CONFIG="config.csv"
    SNAP_DIR="snapshots"
    IMAGE="ghcr.io/jrottenberg/ffmpeg:8.0-alpine"
    PULL_IMAGE=true
    SLEEP_SECS=10
    
    sanitize() {
      # replace unsafe chars with underscore
      echo "$1" | sed -E 's/[^A-Za-z0-9._-]/_/g'
    }
    
    mkdir -p "$SNAP_DIR"
    
    if $PULL_IMAGE; then
      echo "Pulling image $IMAGE..."
      podman pull "$IMAGE"
    fi
    
    last_sum=""
    sources=()
    
    trap 'echo "Exiting..."; exit 0' INT TERM
    
    echo "Starting snapshot loop (sleep ${SLEEP_SECS}s). Config: $CONFIG"
    while true; do
      if [ ! -f "$CONFIG" ]; then
        echo "Warning: $CONFIG not found, sleeping ${SLEEP_SECS}s..."
        sleep "$SLEEP_SECS"
        continue
      fi
    
      sum=$(sha256sum "$CONFIG" | awk '{print $1}')
      if [ "$sum" != "$last_sum" ]; then
        echo "Config changed (or first run) — reloading $CONFIG"
        # Read file, skip header, skip empty lines and comments
        mapfile -t sources < <(tail -n +2 "$CONFIG" | sed -e 's/\r$//' | grep -vE '^[[:space:]]*$' | grep -vE '^[[:space:]]*#')
        last_sum="$sum"
      fi
    
      if [ ${#sources[@]} -eq 0 ]; then
        echo "No sources found in $CONFIG"
      else
        # Run snapshots concurrently (one container per source)
        pids=()
        for line in "${sources[@]}"; do
          # parse CSV line: source_name,source_address
          IFS=',' read -r source_name source_address _rest <<< "$line"
          source_name="$(echo "$source_name" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
          source_address="$(echo "$source_address" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
          if [ -z "$source_name" ] || [ -z "$source_address" ]; then
            echo "Skipping malformed line: $line"
            continue
          fi
          safe_name=$(sanitize "$source_name")
          out_file="/snapshots/${safe_name}.jpg"
    
          echo "Taking snapshot for '$source_name' from '$source_address' -> ${SNAP_DIR}/${safe_name}.jpg"
    
          # Run containerized ffmpeg. Use --network=host so RTSP addresses on the LAN are reachable.
          # The container writes the image into the mounted snapshots directory.
          podman run --rm --network=host -v "$(pwd)/${SNAP_DIR}:/snapshots:Z" "$IMAGE" \
            -loglevel error -rtsp_transport tcp -y -i "$source_address" -frames:v 1 -update true "$out_file" &
          pids+=("$!")
        done
    
        # wait for all background podman runs to finish
        for pid in "${pids[@]}"; do
          wait "$pid" || true
        done
      fi
    
      sleep "$SLEEP_SECS"
    done
  5. 20 remaining items

  6. moved this from In Progress to Todo in NethVoiceon Nov 25, 2026
  7. added
    testing
    on Nov 25, 2026
  8. moved this from Todo to Testing in NethVoiceon Nov 25, 2026
  9. edospadoni commented on Nov 25, 2026

    @edospadoni
    Member

    Test

    PRs: nethesis/ns8-nethvoice#1184 (video gateway, wizard, CTI server, CTI, Tancredi), nethesis/phone-island#315 (released in phone-island 1.1.10), NethServer/nethlink#263, nethesis/ns8-nethvoice#1344 (door phone address confirmation, main extension), nethesis/phone-island#327 (released in phone-island 1.1.13), NethServer/nethlink#278, NethServer/nethlink#279 (door phone video in the released NethLink), NethServer/nethvoice-docs#104 (docs, merged with the stable release)

    Setup:

    • NethVoice with a public FQDN.
    • An RTSP camera or a Fanvil i-series door phone (i60, i61, i62, i63, i64). When NethVoice is in the cloud, the RTSP port of the device must be forwarded on the router of the site.
    • Two CTI users: one with the "Streaming" permission, one without.
    • The NethLink testing build below.

    Test Case 1 - Manual RTSP video source (wizard)

    • In Applications > Video sources, create a source with an rtsp:// URL: the device type preset (Fanvil i-series / Other) and the video quality select (High / Standard) fill the URL path
    • When the PBX cannot reach the device, a warning explains the port forward; a port forward on a non-standard port (e.g. rtsp://<public IP>:2554/...) is checked too
    • rtsp:// and http:// sources with credentials show the clear-text warning
    • The source is saved, and the user with the permission sees the live video in the CTI Streaming page
    • The user without the permission does not see the source

    Test Case 2 - Image (JPEG) sources

    • An existing http(s):// image source keeps working after the update (CTI Streaming page and call preview)
    • A new image source can be created and edited as before

    Test Case 3 - Fanvil i-series door phone provisioning

    • In Devices > Inventory, add the door phone by MAC, choose its i-series model and assign it to an extension
    • The door phone gets its configuration through Fanvil RPS (the tokenized URL; DHCP option 66/PnP without token is not supported for door phones) and registers
    • In the phone settings, configure the call buttons (speed dial) and the relays (DTMF code, open time): invalid codes or times show an error and cannot be saved
    • The door phone web panel still uses the phones' admin password

    Test Case 4 - Create a source from a door phone

    • In Video sources, "Create from a door phone" lists the provisioned door phone; the URL, the quality and the profile are prefilled, and no credentials are asked
    • The streaming (RTSP) password is shown and can be changed only in the door phone settings
    • Changing the URL to a different device asks for the password

    Test Case 5 - Calls from and to the door phone (CTI and NethLink)

    • Incoming call from the door phone: the call preview shows the live video before answering, in the web CTI and in NethLink
    • Answer: the video keeps playing in the streaming view
    • Outgoing call to the door phone: the video is shown
    • Open door buttons: one gate opens directly, several gates show a chooser; a DTMF gate is available only after answering; the result ("Command sent" or the error) is shown in the button
    • Hang up: the video session is closed

    Test Case 6 - Phone keys page in the CTI

    • Settings > Devices: the line keys of a normal physical phone can be viewed and saved as before
    • A door phone assigned to the user is not listed among the phones whose keys can be configured

    Test Case 7 - Update

    • Update an existing NethVoice instance: the update completes, the mediamtx service is running, existing image sources and phones keep working
    • Phone provisioning of the other phones is unchanged (inventory, "Show URL", reprovisioning)

    Test Case 8 - Door phone reached on another address

    • Create a source from a door phone with a URL whose host is not the address the door phone registers from (e.g. a port forward on another public IP of the site): the test and the save are refused, and a warning offers "Send the door phone password to "
    • While the confirmation is offered, the username and password fields are hidden
    • Confirm: the test runs and the source is saved, linked to the door phone, without typing the password
    • Edit the source and change the host again: the confirmation is asked again

    Test Case 9 - Main extension of the door phone

    • Assign the door phone to a secondary extension of a dedicated user (e.g. 91242 of the user 242): the CTI Streaming page shows the main extension (242), and "Call" calls it
    • Several door phones of the same user are all shown with the main extension
    • Incoming call from the door phone: the video preview is shown in the CTI and in NethLink, and the call shows the main extension
    • Without refreshing the CTI or restarting NethLink, add a new door phone source in the wizard and receive a call from it: the video preview is shown
    • A normal call from another device of the same user does not show the door phone video

    Testing release NethLink: v1.6.2-testing.10 (NethServer/nethlink#263, NethServer/nethlink#278, NethServer/nethlink#279)

    Testing release NethVoice: 1.8.7-testing.31 (nethesis/ns8-nethvoice#1184, nethesis/ns8-nethvoice#1344)

    ghcr.io/nethesis/nethvoice:1.8.7-testing.31
    
    api-cli run update-module --data '{"module_url":"ghcr.io/nethesis/nethvoice:1.8.7-testing.31","instances":["nethvoiceX"],"force":true}'
    
  10. removed their assignment
    on Nov 27, 2026
  11. added
    verified
    on Nov 27, 2026
  12. removed
    testing
    on Nov 27, 2026
  13. moved this from Testing to Verified in NethVoiceon Nov 27, 2026
  14. edospadoni commented on Nov 27, 2026

    @edospadoni
    Member

    Release NethServer/nethlink v1.7.0

  15. edospadoni commented on Nov 27, 2026

    @edospadoni
    Member

    Release nethesis/ns8-nethvoice 1.8.7

  16. removed
    verified
    on Nov 27, 2026
  17. moved this from Verified to Done in NethVoiceon Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    milestone goal 👑nethvoicenethvoice-cti

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions