aboutsummaryrefslogtreecommitdiffstats
path: root/rtp.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-05-02 15:37:34 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-05-02 15:37:34 +0000
commit69841867537dfa3d428ff5006c5f4a76a4a781ab (patch)
tree3b65f539dfb3e4461436cdc4d8a48891221a677c /rtp.c
parentf90d5056f66da9d01d4223b369c4bcba0bf83681 (diff)
Show uptime
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@951 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'rtp.c')
-rwxr-xr-xrtp.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/rtp.c b/rtp.c
index 2608f417e..23cff46c2 100755
--- a/rtp.c
+++ b/rtp.c
@@ -151,6 +151,33 @@ static struct ast_frame *send_dtmf(struct ast_rtp *rtp)
}
+static struct ast_frame *process_cisco_dtmf(struct ast_rtp *rtp, unsigned char *data, int len)
+{
+ unsigned int event;
+ char resp = 0;
+ struct ast_frame *f = NULL;
+ event = ntohl(*((unsigned int *)(data)));
+ event &= 0x001F;
+#if 0
+ printf("Cisco Digit: %08x (len = %d)\n", event, len);
+#endif
+ if (event < 10) {
+ resp = '0' + event;
+ } else if (event < 11) {
+ resp = '*';
+ } else if (event < 12) {
+ resp = '#';
+ } else if (event < 16) {
+ resp = 'A' + (event - 12);
+ }
+ if (rtp->resp && (rtp->resp != resp)) {
+ f = send_dtmf(rtp);
+ }
+ rtp->resp = resp;
+ rtp->dtmfcount = dtmftimeout;
+ return f;
+}
+
static struct ast_frame *process_rfc2833(struct ast_rtp *rtp, unsigned char *data, int len)
{
unsigned int event;
@@ -287,6 +314,10 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
/* It's special -- rfc2833 process it */
f = process_rfc2833(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen);
if (f) return f; else return &null_frame;
+ } else if (rtpPT.code == AST_RTP_CISCO_DTMF) {
+ /* It's really special -- process it the Cisco way */
+ f = process_cisco_dtmf(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen);
+ if (f) return f; else return &null_frame;
} else if (rtpPT.code == AST_RTP_CN) {
/* Comfort Noise */
f = process_rfc3389(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen);
@@ -379,6 +410,7 @@ static struct {
{{1, AST_FORMAT_SPEEX}, "audio", "SPEEX"},
{{1, AST_FORMAT_ILBC}, "audio", "iLBC"},
{{0, AST_RTP_DTMF}, "audio", "telephone-event"},
+ {{0, AST_RTP_CISCO_DTMF}, "audio", "bastard-telephone-event"},
{{0, AST_RTP_CN}, "audio", "CN"},
{{1, AST_FORMAT_JPEG}, "video", "JPEG"},
{{1, AST_FORMAT_PNG}, "video", "PNG"},
@@ -410,6 +442,7 @@ static struct rtpPayloadType static_RTP_PT[MAX_RTP_PT] = {
[97] = {1, AST_FORMAT_ILBC},
[101] = {0, AST_RTP_DTMF},
[110] = {1, AST_FORMAT_SPEEX},
+ [121] = {0, AST_RTP_CISCO_DTMF}, // Must be type 121
};
void ast_rtp_pt_clear(struct ast_rtp* rtp)