summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2009-01-05 16:59:36 +0000
committerMark Michelson <mmichelson@digium.com>2009-01-05 16:59:36 +0000
commit129e8a04e83a13ed2d9c59521c793b483f706117 (patch)
tree665daa42aaa6dceb6522b8e9c590ac3fdc8a3778 /channels
parentd13e236488984e24c044dc93589c0ec1e88ca118 (diff)
Merged revisions 167179 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r167179 | mmichelson | 2009-01-05 10:51:59 -0600 (Mon, 05 Jan 2009) | 41 lines A couple of changes to T.38 SDP attribute handling There are some boolean attributes for T.38 such as T38FaxFillBitRemoval, T38FaxTranscodingMMR, and T38FaxTranscodingJBIG. By simply being present, we should treat these as a "true" value. The current code, however, was requiring a 1 or 0 as the value of the attribute in order to parse it. This is due to the fact that there are some T.38 endpoints and gateways that also transmit this information incorrectly. This patch follows the "be liberal in what you accept and strict in what you send" philosophy by accepting both the correctly- and incorrectly-formatted attributes, but only sending information as it is supposed to be sent. It was also discovered that a particular type of T.38 gateway sends some non-standard T.38 SDP attributes. Instead of using T38FaxMaxDatagram and T38MaxBitRate, it used T38MaxDatagram and T38FaxMaxRate respectively. We now will properly accept these attributes as well. Note that there are a lot of patches cited in the below commit message template. This is because the person who submitted these patches is an awesome person and wrote 1.4, 1.6.0, and 1.6.1 variants. (closes issue #13976) Reported by: linulin Patches: chan_sip.c.1.4-update1.diff uploaded by arcivanov (license 648) chan_sip.c.1.6.0-update1.diff uploaded by arcivanov (license 648) chan_sip.c.1.6.1-update1.diff uploaded by arcivanov (license 648) chan_sip.c.1.4-relaxedT38_update1.diff uploaded by arcivanov (license 648) chan_sip.c.1.6.0-relaxedT38_update1.diff uploaded by arcivanov (license 648) chan_sip.c.1.6.1-relaxedT38_update1.diff uploaded by arcivanov (license 648) Tested by: arcivanov ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@167180 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c61
1 files changed, 39 insertions, 22 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index c42eaac1d..f588543a5 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -7711,7 +7711,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
if ((sscanf(a, "T38FaxMaxBuffer:%d", &x) == 1)) {
found = 1;
ast_debug(3, "MaxBufferSize:%d\n", x);
- } else if ((sscanf(a, "T38MaxBitRate:%d", &x) == 1)) {
+ } else if ((sscanf(a, "T38MaxBitRate:%d", &x) == 1) || (sscanf(a, "T38FaxMaxRate:%d", &x) == 1)) {
found = 1;
ast_debug(3, "T38MaxBitRate: %d\n", x);
switch (x) {
@@ -7741,27 +7741,41 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
peert38capability |= T38FAX_VERSION_0;
else if (x == 1)
peert38capability |= T38FAX_VERSION_1;
- } else if ((sscanf(a, "T38FaxMaxDatagram:%d", &x) == 1)) {
+ } else if ((sscanf(a, "T38FaxMaxDatagram:%d", &x) == 1) || (sscanf(a, "T38MaxDatagram:%d", &x) == 1)) {
found = 1;
ast_debug(3, "FaxMaxDatagram: %d\n", x);
ast_udptl_set_far_max_datagram(p->udptl, x);
ast_udptl_set_local_max_datagram(p->udptl, x);
- } else if ((sscanf(a, "T38FaxFillBitRemoval:%d", &x) == 1)) {
+ } else if ((strncmp(a, "T38FaxFillBitRemoval", 20) == 0)) {
found = 1;
- ast_debug(3, "FillBitRemoval: %d\n", x);
- if (x == 1)
+ if(sscanf(a, "T38FaxFillBitRemoval:%d", &x) == 1) {
+ ast_debug(3, "FillBitRemoval: %d\n", x);
+ if(x == 1)
peert38capability |= T38FAX_FILL_BIT_REMOVAL;
- } else if ((sscanf(a, "T38FaxTranscodingMMR:%d", &x) == 1)) {
+ } else {
+ ast_debug(3, "FillBitRemoval\n");
+ peert38capability |= T38FAX_FILL_BIT_REMOVAL;
+ }
+ } else if ((strncmp(a, "T38FaxTranscodingMMR", 20) == 0)) {
found = 1;
- ast_debug(3, "Transcoding MMR: %d\n", x);
- if (x == 1)
+ if(sscanf(a, "T38FaxTranscodingMMR:%d", &x) == 1) {
+ ast_debug(3, "Transcoding MMR: %d\n", x);
+ if(x == 1)
peert38capability |= T38FAX_TRANSCODING_MMR;
- }
- if ((sscanf(a, "T38FaxTranscodingJBIG:%d", &x) == 1)) {
+ } else {
+ ast_debug(3, "Transcoding MMR\n");
+ peert38capability |= T38FAX_TRANSCODING_MMR;
+ }
+ } else if ((strncmp(a, "T38FaxTranscodingJBIG", 21) == 0)) {
found = 1;
- ast_debug(3, "Transcoding JBIG: %d\n", x);
- if (x == 1)
+ if(sscanf(a, "T38FaxTranscodingJBIG:%d", &x) == 1) {
+ ast_debug(3, "Transcoding JBIG: %d\n", x);
+ if(x == 1)
peert38capability |= T38FAX_TRANSCODING_JBIG;
+ } else {
+ ast_debug(3, "Transcoding JBIG\n");
+ peert38capability |= T38FAX_TRANSCODING_JBIG;
+ }
} else if ((sscanf(a, "T38FaxRateManagement:%255s", s) == 1)) {
found = 1;
ast_debug(3, "RateManagement: %s\n", s);
@@ -8815,25 +8829,25 @@ static int t38_get_rate(int t38cap)
int maxrate = (t38cap & (T38FAX_RATE_14400 | T38FAX_RATE_12000 | T38FAX_RATE_9600 | T38FAX_RATE_7200 | T38FAX_RATE_4800 | T38FAX_RATE_2400));
if (maxrate & T38FAX_RATE_14400) {
- ast_debug(2, "T38MaxFaxRate 14400 found\n");
+ ast_debug(2, "T38MaxBitRate 14400 found\n");
return 14400;
} else if (maxrate & T38FAX_RATE_12000) {
- ast_debug(2, "T38MaxFaxRate 12000 found\n");
+ ast_debug(2, "T38MaxBitRate 12000 found\n");
return 12000;
} else if (maxrate & T38FAX_RATE_9600) {
- ast_debug(2, "T38MaxFaxRate 9600 found\n");
+ ast_debug(2, "T38MaxBitRate 9600 found\n");
return 9600;
} else if (maxrate & T38FAX_RATE_7200) {
- ast_debug(2, "T38MaxFaxRate 7200 found\n");
+ ast_debug(2, "T38MaxBitRate 7200 found\n");
return 7200;
} else if (maxrate & T38FAX_RATE_4800) {
- ast_debug(2, "T38MaxFaxRate 4800 found\n");
+ ast_debug(2, "T38MaxBitRate 4800 found\n");
return 4800;
} else if (maxrate & T38FAX_RATE_2400) {
- ast_debug(2, "T38MaxFaxRate 2400 found\n");
+ ast_debug(2, "T38MaxBitRate 2400 found\n");
return 2400;
} else {
- ast_debug(2, "Strange, T38MaxFaxRate NOT found in peers T38 SDP.\n");
+ ast_debug(2, "Strange, T38MaxBitRate NOT found in peers T38 SDP.\n");
return 0;
}
}
@@ -8899,9 +8913,12 @@ static int add_t38_sdp(struct sip_request *resp, struct sip_pvt *p)
ast_str_append(&a_modem, 0, "a=T38FaxVersion:1\r\n");
if ((x = t38_get_rate(p->t38.jointcapability)))
ast_str_append(&a_modem, 0, "a=T38MaxBitRate:%d\r\n", x);
- ast_str_append(&a_modem, 0, "a=T38FaxFillBitRemoval:%d\r\n", (p->t38.jointcapability & T38FAX_FILL_BIT_REMOVAL) ? 1 : 0);
- ast_str_append(&a_modem, 0, "a=T38FaxTranscodingMMR:%d\r\n", (p->t38.jointcapability & T38FAX_TRANSCODING_MMR) ? 1 : 0);
- ast_str_append(&a_modem, 0, "a=T38FaxTranscodingJBIG:%d\r\n", (p->t38.jointcapability & T38FAX_TRANSCODING_JBIG) ? 1 : 0);
+ if ((p->t38.jointcapability & T38FAX_FILL_BIT_REMOVAL) == T38FAX_FILL_BIT_REMOVAL)
+ ast_str_append(&a_modem, 0, "a=T38FaxFillBitRemoval\r\n");
+ if ((p->t38.jointcapability & T38FAX_TRANSCODING_MMR) == T38FAX_TRANSCODING_MMR)
+ ast_str_append(&a_modem, 0, "a=T38FaxTranscodingMMR\r\n");
+ if ((p->t38.jointcapability & T38FAX_TRANSCODING_JBIG) == T38FAX_TRANSCODING_JBIG)
+ ast_str_append(&a_modem, 0, "a=T38FaxTranscodingJBIG\r\n");
ast_str_append(&a_modem, 0, "a=T38FaxRateManagement:%s\r\n", (p->t38.jointcapability & T38FAX_RATE_MANAGEMENT_LOCAL_TCF) ? "localTCF" : "transferredTCF");
x = ast_udptl_get_local_max_datagram(p->udptl);
ast_str_append(&a_modem, 0, "a=T38FaxMaxBuffer:%d\r\n", x);