a-oRTP  5.2.0
telephonyevents.h
Go to the documentation of this file.
1 /*
2  The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
3  Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
26 #ifndef TELEPHONYEVENTS_H
27 #define TELEPHONYEVENTS_H
28 
29 #include <ortp/rtpsession.h>
30 
32 #ifdef ORTP_BIGENDIAN
33  uint32_t event : 8;
34  uint32_t E : 1;
35  uint32_t R : 1;
36  uint32_t volume : 6;
37  uint32_t duration : 16;
38 #else
39  uint32_t event : 8;
40  uint32_t volume : 6;
41  uint32_t R : 1;
42  uint32_t E : 1;
43  uint32_t duration : 16;
44 #endif
45 };
46 
47 typedef struct _telephone_event telephone_event_t;
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 /* tell if the session supports telephony events. For this the telephony events payload_type
54  must be present in the rtp profile used by the session */
55 
56 /* low level functions */
57 int rtp_session_telephone_events_supported(RtpSession *session);
58 int rtp_session_send_telephone_events_supported(RtpSession *session);
59 int rtp_session_recv_telephone_events_supported(RtpSession *session);
60 
61 mblk_t *rtp_session_create_telephone_event_packet(RtpSession *session, int start);
62 
63 int rtp_session_add_telephone_event(RtpSession *session, mblk_t *packet, uint8_t event, int end, uint8_t volume, uint16_t duration);
64 
65 int rtp_session_read_telephone_event(RtpSession *session, mblk_t *packet, telephone_event_t **tab);
66 
67 /* high level functions*/
68 int rtp_session_send_dtmf(RtpSession *session, char dtmf, uint32_t userts);
69 int rtp_session_send_dtmf2(RtpSession *session, char dtmf, uint32_t userts, int duration);
70 /* for high level telephony event callback */
71 void rtp_session_check_telephone_events(RtpSession *session, mblk_t *m0);
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 /* the size allocated for telephony events packets */
78 #define TELEPHONY_EVENTS_ALLOCATED_SIZE (4 * sizeof(telephone_event_t))
79 
80 /* list of named events */
81 #define TEV_DTMF_0 (0)
82 #define TEV_DTMF_1 (1)
83 #define TEV_DTMF_2 (2)
84 #define TEV_DTMF_3 (3)
85 #define TEV_DTMF_4 (4)
86 #define TEV_DTMF_5 (5)
87 #define TEV_DTMF_6 (6)
88 #define TEV_DTMF_7 (7)
89 #define TEV_DTMF_8 (8)
90 #define TEV_DTMF_9 (9)
91 #define TEV_DTMF_STAR (10)
92 #define TEV_DTMF_POUND (11)
93 #define TEV_DTMF_A (12)
94 #define TEV_DTMF_B (13)
95 #define TEV_DTMF_C (14)
96 #define TEV_DTMF_D (15)
97 #define TEV_FLASH (16)
98 
99 #endif
The RtpSession api.
Definition: rtpsession.h:261
Definition: telephonyevents.h:31
Definition: str_utils.h:25