GRYNX

13th 2005f October, 2005

VoIP dect OSS Linux

by @ 15:33. Filed under Uncategorized

VoIP DECT and analogue phones on OSS Linux soundcards using Asterisk

By Onno

Table Of Contents

News
Introduction

Architecture
Hardware ‘hacking’
First approach: transformers
Second one: Direct modifications
Coupling at the right locations
Speaker

Microphone
Ring tone detection circuit
Changes to the Asterisk OSS driver
The driver / Download
DTMF detection
Stereo support

Ringing
Off hook/hang-up detection
Software setup
Configuration/module load
Mixer setup
Setting the thresholds and timeouts and volume prescaler

Dial plan issues
Important things
Links and Acknowledgements

The phone


News

Introduction

VoIP is ‘in’ and very often ridiculously cheap. Most commercial PC-to-phone adapters (DECT as well as POTS) are still rather expensive in the 100EUR range. That is quite a lot of money considering that a phone often costs only 10EUR (eBay etc.) or is essentially even for free when there is an old one lying around.

Now a sound card is often also lying around and even if not, both items together will probably cost less than 20EUR. And modern sound cards are equipped with everything needed to connect to a telephone in principle, i.e. simultaneous high-quality analogue input and output.

But there are some problems: The voltage levels of a typical sound card in respect to the telephone system are totally wrong and a phone needs a DC voltage to operate and go off-hook. Also, there is no proper software support for a phone that is connected to a sound card.

But usually, one still needs to dial via the PC’s keyboard and not the phone’s keypad, there is no ‘hang-up’ or ‘off hook’ state for the phone (i.e. no dial tone), and the PC needs another channel (visual message on screen or another sound card) to indicate a ringing phone.

The following text describes the hardware modifications and all software changes (so far… :) necessary to the asterisk open source PBX to get a DECT phone connected to the PC’s sound card going, complete with dial tone, DTMF detection (i.e. touch tone dialling) and ringing the phone. The on/off hook state of the phone will be detected by the modified asterisk driver, too.

Asterisk itself also fully supports protocols such as SIP so that you can connect to a SIP provider (web.de, sipgate etc…) with your PC. This can happen automatically and in the background so that it seems that you have just another phone connected to a regular phone provider.

To make things clear again, this page describes a modified version of the asterisk chan_oss.c Linux OSS sound card driver for asterisk, NOT the original version!

Architecture

Hardware ‘hacking’

Don’t be afraid, the changes are trivial. But if you have any doubts, consider asking someone with enough experience to do this :)

Note that most of the modifications here (except the ring generation) are described in more detail and variation on this fine page here. There are pages both for the non-invasive and the modification method.

First approach: transformers

This has been tried out but does not work very well. Try the second approach instead.

The most straight-forward approach to interfacing the sound card with the telephone is of course a physical interface between the sound card and the phone without any modifications to the phone. Note that this approach is only possible with sound cards which possess a power amplifier onboard! The power amplifier is often visible as a separate DIP(-like) chip next to the slot cover and the sound cards main IC. An alternative is to use an external amplifier, of course.

For this approach to work, two important things have to be ensured. First, the sound card must generate a rather high voltage (10s of volts) to let the phone ring. Second, it has to generate a constant DC voltage so that the phone detects it is on line and this may be even needed (in the case of the phone I used) just to get the microphone and/or speaker functioning.
These two things are possible for example with this circuit:

With both transformers being small 230V (110V) <-> 6V…12V ones from the junk box, the capacitor being rather big (1000s of uF) as it acts as power supply filter here, and the diode any 1N4007 or whatever. Phones behave rather symmetric in respect to the line that feeds them, more about this can be read here.

The upper transformer T1 is driven by the left channel of the sound card and feeds the voice into the phone. Transformer T2’s sole purpose is to generate a constant DC voltage at the capacitor on the secondary side. T2 is therefore continuously fed with a sine wave from the sound card, in the 50-60Hz range (whatever works best for the combination). The phone’s output signal is picked up on the secondary side of T1 (works best) and fed into the sound card using the (here optional) coupling capacitor and maybe an additional resistor in the phone line. As all parts used here have a high enough internal resistance, it should work without the R. If you want the phone to be on floating potential in respect to the PC (generally a good idea…), replace the ground connection between the secondary and primaries with another cap.

With proper tweaking, the thing worked somewhat, but a few problems popped up:

3 Responses to “VoIP dect OSS Linux”

  1. Serj Says:

    This is a great guide/text. Great for learning, everything covered and explained, thank you very much.

  2. phantomload Says:

    just a question, as I am not as framiliar with asterisk as you obviously are (and the documentation frankly is not upto open-source standards). But It seems it would be easier to use a voice modem with the addition of a ringer circuit (and less likely to have echo issues). As I understand this is what the x100p basically is. From what I understand an FXS is just an FXO that can make a phone ring? seems a simple addition, and there are lots of circuits available online. I do not know if you can force asterisk to route incoming voip calls to a modified FXO. Is it feasable to have astrisk actiate a parrallel port pin when the phone is supposed to ring. If this is far more difficult than what you have done. I just assumed the modem would be better matched to the phone lines than anything I build.

  3. kashif Says:

    many thx for all the efforts. I want to feed pc spkr output to pstn-analog mic input and similarly couple pc mic input with pstn spkr output. the purpose is to forward voip conversation to another pstn subscriber using pstn network.
    can anybody provide similarly simple plan.

Leave a Reply

Host your project

Write for Grynx:

Do you have what it takes? If you're the right person then email us.

Archives:

Support Grynx:

Help us continue our work with a donation

Website promotion SEO Managed Advertising

5 Most popular articles:

Google

Categories:

Do it yourself - DIY
Our projects collection

10 queries. 0.300 seconds

Home