Posted: Sat Jul 28, 2007 5:52 pm Post subject: [Asterisk-bsd] MeetMe drift
On Sun, 29 Jul 2007 01:35:32 +0800, Dinesh Nair wrote:
Quote:
On Fri, 27 Jul 2007 17:10:07 -0700, David G Lawrence wrote:
> Attached is a slightly improved version of my ztdummy.c that should
> work if system HZ is larger than 1000.
david,
this is excellent. i'll check it out a little bit on the various freebsd
boxes we've got, and if it does work, i'll commit it to the zaptel-bsd
subversion repository.
just a cursory build and test on my hp nc6230 notebook running freebsd 6.2
shows that your ztdumy gives about 99.53% accuracy as measured by zttest.
the original ztdummy used to vary from 94% to 99% and was quite
inconsistent in this regard. more testing is obviously required,
especially by systems which are not synced with ntp.
--
Regards, /\_/\ "All dogs go to heaven."
dinesh@alphaque.com (0 0) http://www.openmalaysiablog.com/
+==========================----oOO--(_)--OOo----==========================+
| for a in past present future; do |
| for b in clients employers associates relatives neighbours pets; do |
| echo "The opinions here in no way reflect the opinions of my $a $b." |
| done; done |
+=========================================================================+
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Sat Jul 28, 2007 9:31 pm Post subject: [Asterisk-bsd] MeetMe drift
Quote:
On Sun, 29 Jul 2007 01:35:32 +0800, Dinesh Nair wrote:
> On Fri, 27 Jul 2007 17:10:07 -0700, David G Lawrence wrote:
>
> > Attached is a slightly improved version of my ztdummy.c that should
> > work if system HZ is larger than 1000.
>
> david,
>
> this is excellent. i'll check it out a little bit on the various freebsd
> boxes we've got, and if it does work, i'll commit it to the zaptel-bsd
> subversion repository.
just a cursory build and test on my hp nc6230 notebook running freebsd 6.2
shows that your ztdumy gives about 99.53% accuracy as measured by zttest.
the original ztdummy used to vary from 94% to 99% and was quite
inconsistent in this regard. more testing is obviously required,
especially by systems which are not synced with ntp.
I don't know how long zttest does its testing, but with a stablized NTP
synced clock, it should be 100% accurate over the somewhat longer term (say
a few minutes). In other words, it should actually be more accurate over
the long term than an un-synced Zaptel hardware timer.
-DG
David G. Lawrence
President
Download Technologies, Inc. - http://www.downloadtech.com - (866) 399 8500
Co-Founder, The FreeBSD Project - http://www.freebsd.org
Pave the road of life with opportunities.
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Sun Jul 29, 2007 5:29 am Post subject: [Asterisk-bsd] MeetMe drift
Quote:
On Fri, 27 Jul 2007 17:10:07 -0700, David G Lawrence wrote:
Attached is a slightly improved version of my ztdummy.c that should
work if system HZ is larger than 1000.
I appreciate your help with this problem. FWIW here are some zttest
results with and without your patch:
# $FreeBSD: src/sys/i386/conf/CUSTOM,v 1.429.2.13 2006/10/09 18:41:36 simon Exp $
22,23d21
< cpu I486_CPU
< cpu I586_CPU
25c23
< ident GENERIC
---
Quote:
ident CUSTOM
28,30c26
< #hints "GENERIC.hints" # Default places to
look for devices.
<
< makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols
---
Quote:
#hints "CUSTOM.hints" # Default places to look for devices.
61a58
Quote:
device carp
# pkg_info | egrep '^(asterisk|zaptel)'
asterisk-1.4.9 An Open Source PBX and telephony toolkit
zaptel-1.4.6_2 A FreeBSD Driver for FXO, FXS, BRI and PRI Telephony Cards
Posted: Sun Jul 29, 2007 11:10 am Post subject: [Asterisk-bsd] MeetMe drift
Quote:
> On Fri, 27 Jul 2007 17:10:07 -0700, David G Lawrence wrote:
> Attached is a slightly improved version of my ztdummy.c that should
> work if system HZ is larger than 1000.
I appreciate your help with this problem. FWIW here are some zttest
results with and without your patch:
Hi, Corey. As I mentioned previously, the very short term accuracy of my
ztdummy.c (1 second or less) is very good, but not perfect. PC timers just
don't allow for that. With HZ=1000, the error that will result is 1ms of
jitter, so short term tests will show the accuracy number as less than
perfect. The problem there is actually with the test program, not the
timer. :-) 1ms of jitter in 1 second will not be a problem with packet
voice (in fact anything better than 10ms is as good as perfect).
Quote:
Digium says zttest should report > 99.98 for there not to be timing issues.
Digium is wrong. :-) ...or at least their conclusion is based on an
incorrect assumption - that short term and long term timer accuracy are
the same, which would be the case with a Zaptel hardware timer, but not
in the case where 1ppt corrections are periodically applied (as in my
ztdummy).
The numbers reported by zttest are misleading and wrong, at least when
measuring a timer that has 100% long term accuracy, but just "very good"
sub-second accuracy.
Let me illustrate. The accuracy of zttest.c's results can be improved
by a factor of 10 with the following patch:
...and if you change SIZE above to 800000 (and have a lot of patience -
it will take several minutes to get the first number :-)), you'll get
something like this:
David Greenman-Lawrence
President
Download Technologies, Inc. - http://www.downloadtech.com - (866) 399 8500
Co-Founder, The FreeBSD Project - http://www.freebsd.org
Pave the road of life with opportunities.
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Sun Jul 29, 2007 6:05 pm Post subject: [Asterisk-bsd] MeetMe drift
David,
Quote:
Attached is a patch to Asterisk's channel.c that limits the queue
depth of voice frames to a maximum of just 2 frames (40ms) on the channel
I assume this is a patch against 1.2 as 1.4 rejects it. After looking
at the 1.4 code, there seems to already be a mechanism to limit queue
size in place. Here's a snippet from channel.c:921
/* Allow up to 96 voice frames outstanding, and up to 128 total frames */
if (((fin->frametype == AST_FRAME_VOICE) && (qlen > 96)) || (qlen > 128)) {
if (fin->frametype != AST_FRAME_VOICE) {
ast_log(LOG_WARNING, "Exceptionally long queue length queuing to
%s\n", chan->name);
CRASH;
} else {
if (option_debug)
ast_log(LOG_DEBUG, "Dropping voice to exceptionally long queue on
%s\n", chan->name);
ast_frfree(f);
ast_channel_unlock(chan);
return 0;
}
}
Am I understanding this correctly or is this a different queue? Thanks
for your continued input on this.
Regards,
-Michael I.
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Sun Jul 29, 2007 7:08 pm Post subject: [Asterisk-bsd] MeetMe drift
Quote:
David,
> Attached is a patch to Asterisk's channel.c that limits the queue
> depth of voice frames to a maximum of just 2 frames (40ms) on the channel
I assume this is a patch against 1.2 as 1.4 rejects it. After looking
at the 1.4 code, there seems to already be a mechanism to limit queue
size in place. Here's a snippet from channel.c:921
/* Allow up to 96 voice frames outstanding, and up to 128 total frames */
...
Quote:
Am I understanding this correctly or is this a different queue? Thanks
for your continued input on this.
That code prevents the queue from growing larger than 2.5 *seconds* long
and is utterly ineffective at doing much of anything except causing Asterisk
to core dump. :-) ...and it's not new - it is in 1.2 as well.
Yes, the patch was against 1.2.13. I don't have 1.4 handy, but I recall
that the function was essentially identical.
-DG
David Greenman-Lawrence
President
Download Technologies, Inc. - http://www.downloadtech.com - (866) 399 8500
Co-Founder, The FreeBSD Project - http://www.freebsd.org
Pave the road of life with opportunities.
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Sun Jul 29, 2007 7:17 pm Post subject: [Asterisk-bsd] MeetMe drift
Quote:
Yes, the patch was against 1.2.13. I don't have 1.4 handy, but I recall
that the function was essentially identical.
1.4 has converted to using LIST macros to do list traversals and
manipulations. I'll have to rewrite the patch for that. No promises on
when I'll be able to get to that.
Posted: Sun Jul 29, 2007 11:26 pm Post subject: [Asterisk-bsd] MeetMe drift
David,
Quote:
1.4 has converted to using LIST macros to do list traversals and
manipulations. I'll have to rewrite the patch for that. No promises on
when I'll be able to get to that.
I've attached my first attempt at this. It seems to be dropping a few
initial frames during a call (announcements begin mid-word) and has
segfaulted Asterisk a few times. My 1.4.x programming skills are
nothing to write home about but perhaps someone can take a look both
of our patches and see where I've gone wrong.
-Michael I.
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Mon Jul 30, 2007 12:37 am Post subject: [Asterisk-bsd] MeetMe drift
Quote:
David,
> 1.4 has converted to using LIST macros to do list traversals and
> manipulations. I'll have to rewrite the patch for that. No promises on
> when I'll be able to get to that.
>
I've attached my first attempt at this. It seems to be dropping a few
initial frames during a call (announcements begin mid-word) and has
segfaulted Asterisk a few times. My 1.4.x programming skills are
nothing to write home about but perhaps someone can take a look both
of our patches and see where I've gone wrong.
Nice try, but you translated the patch a bit too literally. :-) It
needed to be re-implemented for use with the queue macros.
Try the attached. Note that this is *completely* untested - I don't even
know for sure if it will compile - I don't run 1.4.x on any machines yet
...but nonetheless I think it will work perfectly. :-)
Please let me know if/how it works for you.
Posted: Mon Jul 30, 2007 1:00 am Post subject: [Asterisk-bsd] MeetMe drift
David,
Quote:
Nice try, but you translated the patch a bit too literally. :-) It
needed to be re-implemented for use with the queue macros.
Live and learn... :)
Quote:
Try the attached. Note that this is *completely* untested - I don't even
know for sure if it will compile - I don't run 1.4.x on any machines yet
...but nonetheless I think it will work perfectly. :-)
clean compile, no more cut frames, 6 channels open switching phones, no crashes
Now that both of your new pieces are in place, I am able to test the
conference delay problems at work tomorrow on real hardware. Thanks
again for all of the time you've spent on this.
-Michael I.
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Mon Jul 30, 2007 1:14 am Post subject: [Asterisk-bsd] MeetMe drift
Quote:
> Try the attached. Note that this is *completely* untested - I don't even
> know for sure if it will compile - I don't run 1.4.x on any machines yet
> ...but nonetheless I think it will work perfectly. :-)
clean compile, no more cut frames, 6 channels open switching phones, no crashes
Now that both of your new pieces are in place, I am able to test the
conference delay problems at work tomorrow on real hardware. Thanks
again for all of the time you've spent on this.
I'm eager to hear how it goes. BTW, the patch to channel.c actually fixes
long delay problems in all calls, not just in conferences. Ideally, the
queue limit would be a tunable number from a config file and the CLI, but
I find that the limit of 3 voice frames (2 previously on the queue plus
the most recent frame) - a total 0f 60ms, is more than adequate buffering
on calls. Also note that the limit code is written specially to drop the
oldest frames. Some people think it doesn't matter which frames you drop
(oldest or newest), but they are wrong. ;-)
Posted: Mon Jul 30, 2007 3:29 am Post subject: [Asterisk-bsd] MeetMe drift
On Fri, 27 Jul 2007 17:38:38 -0700, David G Lawrence wrote:
Quote:
Attached is a patch to Asterisk's channel.c that limits the queue
depth of voice frames to a maximum of just 2 frames (40ms) on the channel
input queue. Under certain circumstances, this may result in an
occasional dropped voice frame, but that is better in my opinion than
adding extra latency to the call.
i'll also test this in conjunction with your ztdummy.c modifications. as
i'm travelling in china at the moment, i'll only be able to revert when i
get back this weekend. if they both are fine, i'll commit your ztdummy
modifications into the zaptel-bsd subversion repository.
however, i'd really need more folk to test the ztdummy.c patches, just to
be sure we're not breaking something else.
--
Regards, /\_/\ "All dogs go to heaven."
dinesh@alphaque.com (0 0) http://www.openmalaysiablog.com/
+==========================----oOO--(_)--OOo----==========================+
| for a in past present future; do |
| for b in clients employers associates relatives neighbours pets; do |
| echo "The opinions here in no way reflect the opinions of my $a $b." |
| done; done |
+=========================================================================+
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
I'm eager to hear how it goes. BTW, the patch to channel.c actually fixes
Everything still sounds perfect after a two hour conference between an
incoming call on an ISDN line, an external SIP softphone and an
internal SIP hardphone. This was done on a 266Mhz system that was
periodically put under load by parsing multiple php pages (5-min loads
of > 2.x). This same setup fell apart after a few minutes of load
without your patches.
This has completely solved my problem! Hopefully others report the
same results and this can be incorporated into the zaptel for bsd
repo. The channel patch is going into the AskoziaPBX build. Is it
worth submitting to the digium bug tracker?
-Michael I.
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
This has completely solved my problem! Hopefully others report the
Glad I could help!
Quote:
Is it worth submitting to the digium bug tracker?
If it gets into the mainline Asterisk repo, then FreeBSD won't outperform
Linux like it is supposed to. ;-)
-DG
David G. Lawrence
President
Download Technologies, Inc. - http://www.downloadtech.com - (866) 399 8500
Co-Founder, The FreeBSD Project - http://www.freebsd.org
Pave the road of life with opportunities.
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
With the original zaptel ztdummy by the time the conference is going
for 20 minutes or so there is considerable latency between the sender
and the receiver (several seconds).
Then I shutdown asterisk, unload the zaptel drivers, rebuild zaptel
with your patch, load zaptel and start asterisk (same config, same
everything besides ztdummy.c) life is good.
I've had the call going for 45 minutes and there is no additional
latency from the first second of the call.
Problem fixed.
Can we get this ztdummy.c patch into the ports system ASAP ? :)
-Corey Smith
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum