Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add siprec extension #4132

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open

Conversation

sorooshm78
Copy link

I had a Session Record Client (SRC) that utilized the SIPREC module from the OpenSIPS SIP server, and I intended to develop a Session Record Server (SRS) capable of supporting SIPREC. The goal was for the SRS to handle requests effectively. However, since PJSIP does not support the SIPREC extension, I added SIPREC extension support to PJSIP.

image (3)

Senario with siprec extension:

INVITE Request

Request-Line: INVITE sip:192.168.10.20 SIP/2.0

Message Headers:
    Via: SIP/2.0/UDP 192.168.10.20:5060;branch=z9hG4bK656b.7f03f537.0
    To: <sip:192.168.10.20>
    From: <sip:192.168.10.20>;tag=85c717edf7d282027df52a83293e4957-ce21
    User-Agent: OpenSIPS (3.5.0-dev (x86_64/linux))
    Require: siprec  
    Content-Type: multipart/mixed; boundary=OSS-unique-boundary-42
    Contact: <sip:192.168.21.89:5060>; +sip.src
    ...

Session Description Protocol (SDP):
    Version: 0
    Media Description (m): audio 35001 RTP/AVP 8 0 101
    Media Attributes (a): 
        sendonly
        label:0
    ...
    Media Description (m): audio 35002 RTP/AVP 8 101
    Media Attributes (a): 
        sendonly
        label:1
    ... 

420 Bad Extension Response

Status-Line: SIP/2.0 420 Bad Extension

Message Header
    ...
    Unsupported: siprec
    Supported: replaces, 100rel, timer, norefersub, trickle-ice
    Content-Length:  0

Senario with siprec extension:

In the SIPREC module of PJSIP, when an INVITE is received with the header Require: siprec and two media attribute labels in the offer SDP, it can generate an appropriate 200 OK response that includes those two media attribute labels in the SDP answer.

INVITE Request

Request-Line: INVITE sip:192.168.10.20 SIP/2.0

Message Headers:
    Via: SIP/2.0/UDP 192.168.10.20:5060;branch=z9hG4bK656b.7f03f537.0
    To: <sip:192.168.10.20>
    From: <sip:192.168.10.20>;tag=85c717edf7d282027df52a83293e4957-ce21
    User-Agent: OpenSIPS (3.5.0-dev (x86_64/linux))
    Require: siprec  
    Content-Type: multipart/mixed; boundary=OSS-unique-boundary-42
    Contact: <sip:192.168.21.89:5060>; +sip.src
    ...

Session Description Protocol (SDP):
    Version: 0
    Media Description (m): audio 35001 RTP/AVP 8 0 101
    Media Attributes (a): 
        sendonly
        label:0
    ...
    Media Description (m): audio 35002 RTP/AVP 8 101
    Media Attributes (a): 
        sendonly
        label:1
    ... 

200 OK Response

Message Headers:
    Via: SIP/2.0/UDP 192.168.10.20:5060; received=192.168.10.20; branch=z9hG4bK656b.7f03f537.0
    From: <sip:192.168.10.20>; tag=85c717edf7d282027df52a83293e4957-ce21
    To: <sip:192.168.10.20>; tag=7de0bfd1-94b6-4462-929f-53955d386d91
    Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
    Supported: replaces, 100rel, timer, siprec, norefersub
    ...

Session Description Protocol (SDP):
    Version: 0
    Session Name (s): pjmedia
    Media Description (m): audio 4000 RTP/AVP 8 101
    Media Attributes (a): 
        label:0
        recvonly
    ...

    Media Description (m): audio 4002 RTP/AVP 8 101
    Media Attributes (a): 
        label:1
        recvonly
    ...

@CLAassistant
Copy link

CLAassistant commented Nov 5, 2024

CLA assistant check
All committers have signed the CLA.

@sorooshm78
Copy link
Author

I couldn't debug the Bitrise error and figure out where the issue in my code is. Please guide me to resolve the problem.

@sauwming
Copy link
Member

Thank you for the submission.

The support seems to be pretty basic, i.e. it allows incoming request with siprec to be accepted (instead of declined). There are a few concerns though:

  • The setting enable_multimedia seems misleading. PJSIP already supports multimedia, i.e. audio and video, even multiple audio and multiple video.
  • The patch seems to assume that only audio is supported.

@sorooshm78
Copy link
Author

Thank you for your response.
I have a few questions:

  1. What do you mean by "pretty basic," and how can I perform more extensive checks?
  2. Is your issue only with the name enable_multimedia? For example, if it is changed to enable_multiple_audio, would that resolve the issue? Or, if PJSIP itself supports multiple audio streams, where can I configure it?
  3. Yes, for now, it only works with audio, but adding video support shouldn’t be too difficult.

In the SIPREC protocol, it is possible to send information in the body in XML format with the Content-Type: application/rs-metadata+xml. I am working on another commit to add this feature.

@sauwming
Copy link
Member

  1. It's basic in the sense that it is more directed towards the UAS, only to accept INVITE that requires siprec. But it lacks other verification, for example, in the RFC, it is mentioned that:
    When an SRS receives a new INVITE, the SRS MUST only consider the SIP session as an RS when both the "+sip.src" feature tag and the "siprec" option tag are included in the INVITE request.
    While for the UAC, it also lacks features such as how to specify the labelling, etc.

  2. PJSIP supports multiple audio media. If you specify call->opt.aud_cnt to 2, there will be two audio streams.

@sorooshm78
Copy link
Author

sorooshm78 commented Nov 17, 2024

  1. I will add more checks for the necessary information the next few days.
  2. I have made some changes to the code. My assumption is that pjsip should work without any issues or changes in both SIPREC mode and normal mode. This means when an INVITE with a SIPREC header (I will add other checks as well) arrives, the call should be established correctly. Specifically, we will modify the value of call->opt.aud_cnt and add a label to its SDP. When a call is established in normal mode (without SIPREC), it should also work without any issues or changes, and should not cause any malfunction in pjsip.
  3. I am implementing SIPREC as a UAS, and if I have time, I will also implement UAC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants