提交 a9e634b6 authored 作者: Mike Jerris's avatar Mike Jerris 提交者: Andrey Volk

FS-11557: [mod_sofia] add support for RFC 7989 Session-ID header

(enable with sofia profile param rfc-7989=true)

FS-11557 [mod_sofia, mod_conference, core] Add support for re-INVITE when setting Session-ID in conference after call has been answered.

FS-11557 [mod_conference] Missed a spot where APP_SESSION_ID needed to be set.

FS-11557: set session id for outbound (initial requests)

FS-11557: [mod_sofia] rename vars and functions "session id" -> "session uuid" to reflect the real meaning for rfc7989.

FS-11557: fix bug - colliding chan var names (session_id)

FS-11557: check nil session uuid

FS-11557 : replace CS_NEW with CS_INIT for when originating calls, generate new uuid.

FS-11557: handle inbound (UAS mode, one leg)

FS-11557: generic param handling and filter via new sip profile option "rfc-7989-filter", eg:
<param name="rfc-7989-filter" value="logme, sec-agree, privacy" />

FS-11557: renamed chan vars (reflect meaning only for RFC7989)

FS-11557: fallback to RFC7329 - "old" Session-ID

FS-11557: distinguish between request and replies when we read the header
(to provide compatibility with old RFC7329 - section 11 of RFC7989)
FS-11557: change more vars/consts names

FS-11557: move compat flag on the channel.

FS-11557: add Session-ID header in REFER

FS-11557: needs extra condition on received initial request

FS-11557: handle NOTIFY

FS-11557: support answer() in dialplan - it was sending back a 200 OK with Session-ID invalid, eg: A=NIL;B=X

FS-11557: add Session-ID for NOTIFY (more cases)

FS-11557: handle reply to SIP INFO (add Session-ID header)

FS-11557: handle case of BYE after REFER, when the channel is destroyed already (save the uuid on sofia_private)

FS-11557: handle more SIP reply cases (eg: 202 Accepted , more negative replies)

FS-11557: handle ACK (UAS role)

FS-11557: added "rfc-7989-force-old" profile param - to enforce old rfc7329 for the UAC role. default off.
enabled with "<param name="rfc-7989-force-old" value="true" />".

FS-11557: fallback to rfc7329 fixes.

FS-11557: set flag CF_RFC7329_COMPAT on partner channel where needed

FS-11557: fix crash (mod_conference)
上级 0c13b704
......@@ -225,6 +225,10 @@ SWITCH_BEGIN_EXTERN_C
#define SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE "exec_after_bridge_app"
#define SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE "exec_after_bridge_arg"
#define SWITCH_MAX_FORWARDS_VARIABLE "max_forwards"
#define SWITCH_RFC7989_SESSION_ID_VARIABLE "session_uuid"
#define SWITCH_RFC7989_REMOTE_SESSION_ID_VARIABLE "remote_session_uuid"
#define SWITCH_RFC7989_APP_SESSION_ID_VARIABLE "app_session_uuid"
#define SWITCH_RFC7989_GENERIC_PARAM_VARIABLE "generic_param_session_uuid"
#define SWITCH_MAX_SESSION_TRANSFERS_VARIABLE "max_session_transfers"
#define SWITCH_DISABLE_APP_LOG_VARIABLE "disable_app_log"
#define SWITCH_SPEECH_KEY "speech"
......@@ -1159,6 +1163,7 @@ typedef enum {
SWITCH_MESSAGE_RING_EVENT,
SWITCH_MESSAGE_RESAMPLE_EVENT,
SWITCH_MESSAGE_HEARTBEAT_EVENT,
SWITCH_MESSAGE_INDICATE_SESSION_ID,
SWITCH_MESSAGE_INVALID
} switch_core_session_message_types_t;
......@@ -1607,6 +1612,7 @@ typedef enum {
CF_ARRANGED_BRIDGE,
CF_STATE_REPEAT,
CF_WANT_DTLSv1_2,
CF_RFC7329_COMPAT,
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
/* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */
CF_FLAG_MAX
......
......@@ -1911,8 +1911,8 @@ SWITCH_STANDARD_APP(conference_function)
switch_channel_set_flag(channel, CF_CONFERENCE);
if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Channel answer failed.\n");
if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Channel pre answer failed.\n");
goto end;
}
......@@ -2060,6 +2060,7 @@ SWITCH_STANDARD_APP(conference_function)
locked = 0;
switch_channel_set_variable(channel, "conference_name", conference->name);
switch_channel_set_variable(channel, SWITCH_RFC7989_APP_SESSION_ID_VARIABLE, conference->uuid_str);
/* Set the minimum number of members (once you go above it you cannot go below it) */
conference->min = 2;
......@@ -2144,6 +2145,7 @@ SWITCH_STANDARD_APP(conference_function)
}
switch_channel_set_variable(channel, "conference_name", conference->name);
switch_channel_set_variable(channel, SWITCH_RFC7989_APP_SESSION_ID_VARIABLE, conference->uuid_str);
/* Set MOH from variable if not set */
if (zstr(conference->moh_sound)) {
......@@ -2210,6 +2212,7 @@ SWITCH_STANDARD_APP(conference_function)
switch_channel_api_on(channel, "api_on_conference_create");
} else { /* setup user variable */
switch_channel_set_variable(channel, "conference_name", conference->name);
switch_channel_set_variable(channel, SWITCH_RFC7989_APP_SESSION_ID_VARIABLE, conference->uuid_str);
rl++;
}
......@@ -2223,6 +2226,12 @@ SWITCH_STANDARD_APP(conference_function)
mdpin = conference->mpin;
}
/* Tell the channel we have a new Session-ID */
msg.from = __FILE__;
msg.message_id = SWITCH_MESSAGE_INDICATE_SESSION_ID;
switch_core_session_receive_message(session, &msg);
switch_channel_answer(channel);
/* if this is not an outbound call, deal with conference pins */
if (enforce_security && (!zstr(dpin) || !zstr(mdpin))) {
......@@ -2233,9 +2242,6 @@ SWITCH_STANDARD_APP(conference_function)
switch_status_t status = SWITCH_STATUS_SUCCESS;
char *supplied_pin_value;
/* Answer the channel */
switch_channel_answer(channel);
/* look for PIN in channel variable first. If not present or invalid revert to prompting user */
supplied_pin_value = switch_core_strdup(conference->pool, switch_channel_get_variable(channel, "supplied_pin"));
if (!zstr(supplied_pin_value)) {
......
......@@ -192,6 +192,7 @@ struct sofia_private {
int is_call;
int is_static;
switch_time_t ping_sent;
char *rfc7989_uuid;
};
#define set_param(ptr,val) if (ptr) {free(ptr) ; ptr = NULL;} if (val) {ptr = strdup(val);}
......@@ -310,6 +311,8 @@ typedef enum {
PFLAG_FIRE_BYE_RESPONSE_EVENTS,
PFLAG_AUTO_INVITE_100,
PFLAG_UPDATE_REFRESHER,
PFLAG_RFC7989_SESSION_ID,
PFLAG_RFC7989_FORCE_OLD,
PFLAG_AUTH_REQUIRE_USER,
PFLAG_AUTH_CALLS_ACL_ONLY,
PFLAG_USE_PORT_FOR_ACL_CHECK,
......@@ -790,6 +793,7 @@ struct sofia_profile {
int bind_attempt_interval;
char *proxy_notify_events;
char *proxy_info_content_types;
char *rfc7989_filter;
char *acl_inbound_x_token_header;
char *acl_proxy_x_token_header;
};
......@@ -989,6 +993,13 @@ void launch_sofia_profile_thread(sofia_profile_t *profile);
switch_status_t sofia_presence_chat_send(switch_event_t *message_event);
#define RFC7989_SESSION_UUID_LEN 32
#define RFC7989_SESSION_UUID_NULL "00000000000000000000000000000000"
int sofia_glue_is_valid_session_id(const char *session_id);
void sofia_glue_store_session_id(switch_core_session_t *session, sofia_profile_t *profile, sip_t const *sip, switch_bool_t is_reply);
char *sofia_glue_session_id_header(switch_core_session_t *session, sofia_profile_t *profile);
/*
* \brief Sets the "ep_codec_string" channel variable, parsing r_sdp and taing codec_string in consideration
* \param channel Current channel
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论