wiki:SRTP

Version 3 (modified by bennylp, 11 years ago) (diff)

--

SRTP Support in PJSIP

Support for SRTP was included in PJSIP in version 0.9 (see ticket #61).

Requirements

SRTP feature in PJSIP uses libsrtp created by David A. McGrew of Cisco Systems, Inc. Copy of libsrtp is included in PJSIP source tree. There is no other software to download.

libsrtp is distributed under BSD-like license, you must satisfy the license requirements if you incorporate SRTP in your application. Please see PJSIP licensing page for more information about this and other third party libraries used in PJSIP.


Building PJSIP with SRTP Support

Availability

SRTP feature is currently available in:

  • Visual C++ 6 and 2005 (for Windows targets)
  • GNU based build system (for Linux, Mingw, MacOS X, and *nix based platforms)

Support for WinCE/Windows Mobile targets and Symbian will be added very soon.

Building

libsrtp is always built by default, from third_party/build/srtp directory.

Support for SRTP is enabled by default in PJMEDIA and PJSUA-LIB. To disable this feature, declare this in your config_site.h:

#define PJMEDIA_HAS_SRTP  0

Implementation Notes

Changes in Media Transport Interface

Since the availability of SRTP changes contents of SDP (Session Description Protocol) and the SDP negotiation, we need to add new interfaces in PJMEDIA transport API to allow media transport to modify and negotiate SDP. Incidently this would work well with ICE too (previously we treat ICE as a special kind of media transport so it is treated differently, but with this new interfaces, all media transports will behave uniformly (anyway that's what API abstraction is for!)).

New interfaces in media transport are as follows (please consult the PJMEDIA transport documentation for more info):

media_create()
This callback is called by application (or PJSUA-LIB) to allow the media transport to add more information in the SDP offer, before the offer is sent to remote. Additionally, for answerer side, this callback allows the media transport to reject the offer from the remote before this offer is processed by the SDP negotiator.
media_start()
This callback is called after offer and answer are negotiated, and before the media is started. For answerer side, this callback will be called before the answer is sent to remote, to allow media transport to put additional info in the SDP. The media transport also has the final chance to negotiate the offer and answer before media is really started.
media_stop()
This callback is called when the media is stopped, to allow the media transport to release its resources.
simulate_lost()
This has nothing to do with SRTP, but since all media transports support this feature (packet loss simulation), we add this as a new interface.

pjmedia_transport_srtp Implementation

As we know, media transport is separated from the stream object (which does the encoding/decoding of PCM frames, (de)packetization of RTP packets, and de-jitter buffering). The connection between stream and media transport is established when the stream is created (because during stream creation we need to specify media transport), and the interconnection can be depicted from the diagram below:


Using SRTP Transport

Using SRTP in PJSUA-LIB

Using SRTP Transport Directly

Attachments (2)

Download all attachments as: .zip