Add support for incoming call pre-cheking

This commit is contained in:
System Administrator 2018-09-06 21:08:02 +02:00
parent 6f6c31222d
commit e2f0f6156c
46 changed files with 4594 additions and 4492 deletions

0
CMakeLists.txt Normal file → Executable file
View File

View File

@ -473,6 +473,16 @@ int32_t MediaSessionMgr::defaultsGetNoiseSuppLevel()
return tmedia_defaults_get_noise_supp_level();
}
bool MediaSessionMgr::defaultsSetConditionalRingingEnabled(bool _cond_ringing_enabled)
{
return tmedia_defaults_set_conditional_ringing_enabled(_cond_ringing_enabled ? tsk_true : tsk_false) == 0;
}
bool MediaSessionMgr::defaultsGetConditionalRingingEnabled()
{
return !!tmedia_defaults_get_conditional_ringing_enabled();
}
bool MediaSessionMgr::defaultsSet100relEnabled(bool _100rel_enabled)
{
return tmedia_defaults_set_100rel_enabled(_100rel_enabled ? tsk_true : tsk_false) == 0;
@ -480,7 +490,7 @@ bool MediaSessionMgr::defaultsSet100relEnabled(bool _100rel_enabled)
bool MediaSessionMgr::defaultsGet100relEnabled()
{
return tmedia_defaults_get_100rel_enabled() == 0;
return !!tmedia_defaults_get_100rel_enabled();
}
bool MediaSessionMgr::defaultsSetScreenSize(int32_t sx, int32_t sy)
@ -662,4 +672,4 @@ bool MediaSessionMgr::defaultsSetOpusMaxPlaybackRate(uint32_t opus_maxplaybackra
bool MediaSessionMgr::defaultsSetMaxFds(int32_t max_fds)
{
return (tmedia_defaults_set_max_fds(max_fds) == 0);
}
}

View File

@ -197,6 +197,8 @@ public:
static bool defaultsGetNoiseSuppEnabled();
static bool defaultsSetNoiseSuppLevel(int32_t noise_supp_level);
static int32_t defaultsGetNoiseSuppLevel();
static bool defaultsSetConditionalRingingEnabled(bool _cond_ringing_enabled);
static bool defaultsGetConditionalRingingEnabled();
static bool defaultsSet100relEnabled(bool _100rel_enabled);
static bool defaultsGet100relEnabled();
static bool defaultsSetScreenSize(int32_t sx, int32_t sy);

View File

@ -103,6 +103,7 @@ tsip_event_type_t;
#define tsip_event_code_dialog_request_outgoing 802
#define tsip_event_code_dialog_request_cancelled 803
#define tsip_event_code_dialog_request_sent 804
#define tsip_event_code_dialog_request_prechecking 805
// 9xx ==> Informational
#define tsip_event_code_dialog_connecting 900

0
bindings/vs_android/tinyWRAP.sln Normal file → Executable file
View File

0
bindings/vs_android/tinyWRAP.vcxproj Normal file → Executable file
View File

0
bindings/vs_android/tinyWRAP.vcxproj.filters Normal file → Executable file
View File

0
tinyBFCP/vs_android/tinyBFCP.vcxproj Normal file → Executable file
View File

0
tinyBFCP/vs_android/tinyBFCP.vcxproj.filters Normal file → Executable file
View File

0
tinyDAV/vs_android/tinyDAV.vcxproj Normal file → Executable file
View File

0
tinyDAV/vs_android/tinyDAV.vcxproj.filters Normal file → Executable file
View File

0
tinyHTTP/vs_android/tinyHTTP.vcxproj Normal file → Executable file
View File

0
tinyHTTP/vs_android/tinyHTTP.vcxproj.filters Normal file → Executable file
View File

0
tinyIPSec/vs_android/tinyIPSec.vcxproj Normal file → Executable file
View File

0
tinyIPSec/vs_android/tinyIPSec.vcxproj.filters Normal file → Executable file
View File

View File

@ -69,6 +69,8 @@ TINYMEDIA_API int tmedia_defaults_set_noise_supp_enabled(tsk_bool_t noise_supp_e
TINYMEDIA_API tsk_bool_t tmedia_defaults_get_noise_supp_enabled();
TINYMEDIA_API int tmedia_defaults_set_noise_supp_level(int32_t noise_supp_level);
TINYMEDIA_API int32_t tmedia_defaults_get_noise_supp_level();
TINYMEDIA_API int tmedia_defaults_set_conditional_ringing_enabled(tsk_bool_t _cond_ringing_enabled);
TINYMEDIA_API tsk_bool_t tmedia_defaults_get_conditional_ringing_enabled();
TINYMEDIA_API int tmedia_defaults_set_100rel_enabled(tsk_bool_t _100rel_enabled);
TINYMEDIA_API tsk_bool_t tmedia_defaults_get_100rel_enabled();
TINYMEDIA_API int tmedia_defaults_set_screen_size(int32_t sx, int32_t sy);

View File

@ -49,6 +49,7 @@ static float __agc_level = 8000.0f;
static tsk_bool_t __vad_enabled = tsk_false;
static tsk_bool_t __noise_supp_enabled = tsk_true;
static int32_t __noise_supp_level = -30;
static tsk_bool_t __cond_ringing_enabled = tsk_false; // Whether to let the user decide if sending ringing is needed or not -> If enabled then, the state machine will hang on "PreChecking" state until "accept" request is received from the end-user
static tsk_bool_t __100rel_enabled = tsk_true;
static int32_t __sx = -1;
static int32_t __sy = -1;
@ -333,6 +334,16 @@ int32_t tmedia_defaults_get_noise_supp_level()
return __noise_supp_level;
}
int tmedia_defaults_set_conditional_ringing_enabled(tsk_bool_t _cond_ringing_enabled)
{
__cond_ringing_enabled = _cond_ringing_enabled;
return 0;
}
tsk_bool_t tmedia_defaults_get_conditional_ringing_enabled()
{
return __cond_ringing_enabled;
}
int tmedia_defaults_set_100rel_enabled(tsk_bool_t _100rel_enabled)
{
__100rel_enabled = _100rel_enabled;

0
tinyMEDIA/vs_android/tinyMEDIA.vcxproj Normal file → Executable file
View File

0
tinyMEDIA/vs_android/tinyMEDIA.vcxproj.filters Normal file → Executable file
View File

0
tinyMSRP/vs_android/tinyMSRP.vcxproj Normal file → Executable file
View File

0
tinyMSRP/vs_android/tinyMSRP.vcxproj.filters Normal file → Executable file
View File

0
tinyNET/vs_android/tinyNET.vcxproj Normal file → Executable file
View File

0
tinyNET/vs_android/tinyNET.vcxproj.filters Normal file → Executable file
View File

0
tinyRTP/vs_android/tinyRTP.vcxproj Normal file → Executable file
View File

0
tinyRTP/vs_android/tinyRTP.vcxproj.filters Normal file → Executable file
View File

0
tinySAK/vs_android/tinySAK.vcxproj Normal file → Executable file
View File

0
tinySAK/vs_android/tinySAK.vcxproj.filters Normal file → Executable file
View File

0
tinySDP/vs_android/tinySDP.vcxproj Normal file → Executable file
View File

0
tinySDP/vs_android/tinySDP.vcxproj.filters Normal file → Executable file
View File

0
tinySIGCOMP/vs_android/tinySIGCOMP.vcxproj Normal file → Executable file
View File

0
tinySIGCOMP/vs_android/tinySIGCOMP.vcxproj.filters Normal file → Executable file
View File

View File

@ -1,129 +1,130 @@
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_api_invite.h
* @brief Public messaging (INVITE) functions.
*
* @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
*/
#ifndef TINYSIP_TSIP_INVITE_H
#define TINYSIP_TSIP_INVITE_H
#include "tinysip_config.h"
#include "tinysip/tsip_event.h"
#include "tinymedia/tmedia_common.h"
TSIP_BEGIN_DECLS
#define TSIP_INVITE_EVENT(self) ((tsip_invite_event_t*)(self))
//@tinyWRAP
typedef enum tsip_invite_event_type_e {
// ============================
// Sip Events
//
tsip_i_newcall,
//! in-dialog requests/reponses
tsip_i_request,
tsip_ao_request,
/* 3GPP TS 24.629: Explicit Call Transfer (ECT) */
tsip_o_ect_trying,
tsip_o_ect_accepted,
tsip_o_ect_completed,
tsip_o_ect_failed,
tsip_o_ect_notify,
tsip_i_ect_requested,
tsip_i_ect_newcall,
tsip_i_ect_completed,
tsip_i_ect_failed,
tsip_i_ect_notify,
// ============================
// Media Events
//
tsip_m_early_media,
tsip_m_updating, // Trying to update from Audio -> Video for example
tsip_m_updated, // succeed to update
/* 3GPP TS 24.610: Communication Hold */
tsip_m_local_hold_ok,
tsip_m_local_hold_nok,
tsip_m_local_resume_ok,
tsip_m_local_resume_nok,
tsip_m_remote_hold,
tsip_m_remote_resume,
}
tsip_invite_event_type_t;
typedef struct tsip_invite_event_e {
TSIP_DECLARE_EVENT;
tsip_invite_event_type_t type;
struct {
unsigned toto:1;
} av;
/*struct{
char* dir;
} msrp;*/
}
tsip_invite_event_t;
int tsip_invite_event_signal(tsip_invite_event_type_t type, tsip_ssession_handle_t* ss, short status_code, const char *phrase, const struct tsip_message_s* sipmessage);
TINYSIP_API int tsip_api_invite_send_invite(const tsip_ssession_handle_t *ss, tmedia_type_t type, ...);
TINYSIP_API int tsip_api_invite_send_info(const tsip_ssession_handle_t *ss, ...);
TINYSIP_API int tsip_api_invite_send_hold(const tsip_ssession_handle_t *ss, tmedia_type_t type, ...);
TINYSIP_API int tsip_api_invite_send_resume(const tsip_ssession_handle_t *ss, tmedia_type_t type, ...);
TINYSIP_API int tsip_api_invite_send_large_message(const tsip_ssession_handle_t *ss, ...);
TINYSIP_API int tsip_api_invite_send_ect(const tsip_ssession_handle_t *ss, const char* toUri, ...);
TINYSIP_API int tsip_api_invite_send_ect_accept(const tsip_ssession_handle_t *ss, ...);
TINYSIP_API int tsip_api_invite_send_ect_reject(const tsip_ssession_handle_t *ss, ...);
TINYSIP_API int tsip_api_invite_send_sos(const tsip_ssession_handle_t *ss, ...);
TINYSIP_API int tsip_api_invite_send_dtmf(const tsip_ssession_handle_t *ss, int event, ...);
TINYSIP_API int tsip_api_invite_send_bye(const tsip_ssession_handle_t *ss, ...);
TINYSIP_GEXTERN const tsk_object_def_t *tsip_invite_event_def_t;
#if 1 // Backward Compatibility
# define tsip_action_INVITE tsip_api_invite_send_invite
# define tsip_action_HOLD tsip_api_invite_send_hold
# define tsip_action_RESUME tsip_api_invite_send_resume
# define tsip_action_LARGE_MESSAGE tsip_api_invite_send_large_message
# define tsip_action_ECT tsip_api_invite_send_ect
# define tsip_action_SOS tsip_api_invite_send_sos
# define tsip_action_DTMF tsip_api_invite_send_dtmf
# define tsip_action_BYE tsip_api_invite_send_bye
#endif
TSIP_END_DECLS
#endif /* TINYSIP_TSIP_INVITE_H */
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_api_invite.h
* @brief Public messaging (INVITE) functions.
*
* @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
*/
#ifndef TINYSIP_TSIP_INVITE_H
#define TINYSIP_TSIP_INVITE_H
#include "tinysip_config.h"
#include "tinysip/tsip_event.h"
#include "tinymedia/tmedia_common.h"
TSIP_BEGIN_DECLS
#define TSIP_INVITE_EVENT(self) ((tsip_invite_event_t*)(self))
//@tinyWRAP
typedef enum tsip_invite_event_type_e {
// ============================
// Sip Events
//
tsip_i_newcall,
tsip_i_prechecking,
//! in-dialog requests/reponses
tsip_i_request,
tsip_ao_request,
/* 3GPP TS 24.629: Explicit Call Transfer (ECT) */
tsip_o_ect_trying,
tsip_o_ect_accepted,
tsip_o_ect_completed,
tsip_o_ect_failed,
tsip_o_ect_notify,
tsip_i_ect_requested,
tsip_i_ect_newcall,
tsip_i_ect_completed,
tsip_i_ect_failed,
tsip_i_ect_notify,
// ============================
// Media Events
//
tsip_m_early_media,
tsip_m_updating, // Trying to update from Audio -> Video for example
tsip_m_updated, // succeed to update
/* 3GPP TS 24.610: Communication Hold */
tsip_m_local_hold_ok,
tsip_m_local_hold_nok,
tsip_m_local_resume_ok,
tsip_m_local_resume_nok,
tsip_m_remote_hold,
tsip_m_remote_resume,
}
tsip_invite_event_type_t;
typedef struct tsip_invite_event_e {
TSIP_DECLARE_EVENT;
tsip_invite_event_type_t type;
struct {
unsigned toto:1;
} av;
/*struct{
char* dir;
} msrp;*/
}
tsip_invite_event_t;
int tsip_invite_event_signal(tsip_invite_event_type_t type, tsip_ssession_handle_t* ss, short status_code, const char *phrase, const struct tsip_message_s* sipmessage);
TINYSIP_API int tsip_api_invite_send_invite(const tsip_ssession_handle_t *ss, tmedia_type_t type, ...);
TINYSIP_API int tsip_api_invite_send_info(const tsip_ssession_handle_t *ss, ...);
TINYSIP_API int tsip_api_invite_send_hold(const tsip_ssession_handle_t *ss, tmedia_type_t type, ...);
TINYSIP_API int tsip_api_invite_send_resume(const tsip_ssession_handle_t *ss, tmedia_type_t type, ...);
TINYSIP_API int tsip_api_invite_send_large_message(const tsip_ssession_handle_t *ss, ...);
TINYSIP_API int tsip_api_invite_send_ect(const tsip_ssession_handle_t *ss, const char* toUri, ...);
TINYSIP_API int tsip_api_invite_send_ect_accept(const tsip_ssession_handle_t *ss, ...);
TINYSIP_API int tsip_api_invite_send_ect_reject(const tsip_ssession_handle_t *ss, ...);
TINYSIP_API int tsip_api_invite_send_sos(const tsip_ssession_handle_t *ss, ...);
TINYSIP_API int tsip_api_invite_send_dtmf(const tsip_ssession_handle_t *ss, int event, ...);
TINYSIP_API int tsip_api_invite_send_bye(const tsip_ssession_handle_t *ss, ...);
TINYSIP_GEXTERN const tsk_object_def_t *tsip_invite_event_def_t;
#if 1 // Backward Compatibility
# define tsip_action_INVITE tsip_api_invite_send_invite
# define tsip_action_HOLD tsip_api_invite_send_hold
# define tsip_action_RESUME tsip_api_invite_send_resume
# define tsip_action_LARGE_MESSAGE tsip_api_invite_send_large_message
# define tsip_action_ECT tsip_api_invite_send_ect
# define tsip_action_SOS tsip_api_invite_send_sos
# define tsip_action_DTMF tsip_api_invite_send_dtmf
# define tsip_action_BYE tsip_api_invite_send_bye
#endif
TSIP_END_DECLS
#endif /* TINYSIP_TSIP_INVITE_H */

View File

@ -1,120 +1,121 @@
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_dialog_invite.common.h
* @brief SIP dialog INVITE (common variables).
*
* @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
*/
#ifndef TINYSIP_DIALOG_INVITE_COMMON_H
#define TINYSIP_DIALOG_INVITE_COMMON_H
#include "tinysip/api/tsip_api_invite.h"
#define DEBUG_STATE_MACHINE 1
#define TSIP_DIALOG_INVITE_SIGNAL(self, type, code, phrase, message) \
tsip_invite_event_signal(type, TSIP_DIALOG(self)->ss, code, phrase, message)
#define TSIP_DIALOG_INVITE_TIMER_SCHEDULE(TX) TSIP_DIALOG_TIMER_SCHEDULE(invite, TX)
#define TSIP_DIALOG_INVITE_ICE_CONNCHECK_TIMEOUT 16000
/* ======================== actions ======================== */
typedef enum _fsm_action_e {
_fsm_action_accept = tsip_atype_accept,
_fsm_action_reject = tsip_atype_hangup,
_fsm_action_dtmf_send = tsip_atype_dtmf_send,
_fsm_action_msrp_send_msg = tsip_atype_lmessage,
_fsm_action_oINVITE = tsip_atype_invite,
_fsm_action_oCANCEL = tsip_atype_cancel,
_fsm_action_oHold = tsip_atype_hold,
_fsm_action_oResume = tsip_atype_resume,
_fsm_action_oECT = tsip_atype_ect,
_fsm_action_iECT_ACCEPT = tsip_atype_ect_accept,
_fsm_action_iECT_REJECT = tsip_atype_ect_reject,
_fsm_action_iECT_lNOTIFY = tsip_atype_ect_lnotify,
_fsm_action_oINFO = tsip_atype_info_send,
_fsm_action_oBYE = tsip_atype_hangup,
_fsm_action_oShutdown = tsip_atype_shutdown,
_fsm_action_transporterror = tsip_atype_transport_error,
_fsm_action_iINVITE = 0xFF,
_fsm_action_oUPDATE,
_fsm_action_iUPDATE,
_fsm_action_iCANCEL,
_fsm_action_iPRACK,
_fsm_action_oPRACK,
_fsm_action_iACK,
_fsm_action_oACK,
_fsm_action_iOPTIONS,
_fsm_action_oOPTIONS,
_fsm_action_iBYE,
_fsm_action_iREFER,
_fsm_action_iINFO,
_fsm_action_iNOTIFY,
_fsm_action_timer100rel,
_fsm_action_timerRefresh,
_fsm_action_timerRSVP,
_fsm_action_i1xx,
_fsm_action_i2xx,
_fsm_action_i300_to_i699,
_fsm_action_i401_i407,
_fsm_action_i422,
_fsm_action_shutdown_timedout, /* Any -> Terminated */
_fsm_action_error,
}
_fsm_action_t;
/* ======================== states ======================== */
typedef enum _fsm_state_e {
_fsm_state_Started,
_fsm_state_Outgoing,
_fsm_state_Incoming,
_fsm_state_Trying,
_fsm_state_Ringing,
_fsm_state_Cancelling,
_fsm_state_InProgress,
_fsm_state_Holding,
_fsm_state_Resuming,
_fsm_state_oECTing,
_fsm_state_iECTing,
_fsm_state_iECTreq,
_fsm_state_Connected,
_fsm_state_Terminated
}
_fsm_state_t;
#define send_INVITE(self, force_sdp) send_INVITEorUPDATE(self, tsk_true, force_sdp)
#define send_UPDATE(self, force_sdp) send_INVITEorUPDATE(self, tsk_false, force_sdp)
#else
#error "This file must only be included in a source(.c or .cxx)"
#endif /* TINYSIP_DIALOG_INVITE_COMMON_H */
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_dialog_invite.common.h
* @brief SIP dialog INVITE (common variables).
*
* @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
*/
#ifndef TINYSIP_DIALOG_INVITE_COMMON_H
#define TINYSIP_DIALOG_INVITE_COMMON_H
#include "tinysip/api/tsip_api_invite.h"
#define DEBUG_STATE_MACHINE 1
#define TSIP_DIALOG_INVITE_SIGNAL(self, type, code, phrase, message) \
tsip_invite_event_signal(type, TSIP_DIALOG(self)->ss, code, phrase, message)
#define TSIP_DIALOG_INVITE_TIMER_SCHEDULE(TX) TSIP_DIALOG_TIMER_SCHEDULE(invite, TX)
#define TSIP_DIALOG_INVITE_ICE_CONNCHECK_TIMEOUT 16000
/* ======================== actions ======================== */
typedef enum _fsm_action_e {
_fsm_action_accept = tsip_atype_accept,
_fsm_action_reject = tsip_atype_hangup,
_fsm_action_dtmf_send = tsip_atype_dtmf_send,
_fsm_action_msrp_send_msg = tsip_atype_lmessage,
_fsm_action_oINVITE = tsip_atype_invite,
_fsm_action_oCANCEL = tsip_atype_cancel,
_fsm_action_oHold = tsip_atype_hold,
_fsm_action_oResume = tsip_atype_resume,
_fsm_action_oECT = tsip_atype_ect,
_fsm_action_iECT_ACCEPT = tsip_atype_ect_accept,
_fsm_action_iECT_REJECT = tsip_atype_ect_reject,
_fsm_action_iECT_lNOTIFY = tsip_atype_ect_lnotify,
_fsm_action_oINFO = tsip_atype_info_send,
_fsm_action_oBYE = tsip_atype_hangup,
_fsm_action_oShutdown = tsip_atype_shutdown,
_fsm_action_transporterror = tsip_atype_transport_error,
_fsm_action_iINVITE = 0xFF,
_fsm_action_oUPDATE,
_fsm_action_iUPDATE,
_fsm_action_iCANCEL,
_fsm_action_iPRACK,
_fsm_action_oPRACK,
_fsm_action_iACK,
_fsm_action_oACK,
_fsm_action_iOPTIONS,
_fsm_action_oOPTIONS,
_fsm_action_iBYE,
_fsm_action_iREFER,
_fsm_action_iINFO,
_fsm_action_iNOTIFY,
_fsm_action_timer100rel,
_fsm_action_timerRefresh,
_fsm_action_timerRSVP,
_fsm_action_i1xx,
_fsm_action_i2xx,
_fsm_action_i300_to_i699,
_fsm_action_i401_i407,
_fsm_action_i422,
_fsm_action_shutdown_timedout, /* Any -> Terminated */
_fsm_action_error,
}
_fsm_action_t;
/* ======================== states ======================== */
typedef enum _fsm_state_e {
_fsm_state_Started,
_fsm_state_Outgoing,
_fsm_state_Incoming,
_fsm_state_PreChecking,
_fsm_state_Trying,
_fsm_state_Ringing,
_fsm_state_Cancelling,
_fsm_state_InProgress,
_fsm_state_Holding,
_fsm_state_Resuming,
_fsm_state_oECTing,
_fsm_state_iECTing,
_fsm_state_iECTreq,
_fsm_state_Connected,
_fsm_state_Terminated
}
_fsm_state_t;
#define send_INVITE(self, force_sdp) send_INVITEorUPDATE(self, tsk_true, force_sdp)
#define send_UPDATE(self, force_sdp) send_INVITEorUPDATE(self, tsk_false, force_sdp)
#else
#error "This file must only be included in a source(.c or .cxx)"
#endif /* TINYSIP_DIALOG_INVITE_COMMON_H */

View File

@ -1,127 +1,128 @@
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_dialog_invite.h
* @brief SIP dialog INVITE.
*
* @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
*/
#ifndef TINYSIP_DIALOG_INVITE_H
#define TINYSIP_DIALOG_INVITE_H
#include "tinysip_config.h"
#include "tinysip/dialogs/tsip_dialog.h"
#include "tinymedia/tmedia_session.h"
TSIP_BEGIN_DECLS
#define TSIP_DIALOG_INVITE(self) ((tsip_dialog_invite_t*)(self))
typedef struct tsip_dialog_invite {
TSIP_DECLARE_DIALOG;
tsk_bool_t support_update; /**< Indicates whether the remote party support UPDATE */
tsk_bool_t is_client;
tsk_bool_t is_transf;
tsk_bool_t refersub;
tsk_bool_t use_rtcp;
tsk_bool_t use_rtcpmux;
tsk_bool_t is_initial_iack_pending; // we're waiting for the initial incoming ACK (for the 200 OK) to ensure the session
tsk_bool_t is_cancelling; // whether we're cancelling the outgoing INVITE
uint32_t rseq;
uint32_t cseq_out_media_update; // CSeq for the last media update request (INVITE or UPDATE).
uint64_t last_out_fastupdate_time;
tsip_timer_t timershutdown;
tsip_timer_t timer100rel;
tsip_response_t* last_o1xxrel;
tsip_request_t* last_iInvite;
tsip_request_t* last_oInvite;
tsip_request_t* last_iRefer;
tmedia_session_mgr_t* msession_mgr; /**< Media session Manager */
struct tsip_ssession_s* ss_transf;
/* ICE */
struct {
tmedia_type_t media_type;
tsk_bool_t is_jingle;
tsk_bool_t start_smgr;
struct tnet_ice_ctx_s *ctx_audio;
struct tnet_ice_ctx_s *ctx_video;
tsk_fsm_action_id last_action_id;
tsip_action_t* last_action;
tsip_message_t* last_message;
int32_t last_sdp_ro_ver;
} ice;
/* Session Timers */
struct {
tsip_timer_t timer;
char* refresher;
uint64_t minse;
tsk_bool_t is_refresher;
} stimers;
/* QoS (Preconditions) */
struct {
tsip_timer_t timer;
enum tmedia_qos_stype_e type;
enum tmedia_qos_strength_e strength;
} qos;
/* Hold/Resume */
struct {
unsigned remote:1;
unsigned local:1;
} hold;
struct {
unsigned _100rel:1;
unsigned precondition:1;
unsigned timer:1;
unsigned norefersub:1;
unsigned ice:1;
} supported;
struct {
unsigned _100rel:1;
unsigned precondition:1;
unsigned timer:1;
unsigned norefersub;
unsigned ice:1;
} required;
}
tsip_dialog_invite_t;
tsip_dialog_invite_t* tsip_dialog_invite_create(const tsip_ssession_handle_t* ss, const char* call_id);
int tsip_dialog_invite_start(tsip_dialog_invite_t *self);
TINYSIP_GEXTERN const tsk_object_def_t *tsip_dialog_invite_def_t;
TSIP_END_DECLS
#endif /* TINYSIP_DIALOG_INVITE_H */
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_dialog_invite.h
* @brief SIP dialog INVITE.
*
* @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
*/
#ifndef TINYSIP_DIALOG_INVITE_H
#define TINYSIP_DIALOG_INVITE_H
#include "tinysip_config.h"
#include "tinysip/dialogs/tsip_dialog.h"
#include "tinymedia/tmedia_session.h"
TSIP_BEGIN_DECLS
#define TSIP_DIALOG_INVITE(self) ((tsip_dialog_invite_t*)(self))
typedef struct tsip_dialog_invite {
TSIP_DECLARE_DIALOG;
tsk_bool_t support_update; /**< Indicates whether the remote party support UPDATE */
tsk_bool_t is_client;
tsk_bool_t is_transf;
tsk_bool_t refersub;
tsk_bool_t use_rtcp;
tsk_bool_t use_rtcpmux;
tsk_bool_t is_initial_iack_pending; // we're waiting for the initial incoming ACK (for the 200 OK) to ensure the session
tsk_bool_t is_cancelling; // whether we're cancelling the outgoing INVITE
tsk_bool_t is_conditional_ringing_enabled; // whether to ask end-user before sending 18x ringing message
uint32_t rseq;
uint32_t cseq_out_media_update; // CSeq for the last media update request (INVITE or UPDATE).
uint64_t last_out_fastupdate_time;
tsip_timer_t timershutdown;
tsip_timer_t timer100rel;
tsip_response_t* last_o1xxrel;
tsip_request_t* last_iInvite;
tsip_request_t* last_oInvite;
tsip_request_t* last_iRefer;
tmedia_session_mgr_t* msession_mgr; /**< Media session Manager */
struct tsip_ssession_s* ss_transf;
/* ICE */
struct {
tmedia_type_t media_type;
tsk_bool_t is_jingle;
tsk_bool_t start_smgr;
struct tnet_ice_ctx_s *ctx_audio;
struct tnet_ice_ctx_s *ctx_video;
tsk_fsm_action_id last_action_id;
tsip_action_t* last_action;
tsip_message_t* last_message;
int32_t last_sdp_ro_ver;
} ice;
/* Session Timers */
struct {
tsip_timer_t timer;
char* refresher;
uint64_t minse;
tsk_bool_t is_refresher;
} stimers;
/* QoS (Preconditions) */
struct {
tsip_timer_t timer;
enum tmedia_qos_stype_e type;
enum tmedia_qos_strength_e strength;
} qos;
/* Hold/Resume */
struct {
unsigned remote:1;
unsigned local:1;
} hold;
struct {
unsigned _100rel:1;
unsigned precondition:1;
unsigned timer:1;
unsigned norefersub:1;
unsigned ice:1;
} supported;
struct {
unsigned _100rel:1;
unsigned precondition:1;
unsigned timer:1;
unsigned norefersub;
unsigned ice:1;
} required;
}
tsip_dialog_invite_t;
tsip_dialog_invite_t* tsip_dialog_invite_create(const tsip_ssession_handle_t* ss, const char* call_id);
int tsip_dialog_invite_start(tsip_dialog_invite_t *self);
TINYSIP_GEXTERN const tsk_object_def_t *tsip_dialog_invite_def_t;
TSIP_END_DECLS
#endif /* TINYSIP_DIALOG_INVITE_H */

View File

@ -1,168 +1,168 @@
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_action.h
* @brief SIP action.
*
* @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
*/
#ifndef TSIP_ACTION_H
#define TSIP_ACTION_H
#include "tinysip_config.h"
#include "tsk_buffer.h"
#include "tsk_options.h"
#include "tsk_params.h"
#include "tinymedia/tmedia_common.h"
#include "tinymedia/tmedia_params.h"
TSIP_BEGIN_DECLS
typedef uint64_t tsip_action_id_t;
#define TSIP_ACTION_INVALID_ID 0
#define TSIP_ACTION_INVALID_HANDLE tsk_null
/** List of all supported actions */
typedef enum tsip_action_type_e {
//! Used as configuration action
tsip_atype_config,
tsip_atype_dtmf_send,
/* === REGISTER == */
tsip_atype_register, /**< Sends SIP REGISTER request */
//! Unregister by sending SIP REGISTER request with expires value equals to zero
#define tsip_atype_unregister tsip_atype_hangup
/* === SUBSCRIBE === */
tsip_atype_subscribe, /**< Sends SIP SUBSCRIBE request */
//! Unsubsribe by sending SIP SUBSCRIBE request with expires value equals to zero
#define tsip_atype_unsubscribe tsip_atype_hangup
/* === MESSAGE === */
tsip_atype_message_send, /**< Sends SIP MESSAGE request */
/* === INFO === */
tsip_atype_info_send, /**< Sends SIP INFO request */
/* === PUBLISH === */
tsip_atype_publish, /**< Sends SIP PUBLISH request */
//! Unpublish by sending SIP PUBLISH request with expires value equals to zero
#define tsip_atype_unpublish tsip_atype_hangup
/* === OPTIONS === */
tsip_atype_options_send, /**< Sends SIP OPTIONS request */
/* === INVITE === */
tsip_atype_invite, /**< Sends SIP INVITE/reINVITE request */
tsip_atype_hold, /**< Puts the session on hold state */
tsip_atype_resume, /**< Resumes a previously held session */
tsip_atype_ect, /**< Transfer the call */
tsip_atype_ect_accept, /**< Accept call transfer request */
tsip_atype_ect_reject, /**< Reject call transfer request */
tsip_atype_ect_lnotify, /**< Intra-Dialog notify. Never called by the end-user */
tsip_atype_lmessage, /**< Large message (MSRP). The session must be connected */
#define tsip_atype_bye tsip_atype_hangup
/* === common === */
//! Accept incoming call (INVITE) or message (SIP MESSAGE)
tsip_atype_accept,
//! Reject incoming call (INVITE) or message (SIP MESSAGE)
#define tsip_atype_reject tsip_atype_hangup
//! Cancel an outgoing request
tsip_atype_cancel,
//! Hangup any SIP dialog (BYE, unREGISTER, unSUBSCRIBE ...). If the dialog is in early state, then it will be canceled.
tsip_atype_hangup,
//! Shutdown a SIP dialog. Should only be called by the stack.
tsip_atype_shutdown,
//! Signal transport error. Should only be called by the stack.
tsip_atype_transport_error,
}
tsip_action_type_t;
/* internal enum used to pass parameters from the application layer to the stack */
typedef enum tsip_action_param_type_e {
aptype_null = 0,
aptype_header,
aptype_config,
aptype_payload,
aptype_resp_line,
aptype_media_type,
aptype_media,
}
tsip_action_param_type_t;
#define TSIP_ACTION_SET_HEADER(NAME_STR, VALUE_STR) aptype_header, (const char*)NAME_STR, (const char*)VALUE_STR
#define TSIP_ACTION_SET_PAYLOAD(PAY_PTR, PAY_SIZE) aptype_payload, (const void*)PAY_PTR, (tsk_size_t)PAY_SIZE
#define TSIP_ACTION_SET_RESP_LINE(CODE_INT, PHRASE_STR) aptype_resp_line, (int32_t)CODE_INT, (const char*)PHRASE_STR
#define TSIP_ACTION_SET_CONFIG(ACTION_CONFIG_HANDLE) aptype_config, (const tsip_action_handle_t*)ACTION_CONFIG_HANDLE
#define TSIP_ACTION_SET_MEDIA_TYPE(TYPE_ENUM) aptype_media_type, (enum tmedia_type_e)TYPE_ENUM
#define TSIP_ACTION_SET_MEDIA(...) aptype_media, ##__VA_ARGS__
#define TSIP_ACTION_SET_NULL() aptype_null
/* private action object. public api should use tsip_action_handle_t. */
typedef struct tsip_action_s {
TSK_DECLARE_OBJECT;
tsip_action_type_t type;
tsk_params_L_t *headers;
tsk_buffer_t* payload;
struct {
short code;
char* phrase;
} line_resp;
struct {
tmedia_type_t type;
tmedia_params_L_t *params;
} media;
struct {
int volume; // useless (manager will always use "10")
int event;
} dtmf;
struct {
char* to;
} ect;
}
tsip_action_t;
/**< Handle to SIP action */
typedef void tsip_action_handle_t;
TINYSIP_API tsip_action_handle_t* tsip_action_create(tsip_action_type_t type, ...);
TINYSIP_API int tsip_action_set(tsip_action_handle_t* self, ...);
typedef tsk_list_t tsip_actions_L_t; /**< List of @ref tsip_action_handle_t elements. */
TINYSIP_GEXTERN const tsk_object_def_t *tsip_action_def_t;
TSIP_END_DECLS
#endif /* TSIP_ACTION_H */
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_action.h
* @brief SIP action.
*
* @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
*/
#ifndef TSIP_ACTION_H
#define TSIP_ACTION_H
#include "tinysip_config.h"
#include "tsk_buffer.h"
#include "tsk_options.h"
#include "tsk_params.h"
#include "tinymedia/tmedia_common.h"
#include "tinymedia/tmedia_params.h"
TSIP_BEGIN_DECLS
typedef uint64_t tsip_action_id_t;
#define TSIP_ACTION_INVALID_ID 0
#define TSIP_ACTION_INVALID_HANDLE tsk_null
/** List of all supported actions */
typedef enum tsip_action_type_e {
//! Used as configuration action
tsip_atype_config,
tsip_atype_dtmf_send,
/* === REGISTER == */
tsip_atype_register, /**< Sends SIP REGISTER request */
//! Unregister by sending SIP REGISTER request with expires value equals to zero
#define tsip_atype_unregister tsip_atype_hangup
/* === SUBSCRIBE === */
tsip_atype_subscribe, /**< Sends SIP SUBSCRIBE request */
//! Unsubsribe by sending SIP SUBSCRIBE request with expires value equals to zero
#define tsip_atype_unsubscribe tsip_atype_hangup
/* === MESSAGE === */
tsip_atype_message_send, /**< Sends SIP MESSAGE request */
/* === INFO === */
tsip_atype_info_send, /**< Sends SIP INFO request */
/* === PUBLISH === */
tsip_atype_publish, /**< Sends SIP PUBLISH request */
//! Unpublish by sending SIP PUBLISH request with expires value equals to zero
#define tsip_atype_unpublish tsip_atype_hangup
/* === OPTIONS === */
tsip_atype_options_send, /**< Sends SIP OPTIONS request */
/* === INVITE === */
tsip_atype_invite, /**< Sends SIP INVITE/reINVITE request */
tsip_atype_hold, /**< Puts the session on hold state */
tsip_atype_resume, /**< Resumes a previously held session */
tsip_atype_ect, /**< Transfer the call */
tsip_atype_ect_accept, /**< Accept call transfer request */
tsip_atype_ect_reject, /**< Reject call transfer request */
tsip_atype_ect_lnotify, /**< Intra-Dialog notify. Never called by the end-user */
tsip_atype_lmessage, /**< Large message (MSRP). The session must be connected */
#define tsip_atype_bye tsip_atype_hangup
/* === common === */
//! Accept incoming call (INVITE) or message (SIP MESSAGE)
tsip_atype_accept,
//! Reject incoming call (INVITE) or message (SIP MESSAGE)
#define tsip_atype_reject tsip_atype_hangup
//! Cancel an outgoing request
tsip_atype_cancel,
//! Hangup any SIP dialog (BYE, unREGISTER, unSUBSCRIBE ...). If the dialog is in early state, then it will be canceled.
tsip_atype_hangup,
//! Shutdown a SIP dialog. Should only be called by the stack.
tsip_atype_shutdown,
//! Signal transport error. Should only be called by the stack.
tsip_atype_transport_error,
}
tsip_action_type_t;
/* internal enum used to pass parameters from the application layer to the stack */
typedef enum tsip_action_param_type_e {
aptype_null = 0,
aptype_header,
aptype_config,
aptype_payload,
aptype_resp_line,
aptype_media_type,
aptype_media,
}
tsip_action_param_type_t;
#define TSIP_ACTION_SET_HEADER(NAME_STR, VALUE_STR) aptype_header, (const char*)NAME_STR, (const char*)VALUE_STR
#define TSIP_ACTION_SET_PAYLOAD(PAY_PTR, PAY_SIZE) aptype_payload, (const void*)PAY_PTR, (tsk_size_t)PAY_SIZE
#define TSIP_ACTION_SET_RESP_LINE(CODE_INT, PHRASE_STR) aptype_resp_line, (int32_t)CODE_INT, (const char*)PHRASE_STR
#define TSIP_ACTION_SET_CONFIG(ACTION_CONFIG_HANDLE) aptype_config, (const tsip_action_handle_t*)ACTION_CONFIG_HANDLE
#define TSIP_ACTION_SET_MEDIA_TYPE(TYPE_ENUM) aptype_media_type, (enum tmedia_type_e)TYPE_ENUM
#define TSIP_ACTION_SET_MEDIA(...) aptype_media, ##__VA_ARGS__
#define TSIP_ACTION_SET_NULL() aptype_null
/* private action object. public api should use tsip_action_handle_t. */
typedef struct tsip_action_s {
TSK_DECLARE_OBJECT;
tsip_action_type_t type;
tsk_params_L_t *headers;
tsk_buffer_t* payload;
struct {
short code;
char* phrase;
} line_resp;
struct {
tmedia_type_t type;
tmedia_params_L_t *params;
} media;
struct {
int volume; // useless (manager will always use "10")
int event;
} dtmf;
struct {
char* to;
} ect;
}
tsip_action_t;
/**< Handle to SIP action */
typedef void tsip_action_handle_t;
TINYSIP_API tsip_action_handle_t* tsip_action_create(tsip_action_type_t type, ...);
TINYSIP_API int tsip_action_set(tsip_action_handle_t* self, ...);
typedef tsk_list_t tsip_actions_L_t; /**< List of @ref tsip_action_handle_t elements. */
TINYSIP_GEXTERN const tsk_object_def_t *tsip_action_def_t;
TSIP_END_DECLS
#endif /* TSIP_ACTION_H */

View File

@ -1,111 +1,112 @@
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_event.h
* @brief SIP event.
*
* @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
*/
#ifndef TINYSIP_TSIP_EVENT_H
#define TINYSIP_TSIP_EVENT_H
#include "tinysip_config.h"
#include "tinysip/tsip_ssession.h"
TSIP_BEGIN_DECLS
#define TSIP_EVENT(self) ((tsip_event_t*)(self))
typedef enum tsip_event_type_e {
tsip_event_invite,
tsip_event_message,
tsip_event_info,
tsip_event_options,
tsip_event_publish,
tsip_event_register,
tsip_event_subscribe,
tsip_event_dialog,
tsip_event_stack,
}
tsip_event_type_t;
/* SIP codes associated to an internal event */
// 100-699 are reserved codes
// 7xx ==> errors @tinyWRAP
#define tsip_event_code_dialog_transport_error 702
#define tsip_event_code_dialog_global_error 703
#define tsip_event_code_dialog_message_error 704
// 8xx ==> success @tinyWRAP
#define tsip_event_code_dialog_request_incoming 800
#define tsip_event_code_dialog_request_outgoing 802
#define tsip_event_code_dialog_request_cancelled 803
#define tsip_event_code_dialog_request_sent 804
// 9xx ==> Informational @tinyWRAP
#define tsip_event_code_dialog_connecting 900
#define tsip_event_code_dialog_connected 901
#define tsip_event_code_dialog_terminating 902
#define tsip_event_code_dialog_terminated 903
#define tsip_event_code_stack_starting 950
#define tsip_event_code_stack_started 951
#define tsip_event_code_stack_stopping 952
#define tsip_event_code_stack_stopped 953
#define tsip_event_code_stack_failed_to_start 954
#define tsip_event_code_stack_failed_to_stop 955
#define tsip_event_code_stack_disconnected 956
typedef struct tsip_event_s {
TSK_DECLARE_OBJECT;
tsip_ssession_handle_t* ss;
short code;
char *phrase;
tsip_event_type_t type;
struct tsip_message_s *sipmessage;
//! copy of stack user data (needed by sessionless events)
const void* userdata;
}
tsip_event_t;
#define TSIP_DECLARE_EVENT tsip_event_t __sipevent__
TINYSIP_GEXTERN const tsk_object_def_t *tsip_event_def_t;
int tsip_event_init(tsip_event_t* self, tsip_ssession_t* ss, short code, const char *phrase, const struct tsip_message_s* sipmessage, tsip_event_type_t type);
int tsip_event_signal(tsip_event_type_t type, tsip_ssession_t* ss, short code, const char *phrase);
int tsip_event_signal_2(tsip_event_type_t type, tsip_ssession_t* ss, short code, const char *phrase, const struct tsip_message_s* sipmessage);
int tsip_event_deinit(tsip_event_t* self);
typedef int (*tsip_stack_callback_f)(const tsip_event_t *sipevent);
TSIP_END_DECLS
#endif /* TINYSIP_TSIP_EVENT_H */
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_event.h
* @brief SIP event.
*
* @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
*/
#ifndef TINYSIP_TSIP_EVENT_H
#define TINYSIP_TSIP_EVENT_H
#include "tinysip_config.h"
#include "tinysip/tsip_ssession.h"
TSIP_BEGIN_DECLS
#define TSIP_EVENT(self) ((tsip_event_t*)(self))
typedef enum tsip_event_type_e {
tsip_event_invite,
tsip_event_message,
tsip_event_info,
tsip_event_options,
tsip_event_publish,
tsip_event_register,
tsip_event_subscribe,
tsip_event_dialog,
tsip_event_stack,
}
tsip_event_type_t;
/* SIP codes associated to an internal event */
// 100-699 are reserved codes
// 7xx ==> errors @tinyWRAP
#define tsip_event_code_dialog_transport_error 702
#define tsip_event_code_dialog_global_error 703
#define tsip_event_code_dialog_message_error 704
// 8xx ==> success @tinyWRAP
#define tsip_event_code_dialog_request_incoming 800
#define tsip_event_code_dialog_request_outgoing 802
#define tsip_event_code_dialog_request_cancelled 803
#define tsip_event_code_dialog_request_sent 804
#define tsip_event_code_dialog_request_prechecking 805
// 9xx ==> Informational @tinyWRAP
#define tsip_event_code_dialog_connecting 900
#define tsip_event_code_dialog_connected 901
#define tsip_event_code_dialog_terminating 902
#define tsip_event_code_dialog_terminated 903
#define tsip_event_code_stack_starting 950
#define tsip_event_code_stack_started 951
#define tsip_event_code_stack_stopping 952
#define tsip_event_code_stack_stopped 953
#define tsip_event_code_stack_failed_to_start 954
#define tsip_event_code_stack_failed_to_stop 955
#define tsip_event_code_stack_disconnected 956
typedef struct tsip_event_s {
TSK_DECLARE_OBJECT;
tsip_ssession_handle_t* ss;
short code;
char *phrase;
tsip_event_type_t type;
struct tsip_message_s *sipmessage;
//! copy of stack user data (needed by sessionless events)
const void* userdata;
}
tsip_event_t;
#define TSIP_DECLARE_EVENT tsip_event_t __sipevent__
TINYSIP_GEXTERN const tsk_object_def_t *tsip_event_def_t;
int tsip_event_init(tsip_event_t* self, tsip_ssession_t* ss, short code, const char *phrase, const struct tsip_message_s* sipmessage, tsip_event_type_t type);
int tsip_event_signal(tsip_event_type_t type, tsip_ssession_t* ss, short code, const char *phrase);
int tsip_event_signal_2(tsip_event_type_t type, tsip_ssession_t* ss, short code, const char *phrase, const struct tsip_message_s* sipmessage);
int tsip_event_deinit(tsip_event_t* self);
typedef int (*tsip_stack_callback_f)(const tsip_event_t *sipevent);
TSIP_END_DECLS
#endif /* TINYSIP_TSIP_EVENT_H */

View File

@ -1,298 +1,299 @@
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_ssession.h
* @brief SIP ssession.
*
* @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
*/
#ifndef TSIP_SSESSION_H
#define TSIP_SSESSION_H
#include "tinysip_config.h"
#include "tinymedia/tmedia_common.h"
#include "tinymedia/tmedia_session.h"
#include "tsk_object.h"
#include "tsk_list.h"
#include "tsk_params.h"
#include "tsk_options.h"
TSIP_BEGIN_DECLS
// Forward declarations
struct tsip_message_s;
struct tsip_action_s;
typedef uint64_t tsip_ssession_id_t;
#define TSIP_SSESSION_INVALID_ID 0
#define TSIP_SSESSION_INVALID_HANDLE tsk_null
#if defined(DEBUG) || defined(_DEBUG)
# define TSIP_SSESSION_EXPIRES_DEFAULT 3600000 /* miliseconds. */
#else
# define TSIP_SSESSION_EXPIRES_DEFAULT 600000000
#endif
#define TSIP_SSESSION(self) ((tsip_ssession_t*)(self))
typedef enum tsip_ssession_param_type_e {
sstype_null = 0,
sstype_header,
sstype_caps,
sstype_userdata,
sstype_to_str,
sstype_from_str,
sstype_to_obj,
sstype_from_obj,
sstype_nocontact,
sstype_expires,
sstype_silent_hangup,
sstype_sigcomp_id,
sstype_auth_ha1,
sstype_auth_impi,
sstype_parent_id,
sstype_ws_src,
sstype_media
}
tsip_ssession_param_type_t;
#define TSIP_SSESSION_SET_PARENT_ID(PARENT_ID_SSID) sstype_parent_id, ((tsip_ssession_id_t)PARENT_ID_SSID)
#define TSIP_SSESSION_SET_HEADER(NAME_STR, VALUE_STR) sstype_header, (const char*)NAME_STR, (const char*)VALUE_STR
#define TSIP_SSESSION_UNSET_HEADER(NAME_STR) TSIP_SSESSION_SET_HEADER(NAME_STR, (const char*)-1)
#define TSIP_SSESSION_SET_CAPS(NAME_STR, VALUE_STR) sstype_caps, (const char*)NAME_STR, (const char*)VALUE_STR /* RFC 3840 */
#define TSIP_SSESSION_UNSET_CAPS(NAME_STR) TSIP_SSESSION_SET_CAPS(NAME_STR, (const char*)-1)
#define TSIP_SSESSION_SET_USERDATA(DATA_PTR) sstype_userdata, (const void*)DATA_PTR
#define TSIP_SSESSION_SET_TO_STR(URI_STR) sstype_to_str, (const char*)URI_STR
#define TSIP_SSESSION_SET_FROM_STR(URI_STR) sstype_from_str, (const char*)URI_STR
#define TSIP_SSESSION_SET_TO(URI_STR) TSIP_SSESSION_SET_TO_STR(URI_STR)
#define TSIP_SSESSION_SET_FROM(URI_STR) TSIP_SSESSION_SET_FROM_STR(URI_STR)
#define TSIP_SSESSION_SET_TO_OBJ(URI_OBJ) sstype_to_obj, (const tsip_uri_t*)URI_OBJ
#define TSIP_SSESSION_SET_FROM_OBJ(URI_OBJ) sstype_from_obj, (const tsip_uri_t*)URI_OBJ
#define TSIP_SSESSION_SET_NO_CONTACT(ENABLED_BOOL) sstype_nocontact, (tsk_bool_t)ENABLED_BOOL
#define TSIP_SSESSION_SET_EXPIRES(VALUE_UINT) sstype_expires, (unsigned)VALUE_UINT
#define TSIP_SSESSION_SET_SILENT_HANGUP(ENABLED_BOOL) sstype_silent_hangup, (tsk_bool_t)ENABLED_BOOL
#define TSIP_SSESSION_SET_SIGCOMP_COMPARTMENT(COMPARTMENT_ID_STR) sstype_sigcomp_id, (const char*)COMPARTMENT_ID_STR
#define TSIP_SSESSION_UNSET_SIGCOMP_COMPARTMENT() TSIP_SSESSION_SET_SIGCOMP_COMPARTMENT((const char*)-1)
#define TSIP_SSESSION_SET_AUTH_HA1(AUTH_HA1_STR) sstype_auth_ha1, (const char*)AUTH_HA1_STR
#define TSIP_SSESSION_SET_AUTH_IMPI(AUTH_IMPI_STR) sstype_auth_impi, (const char*)AUTH_IMPI_STR
#define TSIP_SSESSION_SET_WEBSOCKET_SRC(SRC_HOST_STR, SRC_PORT_INT, SRC_PROTO_STR) sstype_ws_src, (const char*)SRC_HOST_STR, (int32_t)SRC_PORT_INT, (const char*)SRC_PROTO_STR
#define TSIP_SSESSION_SET_MEDIA(...) sstype_media, ##__VA_ARGS__
#define TSIP_SSESSION_SET_NULL() sstype_null
typedef enum tsip_msession_param_type_e {
mstype_null = 0,
mstype_set_profile,
mstype_set_srtp_mode,
mstype_set_avpf_mode,
mstype_set_100rel,
mstype_set_rtcp,
mstype_set_rtcpmux,
mstype_set_ice,
mstype_set_ice_stun,
mstype_set_ice_turn,
mstype_set_stun_server,
mstype_set_stun_cred,
mstype_set_video_fps,
mstype_set_video_bw_up,
mstype_set_video_bw_down,
mstype_set_video_prefsize,
mstype_set_qos,
mstype_unset_qos,
mstype_set_timers,
mstype_unset_timers,
mstype_set_codecs,
mstype_set_bypass_encoding,
mstype_set_bypass_decoding,
mstype_set_rtp_ssrc,
mstype_set_msrp_cb
}
tsip_msession_param_type_t;
#define TSIP_MSESSION_SET_SRTP_MODE(SRTP_MODE_ENUM) mstype_set_srtp_mode, (tmedia_srtp_mode_t)SRTP_MODE_ENUM
#define TSIP_MSESSION_SET_AVPF_MODE(MEDIA_MODE_ENUM) mstype_set_avpf_mode, (tmedia_mode_t)MEDIA_MODE_ENUM
#define TSIP_MSESSION_SET_PROFILE(PROFILE_ENUM) mstype_set_srtp_mode, (tmedia_profile_t)PROFILE_ENUM
#define TSIP_MSESSION_SET_100rel(ENABLED_BOOL) mstype_set_100rel, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_SET_RTCP(ENABLED_BOOL) mstype_set_rtcp, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_SET_RTCPMUX(ENABLED_BOOL) mstype_set_rtcpmux, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_SET_ICE(ENABLED_BOOL) mstype_set_ice, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_SET_ICE_STUN(ENABLED_BOOL) mstype_set_ice_stun, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_SET_ICE_TURN(ENABLED_BOOL) mstype_set_ice_turn, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_SET_STUN_SERVER(HOSTNAME, PORT) mstype_set_stun_server, (const char*)HOSTNAME, (uint16_t)PORT
#define TSIP_MSESSION_SET_STUN_CRED(USERNAME, PASSWORD) mstype_set_stun_cred, (const char*)USERNAME, (const char*)PASSWORD
#define TSIP_MSESSION_SET_QOS(TYPE_ENUM, STRENGTH_ENUM) mstype_set_qos, (tmedia_qos_stype_t)TYPE_ENUM, (tmedia_qos_strength_t)STRENGTH_ENUM
#define TSIP_MSESSION_UNSET_QOS() mstype_unset_qos
#define TSIP_MSESSION_SET_VIDEO_FPS(FPS_INT) mstype_set_video_fps, (int32_t)FPS_INT
#define TSIP_MSESSION_SET_VIDEO_BW_UP(BW_INT) mstype_set_video_bw_up, (int32_t)(BW_INT)
#define TSIP_MSESSION_SET_VIDEO_BW_DOWN(BW_INT) mstype_set_video_bw_down, (int32_t)(BW_INT)
#define TSIP_MSESSION_SET_VIDEO_PREFSIZE(PREFSIZE_ENUM) mstype_set_video_prefsize, (int32_t)(PREFSIZE_ENUM)
#define TSIP_MSESSION_SET_TIMERS(TIMEOUT_UINT, REFRESHER_STR) mstype_set_timers, (unsigned)TIMEOUT_UINT, (const char*)REFRESHER_STR
#define TSIP_MSESSION_UNSET_TIMERS() mstype_unset_timers
#define TSIP_MSESSION_SET_CODECS(CODECS_INT) mstype_set_codecs, (signed)CODECS_INT
#define TSIP_MSESSION_SET_BYPASS_ENCODING(ENABLED_BOOL) mstype_set_bypass_encoding, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_UNSET_BYPASS_ENCODING() TSIP_MSESSION_SET_BYPASS_ENCODING(tsk_false)
#define TSIP_MSESSION_SET_BYPASS_DECODING(ENABLED_BOOL) mstype_set_bypass_decoding, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_SET_RTP_SSRC(MEDIA_ENUM, SSRC_UINT) mstype_set_rtp_ssrc, (tmedia_type_t)MEDIA_ENUM, (uint32_t)SSRC_UINT
#define TSIP_MSESSION_SET_RTP_SSRC_AUDIO(SSRC_UINT) TSIP_MSESSION_SET_RTP_SSRC(tmedia_audio, (SSRC_UINT))
#define TSIP_MSESSION_SET_RTP_SSRC_VIDEO(SSRC_UINT) TSIP_MSESSION_SET_RTP_SSRC(tmedia_video, (SSRC_UINT))
#define TSIP_MSESSION_UNSET_BYPASS_DECODING() TSIP_MSESSION_SET_BYPASS_DECODING(tsk_false)
#define TSIP_MSESSION_SET_MSRP_CB(TMEDIA_SESSION_MSRP_CB_F) mstype_set_msrp_cb, (tmedia_session_msrp_cb_f)TMEDIA_SESSION_MSRP_CB_F
#define TSIP_MSESSION_SET_NULL() mstype_null
typedef struct tsip_ssession_s {
TSK_DECLARE_OBJECT;
tsip_ssession_id_t id;
tsip_ssession_id_t id_parent; //for call transfer
unsigned owner:1;
const struct tsip_stack_s* stack;
const void* userdata;
//=======
// SIP
//=======
tsk_params_L_t *caps;
tsk_params_L_t *headers;
unsigned no_contact:1;
struct tsip_uri_s* from;
struct tsip_uri_s* to;
int64_t expires;
tsk_bool_t silent_hangup;
char* sigcomp_id;
char* auth_ha1;
char* auth_impi;
//=======
// WebSocket
//=======
struct {
// used when the stack is running in webrtc2sip mode to store the 'origin' (a.k.a 'src')
struct {
char* host;
tsk_istr_t port;
char* proto;
} src;
} ws;
//=======
// Media
//=======
struct {
tmedia_type_t type;
tmedia_profile_t profile;
tmedia_srtp_mode_t srtp_mode;
tmedia_mode_t avpf_mode;
tmedia_codec_id_t codecs;
tsk_bool_t bypass_encoding;
tsk_bool_t bypass_decoding;
/* Video */
int32_t video_fps;
int32_t video_bw_up;
int32_t video_bw_down;
tmedia_pref_video_size_t video_pref_size;
/* RTP*/
struct {
struct {
uint32_t audio;
uint32_t video;
} ssrc;
} rtp;
/* Session timers */
struct {
char* refresher;
unsigned timeout;
} timers;
/* QoS */
struct {
tmedia_qos_stype_t type;
tmedia_qos_strength_t strength;
} qos;
/* MSRP */
struct {
tmedia_session_msrp_cb_f callback;
} msrp;
/* STUN */
struct {
char* username;
char* password;
char* hostname;
uint16_t port;
} stun;
/* Features */
unsigned enable_100rel:1;
unsigned enable_ice:1;
unsigned enable_icestun:1;
unsigned enable_iceturn:1;
unsigned enable_rtcp:1;
unsigned enable_rtcpmux:1;
} media;
}
tsip_ssession_t;
/** A pointer to a SIP Session */
typedef void tsip_ssession_handle_t;
/** A pointer to a LTE/IMS stack */
typedef void tsip_stack_handle_t;
TINYSIP_API tsip_ssession_handle_t* tsip_ssession_create(tsip_stack_handle_t *stack, ...);
TINYSIP_API int tsip_ssession_set(tsip_ssession_handle_t *self, ...);
TINYSIP_API tsip_ssession_id_t tsip_ssession_get_id(const tsip_ssession_handle_t *self);
TINYSIP_API tsip_ssession_id_t tsip_ssession_get_id_parent(const tsip_ssession_handle_t *self);
TINYSIP_API int tsip_ssession_take_ownership(tsip_ssession_handle_t *self);
TINYSIP_API tsk_bool_t tsip_ssession_have_ownership(const tsip_ssession_handle_t *self);
TINYSIP_API int tsip_ssession_respond(const tsip_ssession_handle_t *self, short status, const char* phrase, const void* payload, tsk_size_t size, const struct tsip_message_s* request, ...);
TINYSIP_API const void* tsip_ssession_get_userdata(const tsip_ssession_handle_t *self);
TINYSIP_API tmedia_type_t tsip_ssession_get_mediatype(const tsip_ssession_handle_t *self);
TINYSIP_API tmedia_session_mgr_t* tsip_session_get_mediamgr(const tsip_ssession_handle_t *self);
TINYSIP_API const tsip_stack_handle_t* tsip_ssession_get_stack(const tsip_ssession_handle_t *self);
TINYSIP_API tmedia_codec_id_t tsip_ssession_get_codecs_neg(tsip_ssession_handle_t *self);
int tsip_ssession_handle(const tsip_ssession_t *self, const struct tsip_action_s* action);
typedef tsk_list_t tsip_ssessions_L_t; /**< List of @ref tsip_ssession_handle_t elements. */
TINYSIP_GEXTERN const tsk_object_def_t *tsip_ssession_def_t;
TSIP_END_DECLS
#endif /* TSIP_SSESSION_H */
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsip_ssession.h
* @brief SIP ssession.
*
* @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
*/
#ifndef TSIP_SSESSION_H
#define TSIP_SSESSION_H
#include "tinysip_config.h"
#include "tinymedia/tmedia_common.h"
#include "tinymedia/tmedia_session.h"
#include "tsk_object.h"
#include "tsk_list.h"
#include "tsk_params.h"
#include "tsk_options.h"
TSIP_BEGIN_DECLS
// Forward declarations
struct tsip_message_s;
struct tsip_action_s;
typedef uint64_t tsip_ssession_id_t;
#define TSIP_SSESSION_INVALID_ID 0
#define TSIP_SSESSION_INVALID_HANDLE tsk_null
#if defined(DEBUG) || defined(_DEBUG)
# define TSIP_SSESSION_EXPIRES_DEFAULT 3600000 /* miliseconds. */
#else
# define TSIP_SSESSION_EXPIRES_DEFAULT 600000000
#endif
#define TSIP_SSESSION(self) ((tsip_ssession_t*)(self))
typedef enum tsip_ssession_param_type_e {
sstype_null = 0,
sstype_header,
sstype_caps,
sstype_userdata,
sstype_to_str,
sstype_from_str,
sstype_to_obj,
sstype_from_obj,
sstype_nocontact,
sstype_expires,
sstype_silent_hangup,
sstype_sigcomp_id,
sstype_auth_ha1,
sstype_auth_impi,
sstype_parent_id,
sstype_ws_src,
sstype_media
}
tsip_ssession_param_type_t;
#define TSIP_SSESSION_SET_PARENT_ID(PARENT_ID_SSID) sstype_parent_id, ((tsip_ssession_id_t)PARENT_ID_SSID)
#define TSIP_SSESSION_SET_HEADER(NAME_STR, VALUE_STR) sstype_header, (const char*)NAME_STR, (const char*)VALUE_STR
#define TSIP_SSESSION_UNSET_HEADER(NAME_STR) TSIP_SSESSION_SET_HEADER(NAME_STR, (const char*)-1)
#define TSIP_SSESSION_SET_CAPS(NAME_STR, VALUE_STR) sstype_caps, (const char*)NAME_STR, (const char*)VALUE_STR /* RFC 3840 */
#define TSIP_SSESSION_UNSET_CAPS(NAME_STR) TSIP_SSESSION_SET_CAPS(NAME_STR, (const char*)-1)
#define TSIP_SSESSION_SET_USERDATA(DATA_PTR) sstype_userdata, (const void*)DATA_PTR
#define TSIP_SSESSION_SET_TO_STR(URI_STR) sstype_to_str, (const char*)URI_STR
#define TSIP_SSESSION_SET_FROM_STR(URI_STR) sstype_from_str, (const char*)URI_STR
#define TSIP_SSESSION_SET_TO(URI_STR) TSIP_SSESSION_SET_TO_STR(URI_STR)
#define TSIP_SSESSION_SET_FROM(URI_STR) TSIP_SSESSION_SET_FROM_STR(URI_STR)
#define TSIP_SSESSION_SET_TO_OBJ(URI_OBJ) sstype_to_obj, (const tsip_uri_t*)URI_OBJ
#define TSIP_SSESSION_SET_FROM_OBJ(URI_OBJ) sstype_from_obj, (const tsip_uri_t*)URI_OBJ
#define TSIP_SSESSION_SET_NO_CONTACT(ENABLED_BOOL) sstype_nocontact, (tsk_bool_t)ENABLED_BOOL
#define TSIP_SSESSION_SET_EXPIRES(VALUE_UINT) sstype_expires, (unsigned)VALUE_UINT
#define TSIP_SSESSION_SET_SILENT_HANGUP(ENABLED_BOOL) sstype_silent_hangup, (tsk_bool_t)ENABLED_BOOL
#define TSIP_SSESSION_SET_SIGCOMP_COMPARTMENT(COMPARTMENT_ID_STR) sstype_sigcomp_id, (const char*)COMPARTMENT_ID_STR
#define TSIP_SSESSION_UNSET_SIGCOMP_COMPARTMENT() TSIP_SSESSION_SET_SIGCOMP_COMPARTMENT((const char*)-1)
#define TSIP_SSESSION_SET_AUTH_HA1(AUTH_HA1_STR) sstype_auth_ha1, (const char*)AUTH_HA1_STR
#define TSIP_SSESSION_SET_AUTH_IMPI(AUTH_IMPI_STR) sstype_auth_impi, (const char*)AUTH_IMPI_STR
#define TSIP_SSESSION_SET_WEBSOCKET_SRC(SRC_HOST_STR, SRC_PORT_INT, SRC_PROTO_STR) sstype_ws_src, (const char*)SRC_HOST_STR, (int32_t)SRC_PORT_INT, (const char*)SRC_PROTO_STR
#define TSIP_SSESSION_SET_MEDIA(...) sstype_media, ##__VA_ARGS__
#define TSIP_SSESSION_SET_NULL() sstype_null
typedef enum tsip_msession_param_type_e {
mstype_null = 0,
mstype_set_profile,
mstype_set_srtp_mode,
mstype_set_avpf_mode,
mstype_set_100rel,
mstype_set_rtcp,
mstype_set_rtcpmux,
mstype_set_ice,
mstype_set_ice_stun,
mstype_set_ice_turn,
mstype_set_stun_server,
mstype_set_stun_cred,
mstype_set_video_fps,
mstype_set_video_bw_up,
mstype_set_video_bw_down,
mstype_set_video_prefsize,
mstype_set_qos,
mstype_unset_qos,
mstype_set_timers,
mstype_unset_timers,
mstype_set_codecs,
mstype_set_bypass_encoding,
mstype_set_bypass_decoding,
mstype_set_rtp_ssrc,
mstype_set_msrp_cb
}
tsip_msession_param_type_t;
#define TSIP_MSESSION_SET_SRTP_MODE(SRTP_MODE_ENUM) mstype_set_srtp_mode, (tmedia_srtp_mode_t)SRTP_MODE_ENUM
#define TSIP_MSESSION_SET_AVPF_MODE(MEDIA_MODE_ENUM) mstype_set_avpf_mode, (tmedia_mode_t)MEDIA_MODE_ENUM
#define TSIP_MSESSION_SET_PROFILE(PROFILE_ENUM) mstype_set_srtp_mode, (tmedia_profile_t)PROFILE_ENUM
#define TSIP_MSESSION_SET_100rel(ENABLED_BOOL) mstype_set_100rel, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_SET_RTCP(ENABLED_BOOL) mstype_set_rtcp, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_SET_RTCPMUX(ENABLED_BOOL) mstype_set_rtcpmux, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_SET_ICE(ENABLED_BOOL) mstype_set_ice, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_SET_ICE_STUN(ENABLED_BOOL) mstype_set_ice_stun, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_SET_ICE_TURN(ENABLED_BOOL) mstype_set_ice_turn, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_SET_STUN_SERVER(HOSTNAME, PORT) mstype_set_stun_server, (const char*)HOSTNAME, (uint16_t)PORT
#define TSIP_MSESSION_SET_STUN_CRED(USERNAME, PASSWORD) mstype_set_stun_cred, (const char*)USERNAME, (const char*)PASSWORD
#define TSIP_MSESSION_SET_QOS(TYPE_ENUM, STRENGTH_ENUM) mstype_set_qos, (tmedia_qos_stype_t)TYPE_ENUM, (tmedia_qos_strength_t)STRENGTH_ENUM
#define TSIP_MSESSION_UNSET_QOS() mstype_unset_qos
#define TSIP_MSESSION_SET_VIDEO_FPS(FPS_INT) mstype_set_video_fps, (int32_t)FPS_INT
#define TSIP_MSESSION_SET_VIDEO_BW_UP(BW_INT) mstype_set_video_bw_up, (int32_t)(BW_INT)
#define TSIP_MSESSION_SET_VIDEO_BW_DOWN(BW_INT) mstype_set_video_bw_down, (int32_t)(BW_INT)
#define TSIP_MSESSION_SET_VIDEO_PREFSIZE(PREFSIZE_ENUM) mstype_set_video_prefsize, (int32_t)(PREFSIZE_ENUM)
#define TSIP_MSESSION_SET_TIMERS(TIMEOUT_UINT, REFRESHER_STR) mstype_set_timers, (unsigned)TIMEOUT_UINT, (const char*)REFRESHER_STR
#define TSIP_MSESSION_UNSET_TIMERS() mstype_unset_timers
#define TSIP_MSESSION_SET_CODECS(CODECS_INT) mstype_set_codecs, (signed)CODECS_INT
#define TSIP_MSESSION_SET_BYPASS_ENCODING(ENABLED_BOOL) mstype_set_bypass_encoding, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_UNSET_BYPASS_ENCODING() TSIP_MSESSION_SET_BYPASS_ENCODING(tsk_false)
#define TSIP_MSESSION_SET_BYPASS_DECODING(ENABLED_BOOL) mstype_set_bypass_decoding, (tsk_bool_t)ENABLED_BOOL
#define TSIP_MSESSION_SET_RTP_SSRC(MEDIA_ENUM, SSRC_UINT) mstype_set_rtp_ssrc, (tmedia_type_t)MEDIA_ENUM, (uint32_t)SSRC_UINT
#define TSIP_MSESSION_SET_RTP_SSRC_AUDIO(SSRC_UINT) TSIP_MSESSION_SET_RTP_SSRC(tmedia_audio, (SSRC_UINT))
#define TSIP_MSESSION_SET_RTP_SSRC_VIDEO(SSRC_UINT) TSIP_MSESSION_SET_RTP_SSRC(tmedia_video, (SSRC_UINT))
#define TSIP_MSESSION_UNSET_BYPASS_DECODING() TSIP_MSESSION_SET_BYPASS_DECODING(tsk_false)
#define TSIP_MSESSION_SET_MSRP_CB(TMEDIA_SESSION_MSRP_CB_F) mstype_set_msrp_cb, (tmedia_session_msrp_cb_f)TMEDIA_SESSION_MSRP_CB_F
#define TSIP_MSESSION_SET_NULL() mstype_null
typedef struct tsip_ssession_s {
TSK_DECLARE_OBJECT;
tsip_ssession_id_t id;
tsip_ssession_id_t id_parent; //for call transfer
unsigned owner:1;
const struct tsip_stack_s* stack;
const void* userdata;
//=======
// SIP
//=======
tsk_params_L_t *caps;
tsk_params_L_t *headers;
unsigned no_contact:1;
struct tsip_uri_s* from;
struct tsip_uri_s* to;
int64_t expires;
tsk_bool_t silent_hangup;
char* sigcomp_id;
char* auth_ha1;
char* auth_impi;
//=======
// WebSocket
//=======
struct {
// used when the stack is running in webrtc2sip mode to store the 'origin' (a.k.a 'src')
struct {
char* host;
tsk_istr_t port;
char* proto;
} src;
} ws;
//=======
// Media
//=======
struct {
tmedia_type_t type;
tmedia_profile_t profile;
tmedia_srtp_mode_t srtp_mode;
tmedia_mode_t avpf_mode;
tmedia_codec_id_t codecs;
tsk_bool_t bypass_encoding;
tsk_bool_t bypass_decoding;
/* Video */
int32_t video_fps;
int32_t video_bw_up;
int32_t video_bw_down;
tmedia_pref_video_size_t video_pref_size;
/* RTP*/
struct {
struct {
uint32_t audio;
uint32_t video;
} ssrc;
} rtp;
/* Session timers */
struct {
char* refresher;
unsigned timeout;
} timers;
/* QoS */
struct {
tmedia_qos_stype_t type;
tmedia_qos_strength_t strength;
} qos;
/* MSRP */
struct {
tmedia_session_msrp_cb_f callback;
} msrp;
/* STUN */
struct {
char* username;
char* password;
char* hostname;
uint16_t port;
} stun;
/* Features */
unsigned enable_conditional_ringing:1;
unsigned enable_100rel:1;
unsigned enable_ice:1;
unsigned enable_icestun:1;
unsigned enable_iceturn:1;
unsigned enable_rtcp:1;
unsigned enable_rtcpmux:1;
} media;
}
tsip_ssession_t;
/** A pointer to a SIP Session */
typedef void tsip_ssession_handle_t;
/** A pointer to a LTE/IMS stack */
typedef void tsip_stack_handle_t;
TINYSIP_API tsip_ssession_handle_t* tsip_ssession_create(tsip_stack_handle_t *stack, ...);
TINYSIP_API int tsip_ssession_set(tsip_ssession_handle_t *self, ...);
TINYSIP_API tsip_ssession_id_t tsip_ssession_get_id(const tsip_ssession_handle_t *self);
TINYSIP_API tsip_ssession_id_t tsip_ssession_get_id_parent(const tsip_ssession_handle_t *self);
TINYSIP_API int tsip_ssession_take_ownership(tsip_ssession_handle_t *self);
TINYSIP_API tsk_bool_t tsip_ssession_have_ownership(const tsip_ssession_handle_t *self);
TINYSIP_API int tsip_ssession_respond(const tsip_ssession_handle_t *self, short status, const char* phrase, const void* payload, tsk_size_t size, const struct tsip_message_s* request, ...);
TINYSIP_API const void* tsip_ssession_get_userdata(const tsip_ssession_handle_t *self);
TINYSIP_API tmedia_type_t tsip_ssession_get_mediatype(const tsip_ssession_handle_t *self);
TINYSIP_API tmedia_session_mgr_t* tsip_session_get_mediamgr(const tsip_ssession_handle_t *self);
TINYSIP_API const tsip_stack_handle_t* tsip_ssession_get_stack(const tsip_ssession_handle_t *self);
TINYSIP_API tmedia_codec_id_t tsip_ssession_get_codecs_neg(tsip_ssession_handle_t *self);
int tsip_ssession_handle(const tsip_ssession_t *self, const struct tsip_action_s* action);
typedef tsk_list_t tsip_ssessions_L_t; /**< List of @ref tsip_ssession_handle_t elements. */
TINYSIP_GEXTERN const tsk_object_def_t *tsip_ssession_def_t;
TSIP_END_DECLS
#endif /* TSIP_SSESSION_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

0
tinySIP/vs_android/tinySIP.vcxproj Normal file → Executable file
View File

0
tinySIP/vs_android/tinySIP.vcxproj.filters Normal file → Executable file
View File

0
tinySMS/vs_android/tinySMS.vcxproj Normal file → Executable file
View File

0
tinySMS/vs_android/tinySMS.vcxproj.filters Normal file → Executable file
View File

0
tinyXCAP/vs_android/tinyXCAP.vcxproj Normal file → Executable file
View File

0
tinyXCAP/vs_android/tinyXCAP.vcxproj.filters Normal file → Executable file
View File