Merged revisions 210817 via svnmerge from

https://origsvn.digium.com/svn/asterisk/trunk

........
  r210817 | file | 2009-08-06 14:47:04 -0300 (Thu, 06 Aug 2009) | 11 lines
  
  Accept additional T.38 reinvites after an initial one has been handled.
  
  Discussion of this subject has yielded that it is not actually acceptable to change
  T.38 parameters after the initial reinvite but declining is harsh and can cause the
  fax to fail when it may be possible to allow it to continue. This patch changes things
  so that additional T.38 reinvites are accepted but parameter changes ignored. This gives
  the fax a fighting chance.
  
  (closes issue #15610)
  Reported by: huangtx2009
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@210820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.2
Joshua Colp 16 years ago
parent 6f1fcca7f8
commit 65793b16c4

@ -8133,108 +8133,110 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
}
if (udptlportno != -1) {
int found = 0, x;
if (p->t38.state != T38_ENABLED) {
int found = 0, x;
old = 0;
memset(&p->t38.their_parms, 0, sizeof(p->t38.their_parms));
old = 0;
memset(&p->t38.their_parms, 0, sizeof(p->t38.their_parms));
/* Scan trough the a= lines for T38 attributes and set apropriate fileds */
iterator = req->sdp_start;
while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') {
if ((sscanf(a, "T38FaxMaxBuffer:%d", &x) == 1)) {
found = 1;
ast_debug(3, "MaxBufferSize:%d\n", x);
} 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) {
case 14400:
p->t38.their_parms.rate = AST_T38_RATE_14400;
break;
case 12000:
p->t38.their_parms.rate = AST_T38_RATE_12000;
break;
case 9600:
p->t38.their_parms.rate = AST_T38_RATE_9600;
break;
case 7200:
p->t38.their_parms.rate = AST_T38_RATE_7200;
break;
case 4800:
p->t38.their_parms.rate = AST_T38_RATE_4800;
break;
case 2400:
p->t38.their_parms.rate = AST_T38_RATE_2400;
break;
}
} else if ((sscanf(a, "T38FaxVersion:%d", &x) == 1)) {
found = 1;
ast_debug(3, "FaxVersion: %d\n", x);
p->t38.their_parms.version = x;
} 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);
} else if ((strncmp(a, "T38FaxFillBitRemoval", 20) == 0)) {
found = 1;
if (sscanf(a, "T38FaxFillBitRemoval:%d", &x) == 1) {
ast_debug(3, "FillBitRemoval: %d\n", x);
if (x == 1) {
/* Scan trough the a= lines for T38 attributes and set apropriate fileds */
iterator = req->sdp_start;
while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') {
if ((sscanf(a, "T38FaxMaxBuffer:%d", &x) == 1)) {
found = 1;
ast_debug(3, "MaxBufferSize:%d\n", x);
} 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) {
case 14400:
p->t38.their_parms.rate = AST_T38_RATE_14400;
break;
case 12000:
p->t38.their_parms.rate = AST_T38_RATE_12000;
break;
case 9600:
p->t38.their_parms.rate = AST_T38_RATE_9600;
break;
case 7200:
p->t38.their_parms.rate = AST_T38_RATE_7200;
break;
case 4800:
p->t38.their_parms.rate = AST_T38_RATE_4800;
break;
case 2400:
p->t38.their_parms.rate = AST_T38_RATE_2400;
break;
}
} else if ((sscanf(a, "T38FaxVersion:%d", &x) == 1)) {
found = 1;
ast_debug(3, "FaxVersion: %d\n", x);
p->t38.their_parms.version = x;
} 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);
} else if ((strncmp(a, "T38FaxFillBitRemoval", 20) == 0)) {
found = 1;
if (sscanf(a, "T38FaxFillBitRemoval:%d", &x) == 1) {
ast_debug(3, "FillBitRemoval: %d\n", x);
if (x == 1) {
p->t38.their_parms.fill_bit_removal = TRUE;
}
} else {
ast_debug(3, "FillBitRemoval\n");
p->t38.their_parms.fill_bit_removal = TRUE;
}
} else {
ast_debug(3, "FillBitRemoval\n");
p->t38.their_parms.fill_bit_removal = TRUE;
}
} else if ((strncmp(a, "T38FaxTranscodingMMR", 20) == 0)) {
found = 1;
if (sscanf(a, "T38FaxTranscodingMMR:%d", &x) == 1) {
ast_debug(3, "Transcoding MMR: %d\n", x);
if (x == 1) {
} else if ((strncmp(a, "T38FaxTranscodingMMR", 20) == 0)) {
found = 1;
if (sscanf(a, "T38FaxTranscodingMMR:%d", &x) == 1) {
ast_debug(3, "Transcoding MMR: %d\n", x);
if (x == 1) {
p->t38.their_parms.transcoding_mmr = TRUE;
}
} else {
ast_debug(3, "Transcoding MMR\n");
p->t38.their_parms.transcoding_mmr = TRUE;
}
} else {
ast_debug(3, "Transcoding MMR\n");
p->t38.their_parms.transcoding_mmr = TRUE;
}
} else if ((strncmp(a, "T38FaxTranscodingJBIG", 21) == 0)) {
found = 1;
if (sscanf(a, "T38FaxTranscodingJBIG:%d", &x) == 1) {
ast_debug(3, "Transcoding JBIG: %d\n", x);
if (x == 1) {
} else if ((strncmp(a, "T38FaxTranscodingJBIG", 21) == 0)) {
found = 1;
if (sscanf(a, "T38FaxTranscodingJBIG:%d", &x) == 1) {
ast_debug(3, "Transcoding JBIG: %d\n", x);
if (x == 1) {
p->t38.their_parms.transcoding_jbig = TRUE;
}
} else {
ast_debug(3, "Transcoding JBIG\n");
p->t38.their_parms.transcoding_jbig = TRUE;
}
} else {
ast_debug(3, "Transcoding JBIG\n");
p->t38.their_parms.transcoding_jbig = TRUE;
}
} else if ((sscanf(a, "T38FaxRateManagement:%255s", s) == 1)) {
found = 1;
ast_debug(3, "RateManagement: %s\n", s);
if (!strcasecmp(s, "localTCF"))
p->t38.their_parms.rate_management = AST_T38_RATE_MANAGEMENT_LOCAL_TCF;
else if (!strcasecmp(s, "transferredTCF"))
p->t38.their_parms.rate_management = AST_T38_RATE_MANAGEMENT_TRANSFERRED_TCF;
} else if ((sscanf(a, "T38FaxUdpEC:%255s", s) == 1)) {
found = 1;
ast_debug(3, "UDP EC: %s\n", s);
if (!strcasecmp(s, "t38UDPRedundancy")) {
ast_udptl_set_error_correction_scheme(p->udptl, UDPTL_ERROR_CORRECTION_REDUNDANCY);
} else if (!strcasecmp(s, "t38UDPFEC")) {
ast_udptl_set_error_correction_scheme(p->udptl, UDPTL_ERROR_CORRECTION_FEC);
} else {
ast_udptl_set_error_correction_scheme(p->udptl, UDPTL_ERROR_CORRECTION_NONE);
} else if ((sscanf(a, "T38FaxRateManagement:%255s", s) == 1)) {
found = 1;
ast_debug(3, "RateManagement: %s\n", s);
if (!strcasecmp(s, "localTCF"))
p->t38.their_parms.rate_management = AST_T38_RATE_MANAGEMENT_LOCAL_TCF;
else if (!strcasecmp(s, "transferredTCF"))
p->t38.their_parms.rate_management = AST_T38_RATE_MANAGEMENT_TRANSFERRED_TCF;
} else if ((sscanf(a, "T38FaxUdpEC:%255s", s) == 1)) {
found = 1;
ast_debug(3, "UDP EC: %s\n", s);
if (!strcasecmp(s, "t38UDPRedundancy")) {
ast_udptl_set_error_correction_scheme(p->udptl, UDPTL_ERROR_CORRECTION_REDUNDANCY);
} else if (!strcasecmp(s, "t38UDPFEC")) {
ast_udptl_set_error_correction_scheme(p->udptl, UDPTL_ERROR_CORRECTION_FEC);
} else {
ast_udptl_set_error_correction_scheme(p->udptl, UDPTL_ERROR_CORRECTION_NONE);
}
}
}
}
/* Remote party offers T38, we need to update state */
if ((t38action == SDP_T38_ACCEPT) &&
(p->t38.state == T38_LOCAL_REINVITE)) {
change_t38_state(p, T38_ENABLED);
} else if ((t38action == SDP_T38_INITIATE) &&
p->owner && p->lastinvite) {
change_t38_state(p, T38_PEER_REINVITE); /* T38 Offered in re-invite from remote party */
/* Remote party offers T38, we need to update state */
if ((t38action == SDP_T38_ACCEPT) &&
(p->t38.state == T38_LOCAL_REINVITE)) {
change_t38_state(p, T38_ENABLED);
} else if ((t38action == SDP_T38_INITIATE) &&
p->owner && p->lastinvite) {
change_t38_state(p, T38_PEER_REINVITE); /* T38 Offered in re-invite from remote party */
}
}
} else {
change_t38_state(p, T38_DISABLED);

Loading…
Cancel
Save