>>>>> "John" == John Todd <[EMAIL PROTECTED]> writes:
 >> What is the state of speex support in asterisk? I saw the codec
 >> seems to be there.

 John> Install the Speex library support, and re-compile Asterisk.
 John> There's probably a pre-compiled version of Speex for your system;
 John> look around in whatever package manager you use for your Linux
 John> distro.

I do have the libraries installed.

 >> Can speex be used on IAX2 links? Is there much work still to be
 >> done?

 John> Yes, it can be used.  No work required to get functionality.

Really? Have you tried it? I have. It doesn't work -- and a quick look
at chan_iax2.c shows that there is a good reason for this --
get_samples() doesn't know how to calculate the number of samples for an
incoming speex format frame. This results in chopped sound and hundreds
of warnings:

WARNING[163851]: File chan_iax2.c, Line 605 (get_samples): Don't know how to calculate 
samples on 512 packets
WARNING[163851]: File chan_iax2.c, Line 605 (get_samples): Don't know how to calculate 
samples on 512 packets
WARNING[163851]: File chan_iax2.c, Line 605 (get_samples): Don't know how to calculate 
samples on 512 packets
[...]

[time passes]

Ok, adding the following tiny modification to chan_iax2.c solves the
problem:

Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.33
diff -u -r1.33 chan_iax2.c
--- chan_iax2.c 16 Jul 2003 18:45:12 -0000      1.33
+++ chan_iax2.c 18 Jul 2003 19:16:49 -0000
@@ -601,6 +601,9 @@
        case AST_FORMAT_ADPCM:
                samples = f->datalen *2;
                break;
+       case AST_FORMAT_SPEEX:
+               samples = 160 * f->datalen;
+               break;
        default:
                ast_log(LOG_WARNING, "Don't know how to calculate samples on %d 
packets\n", f->subclass);
        }

I don't know if that's correct, but I can now use speex on IAX2
links. It sounds considerably better than GSM.

There is still one remaining problem which I do *not* know how to fix:
when * plays messages from the hard disk stored in GSM format, I get
choppy sound. It seems * can't properly deal with conversion from GSM to
Speex.

--J.
PS: bad advice is worse than no advice...

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to