summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/jabber/jingle/libjingle/talk/third_party/ortp/telephonyevents.h
blob: 6f6936d5ebcd91dbc3965b1c3391aadfd489d958 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
  The oRTP library is an RTP (Realtime Transport Protocol - rfc1889) stack.
  Copyright (C) 2001  Simon MORLAT simon.morlat@linphone.org

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#ifndef TELEPHONYEVENTS_H
#define TELEPHONYEVENTS_H


#include <rtpsession.h>


struct _telephone_event
{
#ifdef WORDS_BIGENDIAN
	guint32 event:8;
	guint32 E:1;
	guint32 R:1;
	guint32 volume:6;
	guint32 duration:16;
#else
	guint32 event:8;
	guint32 volume:6;
	guint32 R:1;
	guint32 E:1;
	guint32 duration:16;
#endif
};

typedef struct _telephone_event telephone_event_t;

#ifdef __cplusplus
extern "C" {
#endif

extern PayloadType	telephone_event;

/* tell if the session supports telephony events. For this the telephony events payload_type 
	must be present in the rtp profile used by the session */
	
/* low level functions */	
gint rtp_session_telephone_events_supported(RtpSession *session);

mblk_t	*rtp_session_create_telephone_event_packet(RtpSession *session, int start);

gint rtp_session_add_telephone_event(RtpSession *session,
			mblk_t *packet, guchar event, gint end, guchar volume, guint16 duration);
			
gint rtp_session_read_telephone_event(RtpSession *session,
		mblk_t *packet,telephone_event_t **tab);

/* high level functions*/
gint rtp_session_send_dtmf(RtpSession *session, gchar dtmf, guint32 userts);
/* for high level telephony event callback */
void rtp_session_check_telephone_events(RtpSession *session, mblk_t *m0);

#ifdef __cplusplus
}
#endif
	
/* the size allocated for telephony events packets */
#define TELEPHONY_EVENTS_ALLOCATED_SIZE		(4*sizeof(telephone_event_t))

/* list of named events */
#define TEV_DTMF_0			(0)
#define TEV_DTMF_1			(1)
#define TEV_DTMF_2			(2)
#define TEV_DTMF_3			(3)
#define TEV_DTMF_4			(4)
#define TEV_DTMF_5			(5)
#define TEV_DTMF_6			(6)
#define TEV_DTMF_7			(7)
#define TEV_DTMF_8			(8)
#define TEV_DTMF_9			(9)
#define TEV_DTMF_STAR		(10)
#define TEV_DTMF_POUND		(11)
#define TEV_DTMF_A			(12)
#define TEV_DTMF_B			(13)
#define TEV_DTMF_C			(14)
#define TEV_DTMF_D			(15)
#define TEV_FLASH			(16)


#endif