00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef _ASTERISK_RTP_H
00015 #define _ASTERISK_RTP_H
00016
00017 #include <asterisk/frame.h>
00018 #include <asterisk/io.h>
00019 #include <asterisk/sched.h>
00020 #include <asterisk/channel.h>
00021
00022 #include <netinet/in.h>
00023
00024 #if defined(__cplusplus) || defined(c_plusplus)
00025 extern "C" {
00026 #endif
00027
00028
00029
00030 #define AST_RTP_DTMF (1 << 0)
00031
00032 #define AST_RTP_CN (1 << 1)
00033
00034 #define AST_RTP_CISCO_DTMF (1 << 2)
00035
00036 #define AST_RTP_MAX AST_RTP_CISCO_DTMF
00037
00038 struct ast_rtp_protocol {
00039 struct ast_rtp *(*get_rtp_info)(struct ast_channel *chan);
00040 struct ast_rtp *(*get_vrtp_info)(struct ast_channel *chan);
00041 int (*set_rtp_peer)(struct ast_channel *chan, struct ast_rtp *peer, struct ast_rtp *vpeer);
00042 char *type;
00043 struct ast_rtp_protocol *next;
00044 };
00045
00046 struct ast_rtp;
00047
00048 typedef int (*ast_rtp_callback)(struct ast_rtp *rtp, struct ast_frame *f, void *data);
00049
00050 struct ast_rtp *ast_rtp_new(struct sched_context *sched, struct io_context *io, int rtcpenable, int callbackmode);
00051
00052 void ast_rtp_set_peer(struct ast_rtp *rtp, struct sockaddr_in *them);
00053
00054 void ast_rtp_get_peer(struct ast_rtp *rtp, struct sockaddr_in *them);
00055
00056 void ast_rtp_get_us(struct ast_rtp *rtp, struct sockaddr_in *us);
00057
00058 void ast_rtp_destroy(struct ast_rtp *rtp);
00059
00060 void ast_rtp_set_callback(struct ast_rtp *rtp, ast_rtp_callback callback);
00061
00062 void ast_rtp_set_data(struct ast_rtp *rtp, void *data);
00063
00064 int ast_rtp_write(struct ast_rtp *rtp, struct ast_frame *f);
00065
00066 struct ast_frame *ast_rtp_read(struct ast_rtp *rtp);
00067
00068 struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp);
00069
00070 int ast_rtp_fd(struct ast_rtp *rtp);
00071
00072 int ast_rtcp_fd(struct ast_rtp *rtp);
00073
00074 int ast_rtp_senddigit(struct ast_rtp *rtp, char digit);
00075
00076 int ast_rtp_settos(struct ast_rtp *rtp, int tos);
00077
00078
00079 void ast_rtp_pt_clear(struct ast_rtp* rtp);
00080
00081 void ast_rtp_pt_default(struct ast_rtp* rtp);
00082 void ast_rtp_set_m_type(struct ast_rtp* rtp, int pt);
00083 void ast_rtp_set_rtpmap_type(struct ast_rtp* rtp, int pt,
00084 char* mimeType, char* mimeSubtype);
00085
00086
00087 struct rtpPayloadType ast_rtp_lookup_pt(struct ast_rtp* rtp, int pt);
00088 int ast_rtp_lookup_code(struct ast_rtp* rtp, int isAstFormat, int code);
00089
00090 void ast_rtp_get_current_formats(struct ast_rtp* rtp,
00091 int* astFormats, int* nonAstFormats);
00092
00093
00094 char* ast_rtp_lookup_mime_subtype(int isAstFormat, int code);
00095
00096 void ast_rtp_setnat(struct ast_rtp *rtp, int nat);
00097
00098 int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc);
00099
00100 int ast_rtp_proto_register(struct ast_rtp_protocol *proto);
00101
00102 void ast_rtp_proto_unregister(struct ast_rtp_protocol *proto);
00103
00104 void ast_rtp_stop(struct ast_rtp *rtp);
00105
00106 void ast_rtp_init(void);
00107
00108 void ast_rtp_reload(void);
00109
00110 #if defined(__cplusplus) || defined(c_plusplus)
00111 }
00112 #endif
00113
00114 #endif