Fork me on GitHub
Data Structures | Macros | Typedefs | Functions
janus_nosip.c File Reference

Janus NoSIP plugin. More...

#include "plugin.h"
#include <arpa/inet.h>
#include <net/if.h>
#include <sys/socket.h>
#include <netdb.h>
#include <poll.h>
#include <jansson.h>
#include "../debug.h"
#include "../apierror.h"
#include "../config.h"
#include "../mutex.h"
#include "../record.h"
#include "../rtp.h"
#include "../rtpsrtp.h"
#include "../rtcp.h"
#include "../ip-utils.h"
#include "../sdp-utils.h"
#include "../utils.h"
Include dependency graph for janus_nosip.c:

Data Structures

struct  janus_nosip_message
 
struct  janus_nosip_media
 
struct  janus_nosip_session
 

Macros

#define JANUS_NOSIP_VERSION   1
 
#define JANUS_NOSIP_VERSION_STRING   "0.0.1"
 
#define JANUS_NOSIP_DESCRIPTION   "This is a simple RTP bridging plugin that leaves signalling details (e.g., SIP) up to the application."
 
#define JANUS_NOSIP_NAME   "JANUS NoSIP plugin"
 
#define JANUS_NOSIP_AUTHOR   "Meetecho s.r.l."
 
#define JANUS_NOSIP_PACKAGE   "janus.plugin.nosip"
 
#define JANUS_NOSIP_ERROR_UNKNOWN_ERROR   499
 
#define JANUS_NOSIP_ERROR_NO_MESSAGE   440
 
#define JANUS_NOSIP_ERROR_INVALID_JSON   441
 
#define JANUS_NOSIP_ERROR_INVALID_REQUEST   442
 
#define JANUS_NOSIP_ERROR_MISSING_ELEMENT   443
 
#define JANUS_NOSIP_ERROR_INVALID_ELEMENT   444
 
#define JANUS_NOSIP_ERROR_WRONG_STATE   445
 
#define JANUS_NOSIP_ERROR_MISSING_SDP   446
 
#define JANUS_NOSIP_ERROR_INVALID_SDP   447
 
#define JANUS_NOSIP_ERROR_IO_ERROR   448
 
#define JANUS_NOSIP_ERROR_RECORDING_ERROR   449
 
#define JANUS_NOSIP_ERROR_TOO_STRICT   450
 

Typedefs

typedef struct janus_nosip_message janus_nosip_message
 
typedef struct janus_nosip_media janus_nosip_media
 
typedef struct janus_nosip_session janus_nosip_session
 

Functions

janus_plugincreate (void)
 
int janus_nosip_init (janus_callbacks *callback, const char *config_path)
 
void janus_nosip_destroy (void)
 
int janus_nosip_get_api_compatibility (void)
 
int janus_nosip_get_version (void)
 
const char * janus_nosip_get_version_string (void)
 
const char * janus_nosip_get_description (void)
 
const char * janus_nosip_get_name (void)
 
const char * janus_nosip_get_author (void)
 
const char * janus_nosip_get_package (void)
 
void janus_nosip_create_session (janus_plugin_session *handle, int *error)
 
struct janus_plugin_resultjanus_nosip_handle_message (janus_plugin_session *handle, char *transaction, json_t *message, json_t *jsep)
 
void janus_nosip_setup_media (janus_plugin_session *handle)
 
void janus_nosip_incoming_rtp (janus_plugin_session *handle, int video, char *buf, int len)
 
void janus_nosip_incoming_rtcp (janus_plugin_session *handle, int video, char *buf, int len)
 
void janus_nosip_hangup_media (janus_plugin_session *handle)
 
void janus_nosip_destroy_session (janus_plugin_session *handle, int *error)
 
json_tjanus_nosip_query_session (janus_plugin_session *handle)
 
void janus_nosip_sdp_process (janus_nosip_session *session, janus_sdp *sdp, gboolean answer, gboolean update, gboolean *changed)
 
char * janus_nosip_sdp_manipulate (janus_nosip_session *session, janus_sdp *sdp, gboolean answer)
 

Detailed Description

Janus NoSIP plugin.

Author
Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om

This is quite a basic plugin, as it only takes care of acting as an RTP bridge. It is named "NoSIP" since, as the name suggests, signalling takes no place here, and is entirely up to the application. The typical usage of this application is something like this:

  1. a WebRTC application handles signalling on its own (e.g., SIP), but needs to interact with a peer that doesn't support WebRTC (DTLS/ICE);
  2. it creates a handle with the NoSIP plugin, creates a JSEP SDP offer, and passes it to the plugin;
  3. the plugin creates a barebone SDP that can be used to communicate with the legacy peer, binds to the ports for RTP/RTCP, and sends this plain SDP back to the application;
  4. the application uses this barebone SDP in its signalling, and expects an answer from the peer;
  5. the SDP answer from the peer will be barebone as well, and so unfit for WebRTC usage; as such, the application passes it to the plugin as the answer to match the offer created before;
  6. the plugin matches the answer to the offer, and starts exchanging RTP/RTCP with the legacy peer: media coming from the peer is relayed via WebRTC to the application, and WebRTC stuff coming from the application is relayed via plain RTP/RTCP to the legacy peer.

The same behaviour can be followed if the application is the callee instead, with the only difference being that the barebone offer will come from the peer in this case, and the application will ask the NoSIP plugin for a barebone answer instead.

As you can see, the behaviour is pretty much the same as the SIP plugin, with the key difference being that in this case there's no SIP stack in the plugin itself. All signalling is left to the application, and Janus (via the NoSIP plugin) is only responsible for bridging the media. This might be more appropriate than the SIP plugin in cases where developers want to keep control on the signalling layer, while still involving a gateway of sorts. Of course, SIP is just an example here: other signalling protocols may be involved as well (e.g., IAX, XMPP, others). The NoSIP plugin, though, will generate and expect plain SDP, so you'll need to take care of any adaptation that may be needed to make this work with the signalling protocol of your choice.

Actual API docs: TBD.

plugins

Macro Definition Documentation

◆ JANUS_NOSIP_AUTHOR

#define JANUS_NOSIP_AUTHOR   "Meetecho s.r.l."

◆ JANUS_NOSIP_DESCRIPTION

#define JANUS_NOSIP_DESCRIPTION   "This is a simple RTP bridging plugin that leaves signalling details (e.g., SIP) up to the application."

◆ JANUS_NOSIP_ERROR_INVALID_ELEMENT

#define JANUS_NOSIP_ERROR_INVALID_ELEMENT   444

◆ JANUS_NOSIP_ERROR_INVALID_JSON

#define JANUS_NOSIP_ERROR_INVALID_JSON   441

◆ JANUS_NOSIP_ERROR_INVALID_REQUEST

#define JANUS_NOSIP_ERROR_INVALID_REQUEST   442

◆ JANUS_NOSIP_ERROR_INVALID_SDP

#define JANUS_NOSIP_ERROR_INVALID_SDP   447

◆ JANUS_NOSIP_ERROR_IO_ERROR

#define JANUS_NOSIP_ERROR_IO_ERROR   448

◆ JANUS_NOSIP_ERROR_MISSING_ELEMENT

#define JANUS_NOSIP_ERROR_MISSING_ELEMENT   443

◆ JANUS_NOSIP_ERROR_MISSING_SDP

#define JANUS_NOSIP_ERROR_MISSING_SDP   446

◆ JANUS_NOSIP_ERROR_NO_MESSAGE

#define JANUS_NOSIP_ERROR_NO_MESSAGE   440

◆ JANUS_NOSIP_ERROR_RECORDING_ERROR

#define JANUS_NOSIP_ERROR_RECORDING_ERROR   449

◆ JANUS_NOSIP_ERROR_TOO_STRICT

#define JANUS_NOSIP_ERROR_TOO_STRICT   450

◆ JANUS_NOSIP_ERROR_UNKNOWN_ERROR

#define JANUS_NOSIP_ERROR_UNKNOWN_ERROR   499

◆ JANUS_NOSIP_ERROR_WRONG_STATE

#define JANUS_NOSIP_ERROR_WRONG_STATE   445

◆ JANUS_NOSIP_NAME

#define JANUS_NOSIP_NAME   "JANUS NoSIP plugin"

◆ JANUS_NOSIP_PACKAGE

#define JANUS_NOSIP_PACKAGE   "janus.plugin.nosip"

◆ JANUS_NOSIP_VERSION

#define JANUS_NOSIP_VERSION   1

◆ JANUS_NOSIP_VERSION_STRING

#define JANUS_NOSIP_VERSION_STRING   "0.0.1"

Typedef Documentation

◆ janus_nosip_media

◆ janus_nosip_message

◆ janus_nosip_session

Function Documentation

◆ create()

janus_plugin* create ( void  )

◆ janus_nosip_create_session()

void janus_nosip_create_session ( janus_plugin_session handle,
int *  error 
)

◆ janus_nosip_destroy()

void janus_nosip_destroy ( void  )

◆ janus_nosip_destroy_session()

void janus_nosip_destroy_session ( janus_plugin_session handle,
int *  error 
)

◆ janus_nosip_get_api_compatibility()

int janus_nosip_get_api_compatibility ( void  )

◆ janus_nosip_get_author()

const char * janus_nosip_get_author ( void  )

◆ janus_nosip_get_description()

const char * janus_nosip_get_description ( void  )

◆ janus_nosip_get_name()

const char * janus_nosip_get_name ( void  )

◆ janus_nosip_get_package()

const char * janus_nosip_get_package ( void  )

◆ janus_nosip_get_version()

int janus_nosip_get_version ( void  )

◆ janus_nosip_get_version_string()

const char * janus_nosip_get_version_string ( void  )

◆ janus_nosip_handle_message()

struct janus_plugin_result * janus_nosip_handle_message ( janus_plugin_session handle,
char *  transaction,
json_t message,
json_t jsep 
)

◆ janus_nosip_hangup_media()

void janus_nosip_hangup_media ( janus_plugin_session handle)

◆ janus_nosip_incoming_rtcp()

void janus_nosip_incoming_rtcp ( janus_plugin_session handle,
int  video,
char *  buf,
int  len 
)

◆ janus_nosip_incoming_rtp()

void janus_nosip_incoming_rtp ( janus_plugin_session handle,
int  video,
char *  buf,
int  len 
)

◆ janus_nosip_init()

int janus_nosip_init ( janus_callbacks callback,
const char *  config_path 
)

◆ janus_nosip_query_session()

json_t * janus_nosip_query_session ( janus_plugin_session handle)

◆ janus_nosip_sdp_manipulate()

char * janus_nosip_sdp_manipulate ( janus_nosip_session session,
janus_sdp sdp,
gboolean  answer 
)

◆ janus_nosip_sdp_process()

void janus_nosip_sdp_process ( janus_nosip_session session,
janus_sdp sdp,
gboolean  answer,
gboolean  update,
gboolean *  changed 
)

◆ janus_nosip_setup_media()

void janus_nosip_setup_media ( janus_plugin_session handle)