Check in TDM and RTP controllable channels (incomplete)

This commit is contained in:
Mathieu Rene committed 2012-06-20 12:30:08 -04:00
1 parent af39d4c9d2
commit 166249b0b9
9 files changed
+1110 -21

No files matched your search

+29 -16
View File
@@ -81,6 +81,7 @@ struct sdp_parser_s {
unsigned pr_insane : 1;
unsigned pr_c_missing : 1;
unsigned pr_config : 1;
unsigned pr_megaco : 1;
};
#define is_posdigit(c) ((c) >= '1' && (c) <= '9')
@@ -176,6 +177,7 @@ sdp_parse(su_home_t *home, char const msg[], issize_t msgsize, int flags)
if (flags & sdp_f_config)
p->pr_c_missing = 1, p->pr_config = 1;
p->pr_mode_manual = (flags & sdp_f_mode_manual) != 0;
p->pr_megaco = (flags & sdp_f_megaco) != 0;
p->pr_session_mode = sdp_sendrecv;
parse_message(p);
@@ -1502,8 +1504,18 @@ static void parse_payload(sdp_parser_t *p, char *r, sdp_rtpmap_t **result)
{
while (*r) {
unsigned long value;
if (((p->pr_config && r[0] == '*') || (p->pr_megaco && r[0] == MEGACO_CHOOSE_TOK)) && (r[1] == ' ' || r[1] == '\0')) {
PARSE_ALLOC(p, sdp_rtpmap_t, rm);
if (parse_ul(p, &r, &value, 128) == 0) {
*result = rm; result = &rm->rm_next;
rm->rm_predef = 1;
rm->rm_any = 1;
rm->rm_encoding = "*";
rm->rm_rate = 0;
return;
} else if (parse_ul(p, &r, &value, 128) == 0 && value < 128) {
PARSE_ALLOC(p, sdp_rtpmap_t, rm);
assert(0 <= value && value < 128);
@@ -1519,21 +1531,8 @@ static void parse_payload(sdp_parser_t *p, char *r, sdp_rtpmap_t **result)
rm->rm_encoding = "";
rm->rm_rate = 0;
}
}
else if (p->pr_config && r[0] == '*' && (r[1] == ' ' || r[1] == '\0')) {
PARSE_ALLOC(p, sdp_rtpmap_t, rm);
*result = rm; result = &rm->rm_next;
rm->rm_predef = 1;
rm->rm_any = 1;
rm->rm_encoding = "*";
rm->rm_rate = 0;
return;
}
else {
parsing_error(p, "m= invalid format for RTP/AVT");
} else {
parsing_error(p, "m= invalid format for RTP/AVP");
return;
}
@@ -1797,6 +1796,13 @@ static int parse_ul(sdp_parser_t *p, char **r,
return 0;
}
if (p->pr_megaco && *ul == MEGACO_CHOOSE_TOK) {
*result = MEGACO_CHOOSE;
(*r)++;
*r += strspn(*r, SPACE TAB);
return 0;
}
return -1;
}
@@ -1824,6 +1830,13 @@ static int parse_ull(sdp_parser_t *p, char **r,
return 0;
}
if (p->pr_megaco && *s == MEGACO_CHOOSE_TOK) {
*result = MEGACO_CHOOSE;
(*r)++;
*r += strspn(*r, SPACE TAB);
return 0;
}
return -1;
}
@@ -24,6 +24,10 @@
#ifndef SDP_H
#define SDP_H
#define MEGACO_CHOOSE_TOK '$'
#define MEGACO_CHOOSE (UINT16_MAX + 1)
/**@file sofia-sip/sdp.h Simple SDP (RFC 2327) Interface.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
@@ -260,7 +264,7 @@ typedef enum {
/** Media announcement.
*
* This structure describes one media type, e.g., audio. The description
* contains the transport address (IP address and port) used for the group,
* contains the transport address (IP address and port) used for the group,/Users/mrene/Downloads
* the transport protocol used, the media formats or RTP payload types, and
* optionally media-specific bandwidth specification, encryption key and
* attributes.
@@ -525,7 +529,9 @@ enum sdp_parse_flags_e {
/** Do not generate or parse SDP mode */
sdp_f_mode_manual = 512,
/** Always generate media-level mode attributes */
sdp_f_mode_always = 1024
sdp_f_mode_always = 1024,
/** Allow optional (choose) parameters */
sdp_f_megaco = 2048
};
/** SDP parser handle. */