<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Telephone events (RFC2833)</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="oRTP Reference Manual" HREF="book1.html"><LINK REL="UP" TITLE="oRTP API" HREF="ortpapi.html"><LINK REL="PREVIOUS" TITLE="Multiplexing sessions (in a one thread design)" HREF="ortp-multiplexing-sessions---in-a-one-thread-design.html"><STYLE TYPE="text/css" >.synopsis, .classsynopsis { background: #eeeeee; border: solid 1px #aaaaaa; padding: 0.5em; } .programlisting { background: #eeeeff; border: solid 1px #aaaaff; padding: 0.5em; } .variablelist { padding: 4px; margin-left: 3em; } .navigation { background: #ffeeee; border: solid 1px #ffaaaa; margin-top: 0.5em; margin-bottom: 0.5em; } .navigation a { color: #770000; } .navigation a:visited { color: #550000; } .navigation .title { font-size: 200%; }</STYLE ></HEAD ><BODY CLASS="REFENTRY" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><TABLE WIDTH="100%" CLASS="navigation" SUMMARY="Navigation header" CELLPADDING="2" CELLSPACING="2" ><TR VALIGN="middle" ><TD ><A ACCESSKEY="p" HREF="ortp-multiplexing-sessions---in-a-one-thread-design.html" ><IMG SRC="left.png" WIDTH="24" HEIGHT="24" BORDER="0" ALT="Prev"></A ></TD ><TD ><A ACCESSKEY="u" HREF="ortpapi.html" ><IMG SRC="up.png" WIDTH="24" HEIGHT="24" BORDER="0" ALT="Up"></A ></TD ><TD ><A ACCESSKEY="h" HREF="book1.html" ><IMG SRC="home.png" WIDTH="24" HEIGHT="24" BORDER="0" ALT="Home"></A ></TD ><TH WIDTH="100%" align="center" >oRTP Reference Manual</TH ></TR ></TABLE ><H1 ><A NAME="ORTP-TELEPHONE-EVENTS---RFC2833-" ></A >Telephone events (RFC2833)</H1 ><DIV CLASS="REFNAMEDIV" ><A NAME="AEN1564" ></A ><H2 >Name</H2 >Telephone events (RFC2833) -- </DIV ><DIV CLASS="REFSYNOPSISDIV" ><A NAME="SYNOPSIS" ></A ><H2 >Synopsis</H2 ><PRE CLASS="SYNOPSIS" > #include <telephonyevents.h> struct <A HREF="ortp-telephone-events---rfc2833-.html#TELEPHONE-EVENT" >telephone_event</A >; int <A HREF="ortp-telephone-events---rfc2833-.html#RTP-SESSION-TELEPHONE-EVENTS-SUPPORTED" >rtp_session_telephone_events_supported</A > (<A HREF="ortp-rtpsession-api.html#RTPSESSION" >RtpSession</A > *session); mblk_t* <A HREF="ortp-telephone-events---rfc2833-.html#RTP-SESSION-CREATE-TELEPHONE-EVENT-PACKET" >rtp_session_create_telephone_event_packet</A > (<A HREF="ortp-rtpsession-api.html#RTPSESSION" >RtpSession</A > *session, int start); int <A HREF="ortp-telephone-events---rfc2833-.html#RTP-SESSION-ADD-TELEPHONE-EVENT" >rtp_session_add_telephone_event</A > (<A HREF="ortp-rtpsession-api.html#RTPSESSION" >RtpSession</A > *session, mblk_t *packet, uint8_t event, int end, uint8_t volume, uint16_t duration); int <A HREF="ortp-telephone-events---rfc2833-.html#RTP-SESSION-READ-TELEPHONE-EVENT" >rtp_session_read_telephone_event</A > (<A HREF="ortp-rtpsession-api.html#RTPSESSION" >RtpSession</A > *session, mblk_t *packet, telephone_event_t **tab); int <A HREF="ortp-telephone-events---rfc2833-.html#RTP-SESSION-SEND-DTMF" >rtp_session_send_dtmf</A > (<A HREF="ortp-rtpsession-api.html#RTPSESSION" >RtpSession</A > *session, char dtmf, uint32_t userts);</PRE ></DIV ><DIV CLASS="REFSECT1" ><A NAME="DESC" ></A ><H2 >Description</H2 ><P ></P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="DETAILS" ></A ><H2 >Details</H2 ><DIV CLASS="REFSECT2" ><A NAME="AEN1601" ></A ><H3 ><A NAME="TELEPHONE-EVENT" ></A >struct telephone_event</H3 ><PRE CLASS="PROGRAMLISTING" >struct telephone_event { #ifdef ORTP_BIGENDIAN uint32_t event:8; uint32_t E:1; uint32_t R:1; uint32_t volume:6; uint32_t duration:16; #else uint32_t event:8; uint32_t volume:6; uint32_t R:1; uint32_t E:1; uint32_t duration:16; #endif };</PRE ><P ></P ></DIV ><HR><DIV CLASS="REFSECT2" ><A NAME="AEN1608" ></A ><H3 ><A NAME="RTP-SESSION-TELEPHONE-EVENTS-SUPPORTED" ></A >rtp_session_telephone_events_supported ()</H3 ><PRE CLASS="PROGRAMLISTING" >int rtp_session_telephone_events_supported (<A HREF="ortp-rtpsession-api.html#RTPSESSION" >RtpSession</A > *session);</PRE ><P >Tells whether telephony events payload type is supported within the context of the rtp session.</P ><P ></P ><P ></P ><TABLE CLASS="variablelist" BORDER="0" CELLSPACING="0" CELLPADDING="4" ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1619"><SPAN STYLE="white-space: nowrap" ><CODE CLASS="PARAMETER" >session</CODE > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > a rtp session </P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1624"><SPAN STYLE="white-space: nowrap" ><SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >Returns</I ></SPAN > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > the payload type number used for telephony events if found, -1 if not found.</P ></TD ></TR ></TBODY ></TABLE ></DIV ><HR><DIV CLASS="REFSECT2" ><A NAME="AEN1629" ></A ><H3 ><A NAME="RTP-SESSION-CREATE-TELEPHONE-EVENT-PACKET" ></A >rtp_session_create_telephone_event_packet ()</H3 ><PRE CLASS="PROGRAMLISTING" >mblk_t* rtp_session_create_telephone_event_packet (<A HREF="ortp-rtpsession-api.html#RTPSESSION" >RtpSession</A > *session, int start);</PRE ><P >Allocates a new rtp packet to be used to add named telephony events. The application can use then <A HREF="ortp-telephone-events---rfc2833-.html#RTP-SESSION-ADD-TELEPHONE-EVENT" ><CODE CLASS="FUNCTION" >rtp_session_add_telephone_event()</CODE ></A > to add named events to the packet. Finally the packet has to be sent with <A HREF="ortp-rtpsession-api.html#RTP-SESSION-SENDM-WITH-TS" ><CODE CLASS="FUNCTION" >rtp_session_sendm_with_ts()</CODE ></A >.</P ><P ></P ><P ></P ><TABLE CLASS="variablelist" BORDER="0" CELLSPACING="0" CELLPADDING="4" ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1645"><SPAN STYLE="white-space: nowrap" ><CODE CLASS="PARAMETER" >session</CODE > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > a rtp session.</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1650"><SPAN STYLE="white-space: nowrap" ><CODE CLASS="PARAMETER" >start</CODE > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > boolean to indicate if the marker bit should be set.</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1655"><SPAN STYLE="white-space: nowrap" ><SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >Returns</I ></SPAN > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > 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).</P ></TD ></TR ></TBODY ></TABLE ></DIV ><HR><DIV CLASS="REFSECT2" ><A NAME="AEN1660" ></A ><H3 ><A NAME="RTP-SESSION-ADD-TELEPHONE-EVENT" ></A >rtp_session_add_telephone_event ()</H3 ><PRE CLASS="PROGRAMLISTING" >int rtp_session_add_telephone_event (<A HREF="ortp-rtpsession-api.html#RTPSESSION" >RtpSession</A > *session, mblk_t *packet, uint8_t event, int end, uint8_t volume, uint16_t duration);</PRE ><P >Adds a named telephony event to a rtp packet previously allocated using <A HREF="ortp-telephone-events---rfc2833-.html#RTP-SESSION-CREATE-TELEPHONE-EVENT-PACKET" ><CODE CLASS="FUNCTION" >rtp_session_create_telephone_event_packet()</CODE ></A >.</P ><P ></P ><P ></P ><TABLE CLASS="variablelist" BORDER="0" CELLSPACING="0" CELLPADDING="4" ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1678"><SPAN STYLE="white-space: nowrap" ><CODE CLASS="PARAMETER" >session</CODE > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > a rtp session.</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1683"><SPAN STYLE="white-space: nowrap" ><CODE CLASS="PARAMETER" >packet</CODE > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > a rtp packet as a <SPAN CLASS="TYPE" >mblk_t</SPAN ></P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1690"><SPAN STYLE="white-space: nowrap" ><CODE CLASS="PARAMETER" >event</CODE > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > the event type as described in rfc2833, ie one of the TEV_ macros.</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1695"><SPAN STYLE="white-space: nowrap" ><CODE CLASS="PARAMETER" >end</CODE > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > boolean to indicate if the end bit should be set. (end of tone)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1700"><SPAN STYLE="white-space: nowrap" ><CODE CLASS="PARAMETER" >volume</CODE > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > the volume of the telephony tone, as described in rfc2833</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1705"><SPAN STYLE="white-space: nowrap" ><CODE CLASS="PARAMETER" >duration</CODE > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >the duration of the telephony tone, in timestamp unit.</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1710"><SPAN STYLE="white-space: nowrap" ><SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >Returns</I ></SPAN > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >0 on success.</P ></TD ></TR ></TBODY ></TABLE ></DIV ><HR><DIV CLASS="REFSECT2" ><A NAME="AEN1715" ></A ><H3 ><A NAME="RTP-SESSION-READ-TELEPHONE-EVENT" ></A >rtp_session_read_telephone_event ()</H3 ><PRE CLASS="PROGRAMLISTING" >int rtp_session_read_telephone_event (<A HREF="ortp-rtpsession-api.html#RTPSESSION" >RtpSession</A > *session, mblk_t *packet, telephone_event_t **tab);</PRE ><P >Reads telephony events from a rtp packet. *<CODE CLASS="PARAMETER" >tab</CODE > points to the beginning of the event buffer.</P ><P ></P ><P ></P ><TABLE CLASS="variablelist" BORDER="0" CELLSPACING="0" CELLPADDING="4" ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1729"><SPAN STYLE="white-space: nowrap" ><CODE CLASS="PARAMETER" >session</CODE > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > a rtp session from which telephony events are received.</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1734"><SPAN STYLE="white-space: nowrap" ><CODE CLASS="PARAMETER" >packet</CODE > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > a rtp packet as a mblk_t.</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1739"><SPAN STYLE="white-space: nowrap" ><CODE CLASS="PARAMETER" >tab</CODE > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > the address of a pointer.</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1744"><SPAN STYLE="white-space: nowrap" ><SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >Returns</I ></SPAN > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > the number of events in the packet if successfull, 0 if the packet did not contain telephony events.</P ></TD ></TR ></TBODY ></TABLE ></DIV ><HR><DIV CLASS="REFSECT2" ><A NAME="AEN1749" ></A ><H3 ><A NAME="RTP-SESSION-SEND-DTMF" ></A >rtp_session_send_dtmf ()</H3 ><PRE CLASS="PROGRAMLISTING" >int rtp_session_send_dtmf (<A HREF="ortp-rtpsession-api.html#RTPSESSION" >RtpSession</A > *session, char dtmf, uint32_t userts);</PRE ><P >This functions creates telephony events packets for <CODE CLASS="PARAMETER" >dtmf</CODE > and sends them. It uses <A HREF="ortp-telephone-events---rfc2833-.html#RTP-SESSION-CREATE-TELEPHONE-EVENT-PACKET" ><CODE CLASS="FUNCTION" >rtp_session_create_telephone_event_packet()</CODE ></A > and <A HREF="ortp-telephone-events---rfc2833-.html#RTP-SESSION-ADD-TELEPHONE-EVENT" ><CODE CLASS="FUNCTION" >rtp_session_add_telephone_event()</CODE ></A > to create them and finally <A HREF="ortp-rtpsession-api.html#RTP-SESSION-SENDM-WITH-TS" ><CODE CLASS="FUNCTION" >rtp_session_sendm_with_ts()</CODE ></A > to send them.</P ><P ></P ><P ></P ><TABLE CLASS="variablelist" BORDER="0" CELLSPACING="0" CELLPADDING="4" ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1769"><SPAN STYLE="white-space: nowrap" ><CODE CLASS="PARAMETER" >session</CODE > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > a rtp session</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1774"><SPAN STYLE="white-space: nowrap" ><CODE CLASS="PARAMETER" >dtmf</CODE > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > a character meaning the dtmf (ex: '1', '#' , '9' ...)</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1779"><SPAN STYLE="white-space: nowrap" ><CODE CLASS="PARAMETER" >userts</CODE > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > the timestamp</P ></TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" ><A NAME="AEN1784"><SPAN STYLE="white-space: nowrap" ><SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >Returns</I ></SPAN > :</SPAN ></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > 0 if successfull, -1 if the session cannot support telephony events or if the dtmf given as argument is not valid.</P ></TD ></TR ></TBODY ></TABLE ></DIV ></DIV ><TABLE CLASS="navigation" WIDTH="100%" SUMMARY="Navigation footer" CELLPADDING="2" CELLSPACING="2" ><TR VALIGN="middle" ><TD ALIGN="left" ><A ACCESSKEY="p" HREF="ortp-multiplexing-sessions---in-a-one-thread-design.html" ><B ><<< Multiplexing sessions (in a one thread design)</B ></A ></TD ><TD ALIGN="right" ></TD ></TR ></TABLE ></BODY ></HTML >