correctly respond to an INVITE with T.38 (bug #3818)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@5378 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2005-04-04 07:05:55 +00:00
parent 7ba20c5024
commit 98d05f22ac

View File

@@ -2616,8 +2616,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
char host[258]; char host[258];
char iabuf[INET_ADDRSTRLEN]; char iabuf[INET_ADDRSTRLEN];
int len = -1; int len = -1;
int portno=0; int portno = -1;
int vportno=0; int vportno = -1;
int peercapability, peernoncodeccapability; int peercapability, peernoncodeccapability;
int vpeercapability=0, vpeernoncodeccapability=0; int vpeercapability=0, vpeernoncodeccapability=0;
struct sockaddr_in sin; struct sockaddr_in sin;
@@ -2628,6 +2628,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
int iterator; int iterator;
int sendonly = 0; int sendonly = 0;
int x; int x;
int found;
int debug=sip_debug_test_pvt(p); int debug=sip_debug_test_pvt(p);
/* Update our last rtprx when we receive an SDP, too */ /* Update our last rtprx when we receive an SDP, too */
@@ -2657,7 +2658,9 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
sdpLineNum_iterator_init(&iterator); sdpLineNum_iterator_init(&iterator);
p->novideo = 1; p->novideo = 1;
while ((m = get_sdp_iterate(&iterator, req, "m"))[0] != '\0') { while ((m = get_sdp_iterate(&iterator, req, "m"))[0] != '\0') {
found = 0;
if ((sscanf(m, "audio %d RTP/AVP %n", &x, &len) == 1)) { if ((sscanf(m, "audio %d RTP/AVP %n", &x, &len) == 1)) {
found = 1;
portno = x; portno = x;
/* Scan through the RTP payload types specified in a "m=" line: */ /* Scan through the RTP payload types specified in a "m=" line: */
ast_rtp_pt_clear(p->rtp); ast_rtp_pt_clear(p->rtp);
@@ -2679,6 +2682,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
ast_rtp_pt_clear(p->vrtp); /* Must be cleared in case no m=video line exists */ ast_rtp_pt_clear(p->vrtp); /* Must be cleared in case no m=video line exists */
if (p->vrtp && (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1)) { if (p->vrtp && (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1)) {
found = 1;
p->novideo = 0; p->novideo = 0;
vportno = x; vportno = x;
/* Scan through the RTP payload types specified in a "m=" line: */ /* Scan through the RTP payload types specified in a "m=" line: */
@@ -2696,6 +2700,12 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
while(*codecs && (*codecs < 33)) codecs++; while(*codecs && (*codecs < 33)) codecs++;
} }
} }
if (!found)
ast_log(LOG_WARNING, "Unknown SDP media type in offer %s\n", m);
}
if (portno == -1 && vportno == -1) {
/* No acceptable offer found in SDP */
return -2;
} }
/* RTP addresses and ports for audio and video */ /* RTP addresses and ports for audio and video */
@@ -2734,7 +2744,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
if (!strcasecmp(a, "sendrecv")) { if (!strcasecmp(a, "sendrecv")) {
sendonly=0; sendonly=0;
} }
if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2) continue; if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2)
continue;
if (debug) if (debug)
ast_verbose("Found description format %s\n", mimeSubtype); ast_verbose("Found description format %s\n", mimeSubtype);
/* Note: should really look at the 'freq' and '#chans' params too */ /* Note: should really look at the 'freq' and '#chans' params too */
@@ -7271,8 +7282,11 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
if (p->owner) { if (p->owner) {
/* Handle SDP here if we already have an owner */ /* Handle SDP here if we already have an owner */
if (!ast_strlen_zero(get_header(req, "Content-Type"))) { if (!ast_strlen_zero(get_header(req, "Content-Type"))) {
if (process_sdp(p, req)) if (process_sdp(p, req)) {
transmit_response(p, "488 Not acceptable here", req);
p->needdestroy = 1;
return -1; return -1;
}
} else { } else {
p->jointcapability = p->capability; p->jointcapability = p->capability;
ast_log(LOG_DEBUG, "Hm.... No sdp for the moment\n"); ast_log(LOG_DEBUG, "Hm.... No sdp for the moment\n");
@@ -7296,8 +7310,11 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
} }
/* Process the SDP portion */ /* Process the SDP portion */
if (!ast_strlen_zero(get_header(req, "Content-Type"))) { if (!ast_strlen_zero(get_header(req, "Content-Type"))) {
if (process_sdp(p, req)) if (process_sdp(p, req)) {
transmit_response(p, "488 Not acceptable here", req);
p->needdestroy = 1;
return -1; return -1;
}
} else { } else {
p->jointcapability = p->capability; p->jointcapability = p->capability;
ast_log(LOG_DEBUG, "Hm.... No sdp for the moment\n"); ast_log(LOG_DEBUG, "Hm.... No sdp for the moment\n");