SIP Message Flow for SIPREC

The device initiates a recording session by sending an INVITE message to the SRS when the call to be recorded is connected. The SIP From header contains the identity of the SRC and the To header contains the identity of the SRS. The SIP message body of the INVITE contains the following:

SDP body:
Two 'm=' lines that represent the two RTP/SRTP streams (Rx and Tx).
Two 'a=label:' lines that identify the streams.

If the recorded leg includes a video stream, the SDP not only includes the two audio streams ('m=audio'), but also two video streams ('m=video') in send-only RTP mode ('a=sendonly') - one for Tx and one for Rx.

XML body (also referred to as metadata), which provides information on the participants of the call session:
<group id>: Logging Session ID (displayed as [SID:nnnnn] in syslog), converted to hex (or Base64 format). This number remains the same even if the call is forwarded or transferred. This is important for recorded calls.
<session id>: SIP Call-ID header value of the recorded leg, which the device represents as a unique hashed number.
<group-ref>: Same as <group id>.
<participant id>: SIP From / To user.
<nameID aor>: From/To user@host.
<send> and <recv>: IDs for the RTP/SRTP streams in hex (or Base64 format) - bits 0-31 are the same as group, bits 32-47 are the RTP port.
<stream id>: Same as <send> for each participant.
<label>: 1 and 2 (same as in the SDP's 'a=label:' line).
RFC 7865 only:
<sessionrecordingassoc>: Session association data.
<participantsessionassoc>: Data for association between participant and session.
<participantstreamassoc>: Data for association between participant and stream.

If the recorded leg includes a video stream, the metadata body contains two additional <stream> sections, which denote the Tx and Rx recording streams of the video payload. When RFC 7865 is chosen as the metadata format, the <participantstreamassoc> sections also contain this additional pair of streams.

You can configure the format of the recording metadata (i.e., based on RFC 7865 or "legacy") generated by the device. For more information, see Configuring Format of SIPREC Metadata.

The SRS can respond with 'a=recvonly' for immediate recording or 'a=inactive' if recording is not yet needed, and send a re-INVITE at any later stage with the desired RTP/SRTP mode change. If a re-INVITE is received in the original call (e.g., when a call is on hold), the device sends another re-INVITE with two 'm=' lines to the SRS with the updated RTP/SRTP data. If the recorded leg uses SRTP, the device can send the media streams to the SRS as SRTP; otherwise, the media streams are sent as RTP to the SRS.

Below is an example of an INVITE sent by the device to the SRS, showing the legacy and RFC 7865 metadata formats (only one of these is generated in real-life scenarios):

INVITE sip:VSRP@1.9.64.253 SIP/2.0

Via: SIP/2.0/UDP 192.168.241.44:5060;branch=z9hG4bKac505782914

Max-Forwards: 10

From: <sip:192.168.241.44>;tag=1c505764207

To: <sip:VSRP@1.9.64.253>

Call-ID: 505763097241201011157@192.168.241.44

CSeq: 1 INVITE

Contact: <sip:192.168.241.44:5060>;src

Supported: replaces,resource-priority Allow: REGISTER,OPTIONS,INVITE,ACK,CANCEL,BYE,NOTIFY,PRACK,REFER,INFO,SUBSCRIBE,UPDATE

Require: siprec

User-Agent: Device /7.40A.600.203

Content-Type: multipart/mixed;boundary=boundary_ac1fffff85b

Content-Length: 1832 --boundary_ac1fffff85b

Content-Type: application/sdp



v=0

o=AudioCodesGW 921244928 921244893 IN IP4 10.33.8.70

s=SBC-Call

c=IN IP4 10.33.8.70

t=0 0

m=audio 6020 RTP/AVP 8 96

c=IN IP4 10.33.8.70

a=ptime:20

a=sendonly

a=label:1

a=rtpmap:8 PCMA/8000

a=rtpmap:96 telephone-event/8000

a=fmtp:96 0-15

m=audio 6030 RTP/AVP 8 96

c=IN IP4 10.33.8.70

a=ptime:20

a=sendonly

a=label:2

a=rtpmap:8 PCMA/8000

a=rtpmap:96 telephone-event/8000

a=fmtp:96 0-15 --boundary_ac1fffff85b



Content-Type: application/rs-metadata

Content-Disposition: recording-session
Legacy XML metadata:
<?xml version="1.0" encoding="UTF-8"?>

<recording xmlns='urn:ietf:params:xml:ns:recording'>

<datamode>complete</datamode>

<group id="00000000-0000-0000-0000-00003a36c4e3">

<associate-time>2010-01-24T01:11:57Z</associate-time>

</group>

<session id="0000-0000-0000-0000-00000000d0d71a52">

<group-ref>00000000-0000-0000-0000-00003a36c4e3</group-ref>

<start-time>2010-01-24T01:11:57Z</start-time>

<ac:AvayaUCID xmlns="urn:ietf:params:xml:ns:Avaya">FA080030C4E34B5B9E59</ac:AvayaUCID>

</session>

<participant id="1056" session="0000-0000-0000-0000-00000000d0d71a52">

<nameID aor="1056@192.168.241.20"></nameID>

<associate-time>2010-01-24T01:11:57Z</associate-time>

<send>00000000-0000-0000-0000-1CF23A36C4E3</send>

<recv>00000000-0000-0000-0000-BF583A36C4E3</recv>

</participant>

<participant id="182052092" session="0000-0000-0000-0000-00000000d0d71a52">

<nameID aor="182052092@voicelab.local"></nameID>

<associate-time>2010-01-24T01:11:57Z</associate-time>

<recv>00000000-0000-0000-0000-1CF23A36C4E3</recv>

<send>00000000-0000-0000-0000-BF583A36C4E3</send>

</participant>

<stream id="00000000-0000-0000-0000-1CF23A36C4E3" session="0000-0000-0000-0000-00000000d0d71a52">

<label>1</label>

</stream>

<stream id="00000000-0000-0000-0000-BF583A36C4E3" session="0000-0000-0000-0000-00000000d0d71a52">

<label>2</label>

</stream>

</recording>

--boundary_ac1fffff85b—
RFC 7865 XML metadata:
<?xml version="1.0" encoding="UTF-8"?>
<recording xmlns="urn:ietf:params:xml:ns:recording" xmlns:ac="http://abc">
  <datamode>complete</datamode>
  <group group_id="4gAAAAC9YRUBDQDw">
    <associate-time>2018-04-17T09:35:41</associate-time>
  </group>
  <session session_id="OWc4Md2PHao=">
    <group-ref>4gAAAAC9YRUBDQDw</group-ref>
  </session>
  <participant participant_id="MjAw">
    <nameID aor="200@10.33.8.52">
        <name xml:lang="en">Bob</name>
    </nameID>
  </participant>
  <participant participant_id="MTAw">
    <nameID aor="100@10.33.8.52"></nameID>
  </participant>
  <stream stream_id="mBfiAAAAAL1hFQENAPA=" session_id="OWc4Md2PHao=">
    <label>1</label>
  </stream>
  <stream stream_id="hBfiAAAAAL1hFQENAPA=" session_id="OWc4Md2PHao=">
    <label>2</label>
  </stream>
  <sessionrecordingassoc session_id="OWc4Md2PHao=">
    <associate-time>2018-04-17T09:35:41</associate-time>
  </sessionrecordingassoc>
  <participantsessionassoc participant_id="MjAw" session_id="OWc4Md2PHao=">
    <associate-time>2018-04-17T09:35:41</associate-time>
  </participantsessionassoc>
  <participantsessionassoc participant_id="MTAw" session_id="OWc4Md2PHao=">
    <associate-time>2018-04-17T09:35:41</associate-time>
  </participantsessionassoc>
  <participantstreamassoc participant_id="MjAw">
    <send>mBfiAAAAAL1hFQENAPA=</send>
    <recv>hBfiAAAAAL1hFQENAPA=</recv>
  </participantstreamassoc>
  <participantstreamassoc participant_id="MTAw">
    <send>hBfiAAAAAL1hFQENAPA=</send>
    <recv>mBfiAAAAAL1hFQENAPA=</recv>
  </participantstreamassoc>
</recording>