[Asterisk-Dev] Bugfix for CVS-HEAD-06/26/04-21:56:45
programmer_ted
ted at fusionapple.com
Wed Jun 30 01:07:09 MST 2004
Hi,
My friend and I were getting a warning when calling his Sipura from a PSTN
line (connecting to Asterisk through BroadVoice), that said:
Asked to transmit frame type 64, while native formats is 4 (read/write = 4/4)
and was followed by a hangup (type 64 is 16-bit Signed Linear PCM, type 4
is G711u). I found that many people have had similar issues, but these
were never resolved. So, I figured that because Asterisk is open-source,
I'd dive into the code and try to fix the bug.
After a couple of hours of familiarizing myself with the Asterisk code and
tracing the problem, I found that for some reason the tone generator, which
uses 16-bit Signed Linear PCM, was still being allocated and
playtones_generator (indications.c) was still getting called, regardless
that the Sipura doesn't take SLINEAR data (in my case, it accepts
G711u). So, I ended up adding an if conditional to the beginning of the
playtones_alloc function (indications.c) to check if SLINEAR was supported
by the channel, and if not, return 0 (which, when received by the
ast_activate_generator function (channel.c), causes the channel
generatordata to remain empty, effectively stopping the SLINEAR data from
being sent in the most nonintrusive way possible).
NOTICE: this bugfix will work for similar issues involving format 64
(16-bit Signed Linear PCM) being sent even if channel capabilities don't
allow it, if the generator is involved - it's not limited to my situation
(dialing the Sipura from Asterisk).
This patch should be applied to indications.c under the main asterisk
source directory (usually /usr/src/asterisk):
68a69
> if (!(chan->nativeformats & AST_FORMAT_SLINEAR)) return 0;
Oh, and finally, here's a shameless plug to a good friend's website (which
includes a VOIP forum!): http://outcast.ws
Comments? Questions? :)
More information about the asterisk-dev
mailing list