Commit ebca7f04 authored by Simon Morlat's avatar Simon Morlat

add method to choose the telephone-event payload type to use for sending

parent 6ac50c13
......@@ -386,6 +386,7 @@ struct _RtpSession
struct timeval last_recv_time; /* Time of receiving the RTP/RTCP packet. */
mblk_t *pending;
/* telephony events extension */
int tev_send_pt; /*telephone event to be used for sending*/
mblk_t *current_tev; /* the pending telephony events */
mblk_t *minimal_sdes;
mblk_t *full_sdes;
......@@ -493,6 +494,8 @@ ORTP_PUBLIC int rtp_session_get_send_payload_type(const RtpSession *session);
ORTP_PUBLIC int rtp_session_get_recv_payload_type(const RtpSession *session);
ORTP_PUBLIC int rtp_session_set_recv_payload_type(RtpSession *session, int pt);
ORTP_PUBLIC int rtp_session_set_send_telephone_event_payload_type(RtpSession *session, int paytype);
ORTP_PUBLIC int rtp_session_set_payload_type(RtpSession *session, int pt);
ORTP_PUBLIC void rtp_session_set_symmetric_rtp (RtpSession * session, bool_t yesno);
......@@ -40,7 +40,7 @@ BuildArch: i686
oRTP is a LGPL licensed C library implementing the RTP protocol
(rfc1889). It is available for most unix clones (primilarly Linux and
(rfc3550). It is available for most unix clones (primilarly Linux and
HP-UX), and Microsoft Windows.
%package devel
......@@ -302,6 +302,7 @@ rtp_session_init (RtpSession * session, int mode)
rtp_session_set_transports( session
,meta_rtp_transport_new(TRUE,NULL, 0)
,meta_rtp_transport_new(FALSE,NULL, 0));
session->tev_send_pt = -1; /*check in rtp profile when needed*/
......@@ -705,6 +706,20 @@ int rtp_session_get_send_payload_type(const RtpSession *session){
return session->;
* Assign the payload type number for sending telephone-event.
* It is required that a "telephone-event" PayloadType is assigned in the RtpProfile set for the RtpSession.
* This function is in most of cases useless, unless there is an ambiguity where several PayloadType for "telephone-event" are present in the RtpProfile.
* This might happen during SIP offeranswer scenarios. This function allows to remove any ambiguity by letting the application choose the one to be used.
* @param session the RtpSession
* @param paytype the payload type number
* @returns 0, -1 on error.
int rtp_session_set_send_telephone_event_payload_type(RtpSession *session, int paytype){
session->tev_send_pt = paytype;
return 0;
* Sets the expected payload type for incoming packets.
......@@ -88,15 +88,31 @@ int rtp_session_send_telephone_events_supported(RtpSession *session)
* @param start boolean to indicate if the marker bit should be set.
* @return a message block containing the rtp packet if successfull, NULL if the rtp session
*cannot support telephony event (because the rtp profile it is bound to does not include
*a telephony event payload type).
* cannot support telephony event (because the rtp profile it is bound to does not include
* a telephony event payload type).
mblk_t *rtp_session_create_telephone_event_packet(RtpSession *session, int start)
mblk_t *mp;
rtp_header_t *rtp;
PayloadType *cur_pt=rtp_profile_get_payload(session->snd.profile, rtp_session_get_send_payload_type(session));
int tev_pt=rtp_profile_find_payload_number(session->snd.profile, "telephone-event", cur_pt ? cur_pt->clock_rate : 8000, 1);
int tev_pt = session->tev_send_pt;
if (tev_pt != -1){
PayloadType *cur_tev_pt=rtp_profile_get_payload(session->snd.profile, tev_pt);
if (!cur_tev_pt){
ortp_error("Undefined telephone-event payload type %i choosen for sending telephone event", tev_pt);
tev_pt = -1;
}else if (cur_pt && cur_tev_pt->clock_rate != cur_pt->clock_rate){
ortp_error("Telephone-event payload type %i has clockrate %i while main audio codec has clockrate %i: this is not permitted.",
tev_pt, cur_tev_pt->clock_rate, cur_pt->clock_rate);
tev_pt = -1;
if (tev_pt == -1){
tev_pt = rtp_profile_find_payload_number(session->snd.profile, "telephone-event", cur_pt ? cur_pt->clock_rate : 8000, 1);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment