oRTP
0.24.0
|
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 ORTP_PUBLIC int rtp_session_telephone_events_supported(RtpSession *session); 00061 ORTP_PUBLIC int rtp_session_send_telephone_events_supported(RtpSession *session); 00062 ORTP_PUBLIC int rtp_session_recv_telephone_events_supported(RtpSession *session); 00063 ORTP_PUBLIC mblk_t *rtp_session_create_telephone_event_packet(RtpSession *session, int start); 00064 00065 ORTP_PUBLIC int rtp_session_add_telephone_event(RtpSession *session, 00066 mblk_t *packet, uint8_t event, int end, uint8_t volume, uint16_t duration); 00067 00068 ORTP_PUBLIC int rtp_session_read_telephone_event(RtpSession *session, 00069 mblk_t *packet,telephone_event_t **tab); 00070 00071 /* high level functions*/ 00072 ORTP_PUBLIC int rtp_session_send_dtmf(RtpSession *session, char dtmf, uint32_t userts); 00073 ORTP_PUBLIC int rtp_session_send_dtmf2(RtpSession *session, char dtmf, uint32_t userts, int duration); 00074 /* for high level telephony event callback */ 00075 ORTP_PUBLIC void rtp_session_check_telephone_events(RtpSession *session, mblk_t *m0); 00076 00077 #ifdef __cplusplus 00078 } 00079 #endif 00080 00081 /* the size allocated for telephony events packets */ 00082 #define TELEPHONY_EVENTS_ALLOCATED_SIZE (4*sizeof(telephone_event_t)) 00083 00084 /* list of named events */ 00085 #define TEV_DTMF_0 (0) 00086 #define TEV_DTMF_1 (1) 00087 #define TEV_DTMF_2 (2) 00088 #define TEV_DTMF_3 (3) 00089 #define TEV_DTMF_4 (4) 00090 #define TEV_DTMF_5 (5) 00091 #define TEV_DTMF_6 (6) 00092 #define TEV_DTMF_7 (7) 00093 #define TEV_DTMF_8 (8) 00094 #define TEV_DTMF_9 (9) 00095 #define TEV_DTMF_STAR (10) 00096 #define TEV_DTMF_POUND (11) 00097 #define TEV_DTMF_A (12) 00098 #define TEV_DTMF_B (13) 00099 #define TEV_DTMF_C (14) 00100 #define TEV_DTMF_D (15) 00101 #define TEV_FLASH (16) 00102 00103 00104 #endif