|
Xorcom / Documentation / White Papers / Fax & Modem |
|
Left menu
- Manuals
-
White Papers
- Land line calls from cellular phones
- Astribank-32 for hotels
- Astribank Vs. Channel Banks
- XR1000 Firmware Upgrade
- Asterisk to Open Doors
- USB2 Interface
- Incoming Call Latency
- Astribank for Burglar Alarms
- Secured Astribank Relays Output
- Treating Echo
- Color Coding for TCO
- Fax & Modem
- Astribank Vs. PCI Cards
- Synchronizing Astribanks
- Articles
- XorCommunique Newsletter
- Brochures
- News Archive
Finally a real fax and modem solution for Asterisk!
Tuesday July 31 2007
The problem
Since Asterisk's early days, reliable fax and modem support was a challenging issue. The technical problem is due to the different clock sources of the Asterisk PC and different Zaptel devices.
Theoretically, all the clocks generate a PCM (voice) packet every 1 millisecond. In reality, because the clocks are not synchronized, one card may generate a PCM packet every 1.0001 millisecond while the other card may receive a packet every 1.0000 millisecond. (these differences always exist due to the nature of electronic devices).
As a result, once in 10,000 packets (every 10 seconds in this example) a voice packet will be lost. The packet loss has a negative effect on voice quality. In a voice call we usually ignore the minor effect – but in data transmission – fax or modem, these problems may break the fax/modem synchronization and terminate the call.
Zaptel declares one device as the "sync master". That device's clock will be used as the clock for Asterisk. This should normally be configured as the clock from PSTN, if applicable. Otherwise, this is just an internal clock from one of the cards.
The solution
Obviously, in order to eliminate this problem, clocks in all Zaptel devices must be synchronized. In other words, if we count clock cycles for a long time, the number of cycles for any Zaptel device should be the same.
In order to be able to synchronize the clocks, all devices are designed with a Phase Locked Loop (PLL). This electronic circuit receives a reference clock from another Zaptel device, and compares it to its own local clock. In real life, the reference clock is the rate of the PCM packets transmitted by the Asterisk server and received by the Astribank.
If the local clock is too slow, the local oscillator is accelerated. If the local clock is too fast, it is slowed. The result is that a few seconds after the Astribank is connected to the Asterisk server it synchronizes to the server's clock forever.
If the other Zaptel device is another Astribank, this Astribank is used as the clock master for the Asterisk, and the rate of PCM packets is synchronized to this Astribank as well.
Thus, all Astribank devices on a system already work with a synchronized clock. However, your system may include Zaptel hardware which is not an Astribank. For instance, a digium E1/T1 card. In such a case, we would like to use the clock from the card as the main clock for the system. In order to do that, you should use a slightly modified version of Zaptel (patches are pending inclusion in Zaptel as of writing this document to make the synch master device of Zaptel provide timing for other Zaptel devices too.
Required Zaptel Version
You will need one patch to Zaptel, and another one is highly recommended.
- http://bugs.digium.com/9645 - makes the Zaptel sync master span sync other spans.
- http://bugs.digium.com/10329 - shows who the sync master is in /proc/zaptel .
Until those patches are applied to Zaptel, you can either apply them manually on your zaptel source tree, or get them from either:
After you have installed zaptel, please verify that the sync_master patch from above patch has been applied. The module xpp will give a specific message , depending on whther the first patch was applied to zaptel when it was built. If the patch was applied (in the system logs or the output of dmesg):
FEATURE: xpp with sync_tick() from ZAPTEL
If it is disabled you will get the message:
FEATURE: xpp without sync_tick() from ZAPTEL
You should also be able to see this with:
grep -a FEATURE: /lib/modules/`uname -r`/*/xpp.ko lib/modules/`uname -r`/*/xpp/xpp.ko
Zaptel Sync Master
System setup is By default, the Astribank will try to define itself as the Astribank sync master when registered. To disable this behaviour, set the value of the parameter prefmaster to 0 for xpp. e.g: in /etc/modprobe.d or in a file under /etc/modprobe.d add the line:
options xpp prefmaster=0
after reloading zaptel modules you should see in /proc/zaptel the span of your card masked with (MASTER) in the first line. If it is not, you may need to make sure that it is the first Zaptel module that loads.
Top menu |
