Sie sind auf Seite 1von 8

PracticalGuide

Howtosetup
anIP04
AsteriskIPPBX

TableofContents
1.Background.........................................................................................................................1
2.TheVoIPscenarios..............................................................................................................2
3.Beforegettingstarted..........................................................................................................3
3.1Scenario1......................................................................................................................3
3.2Scenario2......................................................................................................................3
3.3Scenario3......................................................................................................................4
4.Behindthescenes................................................................................................................5

1. Background
ThefirsteditionoftheVoIP4DPrimer,Buildingvoiceinfrastructureindevelopingregions
releasedinDecember2006coveredbasicIPTelephonyandshowedhowtoconfigureAsterisk
forthreebasicscenarios.
Thisdocumentshowsyouhowtosetup3basicscenariosontheIP04IPPBX.TheIP04is
atiny,fullfunctionAsteriskIPPBXwith4analogueports.Itretailsforaround$450but
canbepotentiallybebuiltanddeployedtodevelopingregionsforunder$100.
ConfigurationoftheIP04canbeperformedusingjustananaloguetelephoneevenaPCis
optional! TheseexercisesshowjusthoweasyAsteriskconfigurationcanbeontheIP04.
Comparedtocommodityhardware(suchaPCandPCIcard),IP04configurationismuch
easier.

2. TheVoIPscenarios
Thethreescenariosdescribedinthisdocument aresimilar totheonesdescribedinthe
VoIP4DPrimer.

Scenario1
Creating a local privatetelephonynetwork
inaruralcommunity
ThisscenarioconsistsofasingleIP04with
1to4analogphones.

Scenario2
Interconnectingcommunities
In this scenario we interconnect two IP04
PBXs. Local extensions of one PBX are
madeavailabletotheotherandviceversa.

Scenario3
ConnectingcommunitiestothePSTN
In this final scenario, we have
interconnected two PBXs and allow the
possibilityofreachingthePSTNfromany
ofthem.

3. Beforegettingstarted
IfyouhavenotreadtheVoIP4DPrimer(www.voip4d.org)pleasereadthefirstchapteras
itwillprovideyouwiththenecessarybackgroundtounderstandthebasicconceptsofIP
Telephony.
YouwillrequiretwoIP04s. BothIP04sshouldbeconfiguredwithtwoFXO(Port1an
Port2)and2FXSports(Port3andPort4). BothIP04sshouldbeconfiguredusingthe
scriptscontainedin:
http://www.rowetel.com/ucasterisk/downloads/voip4d_lab_ip04_001.tar.gz
SeetheREADMEinthetarballforconfigurationinformation.
ThetwoIP04scanbeconnectedviayourLAN,aWiFiconnection,orevenanEthernet
crossovercable.
ThisdocumentationhasusedIPaddressesintherange192.168.46.0/24.Beawarethatyou
mayneedtouseyourownIPaddressrange,forexampleifoperatingonaLANorovera
WiFilink.

3.1 Scenario1
1. ApplypowertotheIP04.Afterabout60secondsitwillbereadyforuse.
2. PlugphonesintoPort3andPort4.Checkthatyouheardialtoneineachphone.
3. Dial3000toreachPort3,ordial4000toreachPort4.

3.2 Scenario2
Inthisscenario,wewillplaceaphonecallfromaFXSphoneonIP04AtoaFXSphoneon
IP04B.IP04AwillconnecttoIP04BusingtheSIPprotocoloveranIPlink.
Wewillusetheprefix9toreachextensionsontheotherPBX.Sodialling 9+4000 ona
phoneconnectedtoIP04AwillplaceacalltoPort4onIP04B.
WecanstillreachextensiononourownPBXbysimplydiallingtheextensionnumber.
EachIP04willbeconfiguredasaSIPpeeroftheotherIP04.WewillsetuptheIPof
eachIP04,andtheIPofit'sSIPpeer:
IP04

IP

IPofSIPPeer

IP04A

192.168.46.31

192.168.46.32

IP04B

192.168.46.32

192.168.46.31

ConfigurationofIP04A
1. Hardwaresetup
PowerupIP04Aandwaitforittobootup.
PlugaphoneintoPort4.
2. ConfigureIPaddress
DialCONF(2663),thendialtheIPofIP04A(192*168*46*31#).
TheIPwillbereadbacktoyou.
3. ConfigureIPaddressofSIPpeer

DialSIP(747),thendialtheIPoftheSIPpeer(192*168*46*32#).
TheIPoftheSIPpeerwillbereadbacktoyou.

ConfigurationofIP04B
1. Hardwaresetup
PowerupIP04B.
PlugaphoneintoPort4
2. ConfigureIPaddress
DialCONF(2663),thendialtheIPofIP04B(192*168*46*32#).
TheIPwillbereadbacktoyou.
3. ConfigureIPaddressofSIPpeer
DialSIP(747),thendialtheIPoftheSIPpeer(192*168*46*31#).
TheIPoftheSIPpeerwillbereadbacktoyou.
Now,trytodialbetweenthetwoIP04PBXsbyusingtheprefix9:
1. Dial9+4000onIP04AtoreachPort4onIP04B
2. Dial9+4000onIP04BtoreachPort4onIP04A.

3.3 Scenario3
Thisscenarioisverysimilarto2,exceptthatwewillplaceacallfromaFXSportonIP04
AtoaFXOport onIP04B. In thiscasetheIP04AtoIP04B link isbeingusedto
extendthePSTNoveranIPlink.
1. ConfigureIP04AandIP04BasinScenario2.
2. ConnectanFXOline(PSTN)toPort1ofIP04B.
3. PickupthephoneconnectedtoPort4ofIP04A.Dial90onthisphonetoconnectto
theFXOlineonPort1ofIP04B.

4. Behindthescenes
In this section the configuration of the IP04 is examined in more detail. This section
requiresaPCwithtelnettoconnecttotheIP04.
OnyouhostPCtelnet192.168.46.31,thiswillproducearootpromptontheIP04.By
defaultnousernameorloginisrequired:
[host]$telnet192.168.46.31
Trying192.168.46.31...
Connectedto192.168.46.31.
Escapecharacteris'^]'.
BusyBoxv1.4.1(2007100910:23:35CST)Builtinshell(msh)
Enter'help'foralistofbuiltincommands.
root:~>

YoucanchecktheIP04IPafterdiallingCONF(2663)usingifconfig:
root:~>ifconfig
eth0Linkencap:EthernetHWaddr00:09:45:54:20:B1
inetaddr:192.168.46.31Bcast:192.168.46.255Mask:255.255.255.0
UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1
RXpackets:4737errors:0dropped:0overruns:0frame:0
TXpackets:4892errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
Interrupt:48

ToobtainanAsteriskcommandline(CLI)interfacetypeasteriskr:
root:~>asteriskr
af1*CLI>

YoucancheckifIP04AandIP04BaresetupasSIPpeersusingtheshowsippeers
command:
af1*CLI>sipshowpeers
Name/usernameHostDynNatACLPortStatus
ast/ast192.168.46.325060OK(2ms)

YoucanexaminethesectionoftheAsteriskdialplanthathandlesIPconfiguration:
af1*CLI>showdialplan2663@default
[Context'default'createdby'pbx_config']
'2663'=>1.Read(newip||15)[pbx_config]
2.SayDigits(${newip})[pbx_config]
3.System(/bin/echo"${newip}">/tmp/newip.txt)[pbx_config]
4.System(/bin/setnewip)[pbx_config]

Thisdialplanfragmentcallsthescript/bin/setnewip.IfyouexittheAsteriskCLI,youcan
examinethisshellscript:
root:/etc/asterisk>cat/bin/setnewip
#!/bin/shx
#/bin/setnewip
#DavidRoweNov182007
#
#SetsanewIPbasedonDTMFdigitscollectedbyAsterisk
#Asteriskplacesit'scollectedIPin/tmp/newip.txt
if[!f/tmp/newip.txt];then
exit
fi
#convert*separatedIPlike192*168*46*32to192.168.46.32
cat/tmp/newip.txt|sed's/\*/\./g'>/tmp/newip_dot.txt
#Modify/etc/asterisk/rc.confstaticIP,sowerebootwith
#thecorrectIP
NEWIP=`cat/tmp/newip_dot.txt`
cat/etc/asterisk/rc.conf|sed
"s/IPADDRESS=\".*\..*\..*\..*\"/IPADDRESS=\"${NEWIP}\"/">/tmp/rc.conf
cp/tmp/rc.conf/etc/asterisk/rc.conf
#ifconfigtosetcurrentIP
ifconfigeth0$NEWIP

Das könnte Ihnen auch gefallen