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);
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;
}
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;
}
}
/* 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);
}