提交 3c51053b authored 作者: Anthony Minessale's avatar Anthony Minessale

compiles the core wow

上级 eb81042a
......@@ -48,7 +48,8 @@ typedef enum {
SM_NDLB_ALLOW_BAD_IANANAME = (1 << 0),
SM_NDLB_ALLOW_NONDUP_SDP = (1 << 1),
SM_NDLB_ALLOW_CRYPTO_IN_AVP = (1 << 2),
SM_NDLB_DISABLE_SRTP_AUTH = (1 << 3)
SM_NDLB_DISABLE_SRTP_AUTH = (1 << 3),
SM_NDLB_SENDRECV_IN_SESSION = (1 << 4)
} switch_core_media_NDLB_t;
typedef enum {
......@@ -126,9 +127,25 @@ typedef struct switch_core_media_params_s {
char *extsipip;
char *local_network;
char *sdp_username;
switch_mutex_t *mutex;
} switch_core_media_params_t;
static inline const char *switch_media_type2str(switch_media_type_t type)
{
switch(type) {
case SWITCH_MEDIA_TYPE_AUDIO:
return "audio";
case SWITCH_MEDIA_TYPE_VIDEO:
return "video";
default:
return "!ERR";
}
}
SWITCH_DECLARE(switch_status_t) switch_media_handle_create(switch_media_handle_t **smhp, switch_core_session_t *session, switch_core_media_params_t *params);
......@@ -170,6 +187,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_write_frame(switch_core_sessio
switch_frame_t *frame, switch_io_flag_t flags, int stream_id, switch_media_type_t type);
SWITCH_DECLARE(int) switch_core_media_check_nat(switch_media_handle_t *smh, const char *network_ip);
SWITCH_DECLARE(switch_status_t) switch_core_media_choose_port(switch_core_session_t *session, switch_media_type_t type, int force);
SWITCH_END_EXTERN_C
#endif
/* For Emacs:
......
......@@ -1290,6 +1290,8 @@ typedef enum {
CF_VIDEO_POSSIBLE,//TFLAG_VIDEO
CF_NOTIMER_DURING_BRIDGE,
CF_PASS_RFC2833,
CF_T38_PASSTHRU,
CF_DROP_DTMF,
/* 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
......
......@@ -203,7 +203,6 @@ typedef enum {
PFLAG_RUNNING,
PFLAG_RESPAWN,
PFLAG_MULTIREG,
PFLAG_SUPPRESS_CNG,
PFLAG_TLS,
PFLAG_CHECKUSER,
PFLAG_SECURE,
......@@ -271,8 +270,7 @@ typedef enum {
typedef enum {
PFLAG_NDLB_TO_IN_200_CONTACT = (1 << 0),
PFLAG_NDLB_BROKEN_AUTH_HASH = (1 << 1),
PFLAG_NDLB_SENDRECV_IN_SESSION = (1 << 2),
PFLAG_NDLB_EXPIRES_IN_REGISTER_RESPONSE = (1 << 6)
PFLAG_NDLB_EXPIRES_IN_REGISTER_RESPONSE = (1 << 2)
} sofia_NDLB_t;
typedef enum {
......@@ -317,7 +315,6 @@ typedef enum {
TFLAG_CAPTURE,
TFLAG_REINVITED,
TFLAG_PASS_ACK,
TFLAG_DROP_DTMF,
/* No new flags below this line */
TFLAG_MAX
} TFLAGS;
......@@ -530,7 +527,6 @@ struct sofia_profile {
uint32_t rtpip_next;
char *sipip;
char *extsipip;
char *username;
char *url;
char *public_url;
char *bindurl;
......@@ -577,6 +573,7 @@ struct sofia_profile {
switch_core_media_flag_t media_flags[SCMF_MAX];
unsigned int mflags;
unsigned int ndlb;
unsigned int mdlb;
uint32_t max_calls;
uint32_t nonce_ttl;
nua_t *nua;
......@@ -745,8 +742,6 @@ struct private_object {
nua_handle_t *nh;
nua_handle_t *nh2;
sip_contact_t *contact;
uint32_t owner_id;
uint32_t session_id;
uint32_t max_missed_packets;
uint32_t max_missed_hold_packets;
/** VIDEO **/
......@@ -1140,9 +1135,7 @@ void sofia_glue_global_siptrace(switch_bool_t on);
void sofia_glue_global_capture(switch_bool_t on);
void sofia_glue_global_watchdog(switch_bool_t on);
void sofia_media_proxy_codec(switch_core_session_t *session, const char *r_sdp);
switch_status_t sofia_media_sdp_map(const char *r_sdp, switch_event_t **fmtp, switch_event_t **pt);
void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl);
void sofia_glue_check_dtmf_type(private_object_t *tech_pvt);
char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua_handle_t *nh, sofia_dispatch_event_t *de, sofia_nat_parse_t *np);
void sofia_glue_pause_jitterbuffer(switch_core_session_t *session, switch_bool_t on);
void sofia_process_dispatch_event(sofia_dispatch_event_t **dep);
......
......@@ -3605,7 +3605,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
profile->local_network = "localnet.auto";
sofia_set_flag(profile, TFLAG_ENABLE_SOA);
sofia_set_pflag(profile, PFLAG_CID_IN_1XX);
profile->ndlb |= SM_NDLB_ALLOW_NONDUP_SDP;
profile->mndlb |= SM_NDLB_ALLOW_NONDUP_SDP;
profile->te = 101;
profile->ireg_seconds = IREG_SECONDS;
profile->paid_type = PAID_DEFAULT;
......@@ -3926,7 +3926,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
sofia_clear_media_flag(profile, SCMF_DISABLE_RTP_AUTOADJ);
}
} else if (!strcasecmp(var, "NDLB-support-asterisk-missing-srtp-auth") && switch_true(val)) {
profile->ndlb |= SM_NDLB_DISABLE_SRTP_AUTH;
profile->mndlb |= SM_NDLB_DISABLE_SRTP_AUTH;
} else if (!strcasecmp(var, "user-agent-filter")) {
profile->user_agent_filter = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "max-registrations-per-extension")) {
......@@ -4165,15 +4165,15 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
}
} else if (!strcasecmp(var, "NDLB-sendrecv-in-session")) {
if (switch_true(val)) {
profile->ndlb |= PFLAG_NDLB_SENDRECV_IN_SESSION;
profile->mndlb |= SM_NDLB_SENDRECV_IN_SESSION;
} else {
profile->ndlb &= ~PFLAG_NDLB_SENDRECV_IN_SESSION;
profile->mndlb &= ~SM_NDLB_SENDRECV_IN_SESSION;
}
} else if (!strcasecmp(var, "NDLB-allow-bad-iananame")) {
if (switch_true(val)) {
profile->ndlb |= SM_NDLB_ALLOW_BAD_IANANAME;
profile->mndlb |= SM_NDLB_ALLOW_BAD_IANANAME;
} else {
profile->ndlb &= ~SM_NDLB_ALLOW_BAD_IANANAME;
profile->mndlb &= ~SM_NDLB_ALLOW_BAD_IANANAME;
}
} else if (!strcasecmp(var, "NDLB-expires-in-register-response")) {
if (switch_true(val)) {
......@@ -4183,15 +4183,15 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
}
} else if (!strcasecmp(var, "NDLB-allow-crypto-in-avp")) {
if (switch_true(val)) {
profile->ndlb |= SM_NDLB_ALLOW_CRYPTO_IN_AVP;
profile->mndlb |= SM_NDLB_ALLOW_CRYPTO_IN_AVP;
} else {
profile->ndlb &= ~SM_NDLB_ALLOW_CRYPTO_IN_AVP;
profile->mndlb &= ~SM_NDLB_ALLOW_CRYPTO_IN_AVP;
}
} else if (!strcasecmp(var, "NDLB-allow-nondup-sdp")) {
if (switch_true(val)) {
profile->ndlb |= SM_NDLB_ALLOW_NONDUP_SDP;
profile->mndlb |= SM_NDLB_ALLOW_NONDUP_SDP;
} else {
profile->ndlb &= ~SM_NDLB_ALLOW_NONDUP_SDP;
profile->mndlb &= ~SM_NDLB_ALLOW_NONDUP_SDP;
}
} else if (!strcasecmp(var, "pass-rfc2833")) {
if (switch_true(val)) {
......@@ -4324,7 +4324,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
profile->codec_flags = SWITCH_CODEC_FLAG_AAL2;
}
} else if (!strcasecmp(var, "username")) {
profile->username = switch_core_strdup(profile->pool, val);
profile->sdp_username = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "context")) {
profile->context = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "apply-nat-acl")) {
......@@ -5229,37 +5229,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
switch_core_session_rwunlock(other_session);
goto end;
} else {
char *remote_host = switch_rtp_get_remote_host(tech_pvt->rtp_session);
switch_port_t remote_port = switch_rtp_get_remote_port(tech_pvt->rtp_session);
char tmp[32] = "";
tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, t38_options->remote_ip);
tech_pvt->remote_sdp_audio_port = t38_options->remote_port;
if (remote_host && remote_port && !strcmp(remote_host, tech_pvt->remote_sdp_audio_ip) &&
remote_port == tech_pvt->remote_sdp_audio_port) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG,
"Audio params are unchanged for %s.\n",
switch_channel_get_name(tech_pvt->channel));
} else {
const char *err = NULL;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG,
"Audio params changed for %s from %s:%d to %s:%d\n",
switch_channel_get_name(tech_pvt->channel),
remote_host, remote_port, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip);
switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp);
if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip,
tech_pvt->remote_sdp_audio_port, 0, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "AUDIO RTP REPORTS ERROR: [%s]\n", err);
switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
}
}
switch_core_media_copy_t38_options(t38_options, other_session);
switch_core_media_process_t38_passthru(session, other_session, t38_options);
}
}
......@@ -5629,7 +5599,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
if (r_sdp) {
if (!(profile->ndlb & SM_NDLB_ALLOW_NONDUP_SDP) || (!zstr(tech_pvt->remote_sdp_str) && !strcmp(tech_pvt->remote_sdp_str, r_sdp))) {
if (!(profile->mndlb & SM_NDLB_ALLOW_NONDUP_SDP) || (!zstr(tech_pvt->remote_sdp_str) && !strcmp(tech_pvt->remote_sdp_str, r_sdp))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Duplicate SDP\n%s\n", r_sdp);
is_dup_sdp = 1;
} else {
......
......@@ -178,23 +178,6 @@ void sofia_glue_set_udptl_image_sdp(private_object_t *tech_pvt, switch_t38_optio
}
void sofia_glue_check_dtmf_type(private_object_t *tech_pvt)
{
const char *val;
if ((val = switch_channel_get_variable(tech_pvt->channel, "dtmf_type"))) {
if (!strcasecmp(val, "rfc2833")) {
tech_pvt->dtmf_type = DTMF_2833;
} else if (!strcasecmp(val, "info")) {
tech_pvt->dtmf_type = DTMF_INFO;
} else if (!strcasecmp(val, "none")) {
tech_pvt->dtmf_type = DTMF_NONE;
} else {
tech_pvt->dtmf_type = tech_pvt->profile->dtmf_type;
}
}
}
private_object_t *sofia_glue_new_pvt(switch_core_session_t *session)
{
......@@ -279,7 +262,7 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
switch_channel_set_cap(tech_pvt->channel, CC_FS_RTP);
switch_channel_set_cap(tech_pvt->channel, CC_QUEUEABLE_DTMF_DELAY);
tech_pvt->mparams->ndlb = tech_pvt->profile->ndlb;
tech_pvt->mparams->ndlb = tech_pvt->profile->mndlb;
tech_pvt->mparams->inbound_codec_string = profile->inbound_codec_string;
tech_pvt->mparams->outbound_codec_string = profile->outbound_codec_string;
tech_pvt->mparams->auto_rtp_bugs = profile->auto_rtp_bugs;
......@@ -289,6 +272,7 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
tech_pvt->mparams->manual_video_rtp_bugs = profile->manual_video_rtp_bugs;
tech_pvt->mparams->extsipip = profile->extsipip;
tech_pvt->mparams->local_network = profile->local_network;
tech_pvt->mparams->mutex = tech_pvt->sofia_mutex;
switch_media_handle_create(&tech_pvt->media_handle, session, &tech_pvt->mparams);
......@@ -318,76 +302,6 @@ const char *sofia_glue_get_unknown_header(sip_t const *sip, const char *name)
return NULL;
}
switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt, int force)
{
char *lookup_rtpip = tech_pvt->rtpip; /* Pointer to externally looked up address */
switch_port_t sdp_port, rtcp_port; /* The external port to be sent in the SDP */
const char *use_ip = NULL; /* The external IP to be sent in the SDP */
/* Don't do anything if we're in proxy mode or if a (remote) port already has been found */
if (!force) {
if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) ||
switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) || tech_pvt->adv_sdp_audio_port) {
return SWITCH_STATUS_SUCCESS;
}
}
/* Release the local sdp port */
if (tech_pvt->local_sdp_audio_port) {
switch_rtp_release_port(tech_pvt->rtpip, tech_pvt->local_sdp_audio_port);
}
/* Request a local port from the core's allocator */
if (!(tech_pvt->local_sdp_audio_port = switch_rtp_request_port(tech_pvt->rtpip))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_CRIT, "No RTP ports available!\n");
return SWITCH_STATUS_FALSE;
}
tech_pvt->local_sdp_audio_ip = tech_pvt->rtpip;
sdp_port = tech_pvt->local_sdp_audio_port;
/* Check if NAT is detected */
if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
/* Yes, map the port through switch_nat */
switch_nat_add_mapping(tech_pvt->local_sdp_audio_port, SWITCH_NAT_UDP, &sdp_port, SWITCH_FALSE);
switch_nat_add_mapping(tech_pvt->local_sdp_audio_port + 1, SWITCH_NAT_UDP, &rtcp_port, SWITCH_FALSE);
/* Find an IP address to use */
if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_audio_ip"))
&& !zstr(tech_pvt->profile->extrtpip)) {
use_ip = tech_pvt->profile->extrtpip;
}
if (use_ip) {
if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &lookup_rtpip, &sdp_port,
use_ip, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
/* Address lookup was required and fail (external ip was "host:..." or "stun:...") */
return SWITCH_STATUS_FALSE;
} else {
/* Address properly resolved, use it as external ip */
use_ip = lookup_rtpip;
}
} else {
/* No external ip found, use the profile's rtp ip */
use_ip = tech_pvt->rtpip;
}
} else {
/* No NAT traversal required, use the profile's rtp ip */
use_ip = tech_pvt->rtpip;
}
tech_pvt->adv_sdp_audio_port = sdp_port;
tech_pvt->adv_sdp_audio_ip = tech_pvt->extrtpip = switch_core_session_strdup(tech_pvt->session, use_ip);
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->local_sdp_audio_ip);
switch_channel_set_variable_printf(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE, "%d", sdp_port);
switch_channel_set_variable(tech_pvt->channel, SWITCH_ADVERTISED_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
return SWITCH_STATUS_SUCCESS;
}
sofia_transport_t sofia_glue_str2transport(const char *str)
{
if (!strncasecmp(str, "udp", 3)) {
......@@ -1954,6 +1868,12 @@ void sofia_glue_del_profile(sofia_profile_t *profile)
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
}
#if 1
int sofia_recover_callback(switch_core_session_t *session)
{
return -1;
}
#else
int sofia_recover_callback(switch_core_session_t *session)
{
......@@ -2184,6 +2104,8 @@ int sofia_recover_callback(switch_core_session_t *session)
return r;
}
#endif
int sofia_glue_recover(switch_bool_t flush)
{
......
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论