Recording Music Over Asterisk

Hello guys,
I am totally new to asterisk. I am currently working on a music fingerprinting application, that will record a song over a phone using the asterisk technology, and then fingerprint the song and check for a match on a database, my problem is that while recording over asterisk, the recorded wav file looses too much data, the file is way too small and I am not able to find a match after finger printing. when recorded over other sound recorders the file size is bigger and I am able to find a match. I would really appreciate any help that could be provided.


The PSTN has a bandwidth of 300Hz to 3.4kHz and uses 8 bit codecs (companding from 10 bits). If your application cannot cope with 8kHz sampling rate, G.711 coded material, it is not going to work over the PSTN.

You must record in G.711 (alaw or ulaw) or signed linear format to even achieve this quality. If you have GSM or G.729 selected, these are vocoder based and only intended for voice traffic.

Some VoIP phones support higher quality audio, but only within the system.

Thanks David,
is there really no way to record at a higher sample rate using asterisk. my application needs 11025 Khz.

Use sox to upsample it, but the result will not increase the upper frequency limit, which is set by the anti-aliasing filters in network codecs, and by Nyquist constraints, given the PSTN uses 8kHz PCM.

Any resampling to an rate which isn’t an integral multiple or submultiple is going to cause some additional loss.

You could ask Asterisk to record in wav16, i.e. 16kHz sampling, but, again, this will not put back information lost when the PSTN converted it to 8kHz sampling.

I’m assuming that you are using ISDN or VoIP, and therefore that there is only one A/D conversion. If you are using an analogue line, there will be two A/D conversions, one at the source end, and one within your line card, and the signal will be further degraded.

To a greater or lesser extent, the commonly used telephone codecs are intended of speech. Some, like GSM, are very strongly oriented to speech (don’t expect your application ever to work over a mobile phone.