}
/* Make sure it's a SIP URL */
if (strncasecmp(c, "sip:", 4)) {
- ast_log(LOG_NOTICE, "'%s' is not a valid SIP contcact\n", c);
- return -1;
- }
- c += 4;
+ ast_log(LOG_NOTICE, "'%s' is not a valid SIP contact (missing sip:) trying to use anyway\n", c);
+ } else
+ c += 4;
/* Ditch q */
n = strchr(c, ';');
if (n)
strncpy(tmp, get_header(req, "To"), sizeof(tmp) - 1);
c = ditch_braces(tmp);
- if (strncmp(c, "sip:", 4)) {
- ast_log(LOG_NOTICE, "Invalid to address: '%s' from %s\n", tmp, inet_ntoa(sin->sin_addr));
- return -1;
+ if (!strncmp(c, "sip:", 4)) {
+ name = c + 4;
+ } 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, '@');
if (c)
*c = '\0';
of = get_header(req, "From");
strncpy(from, of, sizeof(from) - 1);
of = ditch_braces(from);
- if (strncmp(of, "sip:", 4))
- return 0;
- else
+ if (strncmp(of, "sip:", 4)) {
+ ast_log(LOG_NOTICE, "From address missing 'sip:', using it anyway\n");
+ } else
of += 4;
/* Get just the username part */
if ((c = strchr(of, '@')))
}
}
transmit_request(p, "BYE", p->outgoing);
+ p->alreadygone = 1;
}
} else if (!strcasecmp(cmd, "CANCEL") || !strcasecmp(cmd, "BYE")) {
copy_request(&p->initreq, req);
gettimeofday(&now, NULL);
ms = (now.tv_sec - rtp->txcore.tv_sec) * 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;
}
ms = calc_txstamp(rtp);
/* Default prediction */
- pred = ms * 8;
+ pred = rtp->lastts + ms * 8;
/* Get a pointer to the header */
rtpheader = (unsigned int *)data;
ms = calc_txstamp(rtp);
/* Default prediction */
- pred = ms * 8;
+ pred = rtp->lastts + ms * 8;
switch(f->subclass) {
case AST_FORMAT_ULAW:
}
/* Re-calculate last TS */
- rtp->lastts = ms * 8;
-#if 0 /* XXX Experiment -- Make timestamp always relative XXX */
+ rtp->lastts = rtp->lastts + ms * 8;
/* If it's close to ou prediction, go for it */
if (abs(rtp->lastts - pred) < 640)
-#endif
rtp->lastts = pred;
-#if 0
else
- printf("Difference is %d, ms is %d\n", abs(rtp->lastts - pred), ms);
-#endif
+ ast_log(LOG_DEBUG, "Difference is %d, ms is %d\n", abs(rtp->lastts - pred), ms);
/* Get a pointer to the header */
rtpheader = (unsigned int *)(f->data - hdrlen);
rtpheader[0] = htonl((2 << 30) | (codec << 16) | (rtp->seqno++));