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

Janus SIPre plugin (libre) 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 <re_types.h>
#include <re_fmt.h>
#include <re_mbuf.h>
#include <re_msg.h>
#include <re_list.h>
#include <re_sa.h>
#include <re_main.h>
#include <re_mem.h>
#include <re_mqueue.h>
#include <re_sdp.h>
#include <re_uri.h>
#include <re_sip.h>
#include <re_sipreg.h>
#include <re_sipsess.h>
#include <re_srtp.h>
#include <re_tmr.h>
#include <re_tls.h>
#include <re_dns.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_sipre.c:

Data Structures

struct  janus_sipre_message
 
struct  janus_sipre_mqueue_payload
 
struct  janus_sipre_account
 
struct  janus_sipre_stack
 
struct  janus_sipre_media
 
struct  janus_sipre_session
 

Macros

#define JANUS_SIPRE_VERSION   1
 
#define JANUS_SIPRE_VERSION_STRING   "0.0.1"
 
#define JANUS_SIPRE_DESCRIPTION   "This is a simple SIP plugin for Janus (based on libre instead of Sofia), allowing WebRTC peers to register at a SIP server and call SIP user agents through a Janus instance."
 
#define JANUS_SIPRE_NAME   "JANUS SIPre plugin"
 
#define JANUS_SIPRE_AUTHOR   "Meetecho s.r.l."
 
#define JANUS_SIPRE_PACKAGE   "janus.plugin.sipre"
 
#define JANUS_DEFAULT_REGISTER_TTL   3600
 
#define JANUS_SIPRE_ERROR_UNKNOWN_ERROR   499
 
#define JANUS_SIPRE_ERROR_NO_MESSAGE   440
 
#define JANUS_SIPRE_ERROR_INVALID_JSON   441
 
#define JANUS_SIPRE_ERROR_INVALID_REQUEST   442
 
#define JANUS_SIPRE_ERROR_MISSING_ELEMENT   443
 
#define JANUS_SIPRE_ERROR_INVALID_ELEMENT   444
 
#define JANUS_SIPRE_ERROR_ALREADY_REGISTERED   445
 
#define JANUS_SIPRE_ERROR_INVALID_ADDRESS   446
 
#define JANUS_SIPRE_ERROR_WRONG_STATE   447
 
#define JANUS_SIPRE_ERROR_MISSING_SDP   448
 
#define JANUS_SIPRE_ERROR_LIBRE_ERROR   449
 
#define JANUS_SIPRE_ERROR_IO_ERROR   450
 
#define JANUS_SIPRE_ERROR_RECORDING_ERROR   451
 
#define JANUS_SIPRE_ERROR_TOO_STRICT   452
 

Typedefs

typedef struct janus_sipre_message janus_sipre_message
 
typedef enum janus_sipre_mqueue_event janus_sipre_mqueue_event
 
typedef struct janus_sipre_session janus_sipre_session
 
typedef struct janus_sipre_mqueue_payload janus_sipre_mqueue_payload
 
typedef struct janus_sipre_account janus_sipre_account
 
typedef struct janus_sipre_stack janus_sipre_stack
 
typedef struct janus_sipre_media janus_sipre_media
 

Enumerations

enum  janus_sipre_mqueue_event {
  janus_sipre_mqueue_event_do_init, janus_sipre_mqueue_event_do_register, janus_sipre_mqueue_event_do_unregister, janus_sipre_mqueue_event_do_call,
  janus_sipre_mqueue_event_do_accept, janus_sipre_mqueue_event_do_rcode, janus_sipre_mqueue_event_do_update, janus_sipre_mqueue_event_do_info,
  janus_sipre_mqueue_event_do_message, janus_sipre_mqueue_event_do_bye, janus_sipre_mqueue_event_do_close, janus_sipre_mqueue_event_do_destroy,
  janus_sipre_mqueue_event_do_exit
}
 
enum  janus_sipre_registration_status {
  janus_sipre_registration_status_disabled = -2, janus_sipre_registration_status_failed = -1, janus_sipre_registration_status_unregistered = 0, janus_sipre_registration_status_registering,
  janus_sipre_registration_status_registered, janus_sipre_registration_status_unregistering
}
 
enum  janus_sipre_call_status {
  janus_sipre_call_status_idle = 0, janus_sipre_call_status_inviting, janus_sipre_call_status_invited, janus_sipre_call_status_incall,
  janus_sipre_call_status_closing
}
 
enum  janus_sipre_secret_type { janus_sipre_secret_type_plaintext = 1, janus_sipre_secret_type_hashed = 2, janus_sipre_secret_type_unknown }
 

Functions

janus_plugincreate (void)
 
int janus_sipre_init (janus_callbacks *callback, const char *config_path)
 
void janus_sipre_destroy (void)
 
int janus_sipre_get_api_compatibility (void)
 
int janus_sipre_get_version (void)
 
const char * janus_sipre_get_version_string (void)
 
const char * janus_sipre_get_description (void)
 
const char * janus_sipre_get_name (void)
 
const char * janus_sipre_get_author (void)
 
const char * janus_sipre_get_package (void)
 
void janus_sipre_create_session (janus_plugin_session *handle, int *error)
 
struct janus_plugin_resultjanus_sipre_handle_message (janus_plugin_session *handle, char *transaction, json_t *message, json_t *jsep)
 
void janus_sipre_setup_media (janus_plugin_session *handle)
 
void janus_sipre_incoming_rtp (janus_plugin_session *handle, int video, char *buf, int len)
 
void janus_sipre_incoming_rtcp (janus_plugin_session *handle, int video, char *buf, int len)
 
void janus_sipre_hangup_media (janus_plugin_session *handle)
 
void janus_sipre_destroy_session (janus_plugin_session *handle, int *error)
 
json_tjanus_sipre_query_session (janus_plugin_session *handle)
 
void janus_sipre_mqueue_handler (int id, void *data, void *arg)
 
gpointer janus_sipre_stack_thread (gpointer user_data)
 
int janus_sipre_cb_auth (char **user, char **pass, const char *realm, void *arg)
 
void janus_sipre_cb_register (int err, const struct sip_msg *msg, void *arg)
 
void janus_sipre_cb_progress (const struct sip_msg *msg, void *arg)
 
void janus_sipre_cb_incoming (const struct sip_msg *msg, void *arg)
 
int janus_sipre_cb_offer (struct mbuf **mbp, const struct sip_msg *msg, void *arg)
 
int janus_sipre_cb_answer (const struct sip_msg *msg, void *arg)
 
void janus_sipre_cb_established (const struct sip_msg *msg, void *arg)
 
void janus_sipre_cb_info (struct sip *sip, const struct sip_msg *msg, void *arg)
 
void janus_sipre_cb_closed (int err, const struct sip_msg *msg, void *arg)
 
void janus_sipre_cb_exit (void *arg)
 
void janus_sipre_sdp_process (janus_sipre_session *session, janus_sdp *sdp, gboolean answer, gboolean update, gboolean *changed)
 
char * janus_sipre_sdp_manipulate (janus_sipre_session *session, janus_sdp *sdp, gboolean answer)
 

Variables

GThread * sipstack_thread = NULL
 

Detailed Description

Janus SIPre plugin (libre)

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

Check the SIPre plugin documentation for more details.

Plugins

Macro Definition Documentation

#define JANUS_DEFAULT_REGISTER_TTL   3600
#define JANUS_SIPRE_AUTHOR   "Meetecho s.r.l."
#define JANUS_SIPRE_DESCRIPTION   "This is a simple SIP plugin for Janus (based on libre instead of Sofia), allowing WebRTC peers to register at a SIP server and call SIP user agents through a Janus instance."
#define JANUS_SIPRE_ERROR_ALREADY_REGISTERED   445
#define JANUS_SIPRE_ERROR_INVALID_ADDRESS   446
#define JANUS_SIPRE_ERROR_INVALID_ELEMENT   444
#define JANUS_SIPRE_ERROR_INVALID_JSON   441
#define JANUS_SIPRE_ERROR_INVALID_REQUEST   442
#define JANUS_SIPRE_ERROR_IO_ERROR   450
#define JANUS_SIPRE_ERROR_LIBRE_ERROR   449
#define JANUS_SIPRE_ERROR_MISSING_ELEMENT   443
#define JANUS_SIPRE_ERROR_MISSING_SDP   448
#define JANUS_SIPRE_ERROR_NO_MESSAGE   440
#define JANUS_SIPRE_ERROR_RECORDING_ERROR   451
#define JANUS_SIPRE_ERROR_TOO_STRICT   452
#define JANUS_SIPRE_ERROR_UNKNOWN_ERROR   499
#define JANUS_SIPRE_ERROR_WRONG_STATE   447
#define JANUS_SIPRE_NAME   "JANUS SIPre plugin"
#define JANUS_SIPRE_PACKAGE   "janus.plugin.sipre"
#define JANUS_SIPRE_VERSION   1
#define JANUS_SIPRE_VERSION_STRING   "0.0.1"

Typedef Documentation

Enumeration Type Documentation

Enumerator
janus_sipre_call_status_idle 
janus_sipre_call_status_inviting 
janus_sipre_call_status_invited 
janus_sipre_call_status_incall 
janus_sipre_call_status_closing 
Enumerator
janus_sipre_mqueue_event_do_init 
janus_sipre_mqueue_event_do_register 
janus_sipre_mqueue_event_do_unregister 
janus_sipre_mqueue_event_do_call 
janus_sipre_mqueue_event_do_accept 
janus_sipre_mqueue_event_do_rcode 
janus_sipre_mqueue_event_do_update 
janus_sipre_mqueue_event_do_info 
janus_sipre_mqueue_event_do_message 
janus_sipre_mqueue_event_do_bye 
janus_sipre_mqueue_event_do_close 
janus_sipre_mqueue_event_do_destroy 
janus_sipre_mqueue_event_do_exit 
Enumerator
janus_sipre_registration_status_disabled 
janus_sipre_registration_status_failed 
janus_sipre_registration_status_unregistered 
janus_sipre_registration_status_registering 
janus_sipre_registration_status_registered 
janus_sipre_registration_status_unregistering 
Enumerator
janus_sipre_secret_type_plaintext 
janus_sipre_secret_type_hashed 
janus_sipre_secret_type_unknown 

Function Documentation

janus_plugin* create ( void  )
int janus_sipre_cb_answer ( const struct sip_msg *  msg,
void *  arg 
)
int janus_sipre_cb_auth ( char **  user,
char **  pass,
const char *  realm,
void *  arg 
)
void janus_sipre_cb_closed ( int  err,
const struct sip_msg *  msg,
void *  arg 
)
void janus_sipre_cb_established ( const struct sip_msg *  msg,
void *  arg 
)
void janus_sipre_cb_exit ( void *  arg)
void janus_sipre_cb_incoming ( const struct sip_msg *  msg,
void *  arg 
)
void janus_sipre_cb_info ( struct sip *  sip,
const struct sip_msg *  msg,
void *  arg 
)
int janus_sipre_cb_offer ( struct mbuf **  mbp,
const struct sip_msg *  msg,
void *  arg 
)
void janus_sipre_cb_progress ( const struct sip_msg *  msg,
void *  arg 
)
void janus_sipre_cb_register ( int  err,
const struct sip_msg *  msg,
void *  arg 
)
void janus_sipre_create_session ( janus_plugin_session handle,
int *  error 
)
void janus_sipre_destroy ( void  )
void janus_sipre_destroy_session ( janus_plugin_session handle,
int *  error 
)
int janus_sipre_get_api_compatibility ( void  )
const char * janus_sipre_get_author ( void  )
const char * janus_sipre_get_description ( void  )
const char * janus_sipre_get_name ( void  )
const char * janus_sipre_get_package ( void  )
int janus_sipre_get_version ( void  )
const char * janus_sipre_get_version_string ( void  )
struct janus_plugin_result * janus_sipre_handle_message ( janus_plugin_session handle,
char *  transaction,
json_t message,
json_t jsep 
)
void janus_sipre_hangup_media ( janus_plugin_session handle)
void janus_sipre_incoming_rtcp ( janus_plugin_session handle,
int  video,
char *  buf,
int  len 
)
void janus_sipre_incoming_rtp ( janus_plugin_session handle,
int  video,
char *  buf,
int  len 
)
int janus_sipre_init ( janus_callbacks callback,
const char *  config_path 
)
void janus_sipre_mqueue_handler ( int  id,
void *  data,
void *  arg 
)
json_t * janus_sipre_query_session ( janus_plugin_session handle)
char * janus_sipre_sdp_manipulate ( janus_sipre_session session,
janus_sdp sdp,
gboolean  answer 
)
void janus_sipre_sdp_process ( janus_sipre_session session,
janus_sdp sdp,
gboolean  answer,
gboolean  update,
gboolean *  changed 
)
void janus_sipre_setup_media ( janus_plugin_session handle)
gpointer janus_sipre_stack_thread ( gpointer  user_data)

Variable Documentation

GThread* sipstack_thread = NULL