/** * Tells whether telephony events payload type is supported within the * context of the rtp session. * @param session a rtp session * * @return the payload type number used for telephony events if found, -1 if not found. **/ int rtp_session_telephone_events_supported(RtpSession *session) { /* search for a telephony event payload in the current profile */ session->snd.telephone_events_pt=rtp_profile_get_payload_number_from_mime(session->snd.profile,"telephone-event"); session->rcv.telephone_events_pt=rtp_profile_get_payload_number_from_mime(session->rcv.profile,"telephone-event"); /*printf("Telephone event pt is %i\n",session->telephone_events_pt);*/ return session->snd.telephone_events_pt; }
TextStream* text_stream_start(TextStream *stream, RtpProfile *profile, const char *rem_rtp_addr, int rem_rtp_port, const char *rem_rtcp_addr, int rem_rtcp_port, int payload_type /* ignored */) { RtpSession *rtps = stream->ms.sessions.rtp_session; MSConnectionHelper h; rtp_session_set_profile(rtps, profile); if (rem_rtp_port > 0) rtp_session_set_remote_addr_full(rtps, rem_rtp_addr, rem_rtp_port, rem_rtcp_addr, rem_rtcp_port); if (rem_rtcp_port > 0) { rtp_session_enable_rtcp(rtps, TRUE); } else { rtp_session_enable_rtcp(rtps, FALSE); } stream->pt_t140 = rtp_profile_get_payload_number_from_mime(profile, "t140"); stream->pt_red = rtp_profile_get_payload_number_from_mime(profile, "red"); if (payload_type == stream->pt_t140) { ms_message("Text payload type is T140"); } else if (payload_type == stream->pt_red) { ms_message("Text payload type is RED"); } else { /* we dont know this kind of textstream... */ ms_warning("unkown type of textstream"); } rtp_session_set_payload_type(rtps, payload_type); if (rem_rtp_port > 0) ms_filter_call_method(stream->ms.rtpsend, MS_RTP_SEND_SET_SESSION, rtps); stream->ms.rtprecv = ms_filter_new(MS_RTP_RECV_ID); ms_filter_call_method(stream->ms.rtprecv, MS_RTP_RECV_SET_SESSION, rtps); stream->ms.sessions.rtp_session = rtps; if (stream->ms.sessions.ticker == NULL) media_stream_start_ticker(&stream->ms); stream->rttsource = ms_filter_new(MS_RTT_4103_SOURCE_ID); stream->rttsink = ms_filter_new(MS_RTT_4103_SINK_ID); ms_filter_call_method(stream->rttsource, MS_RTT_4103_SOURCE_SET_T140_PAYLOAD_TYPE_NUMBER, &stream->pt_t140); ms_filter_call_method(stream->rttsink, MS_RTT_4103_SINK_SET_T140_PAYLOAD_TYPE_NUMBER, &stream->pt_t140); if (payload_type == stream->pt_red) { ms_filter_call_method(stream->rttsource, MS_RTT_4103_SOURCE_SET_RED_PAYLOAD_TYPE_NUMBER, &stream->pt_red); ms_filter_call_method(stream->rttsink, MS_RTT_4103_SINK_SET_RED_PAYLOAD_TYPE_NUMBER, &stream->pt_red); } ms_connection_helper_start(&h); ms_connection_helper_link(&h, stream->rttsource, -1, 0); ms_connection_helper_link(&h, stream->ms.rtpsend, 0, -1); ms_connection_helper_start(&h); ms_connection_helper_link(&h, stream->ms.rtprecv, -1, 0); ms_connection_helper_link(&h, stream->rttsink, 0, -1); ms_ticker_attach_multiple(stream->ms.sessions.ticker, stream->rttsource, stream->ms.rtprecv, NULL); stream->ms.start_time = stream->ms.last_packet_time = ms_time(NULL); stream->ms.is_beginning = TRUE; stream->ms.state = MSStreamStarted; return stream; }
PayloadType * rtp_profile_get_payload_from_mime(RtpProfile *profile,const char *mime) { int pt; pt=rtp_profile_get_payload_number_from_mime(profile,mime); if (pt==-1) return NULL; else return rtp_profile_get_payload(profile,pt); }
**/int rtp_session_recv_telephone_events_supported(RtpSession *session) { /* search for a telephony event payload in the current profile */ return rtp_profile_get_payload_number_from_mime(session->rcv.profile,"telephone-event"); }
/** *rtp_session_telephone_events_supported: *@session : a rtp session * * Tells whether telephony events payload type is supported within the context of the rtp * session. * *Returns: the payload type number used for telephony events if found, -1 if not found. **/ gint rtp_session_telephone_events_supported(RtpSession *session) { /* search for a telephony event payload in the current profile */ session->telephone_events_pt=rtp_profile_get_payload_number_from_mime(session->profile,"telephone-event"); return session->telephone_events_pt; }