Merge branch 'nsg-4.3' of ssh://git.sangoma.com/smg_freeswitch into nsg-4.3

This commit is contained in:
root 2012-07-25 23:15:16 -04:00
commit 0c18f809cf
1 changed files with 15 additions and 4 deletions

View File

@ -188,11 +188,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
tech_pvt->dtmf_type = DTMF_2833; /* XXX */
if (zstr(local_addr) || local_port == 0) {
tech_pvt->mode = RTP_SENDONLY;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "The local address and port must be set\n");
goto fail;
} else if (zstr(remote_addr) || remote_port == 0) {
tech_pvt->mode = RTP_SENDRECV;
tech_pvt->mode = RTP_RECVONLY;
} else {
tech_pvt->mode = RTP_SENDRECV;
}
switch_core_session_set_private(*new_session, tech_pvt);
@ -314,7 +315,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
if (!tech_pvt->rtp_session) {
if (!tech_pvt->rtp_session || tech_pvt->mode == RTP_RECVONLY) {
goto cng;
}
@ -429,6 +430,7 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error setting RTP remote address: %s\n", err);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Set RTP remote: %s:%d\n", remote_addr, (int)remote_port);
tech_pvt->mode = RTP_SENDRECV;
}
}
@ -439,6 +441,15 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
/* Reset codec */
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Switching codec not yet implemented\n");
}
if (compare_var(event, channel, kRFC2833PT)) {
const char *szpt = switch_channel_get_variable(channel, kRFC2833PT);
int pt = !zstr(szpt) ? atoi(szpt) : 0;
switch_channel_set_variable(channel, kRFC2833PT, szpt);
switch_rtp_set_telephony_event(tech_pvt->rtp_session, pt);
}
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Received unknown command [%s] in event.\n", !command ? "null" : command);
}