提交 2f6798fd authored 作者: Anthony Minessale's avatar Anthony Minessale

change some log levels

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5114 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 33a21eff
......@@ -74,9 +74,9 @@ static switch_status_t sofia_kill_channel(switch_core_session_t *session, int si
*/
static switch_status_t sofia_on_init(switch_core_session_t *session)
{
private_object_t *tech_pvt;
switch_channel_t *channel = NULL;
private_object_t *tech_pvt;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
......@@ -86,8 +86,7 @@ static switch_status_t sofia_on_init(switch_core_session_t *session)
tech_pvt->read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SOFIA INIT\n");
if (switch_channel_test_flag(channel, CF_NOMEDIA)) {
switch_set_flag_locked(tech_pvt, TFLAG_NOMEDIA);
if (switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) {
sofia_glue_tech_absorb_sdp(tech_pvt);
}
......@@ -283,9 +282,8 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
if (!switch_test_flag(tech_pvt, TFLAG_ANS) && !switch_channel_test_flag(channel, CF_OUTBOUND)) {
switch_set_flag_locked(tech_pvt, TFLAG_ANS);
if (switch_channel_test_flag(channel, CF_NOMEDIA)) {
if (switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) {
char *sdp = NULL;
switch_set_flag_locked(tech_pvt, TFLAG_NOMEDIA);
if ((sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE))) {
tech_pvt->local_sdp_str = switch_core_session_strdup(session, sdp);
}
......@@ -692,8 +690,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
switch_core_session_t *other_session;
switch_channel_t *other_channel;
char *ip = NULL, *port = NULL;
switch_set_flag_locked(tech_pvt, TFLAG_NOMEDIA);
switch_channel_set_flag(channel, CF_BYPASS_MEDIA);
tech_pvt->local_sdp_str = NULL;
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
&& (other_session = switch_core_session_locate(uuid))) {
......@@ -712,7 +709,8 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
}
break;
case SWITCH_MESSAGE_INDICATE_MEDIA:{
switch_clear_flag_locked(tech_pvt, TFLAG_NOMEDIA);
uint32_t count = 0;
switch_channel_clear_flag(channel, CF_BYPASS_MEDIA);
tech_pvt->local_sdp_str = NULL;
if (!switch_rtp_ready(tech_pvt->rtp_session)) {
sofia_glue_tech_prepare_codecs(tech_pvt);
......@@ -723,8 +721,18 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
}
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
sofia_glue_do_invite(session);
while (!switch_rtp_ready(tech_pvt->rtp_session) && switch_channel_get_state(channel) < CS_HANGUP) {
switch_yield(1000);
/* wait for rtp to start and first real frame to arrive */
tech_pvt->read_frame.datalen = 0;
while (switch_test_flag(tech_pvt, TFLAG_IO) && switch_channel_get_state(channel) < CS_HANGUP && !switch_rtp_ready(tech_pvt->rtp_session)) {
if (++count > 1000) {
return SWITCH_STATUS_FALSE;
}
if (!switch_rtp_ready(tech_pvt->rtp_session)) {
switch_yield(1000);
continue;
}
break;
}
}
break;
......@@ -741,7 +749,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
}
break;
case SWITCH_MESSAGE_INDICATE_BRIDGE:
if (switch_test_flag(tech_pvt, TFLAG_XFER)) {
switch_clear_flag_locked(tech_pvt, TFLAG_XFER);
if (msg->pointer_arg) {
......@@ -825,9 +833,8 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Asked to send early media by %s\n", msg->from);
/* Transmit 183 Progress with SDP */
if (switch_channel_test_flag(channel, CF_NOMEDIA)) {
if (switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) {
char *sdp = NULL;
switch_set_flag_locked(tech_pvt, TFLAG_NOMEDIA);
if ((sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE))) {
tech_pvt->local_sdp_str = switch_core_session_strdup(session, sdp);
}
......
......@@ -135,7 +135,7 @@ typedef enum {
TFLAG_REFER = (1 << 17),
TFLAG_NOHUP = (1 << 18),
TFLAG_XFER = (1 << 19),
TFLAG_NOMEDIA = (1 << 20),
TFLAG_RESERVED = (1 << 20),
TFLAG_BUGGY_2833 = (1 << 21),
TFLAG_SIP_HOLD = (1 << 22),
TFLAG_INB_NOMEDIA = (1 << 23),
......@@ -261,6 +261,7 @@ struct private_object {
uint32_t flags;
switch_payload_t agreed_pt;
switch_core_session_t *session;
switch_channel_t *channel;
switch_frame_t read_frame;
char *codec_order[SWITCH_MAX_CODECS];
int codec_order_last;
......
......@@ -56,9 +56,6 @@ void sofia_event_callback(nua_event_t event,
if ((session = switch_core_session_locate(sofia_private->uuid))) {
tech_pvt = switch_core_session_get_private(session);
channel = switch_core_session_get_channel(tech_pvt->session);
if (switch_channel_test_flag(channel, CF_NOMEDIA)) {
switch_set_flag(tech_pvt, TFLAG_NOMEDIA);
}
if (!tech_pvt->call_id && sip && sip->sip_call_id && sip->sip_call_id->i_id) {
tech_pvt->call_id = switch_core_session_strdup(session, (char *) sip->sip_call_id->i_id);
switch_channel_set_variable(channel, "sip_call_id", tech_pvt->call_id);
......@@ -988,10 +985,6 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
if (switch_channel_test_flag(channel, CF_NOMEDIA)) {
switch_set_flag(tech_pvt, TFLAG_NOMEDIA);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel %s entering state [%s]\n",
switch_channel_get_name(channel), nua_callstate_name(ss_state));
......@@ -1000,7 +993,6 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
tech_pvt->remote_sdp_str = switch_core_session_strdup(session, r_sdp);
switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp);
sofia_glue_pass_sdp(tech_pvt, (char *) r_sdp);
}
}
......@@ -1020,7 +1012,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
if (status == 180) {
switch_channel_mark_ring_ready(channel);
if (!switch_channel_test_flag(channel, CF_GEN_RINGBACK)) {
if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) {
if (switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) {
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
&& (other_session = switch_core_session_locate(uuid))) {
switch_core_session_message_t msg;
......@@ -1037,7 +1029,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
}
if (r_sdp) {
if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) {
if (switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) {
switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
switch_channel_mark_pre_answered(channel);
if (!switch_channel_test_flag(channel, CF_GEN_RINGBACK) && (uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
......@@ -1072,7 +1064,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
case nua_callstate_received:
if (tech_pvt && !switch_test_flag(tech_pvt, TFLAG_SDP)) {
if (r_sdp && !switch_test_flag(tech_pvt, TFLAG_SDP)) {
if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) {
if (switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOMEDIA");
switch_set_flag_locked(tech_pvt, TFLAG_READY);
switch_channel_set_state(channel, CS_INIT);
......@@ -1135,7 +1127,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
}
} else {
if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) {
if (switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) {
goto done;
} else {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
......@@ -1155,14 +1147,14 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
break;
case nua_callstate_completed:
if (tech_pvt && r_sdp) {
if (r_sdp) { // && !switch_test_flag(tech_pvt, TFLAG_SDP)) {
if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) {
sdp_parser_t *parser;
sdp_session_t *sdp;
uint8_t match = 0;
if (r_sdp) {
if (switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) {
goto done;
} else {
sdp_parser_t *parser;
sdp_session_t *sdp;
uint8_t match = 0;
if (tech_pvt->num_codecs) {
if ((parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
if ((sdp = sdp_session(parser))) {
......@@ -1222,7 +1214,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
r_sdp = (const char *) switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
}
if (r_sdp && !switch_test_flag(tech_pvt, TFLAG_SDP)) {
if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) {
if (switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) {
switch_set_flag_locked(tech_pvt, TFLAG_ANS);
switch_channel_mark_answered(channel);
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
......@@ -1337,7 +1329,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
}
if (switch_channel_test_flag(channel_a, CF_NOMEDIA)) {
if (switch_channel_test_flag(channel_a, CF_BYPASS_MEDIA)) {
nua_notify(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END());
goto done;
......@@ -1819,8 +1811,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
if (switch_test_flag(tech_pvt, TFLAG_INB_NOMEDIA)) {
switch_set_flag_locked(tech_pvt, TFLAG_NOMEDIA);
switch_channel_set_flag(channel, CF_NOMEDIA);
switch_channel_set_flag(channel, CF_BYPASS_MEDIA);
}
if (!tech_pvt->call_id && sip->sip_call_id && sip->sip_call_id->i_id) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论