<!doctype linuxdoc system>

<article><!-- LyX 1.2 created this file. For more info see http://www.lyx.org/ -->
<title>VoIP Howto
</title><author>Roberto Arcomano berto@fatamorgana.com
</author><date>v1.7, August 7, 2002
</date><abstract>Voice Over IP is a new communication means that let you telephone
 with Internet at almost null cost. How this is possible, what systems
 are used, what is the standard, all that is covered by this Howto.
 Web site <url url="http://www.fatamorgana.com/bertolinux" name="http://www.fatamorgana.com/bertolinux"> contains latest version of this document.
</abstract><toc><sect>Introduction
<sect1>Introduction
<p>This document explains about VoIP systems. Recent happenings
 like Internet diffusion at low cost, new integration of dedicated
 voice compression processors, have changed common user requirements
 allowing VoIP standards to diffuse. This howto tries to define some
 basic lines of VoIP architecture.
</p><p>Please send suggestions and critics to <url url="mailto:berto@fatamorgana.com" name="my email address">
</p><sect1>Copyright
<p>Copyright (C) 2000,2001 Roberto Arcomano. This document is free;
 you can redistribute it and/or modify it under the terms of the GNU
 General Public License as published by the Free Software Foundation;
 either version 2 of the License, or (at your option) any later version.
 This document is distributed in the hope that it will be useful,
 but
</p><p>WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 for more details. You can get a copy of the GNU GPL <url url="http://www.gnu.org/copyleft/gpl.html" name="here">
</p><sect1>Translations
<p>If you want to translate this document you are free, you only
 have to: 
</p><p><enum><item>Check that another version of it doesn't already exist at your
 local LDP
<item>Maintain all 'Introduction' section (including 'Introduction',
 'Copyright', 'Translations', 'Credits').
</enum></p><p>Warning! You don't have to translate TXT or HTML file, you have
 to modify LYX file, so that it is possible to convert it all other
 formats (TXT, HTML, RIFF, etc.): to do that you can use "LyX" application
 you download from <url url="http://www.lyx.org" name="http://www.lyx.org">.
</p><p>No need to ask me to translate! You just have to let me know
 (if you want) about your translation.
</p><p>Thank you for your translation!
</p><sect1>Credits
<p>Thanks to <url url="http://www.fatamorgana.com" name="Fatamorgana Computers"> for hardware equipment and experimental opportunity.
</p><p>Thanks to <url url="http://www.linuxdoc.org" name="Linux Documentation Project"> for publishing and uploading my document in a very
 quickly fashion.
</p><p>Thanks to <url url="mailto:dprice@intercorp.com.au" name="David Price"> for his support.
</p><sect>Background
<sect1>The past
<p>More than 30 years ago Internet didn't exist. Interactive communications
 were only made by telephone at PSTN line cost.
</p><p>Data exchange was expansive (for a long distance) and no one
 had been thinking to video interactions (there was only television
 that is not interactive, as known).
</p><sect1>Yesterday
<p>Few years ago we saw appearing some interesting things: PCs to
 large masses, new technologies to communicate like cellular phones
 and finally the great net: Internet; people begun to communicate
 with new services like email, chat, etc. and business reborned with
 the web allowing people buy with a "click".
</p><sect1>Today
<p>Today we can see a real revolution in communication world: everybody
 begins to use PCs and Internet for job and free time to communicate
 each other, to exchange data (like images, sounds, documents) and,
 sometimes, to talk each other using applications like Netmeeting
 or Internet Phone. Particularly starts to diffusing a common idea
 that could be the future and that can allow real-time vocal communication:
 VoIP.
</p><sect1>The future
<p>We cannot know what is the future, but we can try to image it
 with many computers, Internet almost everywhere at high speed and
 people talking (audio and video) in a real time fashion. We only
 need to know what will be the means to do this: UMTS, VoIP (with
 video extension) or other? Anyway we can notice that Internet has
 grown very much in the last years, it is free (at least as international
 means) and could be the right communication media for future.
</p><sect>Overview
<sect1>What is VoIP?
<p>VoIP stands for 'V'oice 'o'ver 'I'nternet 'P'rotocol. As the
 term says VoIP tries to let go voice (mainly human) through IP packets
 and, in definitive through Internet. VoIP can use accelerating hardware
 to achieve this purpose and can also be used in a PC environment.
</p><sect1>How does it work? 
<p>Many years ago we discovered that sending a signal to a remote
 destination could have be done also in a digital fashion: before
 sending it we have to digitalize it with an ADC (analog to digital
 converter), transmit it, and at the end transform it again in analog
 format with DAC (digital to analog converter) to use it. 
</p><p>VoIP works like that, digitalizing voice in data packets, sending
 them and reconverting them in voice at destination.  
</p><p>Digital format can be better controlled: we can compress it,
 route it, convert it to a new better format, and so on; also we saw
 that digital signal is more noise tolerant than the analog one (see
 GSM vs TACS).
</p><p>TCP/IP networks are made of IP packets containing a header (to
 control communication) and a payload to transport data: VoIP use
 it to go across the network and come to destination.
</p><p><verb>Voice (source)  - - ADC - - - - Internet - - - DAC  - - Voice (dest)
</verb></p><sect1>What is the advantages using VoIP rather PSTN?
<p>When you are using PSTN line, you typically pay for time used
 to a PSTN line manager company: more time you stay at phone and more
 you'll pay. In addition you couldn't talk with other that one person
 at a time.
</p><p>In opposite with VoIP mechanism you can talk all the time with
 every person you want (the needed is that other person is also connected
 to Internet at the same time), as far as you want (money independent)
 and, in addition, you can talk with many people at the same time.
 
</p><p>If you're still not persuaded you can consider that, at the same
 time, you can exchange data with people are you talking with, sending
 images, graphs and videos.
</p><sect1>Then, why everybody doesn't use it yet?
<p>Unfortunately we have to report some problem with the integration
 between VoIP architecture and Internet. As you can easy imagine,
 voice data communication must be a real time stream (you couldn't
 speak, wait for many seconds, then hear other side answering): this
 is in contrast with the Internet heterogeneous architecture that
 can be made of many routers (machines that route packets), about
 20-30 or more and can have a very high round trip time (RTT), so
 we need to modify something to get it properly working. 
</p><p>In next sections we'll try to understand how to solve this great
 problem. In general we know that is very difficult to guarantee a
 bandwidth in Internet for VoIP application.
</p><sect>Technical info about VoIP
<p>Here we see some important info about VoIP, needed to understand
 it.
</p><sect1>Overview on a VoIP connection
<p>To setup a VoIP communication we need:
</p><p><enum><item>First the ADC to convert analog voice to digital signals (bits)
<item>Now the bits have to be compressed in a good format for transmission:
 there is a number of protocols we'll see after.
<item>Here we have to insert our voice packets in data packets using
 a real-time protocol (typically RTP over UDP over IP)
<item>We need a signaling protocol to call users: ITU-T H323 does that.
<item>At RX we have to disassemble packets, extract datas, then convert
 them to analog voice signals and send them to sound card (or phone)
<item>All that must be done in a real time fashion cause we cannot
 waiting for too long for a vocal answer! (see QoS section)
</enum><p><verb>                         
                        Base architecture

Voice )) ADC - Compression Algorithm -  Assembling RTP in TCP/IP -----
                                                         ----&gt;      |
                                                         &lt;----      |
Voice (( DAC - Decompress. Algorithm -  Disass. RTP from TCP/IP  -----

</verb></p><sect1>Analog to Digital Conversion
<p>This is made by hardware, typically by card integrated ADC. 
</p><p>Today every sound card allows you convert with 16 bit a band
 of 22050 Hz (for sampling it you need a freq of 44100 Hz for Nyquist
 Principle) obtaining a throughput of 2 bytes * 44100 (samples per
 second) = 88200 Bytes/s, 176.4 kBytes/s for stereo stream.
</p><p>For VoIP we needn't such a throughput (176kBytes/s) to send voice
 packet: next we'll see other coding used for it.
</p><sect1>Compression Algorithms
<p>Now that we have digital data we may convert it to a standard
 format that could be quickly transmitted.
</p><p><verb>PCM, Pulse Code Modulation, Standard ITU-T G.711
</verb><p><itemize><item>Voice bandwidth is 4 kHz, so sampling bandwidth has to be 8 kHz
 (for Nyquist). 
<item>We represent each sample with 8 bit (having 256 possible values).
<item>Throughput is 8000 Hz *8 bit = 64 kbit/s, as a typical digital
 phone line.
<item>In real application mu-law (North America) and a-law (Europe)
 variants are used which code analog signal a logarithmic scale using
 12 or 13 bits instead of 8 bits (see Standard ITU-T G.711).
</itemize><p><verb>ADPCM, Adaptive differential PCM, Standard ITU-T G.726
</verb></p><p>It converts only the difference between the actual and the previous
 voice packet requiring 32 kbps (see Standard ITU-T G.726).
</p><p><verb>LD-CELP, Standard ITU-T G.728
CS-ACELP, Standard ITU-T G.729 and G.729a
MP-MLQ, Standard ITU-T G.723.1, 6.3kbps, Truespeech
ACELP, Standard ITU-T G.723.1, 5.3kbps, Truespeech
LPC-10, able to reach 2.5 kbps!!
</verb></p><p>This last protocols are the most important cause can guarantee
 a very low minimal band using source coding; also G.723.1 codecs
 have a very high MOS (Mean Opinion Score, used to measure voice fidelity)
 but attention to elaboration performance required by them, up to
 26 MIPS! 
</p><sect1>RTP Real Time Transport Protocol
<p>Now we have the raw data and we want to encapsulate it into TCP/IP
 stack. We follow the structure:
</p><p><verb>VoIP data packets
       RTP
       UDP
       IP
    I,II layers
</verb></p><p>VoIP data packets live in RTP (Real-Time Transport Protocol)
 packets which are inside UDP-IP packets.
</p><p>Firstly, VoIP doesn't use TCP because it is too heavy for real
 time applications, so instead a UDP (datagram) is used. 
</p><p>Secondly, UDP has no control over the order in which packets
 arrive at the destination or how long it takes them to get there
 (datagram concept). Both of these are very important to overall voice
 quality (how well you can understand what the other person is saying)
 and conversation quality (how easy it is to carry out a conversation).
 RTP solves the problem enabling the receiver to put the packets back
 into the correct order and not wait too long for packets that have
 either lost their way or are taking too long to arrive (we don't
 need every single voice packet, but we need a continuous flow of
 many of them and ordered).
</p><p><verb>                    Real Time Transport Protocol
 
    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |V=2|P|X|  CC   |M|     PT      |       sequence number         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                           timestamp                           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |           synchronization source (SSRC) identifier            |
   +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
   |            contributing source (CSRC) identifiers             |
   |                             ....                              |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
</verb></p><p>Where:
</p><p><itemize><item>V indicates the version of RTP used
<item>P indicates the padding, a byte not used at bottom packet to
 reach the parity packet dimension
<item>X is the presence of the header extension
<item>CC field is the number of CSRC identifiers following the fixed
 header. CSRC field are used, for example, in conference case.
<item>M is a marker bit
<item>PT payload type
</itemize></p><p>For a complete description of RTP protocol and all its applications
 see relative RFCs<url url="http://www.ietf.org/rfc/rfc1889.txt" name="1889"> and <url url="http://www.ietf.org/rfc/rfc1890.txt" name="1890">.
</p><sect1>RSVP
<p>There are also other protocols used in VoIP, like RSVP, that
 can manage Quality of Service (QoS).
</p><p>RSVP is a signaling protocol that requests a certain amount of
 bandwidth and latency in every network hop that supports it. 
</p><p>For detailed info about RSVP see the<url url="http://www.ietf.org/rfc/rfc2205.txt?number=2205" name="RFC 2205">
</p><sect1>Quality of Service (QoS)
<p>We said many times that VoIP applications require a real-time
 data streaming cause we expect an interactive data voice exchange.
 
</p><p>Unfortunately, TCP/IP cannot guarantee this kind of purpose,
 it just make a "best effort" to do it. So we need to introduce tricks
 and policies that could manage the packet flow in EVERY router we
 cross.
</p><p>So here are:
</p><p><enum><item>TOS field in IP protocol to describe type of service: high values
 indicate low urgency while more and more low values bring us more
 and more real-time urgency
<item>Queuing packets methods:
<enum><item>FIFO (First in First Out), the more stupid method that allows
 passing packets in arrive order.
<item>WFQ (Weighted Fair Queuing), consisting in a fair passing of
 packets (for example, FTP cannot consume all available bandwidth),
 depending on kind of data flow, typically one packet for UDP and
 one for TCP in a fair fashion.
<item>CQ (Custom Queuing), users can decide priority.
<item>PQ (Priority Queuing), there is a number (typically 4) of queues
 with a priority level each one: first, packets in the first queue
 are sent, then (when first queue is empty) starts sending from the
 second one and so on.
<item>CB-WFQ (Class Based Weighted Fair Queuing), like WFQ but, in
 addition, we have classes concept (up to 64) and the bandwidth value
 associated for each one.
</enum><item>Shaping capability, that allows to limit the source to a fixed
 bandwidth in:
<enum><item>download
<item>upload
</enum><item>Congestion Avoidance, like RED (Random Early Detection).
</enum></p><p>For an exhaustive information about QoS see <url url="http://www.ietf.org/html.charters/diffserv-charter.html" name="Differentiated Services"> at IETF.
</p><sect1>H323 Signaling Protocol
<p>H323 protocol is used, for example, by Microsoft Netmeeting to
 make VoIP calls.
</p><p>This protocol allow a variety of elements talking each other:
</p><p><enum><item>Terminals, clients that initialize VoIP connection. Although
 terminals could talk together without anyone else, we need some additional
 elements for a scalable vision.
<item>Gatekeepers, that essentially operate:
<enum><item>address translation service, to use names instead IP addresses
<item>admission control, to allow or deny some hosts or some users
<item>bandwidth management
</enum><item>Gateways, points of reference for conversion TCP/IP - PSTN.
<item>Multipoint Control Units (MCUs) to provide conference.
<item>Proxies Server also are used.
</enum></p><p>h323 allows not only VoIP but also video and data communications.
</p><p>Concerning VoIP, h323 can carry audio codecs G.711, G.722, G.723,
 G.728 and G.729 while for video it supports h261 and h263.
</p><p>More info about h323 is available at <url url="http://www.openh323.org/standards.html" name="Openh323 Standards">, at <url url="http://www.cs.columbia.edu/~hgs/rtp/h323.html" name="this h323 web site"> and at its standard
 description: <url url="http://www.itu.int/itudoc/itu-t/rec/h/" name="ITU H-series Recommendations">.
</p><p>You can find it implemented in various application software like
 <url url="http://www.microsoft.com" name="Microsoft Netmeeting">, <url url="http://www.net2phone.com" name="Net2Phone">, <url url="http://www.dialpad.com" name="DialPad">, ... and also in freeware products you can find at <url url="http://www.openh323.org" name="Openh323 Web Site">.
</p><sect>Requirement
<sect1>Hardware requirement
<p>To create a little VoIP system you need the following hardware:
</p><p><enum><item>PC 386 or more
<item>Sound card, full duplex capable
<item>a network card or connection to internet or other kind of interface
 to allow communication between 2 PCs
</enum></p><p>All that has to be present twice to simulate a standard communication.
</p><p>The tool above are the minimal requirement for a VoIP connection:
 next we'll see that we should (and in Internet we must) use more
 hardware to do the same in a real situation.
</p><p>Sound card has be full duplex unless we couldn't hear anything
 while speaking!
</p><p>As additional you can use hardware cards (see next) able to manage
 data stream in a compressed format (see Par 4.3).
</p><sect1>Hardware accelerating cards 
<p>We can use special cards with hardware accelerating capability.
 Two of them (and also the only ones directly managed by the Linux
 kernel at this moment) are the
</p><p><enum><item>Quicknet PhoneJack
<item>Quicknet LineJack
<item>VoiceTronix V4PCI
<item>VoiceTronix VPB4
<item>VoiceTronix VPB8L
</enum></p><p>Quicknet PhoneJack is a sound card that can use standard algorithms
 to compress audio stream like G723.1 (section 4.3) down to 4.1 Kbps
 rate. 
</p><p>It can be connected directly to a phone (POTS port) or a couple
 mic-speaker.
</p><p>It has a ISA or PCI connector bus.
</p><p>Quicknet LineJack works like PhoneJack with some addition features
 (see next).
</p><p>VoiceTronix V4PCI is a PCI card pretty like Quicknet LineJack
 but with 4 phone ports
</p><p>VoiceTronix VPB4 is a ISA card equivalent to V4PCI.
</p><p>VoiceTronix VPB8L is a logging card with 8 ports.
</p><p>For more info see <url url="http://www.quicknet.net" name="Quicknet web site"> and <url url="http://www.voicetronix.com.au" name="VoiceTronix web site">
</p><sect1>Hardware gateway cards
<p>Quicknet LineJack and VoiceTronix cards can be connected to a
 PSTN line allowing VoIP gateway feature. 
</p><p>Then you'll need a software to manage it (see after).
</p><sect1>Software requirement
<p>We can choose what O.S. to use:
</p><p><enum><item>Win9x
<item>Linux
</enum></p><p>Under Win9x we have Microsoft Netmeeting, Internet Phone, DialPad
 or others or Internet Switchboard (from <url url="http://www.quicknet.net" name="Quicknet web site">) for Quicknet cards. 
</p><p>Warning!!: Latest Quicknet cards using Swithboard (older version
 too) NEED to be connected to Internet to get working for managing
 Microtelco account (not free of charge), so if you plan to remain
 isolated from Internet you need to install <url url="http://www.openh323.org" name="OpenH323 software">.
</p><p>For VoiceTronix cards you can find software at <url url="http://www.voicetronix.com.au" name="VoiceTronix web site">
</p><p>Under Linux we have free software <url url="http://www.gnomemeeting.org" name="GnomeMeeting">, a clone of Microsoft Netmeeting,
 while in console mode we use (also free software) applications from
 <url url="http://www.openh323.org" name="OpenH323"> web site: simph323 or ohphone that can also work with Quicknet accelerating
 hardware.
</p><p>Attention: all Openh323 source code has to be compiled in a user
 directory (if not it is necessary to change some environment variable).
 You are warned that compiling time could be very high and you could
 need a lot of RAM to make it in a decent time. 
</p><sect1>Gateway software
<p>To manage gateway feature (join TCP/IP VoIP to PSTN lines) you
 need some kind of software like this:
</p><p><itemize><item><url url="http://www.quicknet.net" name="Internet SwitchBoard"> (only when connected to Internet) for Windows systems also acting
 as a h323 terminal;
<item>PSTNGw for Linux and Windows systems you download from <url url="http://www.openh323.org/code.html" name="OpenH323">.
</itemize></p><sect1>Gatekeeper software
<p>You can choose as gatekeeper:
</p><p><enum><item>Opengatekeeper, you can download from <url url="http://www.opengatekeeper.org" name="opengatekeeper web site"> for Linux and Win9x.
<item>Openh323 Gatekeeper (GK) from <url url="http://www.willamowius.de/openh323gk.html" name="here">.
</enum></p><sect1>Other software
<p><label id="Phonepatch" >In addition I report some useful software h323 compliant:
</p><p><itemize><item>Phonepatch, able to solve problems behind a NAT firewall. It
 simply allows users (external or internal) calling from a web page
 (which is reachable from even external and internal users): when
 web application understands the remote host is ready, it calls (h323)
 the source telling it all is ok and communication can be established.
 Phonepatch is a proprietary software (with also a demo version for
 no more than 3 minutes long conversations) you download from <url url="http://www.equival.com/phonepatch" name="here">.
</itemize></p><sect>Cards setup
<p>Here we see how to configure special hardware card in Linux and
 Windows environment.
</p><sect1>Quicknet PhoneJack
<p>As we saw, Quicknet Phonejack is a sound card with VoIP accelerating
 capability. It supports:
</p><p><itemize><item>G.711 normal and mu/A-law, G.728-9, G.723.1 (TrueSpeech) and
 LPC10.
<item>Phone connector (to allow calling directly from your phone) or
<item>Mic &amp; speaker jacks.
</itemize></p><p>Quicknet PhoneJack is a ISA (or PCI) card to install into your
 Pc box. It can work without an IRQ.
</p><sect2>Software installation
<p>Under Windows you have to install:
</p><p><enum><item>Card driver
<item>Internet Switchboard application (working only with Internet,
 using newer Quicknet cards)
</enum></p><p>all downloadable from <url url="http://www.quicknet.net" name="Quicknet web site">
</p><p>After Switchboard has been installed, you need to register to
 Quicknet to obtain full capability of your card.
</p><p>When you pick up the phone Internet Switchboard wakes up and
 waits for your calling number (directly entered from your phone),
 you can:
</p><p><enum><item>enter an asterisk, then type an IP number (with asterisks in
 place of dot) with a &num; in the end
<item>type directly a PSTN phone number (with international prefix)
 to call a classic phone user. In this case you need a registration
 to a gateway manager to which pay for time.
<item>enter directly a quick dial number (up to 2 digits) you have
 previously stored which make a call (IP or PSTN).
</enum></p><p>Internet Swichboard is h323 compatible, so if you can use, for
 example, Microsoft Netmeeting at the other end to talk. 
</p><p>Warning!! Internet Switchboard NEED to be connected to Internet
 when used with newer Quicknet cards
</p><p>In place of Internet Switchboard you can use openh323 application
 <url url="http://www.openh323.org/code.html" name="openphone"> (using GUI) or <url url="http://www.openh323.org/code.html" name="ohphone"> (command line).
</p><p>Under Linux you have to install:
</p><p><enum><item>Card driver, from <url url="http://www.quicknet.net" name="Quicknet web site">. After downloaded you have to compile it (you
 must have a /usr/src/linux soft or hard link to your Linux source
 directory): type make for instructions.
<item>Application <url url="http://www.openh323.org/code.html" name="openphone"> or <url url="http://www.openh323.org/code.html" name="ohphone">. 
<item>If you are a developer you can use <url url="ftp://ftp.quicknet.net/Developer/Linux/Docs/" name="SDK"> to create your own application
 (also for Windows).
</enum></p><sect2>Settings
<p>With Internet Switchboard (and with other application) you can:
</p><p><enum><item>Change compression algorithm preferred
<item>Tune jitter delay
<item>Adjust volume
<item>Adjust echo cancellation level.
</enum></p><sect1>Quicknet LineJack
<p>This card is very similar to the previous, it supports also gateway
 feature. 
</p><p>We only notice that we have to <url url="http://www.quicknet.net/code.html" name="download"> PSTNGx application (for Linux
 and Windows) or we use Internet Switchboard to gateway feature.
</p><sect1>VoiceTronix products
<p><enum><item>First download software <url url="http://www.voicetronix.com.au/vpb-driver-2.1.8.tar.gz" name="here">
<item>Untar it
<item>Modify 'src/vpbreglinux.cpp' according to file README
<item>type 'make'
<item>type 'make install'
<item>cd to src
<item>type 'insmod vpb.o'
<item>retrieve (from console of from 'dmesg' output command) major
 number, say MAJOR
<item>type 'mknod /dev/vpb0 c MAJOR 0' where MAJOR is the above number
<item>cd to unittest and type './echo'
</enum></p><p>Follow README file for more help.
</p><p>I personally haven't tested VoiceTronix products so please contact
 <url url="http://www.voicetronix.com.au" name="VoiceTronix web site"> for support.
</p><sect>Setup
<p>In this chapter we try to setup VoIP system, simple at first,
 then more and more complex.
</p><sect1>Simple communication: IP to IP
<p><verb>
       A (Sound card)   -  -  -    B (Sound card)

        192.168.1.1     -  -  -     192.168.1.2

        
      192.168.1.1 calls 192.168.1.2 and viceversa.
</verb></p><p>A and B should have
</p><p><enum><item>an application like Microsoft Netmeeting, Internet Switchboard,
 Openh323 (under Windows environment) or Ohphone, Gnomemeeting (under
 Linux), installed and properly configured.
<item>a network card or other kind of TCP/IP interface to talk each
 other.
</enum></p><p>In this kind of view A can make a H323 call to B (if B has server
 side application active) using B IP address. Then B can answer to
 it if it wants. After accepting call, VoIP data packets start to
 flow.
</p><sect1>Using names
<p>Under Microsoft Windows a NetBIOS name can be used instead of
 an IP address.
</p><p><verb>          A            -  -  -             B 
 
     192.168.1.1       -  -  -        192.168.1.2
   
        John           -  -  -           Alice

             
                    John calls Alice.

</verb></p><p>This is possible cause John call request to Alice is converted
 to IP calling by the NetBIOS protocol.
</p><p>The above 2 examples are very easy to implement but aren't scalable.
 
</p><p>In a more big view such as Internet it is impossible to use direct
 calling cause, usually, the callers don't know the destination IP
 address. Furthermore NetBIOS naming feature cannot work cause it
 uses broadcast messages, which typically don't pass ISP routers .
</p><p>You can also use DNS to solve name in IP address: for example
 you can call ''box.domain.com''.
</p><sect1>Internet calling using a WINS server
<p>The NetBIOS name calling idea can be implemented also in a Internet
 environment, using a WINS server: NetBIOS clients can be configured
 to use a WINS server to resolve names. 
</p><p>PCs using the same WINS server will be able to make direct calling
 between them.
</p><p><verb>
A (WINS Server is S) - - - - I  - - - -  B (WINS Server is S)
                             N
                             T  
                             E  - - - - -   S (WINS Server)   
C (WINS Server is S) - - - - R  
                             N
                             E  - - - -  D (WINS Server is S)
                             T
 
                   Internet communication

</verb></p><p>A, B, C and D are in different subnets, but they can call each
 other in a NetBIOS name calling fashion. The needed is that all are
 using S as WINS Server.
</p><p>Note: WINS server hasn't very high performance cause it use NetBIOS
 feature and should only be used for joining few subnets.
</p><sect1>ILS server
<p>ILS is a kind of server which allows you to solve your name during
 an H323 calling: when you start VoIP application you first register
 to ILS server using a name, then everyone will be able to see you
 using that name (if he uses same Server ILS!).
</p><sect1>A big problem: the masquering.
<p>A problem of few IPs is commonly solved using the so called masquering
 (also NAT, network address translation): there is only 1 IP public
 address (that Internet can directly "see"), the others machines are
 "masqueraded" using all this IP. 
</p><p><verb>        
           A  - - -

           B  - - -   Router with NAT  - - -  Internet

           C  - - -
     
                     
                       This doesn't work

</verb></p><p>In the example A,B and C can navigate, pinging, using mail and
 news services with Internet people, but they CANNOT make a VoIP call.
 This because H323 protocol send IP address at application level,
 so the answer will never arrive to source (that is using a private
 IP address).
</p><p>Solutions: 
</p><p><itemize><item>there is a Linux module that modifies H323 packets avoiding this
 problem. You can download the module <url url="http://www.coritel.it/coritel/ip/sofia/nat/nat2/nat2.htm" name="here">. To install it you have to
 copy it to source directory specified, modify Makefile and go compiling
 and installing module with "modprobe ip_masq_h323". Unfortunately this
 module cannot work with ohphone software at this moment (I don't
 know why).
</itemize><p><verb> 
           A  - - -   Router with NAT 
 
           B  - - -         +           - - -  Internet

           C  - - -  ip_masq_h323 module
 
 
                         This works

</verb><p><itemize><item>There is a application program that also solves this problem:
 for more see <ref id="Phonepatch" name="Par 5.7" >
</itemize><p><verb>           
           A  - - -   
 
           B  - - -    PhonePatch   - - -  Internet

           C  - - -  
 
 
                         This works

</verb></p><sect1>Open Source applications
<sect2>Ohphone Sintax
<p>Sintax is:
</p><p>"ohphone -l|--listen &lsqb;options&rsqb;"
</p><p>"ohphone &lsqb;options&rsqb;... address"
</p><p><itemize><item>"-l", listen to standard port (1720)
<item>"address", mean that we don't wait for a call, but we connect to
 "address" host
<item>"-n", "--no-gatekeeper", this is ok if we haven't a gatekeeper
<item>"-q num", "--quicknet num", it uses Quicknet card, device /dev/phone(num)
<item>"-s device", "--sound device", it uses /dev/device sound device.
<item>"-j delay", "--jitter delay", it change delay buffer to "delay".
</itemize></p><p>Also, when you start ohphone, you can give command to the interpreter
 directly (like decrease AEC, Automatic Echo Cancellation).
</p><sect2>Gnomemeeting
<p>Gnomemeeting is an application using GUI interface to make call
 using VoIP. It is very simple to use and allows you to use ILS server,
 chat and other things.
</p><sect1>Setting up a gatekeeper
<p>You can also experiment gatekeeper feature
</p><p><verb>Example
  
        (Terminal H323) A  - - -    
                                 &bsol;
        (Terminal H323) B  - -  - D (Gatekeeper)
                                 /
        (Terminal H323) C  - - -  
               
                   Gatekeeper configuration

</verb><p><enum><item>Hosts A,B and C have gatekeeper setting to point to D. 
<item>At start time each host tells D own address and own name (also
 with aliases) which could be used by a caller to reach it.
<item>When a terminal asks D for an host, D answers with right IP address,
 so communication can be established.
</enum></p><p>We have to notice that the Gatekeeper is able only to solve name
 in IP address, it couldn't join hosts that aren't reachable each
 other (at IP level), in other words it couldn't act as a NAT router.
</p><p>You can find gatekeeper code <url url="http://www.opengatekeeper.org" name="here">: <url url="http://www.openh323.org/code.html" name="openh323 library"> is also required.
</p><p>Program has only to be launch with -d (as daemon) or -x (execute)
 parameter. 
</p><p>In addition you can use a config file (.ini) you find <url url="http://www.opengatekeeper.org/opengate.ini" name="here">.
</p><sect1>Setting up a gateway
<p>As we said, gateway is an entity that can join VoIP to PSTN lines
 allowing us to made call from Internet to a classic telephone. So,
 in addition, we need a card that could manage PSTN lines: Quicknet
 LineJack does it.
</p><p>From <url url="http://www.openh323.org" name="OpenH323 web site"> we download: 
</p><p><enum><item>driver for Linejack
<item>PSTNGw application to create our gateway.
</enum></p><p>If executable doesn't work you need to download source code and
 <url url="http://www.openh323.org/code.html" name="openh323 library">, then install all in a home user directory.
</p><p>After that you only need to launch PSTNGw to start your H323
 gateway.
</p><sect1>Compatibility Matrix
<p>First Matrix refers to:
</p><p><enum><item>Software intercommunications (i.e. Netmeeting with SwitchBoard)
<item>Software/Driver/Hardware talking (i.e. Netmeeting can use a PhoneJACK
 card).
</enum><p><verb> _____________________________________________________________________________________________________________________
|            | Netmeeting |SwitchBoard |  Simph323  |  OhPhone   | LinPhone    |Speak-Freely|HW PhoneJACK|HW LineJACK |
|____________|____________|____________|____________|____________|_____________|____________|____________|____________|
| Netmeeting |      V            V            V           V             X            X            V            V            
|____________|____________|____________|____________|____________|_____________|____________|____________|____________|
|SwitchBoard |      V            V            V           V             X            X            V            V            
|____________|____________|____________|____________|____________|_____________|____________|____________|____________|
|  Simph323  |      V            V            V           V             X            X            X            X                   
|____________|____________|____________|____________|____________|_____________|____________|____________|____________|
|  OhPhone   |      V            V            V           V             X            X            V            V            
|____________|____________|____________|____________|____________|_____________|____________|____________|____________|
| LinPhone   |      X            X            X           X             V            X            X            X            
|____________|____________|____________|____________|____________|_____________|____________|____________|____________|
|SpeakFreely |      X            X            X           X             X            V            X            X
|____________|____________|____________|____________|____________|_____________|____________|____________|____________|
|HW PhoneJACK|      V            V            X           V             X            X            _            _  
|____________|____________|____________|____________|____________|_____________|____________|____________|____________|
|HW LineJACK |      V            V            X           V             X            X            _            _
|____________|____________|____________|____________|____________|_____________|____________|____________|____________|
 

</verb></p><p>Second Matrix refers to Gateway softwares that manage LineJACK
 card.
</p><p><verb> ___________________________________________________________
|              |HW LineJACK GW| SwitchBoard  |    PSTNGW    |
|______________|______________|______________|______________|
|HW LineJACK GW|      _       |      V       |       V      |
|______________|______________|______________|______________|
| SwitchBoard  |      V       |      _       |       _      |
|______________|______________|______________|______________|
|    PSTNGW    |      V       |      _       |       _      |  
|______________|______________|______________|______________|
</verb></p><p>Notation:
</p><p><itemize><item>V : Works
<item>X : Doesn't Work
<item>-- : Doesn't care
</itemize></p><sect>Communications using PSTN line
<sect1>Overview
<p>VoIP becomes very interesting when you start to use PSTN lines
 to call other people in the world, directly to their home telephone.
</p><sect1>Scenario
<p>A typical application is like that:
</p><p><verb>
Home telephone1 -- (PSTN) -- PC1 -- (Internet) -- PC2 -- (PSTN) -- Home telephone2

</verb><p><enum><item>Home Telephone1 make a calls to PC1 phone number (using PSTN
 line, I mean classic telephone line).
<item>PC1 answer to it.
<item>Home telephone1 must tell PC1 what gateway use (PC2 in this case)
 by giving the IP address (from DTMF keyboard) and/or what number
 call (in this case Home telephone2).
<item>After that PC1 will start to make an H323 call to PC2, then it
 will pass Home telephone2 to PC2 to make it call it throught PSTN
 line.
<item>Home telephone2 answers to call and communication between Home
 telephone1 and Home telephone2 begins.
</enum></p><sect1>What can be changed in this configuration? 
<p><enum><item>You may use a PBX to select many lines to access many PC1 gateway
 (for example one to call within your state, one to go accross Europe,
 and so on...): typically you don't have to change this, cause cost
 is always the same.
<item>You can select (after called your PC1 gateway) every PC2 you
 want (for example a PC2 living in England to call an English person
 so that you'd pay only intra-country costs).
</enum></p><p>So your decision will be taken considering PSTN line costs. In
 fact what VoIP does is the convert this:
</p><p><verb>Home Telephone1 --- (PSTN) --- Home Telephone2
             PSTN great distance calling cost
</verb></p><p>into this:
</p><p><verb>      Home Telephone1 --- (PSTN) --- PC1   +
      PC2 ---- (PSTN) --- Home Telephone2  =
      --------------------------------------
          2 PSTN short distance calling costs
</verb></p><p>To save money you need that:
</p><p><verb>2 PSTN short distance calling costs &lt; PSTN great distance calling cost 
</verb></p><p>Typically "short distance calling" refers to a "city cal" while "great
 distance calling" can be an "intercontinental call"!
</p><sect>Bandwidth consideration
<p>From all we said before we noticed that we still have not solved
 problems about bandwidth, how to create a real time streaming of
 data.
</p><p>We know we couldn't find a solution unless we enable a right
 real-time manager protocol in each router we cross, so what do we
 can do?
</p><p>First we try to use a very (as more as possible) high rate compression
 algorithms (like LPC10 which only consumes a 2.5 kbps bandwidth,
 about 313 bytes/s).
</p><p>Then we starts classify our packets, in TOS field, with the most
 high priority level, so every router help us having urgently.
</p><p>Important: all that is not sufficient to guarantee our conversation
 would always be ok, but without an great infrastructure managing
 shaping, bandwidth reservation and so on, it is not possible to do
 it, TCP/IP is not a real time protocol. 
</p><p>A possible solution could be starts with little WAN at guaranteed
 bandwidth and get larger step by step.
</p><p>We finally have to notice a thing: also the so called guaranteed
 services like PSTN line could not manage all clients they have: for
 example a GSM call is not able to manage more that some hundred or
 some thousand of clients.
</p><p>Anyway for a starting service, limited to few users, VoIP can
 be a valid alternative to classic PSTN service.
</p><sect>Glossary
<p>PSTN: Public Switched Telephone Network
</p><p>VoIP: Voice over Internet Protocol
</p><p>LAN: Local Area Network
</p><p>WAN: Wide Area Network
</p><p>TOS: Type Of Service
</p><p>ISP: Internet Service Provider
</p><p>RTP: Real Time Protocol
</p><p>RSVP: ReSerVation Protocol
</p><p>QoS: Quality of Service
</p><sect>Useful links
<sect1>Open software link
<p><itemize><item><url url="http://www.voxilla.org" name="Voxilla">
<item><url url="http://www.linuxtelephony.org" name="Linux Telephony">
<item><url url="http://www.openh323.org" name="Open H323 web site">
<item><url url="http://www.gnomemeeting.org/" name="http://www.gnomemeeting.org/">
<item><url url="http://www.speakfreely.org" name="Speak Freely">
<item><url url="http://www.linphone.org" name="http://www.linphone.org">
<item><url url="http://www.fsf.org/software/osip" name="http://www.fsf.org/software/osip">
<item><url url="http://www.gnu.org/software/bayonne" name="http://www.gnu.org/software/bayonne">
</itemize></p><sect1>Commercial link
<p><itemize><item><url url="http://www.fatamorgana.com" name="Fatamorgana Computers">
<item><url url="http://www.itu.org" name="International Communication Union">
<item><url url="http://www.voicetronix.com.au" name="Voicetronix web site">
<item><url url="http://www.quicknet.net" name="Quicknet Web site">
<item><url url="http://www.cisco.com" name="Cisco Systems">
<item><url url="www.metropark.com" name="www.metropark.com">
<item><url url="www.nbxsoftware.com" name="www.nbxsoftware.com">
</itemize>

</article>
