AI Connect Service - SIPRec Forwarding

Download OpenAPI specification:Download

SIPRec Forwarding

SIPRec Forwarding

Overview

SIPRec Forwarding is a function in the AI Connect Service with the ability to act as a SIP Recording Client (SRC) towards external SIP Recording Servers (SRS).

The function is designed for deployments where downstream analytics, compliance, or archival platforms only support SIPRec, while AI Connect continues to ingest inbound SIPRec sessions from PBXs, SBCs, or carriers.

With SIPRec Forwarding enabled, AI Connect terminates tanhe inbound SIPRec session as usual, and in parallel establishes a new outbound SIPRec session towards a remote SRS. Audio, metadata, and participant semantics are preserved, while allowing AI Connect to perform transcoding, media security negotiation, and event correlation.

This enables a single inbound SIPRec session to be recorded in parallel with streaming to an external SIPRec service, and the APIs allow the forwarding to start and stop dynamically while the inbound SIPRec session is still active.

The SIPRec Forwarding function complements the existing WebSocket-based audio streaming and file recording functions. Where startStream enables raw audio delivery to AI or analytics engines, startSIPRecForward enables protocol-native forwarding to SIPRec-only platforms.

All mechanisms can coexist within the same call, allowing AI Connect to simultaneously stream audio to AI services and forward a standards-compliant SIPRec session to an external recorder.

flowchart LR %% Systems SRC(Originating SIPRec SRC) AIC(AI Connect Service) APP(Customer Application) SRS(External SIPRec SRS) TRUNK(SIP Trunk) %% Inbound SIPRec SRC -->|Inbound SIPRec INVITE| AIC --> TRUNK -->|Outbound SIPRec session | SRS %% App control + events AIC <-->|REST API| APP

Key functionality

SIPRec Forwarding provides the following capabilities:

  • Acts as a SIPRec SRC towards one or more external SRS platforms

  • Functionality to set the SIPRec meta-data information for the outbound SIPRec session

  • Supports PCMA and PCMU codec with transcoding

  • Supports encrypted SIP/TLS signalling and SRTP media

  • Allows injection of custom SIP headers for the outbound SIPRec session

  • Emits lifecycle events for observability and error handling

The feature is fully controlled by the customer application through the AI Connect Service APIs.

Destination resolution follows RFC 3263 using DNS SRV records. This enables redundancy and load distribution across multiple SRS instances. Connectivity between AI Connect and the external SRS is assumed to use the public Internet unless otherwise arranged.

API overview

The SIPRec Forwarding session is initiated by returning a startSIPRecForward object in the 200 OK response to the newCall callback or by calling the /startsiprecforward API endpoint for an already established inbound SIPRec session.

{
    "startSIPRecForward": {
        "uri": "sip:analytics@aiplatform.ai",
        "codec": "PCMU",
        "srtp": true,
        "caller": {
            "name": "Alice Andersson",
            "user": "alice",
            "label": "labelA"
        },
        "calledParty": {
            "name": "Support IVR",
            "user": "support",
            "label": "labelB"
        },
        "xHeaders": {
            "X-Correlation-Id": "a3b47c1e",
            "X-Tenant": "acme-cc"
        },
        "sipRecForwardReferenceId": {
            "ticketId": 98765
        }
    }
}

startSIPRecForward object properties

uri

SIP URI of the external SRS to start a SIPRec forward stream with.

codec Target codec for the outbound SIPRec session. PCMA is used by default. If the inbound session uses a different codec, AI Connect Service performs transcoding.

srtp

Enables SRTP using SDES. Requires SIP/TLS signalling.

callingParty

Object that control the meta-data information set for the calling party stream

calledParty

Object that control the meta-data information set for the called party stream

xHeaders

A set of custom SIP X- headers added to all outbound SIP messages.

sipRecForwardReferenceId

An opaque object that is echoed unchanged in SIPRec forwarding events for correlation with external systems.

Event Lifecycle

The SIPRec Forwarding function integrates with the standard AI Connect Service event model.

  • An inbound SIPRec INVITE is accepted and answered by AI Connect Service

  • The /newCall callback is sent to the customer application

  • The application responds with startSIPRecForward command

  • The AI Connect Service establishes an outbound SIPRec session towards the remote SIPRec SRS

  • Lifecycle events are emitted as the session progresses

Key events include:

  • SIPRECFORWARDSTARTED

  • SIPRECFORWARDFAILED

  • SIPRECFORWARDSTOPPED

These events allow applications to monitor success, correlate recordings, and implement fallback logic.

Call Flow Overview

The following sequence illustrates a typical SIPRec Forwarding scenario.

sequenceDiagram autonumber participant SRC as Originating SIPRec SRC participant AIC as AI Connect Service participant APP as Customer Application participant SRS as Target SIPRec SRS Note over SRC,AIC: Given a new SIPRec call SRC->>AIC: SIPRec INVITE (inbound) AIC->>SRC: 100 Trying\ AIC->>APP: POST /newCall
body APP->>AIC: 200 OK
body: {
startSIPRecForward: {
uri: sip:analytics@aiplatform.ai
codec: PCMU, srtp: true, usePrivateIp: false,
caller: { name: Alice Andersson, user: alice, label: A },
callee: { name: Support IVR, user: bob, label: B },
xHeaders: { X-Correlation-Id: a3b47c1e, X-Tenant: acme-cc },
sipRecForwardReferenceId: { ticketId: 98765 }
}
}\ AIC->>SRC: 200 OK (final response) SRC->>AIC: ACK AIC->>APP: SESSIONSTARTED
body: { event: SESSIONSTARTED, sessionId: String, ... } Note over AIC,SRS: Start SIPRec forwarding to Remote Analytics Platform AIC->>SRS: INVITE sip:analytics@aiplatform.ai (SIPRec forward session)
codec: PCMU, srtp: true, usePrivateIp: false SRS->>AIC: 180 Ringing SRS->>AIC: 200 OK AIC->>SRS: ACK\ AIC->>APP: SIPRECFORWARDSTARTED\ SRC->>AIC: BYE (inbound) AIC->>SRC: 200 OK AIC->>SRS: BYE sip:analytics@aiplatform.ai AIC->>APP: SIPRECFORWARDSTOPPED\ SRS->>AIC: 200 OK (BYE response) AIC->>APP: SESSIONCOMPLETED

Getting Started Overview

To start to use the SIPRec Forwarding function of the AI connect service to forward an inbound SIPRec session you need to configure the service by:

  1. Configure the inbound SIPRec service for your tenant here: SIPRec Provisioning.

  2. Configure a SIP Trunk to be used to connect with the remote SIPRec SRS here: Trunk Provisioning

    • Configure the destination match property with a value that you will use as destination in the startSIPRecForward command, for example aiforward.

    • Configure the destination target with the FQDN or IP adress of the remote SIPRec SRS.

    • Configure the destination transport with the desired type, TLS is recommended if public Internet is used for the connectivity.

  3. Construct the SIP URI in the startSIPRecForward as follows:

    • Set the user part of the URI to match the SIP Trunk previously configured

    • Set the domain part to be the domain for your tenant in the iotcomms.io service.

    • Example: If your domain is customer.prod-eu-north-1.iotcomms.io you should set the uri property in the startSIPRecForward command to be sip:aiforward@customer.prod-eu-north-1.iotcomms.io.