mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-22 20:56:39 +00:00
lun feb 24 22:10:09 CET 2003
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2037,10 +2037,9 @@ static int parse_contact(struct sip_pvt *pvt, struct sip_peer *p, struct sip_req
|
|||||||
}
|
}
|
||||||
/* Make sure it's a SIP URL */
|
/* Make sure it's a SIP URL */
|
||||||
if (strncasecmp(c, "sip:", 4)) {
|
if (strncasecmp(c, "sip:", 4)) {
|
||||||
ast_log(LOG_NOTICE, "'%s' is not a valid SIP contcact\n", c);
|
ast_log(LOG_NOTICE, "'%s' is not a valid SIP contact (missing sip:) trying to use anyway\n", c);
|
||||||
return -1;
|
} else
|
||||||
}
|
c += 4;
|
||||||
c += 4;
|
|
||||||
/* Ditch q */
|
/* Ditch q */
|
||||||
n = strchr(c, ';');
|
n = strchr(c, ';');
|
||||||
if (n)
|
if (n)
|
||||||
@@ -2203,11 +2202,12 @@ static int register_verify(struct sip_pvt *p, struct sockaddr_in *sin, struct si
|
|||||||
|
|
||||||
strncpy(tmp, get_header(req, "To"), sizeof(tmp) - 1);
|
strncpy(tmp, get_header(req, "To"), sizeof(tmp) - 1);
|
||||||
c = ditch_braces(tmp);
|
c = ditch_braces(tmp);
|
||||||
if (strncmp(c, "sip:", 4)) {
|
if (!strncmp(c, "sip:", 4)) {
|
||||||
ast_log(LOG_NOTICE, "Invalid to address: '%s' from %s\n", tmp, inet_ntoa(sin->sin_addr));
|
name = c + 4;
|
||||||
return -1;
|
} else {
|
||||||
|
name = c;
|
||||||
|
ast_log(LOG_NOTICE, "Invalid to address: '%s' from %s (missing sip:) trying to use anyway...\n", c, inet_ntoa(sin->sin_addr));
|
||||||
}
|
}
|
||||||
name = c + 4;
|
|
||||||
c = strchr(name, '@');
|
c = strchr(name, '@');
|
||||||
if (c)
|
if (c)
|
||||||
*c = '\0';
|
*c = '\0';
|
||||||
@@ -2434,9 +2434,9 @@ static int check_user(struct sip_pvt *p, struct sip_request *req, char *cmd, cha
|
|||||||
of = get_header(req, "From");
|
of = get_header(req, "From");
|
||||||
strncpy(from, of, sizeof(from) - 1);
|
strncpy(from, of, sizeof(from) - 1);
|
||||||
of = ditch_braces(from);
|
of = ditch_braces(from);
|
||||||
if (strncmp(of, "sip:", 4))
|
if (strncmp(of, "sip:", 4)) {
|
||||||
return 0;
|
ast_log(LOG_NOTICE, "From address missing 'sip:', using it anyway\n");
|
||||||
else
|
} else
|
||||||
of += 4;
|
of += 4;
|
||||||
/* Get just the username part */
|
/* Get just the username part */
|
||||||
if ((c = strchr(of, '@')))
|
if ((c = strchr(of, '@')))
|
||||||
@@ -3299,6 +3299,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
transmit_request(p, "BYE", p->outgoing);
|
transmit_request(p, "BYE", p->outgoing);
|
||||||
|
p->alreadygone = 1;
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(cmd, "CANCEL") || !strcasecmp(cmd, "BYE")) {
|
} else if (!strcasecmp(cmd, "CANCEL") || !strcasecmp(cmd, "BYE")) {
|
||||||
copy_request(&p->initreq, req);
|
copy_request(&p->initreq, req);
|
||||||
|
15
rtp.c
15
rtp.c
@@ -494,6 +494,9 @@ static unsigned int calc_txstamp(struct ast_rtp *rtp)
|
|||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
ms = (now.tv_sec - rtp->txcore.tv_sec) * 1000;
|
ms = (now.tv_sec - rtp->txcore.tv_sec) * 1000;
|
||||||
ms += (now.tv_usec - rtp->txcore.tv_usec) / 1000;
|
ms += (now.tv_usec - rtp->txcore.tv_usec) / 1000;
|
||||||
|
/* Use what we just got for next time */
|
||||||
|
rtp->txcore.tv_sec = now.tv_sec;
|
||||||
|
rtp->txcore.tv_usec = now.tv_usec;
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -529,7 +532,7 @@ int ast_rtp_senddigit(struct ast_rtp *rtp, char digit)
|
|||||||
|
|
||||||
ms = calc_txstamp(rtp);
|
ms = calc_txstamp(rtp);
|
||||||
/* Default prediction */
|
/* Default prediction */
|
||||||
pred = ms * 8;
|
pred = rtp->lastts + ms * 8;
|
||||||
|
|
||||||
/* Get a pointer to the header */
|
/* Get a pointer to the header */
|
||||||
rtpheader = (unsigned int *)data;
|
rtpheader = (unsigned int *)data;
|
||||||
@@ -568,7 +571,7 @@ static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec
|
|||||||
|
|
||||||
ms = calc_txstamp(rtp);
|
ms = calc_txstamp(rtp);
|
||||||
/* Default prediction */
|
/* Default prediction */
|
||||||
pred = ms * 8;
|
pred = rtp->lastts + ms * 8;
|
||||||
|
|
||||||
switch(f->subclass) {
|
switch(f->subclass) {
|
||||||
case AST_FORMAT_ULAW:
|
case AST_FORMAT_ULAW:
|
||||||
@@ -591,16 +594,12 @@ static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Re-calculate last TS */
|
/* Re-calculate last TS */
|
||||||
rtp->lastts = ms * 8;
|
rtp->lastts = rtp->lastts + ms * 8;
|
||||||
#if 0 /* XXX Experiment -- Make timestamp always relative XXX */
|
|
||||||
/* If it's close to ou prediction, go for it */
|
/* If it's close to ou prediction, go for it */
|
||||||
if (abs(rtp->lastts - pred) < 640)
|
if (abs(rtp->lastts - pred) < 640)
|
||||||
#endif
|
|
||||||
rtp->lastts = pred;
|
rtp->lastts = pred;
|
||||||
#if 0
|
|
||||||
else
|
else
|
||||||
printf("Difference is %d, ms is %d\n", abs(rtp->lastts - pred), ms);
|
ast_log(LOG_DEBUG, "Difference is %d, ms is %d\n", abs(rtp->lastts - pred), ms);
|
||||||
#endif
|
|
||||||
/* Get a pointer to the header */
|
/* Get a pointer to the header */
|
||||||
rtpheader = (unsigned int *)(f->data - hdrlen);
|
rtpheader = (unsigned int *)(f->data - hdrlen);
|
||||||
rtpheader[0] = htonl((2 << 30) | (codec << 16) | (rtp->seqno++));
|
rtpheader[0] = htonl((2 << 30) | (codec << 16) | (rtp->seqno++));
|
||||||
|
Reference in New Issue
Block a user