[Asterisk-Users] Caller ID with BT CD50
Tony Hoyle
tmh at nodomain.org
Fri May 28 16:12:18 MST 2004
Tony Hoyle wrote:
> That's the way the code is written (which is why you have 3 values in
> the dring entry I think). There's an assumption in the code that it has
> 3 rings to compare with.
>
Actually it's worse than that... there is actually no terminator in the code.
It's looking for a distinct pattern of <ring>,<ring>,<short ring> and it
terminates after <short ring>. If you never get that theoretically it'll
never terminate (and scrawl already the stack, memory etc. which isn't a good
thing for an app running in the root context!!!).
The standard ring BT pattern I see is 367,247,217,96 (which is actually
120,30,121, but the numbers are cumulative). The 96 causes a break out of the
loop after the 3rd ring. If the 4th ring was >200 it would be a buffer
overrun (this could be caused easily by, for example, two short rings followed
by a long one).
So what I *suspect* is happening is this:
1. The code is working as written, but isn't really suitable for the UK... it
will work though (you'll have to specify all 3 dring values though).
2. The 4th ring on your second number is actually causing a buffer overrun and
corrupting asterisk... you're lucky it doesn't crash :)
I've changed the patch to fix the buffer overrun, plus a hack to only look for
the dring values you specify, thus:
(just after the ++receivedRingT):
if(receivedRingT==3)
break; /* More than 3 rings would overrun our test buffer */
/* If all 3 dring values are zero, then there's nothing left to detect */
for (counter=0; counter < 3; counter++) {
if (p->drings.ringnum[counter].ring[receivedRingT])
break;
}
if (counter == 3)
break;
In my case if I specify dring1=367,0,0 it'll stop trying to detect after the
first ring.
Not sure I like all the hardcoded numbers for number of drings etc... that's
another patch though :)
Tony
--
Te audire no possum. Musa sapientum fixa est in aure.
Tony Hoyle <tmh at nodomain.org> Key ID: 104D/4F4B6917 2003-09-13
Fingerprint: 063C AFB4 3026 F724 0AA2 02B8 E547 470E 4F4B 6917
More information about the asterisk-users
mailing list