Fork me on GitHub
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
janus_sip.c File Reference

Janus SIP plugin. More...

#include "plugin.h"
#include <arpa/inet.h>
#include <net/if.h>
#include <jansson.h>
#include <sofia-sip/msg_header.h>
#include <sofia-sip/nua.h>
#include <sofia-sip/sdp.h>
#include <sofia-sip/sip_status.h>
#include <sofia-sip/url.h>
#include <sofia-sip/tport_tag.h>
#include <sofia-sip/su_log.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 "../sdp-utils.h"
#include "../utils.h"
#include "../ip-utils.h"
Include dependency graph for janus_sip.c:

Data Structures

struct  janus_sip_message
 
struct  janus_sip_account
 
struct  janus_sip_media
 
struct  janus_sip_session
 
struct  ssip_s
 
struct  janus_sip_uri_t
 

Macros

#define JANUS_SIP_VERSION   7
 
#define JANUS_SIP_VERSION_STRING   "0.0.7"
 
#define JANUS_SIP_DESCRIPTION   "This is a simple SIP plugin for Janus, allowing WebRTC peers to register at a SIP server and call SIP user agents through a Janus instance."
 
#define JANUS_SIP_NAME   "JANUS SIP plugin"
 
#define JANUS_SIP_AUTHOR   "Meetecho s.r.l."
 
#define JANUS_SIP_PACKAGE   "janus.plugin.sip"
 
#define JANUS_DEFAULT_REGISTER_TTL   3600
 
#define SU_ROOT_MAGIC_T   ssip_t
 
#define NUA_MAGIC_T   ssip_t
 
#define NUA_HMAGIC_T   ssip_oper_t
 
#define JANUS_SIP_URI_MAXLEN   1024
 
#define JANUS_SIP_ERROR_UNKNOWN_ERROR   499
 
#define JANUS_SIP_ERROR_NO_MESSAGE   440
 
#define JANUS_SIP_ERROR_INVALID_JSON   441
 
#define JANUS_SIP_ERROR_INVALID_REQUEST   442
 
#define JANUS_SIP_ERROR_MISSING_ELEMENT   443
 
#define JANUS_SIP_ERROR_INVALID_ELEMENT   444
 
#define JANUS_SIP_ERROR_ALREADY_REGISTERED   445
 
#define JANUS_SIP_ERROR_INVALID_ADDRESS   446
 
#define JANUS_SIP_ERROR_WRONG_STATE   447
 
#define JANUS_SIP_ERROR_MISSING_SDP   448
 
#define JANUS_SIP_ERROR_LIBSOFIA_ERROR   449
 
#define JANUS_SIP_ERROR_IO_ERROR   450
 
#define JANUS_SIP_ERROR_RECORDING_ERROR   451
 
#define JANUS_SIP_ERROR_TOO_STRICT   452
 

Typedefs

typedef struct janus_sip_message janus_sip_message
 
typedef struct ssip_s ssip_t
 
typedef struct ssip_oper_s ssip_oper_t
 
typedef struct janus_sip_account janus_sip_account
 
typedef struct janus_sip_media janus_sip_media
 
typedef struct janus_sip_session janus_sip_session
 

Enumerations

enum  janus_sip_registration_status {
  janus_sip_registration_status_disabled = -2, janus_sip_registration_status_failed = -1, janus_sip_registration_status_unregistered = 0, janus_sip_registration_status_registering,
  janus_sip_registration_status_registered, janus_sip_registration_status_unregistering
}
 
enum  janus_sip_call_status {
  janus_sip_call_status_idle = 0, janus_sip_call_status_inviting, janus_sip_call_status_invited, janus_sip_call_status_incall,
  janus_sip_call_status_closing
}
 
enum  janus_sip_secret_type { janus_sip_secret_type_plaintext = 1, janus_sip_secret_type_hashed = 2, janus_sip_secret_type_unknown }
 

Functions

janus_plugincreate (void)
 
int janus_sip_init (janus_callbacks *callback, const char *config_path)
 
void janus_sip_destroy (void)
 
int janus_sip_get_api_compatibility (void)
 
int janus_sip_get_version (void)
 
const char * janus_sip_get_version_string (void)
 
const char * janus_sip_get_description (void)
 
const char * janus_sip_get_name (void)
 
const char * janus_sip_get_author (void)
 
const char * janus_sip_get_package (void)
 
void janus_sip_create_session (janus_plugin_session *handle, int *error)
 
struct janus_plugin_resultjanus_sip_handle_message (janus_plugin_session *handle, char *transaction, json_t *message, json_t *jsep)
 
void janus_sip_setup_media (janus_plugin_session *handle)
 
void janus_sip_incoming_rtp (janus_plugin_session *handle, int video, char *buf, int len)
 
void janus_sip_incoming_rtcp (janus_plugin_session *handle, int video, char *buf, int len)
 
void janus_sip_hangup_media (janus_plugin_session *handle)
 
void janus_sip_destroy_session (janus_plugin_session *handle, int *error)
 
json_tjanus_sip_query_session (janus_plugin_session *handle)
 
gpointer janus_sip_sofia_thread (gpointer user_data)
 
void janus_sip_sofia_callback (nua_event_t event, int status, char const *phrase, nua_t *nua, nua_magic_t *magic, nua_handle_t *nh, nua_hmagic_t *hmagic, sip_t const *sip, tagi_t tags[])
 
void janus_sip_sdp_process (janus_sip_session *session, janus_sdp *sdp, gboolean answer, gboolean update, gboolean *changed)
 
char * janus_sip_sdp_manipulate (janus_sip_session *session, janus_sdp *sdp, gboolean answer)
 

Variables

char sofia_log [2048]
 
char call_id [255]
 
gboolean skip = FALSE
 
gboolean started = FALSE
 
gboolean append = FALSE
 

Detailed Description

Janus SIP plugin.

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

Check the SIP plugin documentation for more details.

Plugins

Macro Definition Documentation

#define JANUS_DEFAULT_REGISTER_TTL   3600
#define JANUS_SIP_AUTHOR   "Meetecho s.r.l."
#define JANUS_SIP_DESCRIPTION   "This is a simple SIP plugin for Janus, allowing WebRTC peers to register at a SIP server and call SIP user agents through a Janus instance."
#define JANUS_SIP_ERROR_ALREADY_REGISTERED   445
#define JANUS_SIP_ERROR_INVALID_ADDRESS   446
#define JANUS_SIP_ERROR_INVALID_ELEMENT   444
#define JANUS_SIP_ERROR_INVALID_JSON   441
#define JANUS_SIP_ERROR_INVALID_REQUEST   442
#define JANUS_SIP_ERROR_IO_ERROR   450
#define JANUS_SIP_ERROR_LIBSOFIA_ERROR   449
#define JANUS_SIP_ERROR_MISSING_ELEMENT   443
#define JANUS_SIP_ERROR_MISSING_SDP   448
#define JANUS_SIP_ERROR_NO_MESSAGE   440
#define JANUS_SIP_ERROR_RECORDING_ERROR   451
#define JANUS_SIP_ERROR_TOO_STRICT   452
#define JANUS_SIP_ERROR_UNKNOWN_ERROR   499
#define JANUS_SIP_ERROR_WRONG_STATE   447
#define JANUS_SIP_NAME   "JANUS SIP plugin"
#define JANUS_SIP_PACKAGE   "janus.plugin.sip"
#define JANUS_SIP_URI_MAXLEN   1024
#define JANUS_SIP_VERSION   7
#define JANUS_SIP_VERSION_STRING   "0.0.7"
#define NUA_HMAGIC_T   ssip_oper_t
#define NUA_MAGIC_T   ssip_t
#define SU_ROOT_MAGIC_T   ssip_t

Typedef Documentation

typedef struct ssip_oper_s ssip_oper_t
typedef struct ssip_s ssip_t

Enumeration Type Documentation

Enumerator
janus_sip_call_status_idle 
janus_sip_call_status_inviting 
janus_sip_call_status_invited 
janus_sip_call_status_incall 
janus_sip_call_status_closing 
Enumerator
janus_sip_registration_status_disabled 
janus_sip_registration_status_failed 
janus_sip_registration_status_unregistered 
janus_sip_registration_status_registering 
janus_sip_registration_status_registered 
janus_sip_registration_status_unregistering 
Enumerator
janus_sip_secret_type_plaintext 
janus_sip_secret_type_hashed 
janus_sip_secret_type_unknown 

Function Documentation

janus_plugin* create ( void  )
void janus_sip_create_session ( janus_plugin_session handle,
int *  error 
)
void janus_sip_destroy ( void  )
void janus_sip_destroy_session ( janus_plugin_session handle,
int *  error 
)
int janus_sip_get_api_compatibility ( void  )
const char * janus_sip_get_author ( void  )
const char * janus_sip_get_description ( void  )
const char * janus_sip_get_name ( void  )
const char * janus_sip_get_package ( void  )
int janus_sip_get_version ( void  )
const char * janus_sip_get_version_string ( void  )
struct janus_plugin_result * janus_sip_handle_message ( janus_plugin_session handle,
char *  transaction,
json_t message,
json_t jsep 
)
void janus_sip_hangup_media ( janus_plugin_session handle)
void janus_sip_incoming_rtcp ( janus_plugin_session handle,
int  video,
char *  buf,
int  len 
)
void janus_sip_incoming_rtp ( janus_plugin_session handle,
int  video,
char *  buf,
int  len 
)
int janus_sip_init ( janus_callbacks callback,
const char *  config_path 
)
json_t * janus_sip_query_session ( janus_plugin_session handle)
char * janus_sip_sdp_manipulate ( janus_sip_session session,
janus_sdp sdp,
gboolean  answer 
)
void janus_sip_sdp_process ( janus_sip_session session,
janus_sdp sdp,
gboolean  answer,
gboolean  update,
gboolean *  changed 
)
void janus_sip_setup_media ( janus_plugin_session handle)
void janus_sip_sofia_callback ( nua_event_t  event,
int  status,
char const *  phrase,
nua_t *  nua,
nua_magic_t *  magic,
nua_handle_t *  nh,
nua_hmagic_t *  hmagic,
sip_t const *  sip,
tagi_t  tags[] 
)
gpointer janus_sip_sofia_thread ( gpointer  user_data)

Variable Documentation

gboolean append = FALSE
char call_id[255]
gboolean skip = FALSE
char sofia_log[2048]
gboolean started = FALSE