TextStream *text_stream_new2(const char* ip, int loc_rtp_port, int loc_rtcp_port) { TextStream *stream; MSMediaStreamSessions sessions = {0}; sessions.rtp_session = ms_create_duplex_rtp_session(ip, loc_rtp_port, loc_rtcp_port); stream = text_stream_new_with_sessions(&sessions); stream->ms.owns_sessions = TRUE; return stream; }
static void dtmfgen_enc_rtp_dec_tonedet(void) { MSConnectionHelper h; RtpSession *rtps; unsigned int filter_mask = FILTER_MASK_VOIDSOURCE | FILTER_MASK_DTMFGEN | FILTER_MASK_ENCODER | FILTER_MASK_RTPSEND | FILTER_MASK_RTPRECV | FILTER_MASK_DECODER | FILTER_MASK_TONEDET | FILTER_MASK_VOIDSINK; bool_t send_silence = TRUE; MSSndCardManager *scm = ms_factory_get_snd_card_manager(factory); ms_factory_reset_statistics(factory); //ms_filter_reset_statistics(); ms_tester_create_ticker(); ms_tester_codec_mime = "pcmu"; ms_tester_create_filters(filter_mask, factory); ms_filter_add_notify_callback(ms_tester_tonedet, (MSFilterNotifyFunc)tone_detected_cb, NULL,TRUE); rtps = ms_create_duplex_rtp_session("0.0.0.0", 50060, 0, ms_factory_get_mtu(factory)); rtp_session_set_remote_addr_full(rtps, "127.0.0.1", 50060, "127.0.0.1", 50061); rtp_session_set_payload_type(rtps, 8); rtp_session_enable_rtcp(rtps,FALSE); ms_filter_call_method(ms_tester_rtprecv, MS_RTP_RECV_SET_SESSION, rtps); ms_filter_call_method(ms_tester_rtpsend, MS_RTP_SEND_SET_SESSION, rtps); ms_filter_call_method(ms_tester_voidsource, MS_VOID_SOURCE_SEND_SILENCE, &send_silence); ms_connection_helper_start(&h); ms_connection_helper_link(&h, ms_tester_voidsource, -1, 0); ms_connection_helper_link(&h, ms_tester_dtmfgen, 0, 0); ms_connection_helper_link(&h, ms_tester_encoder, 0, 0); ms_connection_helper_link(&h, ms_tester_rtpsend, 0, -1); ms_connection_helper_start(&h); ms_connection_helper_link(&h, ms_tester_rtprecv, -1, 0); ms_connection_helper_link(&h, ms_tester_decoder, 0, 0); ms_connection_helper_link(&h, ms_tester_tonedet, 0, 0); ms_connection_helper_link(&h, ms_tester_voidsink, 0, -1); ms_ticker_attach_multiple(ms_tester_ticker, ms_tester_voidsource, ms_tester_rtprecv, NULL); ms_tester_tone_generation_and_detection_loop(); ms_ticker_detach(ms_tester_ticker, ms_tester_voidsource); ms_ticker_detach(ms_tester_ticker, ms_tester_rtprecv); ms_connection_helper_start(&h); ms_connection_helper_unlink(&h, ms_tester_voidsource, -1, 0); ms_connection_helper_unlink(&h, ms_tester_dtmfgen, 0, 0); ms_connection_helper_unlink(&h, ms_tester_encoder, 0, 0); ms_connection_helper_unlink(&h, ms_tester_rtpsend, 0, -1); ms_connection_helper_start(&h); ms_connection_helper_unlink(&h, ms_tester_rtprecv, -1, 0); ms_connection_helper_unlink(&h, ms_tester_decoder, 0, 0); ms_connection_helper_unlink(&h, ms_tester_tonedet, 0, 0); ms_connection_helper_unlink(&h, ms_tester_voidsink, 0, -1); // ms_filter_log_statistics(); ms_factory_log_statistics(scm->factory); ms_tester_destroy_filters(filter_mask); ms_tester_destroy_ticker(); rtp_session_destroy(rtps); }