aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_iax2.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-08-07 19:16:53 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-08-07 19:16:53 +0000
commit34d1b5a68bc3e3f1e2c2748c69f24acbe02f90f7 (patch)
tree0faaaf0c589b9551e05168ee8e96f8bd0c401401 /channels/chan_iax2.c
parente86c92fb1c7622293dc5b99f54a9b3af485586fe (diff)
Merge Steven Davie's bridging patches
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3592 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_iax2.c')
-rwxr-xr-xchannels/chan_iax2.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index d9b955f6b..f135f15eb 100755
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -1672,6 +1672,17 @@ static int forward_delivery(struct iax_frame *fr)
ast_inet_ntoa(iabuf, sizeof(iabuf), p2->addr.sin_addr),
ntohs(p2->addr.sin_port));
+ /* Undo wraparound - which can happen when full VOICE frame wasn't sent by our peer.
+ This is necessary for when our peer is chan_iax2.c v1.175 or earlier which didn't
+ send full frame on timestamp wrap when doing optimized bridging
+ */
+ if (fr->ts + 32767 <= p1->last) {
+ fr->ts = ( (p1->last & 0xFFFF0000) + 0x10000) | (fr->ts & 0xFFFF);
+ p1->last = fr->ts; /* necessary? */
+ if (option_debug)
+ ast_log(LOG_DEBUG, "forward_delivery: pushed forward timestamp to %u\n", fr->ts);
+ }
+
/* Fix relative timestamp */
fr->ts = calc_fakestamp(p1, p2, fr->ts);
/* Now just send it send on the 2nd one
@@ -2824,6 +2835,8 @@ static unsigned int calc_fakestamp(struct chan_iax2_pvt *p1, struct chan_iax2_pv
ms = (p1->rxcore.tv_sec - p2->offset.tv_sec) * 1000 +
(1000000 + p1->rxcore.tv_usec - p2->offset.tv_usec) / 1000 - 1000;
fakets += ms;
+
+ /* FIXME? SLD would rather remove this and leave it to the end system to deal with */
if (fakets <= p2->lastsent)
fakets = p2->lastsent + 1;
p2->lastsent = fakets;
@@ -3279,7 +3292,7 @@ static int iax2_show_channels(int fd, int argc, char *argv[])
iaxs[x]->oseqno, iaxs[x]->iseqno,
iaxs[x]->lag,
iaxs[x]->jitter,
- jitterbufsize(iaxs[x]),
+ use_jitterbuffer ? jitterbufsize(iaxs[x]) : 0,
ast_getformatname(iaxs[x]->voiceformat) );
numchans++;
}