include/ortp/telephonyevents.h

Go to the documentation of this file.
00001 /*
00002   The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
00003   Copyright (C) 2001  Simon MORLAT simon.morlat@linphone.org
00004 
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Lesser General Public
00007   License as published by the Free Software Foundation; either
00008   version 2.1 of the License, or (at your option) any later version.
00009 
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Lesser General Public License for more details.
00014 
00015   You should have received a copy of the GNU Lesser General Public
00016   License along with this library; if not, write to the Free Software
00017   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00027 #ifndef TELEPHONYEVENTS_H
00028 #define TELEPHONYEVENTS_H
00029 
00030 #include <ortp/rtpsession.h>
00031 
00032 
00033 struct _telephone_event
00034 {
00035 #ifdef ORTP_BIGENDIAN
00036         uint32_t event:8;
00037         uint32_t E:1;
00038         uint32_t R:1;
00039         uint32_t volume:6;
00040         uint32_t duration:16;
00041 #else
00042         uint32_t event:8;
00043         uint32_t volume:6;
00044         uint32_t R:1;
00045         uint32_t E:1;
00046         uint32_t duration:16;
00047 #endif
00048 };
00049 
00050 typedef struct _telephone_event telephone_event_t;
00051 
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055 
00056 /* tell if the session supports telephony events. For this the telephony events payload_type 
00057         must be present in the rtp profile used by the session */
00058         
00059 /* low level functions */       
00060 int rtp_session_telephone_events_supported(RtpSession *session);
00061 int rtp_session_send_telephone_events_supported(RtpSession *session);
00062 int rtp_session_recv_telephone_events_supported(RtpSession *session);
00063 
00064 mblk_t  *rtp_session_create_telephone_event_packet(RtpSession *session, int start);
00065 
00066 int rtp_session_add_telephone_event(RtpSession *session,
00067                         mblk_t *packet, uint8_t event, int end, uint8_t volume, uint16_t duration);
00068                         
00069 int rtp_session_read_telephone_event(RtpSession *session,
00070                 mblk_t *packet,telephone_event_t **tab);
00071 
00072 /* high level functions*/
00073 int rtp_session_send_dtmf(RtpSession *session, char dtmf, uint32_t userts);
00074 int rtp_session_send_dtmf2(RtpSession *session, char dtmf, uint32_t userts, int duration);
00075 /* for high level telephony event callback */
00076 void rtp_session_check_telephone_events(RtpSession *session, mblk_t *m0);
00077 
00078 #ifdef __cplusplus
00079 }
00080 #endif
00081         
00082 /* the size allocated for telephony events packets */
00083 #define TELEPHONY_EVENTS_ALLOCATED_SIZE         (4*sizeof(telephone_event_t))
00084 
00085 /* list of named events */
00086 #define TEV_DTMF_0                      (0)
00087 #define TEV_DTMF_1                      (1)
00088 #define TEV_DTMF_2                      (2)
00089 #define TEV_DTMF_3                      (3)
00090 #define TEV_DTMF_4                      (4)
00091 #define TEV_DTMF_5                      (5)
00092 #define TEV_DTMF_6                      (6)
00093 #define TEV_DTMF_7                      (7)
00094 #define TEV_DTMF_8                      (8)
00095 #define TEV_DTMF_9                      (9)
00096 #define TEV_DTMF_STAR           (10)
00097 #define TEV_DTMF_POUND          (11)
00098 #define TEV_DTMF_A                      (12)
00099 #define TEV_DTMF_B                      (13)
00100 #define TEV_DTMF_C                      (14)
00101 #define TEV_DTMF_D                      (15)
00102 #define TEV_FLASH                       (16)
00103 
00104 
00105 #endif

Generated on Thu Apr 5 18:59:20 2007 for oRTP by  doxygen 1.5.1