[asterisk-users] Newcomer Question

Anselm Martin Hoffmeister anselm at hoffmeister-online.de
Thu Sep 20 05:21:53 CDT 2007


Am Donnerstag, den 20.09.2007, 08:30 +0200 schrieb Guenther Sohler:
> Hallo Group!
> 
> My Name is Guenther Sohler and I registred to this group, because
> I think asterisk could be interesting for me.

Hi Guenther, this place probably is the right one. Welcome!

> I have got a small server at home running linux.
> It does NAT and a Firewall. There is an intranet with my home PC
> and a hardware SIP phone.
> 
> This SIP phone registers at mujtelefon.cz
> 
> Now I got another account at sipgate.at
> 
> My idea is following:
> I want to be reachable at both providers(numbers) at the same time.
> And If I call someone, calls to austria shall use sipgate, whereas
> calls to czech shall use mujtelefon.

This is possible, and it does not require too difficult steps.

First question though is wether your server has an external IP (e.g.
does the internet routing) or there is a router in between (you wrote
the server does NAT, but I already saw double- and even triple-NAT
configurations - I have to mention that). Both will work, but _not_
having NAT in between might be one trouble source less - so if you run
Asterisk on a machine with a globally valid and routable IP, you are
better off.

Your firewall should accept incoming TCP on port 5060 and incoming UDP
on all the ports RTP uses (like 10000 to 20000) - I rarely bother
firewalling incoming UDP packets on high ports, but you should check
that. If your phone works behind the router, the UDP requirement
probably is already sorted.

Basically, you will have to edit a few configuration files. I will give
some examples based on one of my asterisk configs, but you really should
read about those files and check wether everything is OK - I will try to
adapt to your situation, but do not blame me if I mistype or just
mis-think something.

In sip.conf, you will need to list the providers and the phones you are
going to use. I assume you will have your allnet and perhaps a few
softphones - you will probably want more than one phone some day ;-)

8<==== sip.conf (with example data indicated)
[general]
bindport=5060
bindaddr=0.0.0.0
disallow=all
allow=ulaw
allow=alaw
allow=ilbc
allow=gsm
musicclass=default
language=en
; well, no idea if there are czech audio files readily available.
; I personally use language=de, of course.
dtmfmode=rfc2833
sipdebug=no

register => 1234567:4321 at sipgate.at:5060/004311234567
; put your sip id (1234567), password (4321) and your
; phone number (004311234567) here
register => 123321321:abcd at otherprovider.example.org:5060/123333

[sipgateat]
host=sipgate.at
secret=4321
username=1234567
fromuser=1234567
fromdomain=sipgate.at
srvlookup=yes
context=sipgateat-in
canreinvite=no
nat=no
; perhaps this needs to be set to "yes"
; insecure=very
; perhaps this needs to be activated - try it.
type=friend
qualify=yes

[otherprovider]
host=otherprovider.example.org
secret=abcd
username=123321321
fromuser=123321321
fromdomain=otherprovider.example.org
srvlookup=yes
context=otherprovider-in
canreinvite=no
nat=no
type=friend
qualify=yes

; stanza for SIP clients
[sip01]
mailbox=01
callerid=11
type=friend
username=sip01
secret=LaBananaLoca
; replace with the secret for your telephone, username should
; always be the same as the [stanza] name to avoid trouble
context=sipclient
host=dynamic
nat=yes

[sip02]
mailbox=01
callerid=12
type=friend
username=sip01
secret=AyayayDiosMio
context=sipclient
host=dynamic
nat=yes

====>8

so much for the sip.conf. This allows for two accounts with providers,
and two SIP phones (wether hard- or softphone does not matter, of
course :-) 

You will also need to setup an extensions.conf, somehow like this

8<==== extensions.conf
[general]
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no
;; all of those have been like this in my conf for ages, I do not
;; even know what exactly those are good for.


; context where sipclient outgoing calls are handled
[sipclient]
; let "11" and "12" be internal numbers
exten => 11,1,Dial(SIP/sip01,60)
exten => 11,2,Hangup()
exten => 12,1,Dial(SIP/sip02,60)
exten => 12,2,Hangup()
; Outward calls. If a country prefix is present _and_ it is Austria,
; use sipgate.at
exten => _0043.,1,Dial(SIP/${EXTEN}@sipgateat,60)
exten => _0043.,2,Hangup()
; Outward calls with country prefix for Czech Republic go through
; your other provider
exten => _00420.,1,Dial(SIP/${EXTEN}@otherprovider,60)
exten => _00420.,2,Hangup()
; All other non-international calls go through "otherprovider" -
; three digit minimum here, shorter numbers treated as "internal"
exten => _0[1-9].,1,Dial(SIP/${EXTEN}@otherprovider,60)
exten => _0[1-9].,2,Hangup()
exten => _[1-9][0-9].,1,Dial(SIP/${EXTEN}@otherprovider,60)
exten => _[1-9][0-9].,2,Hangup

; add stuff for voicemail call-in.... here

; context for incoming calls through sipgate

[sipgateat-in]
exten => 004311234567,1,Dial(SIP/sip01&SIP/sip02,60)
exten => 004311234567,2,Hangup()

[otherprovider-in]
exten => 123333,1,Dial(SIP/sip01&SIP/sip02,60)
exten => 123333,2,Hangup()

====>8

This should get you started. This is a very rough example, and I might
have made a mistake somewhere... beware. Quite extensive documentation
is on www.voip-info.org - both for sip.conf and everything you might
want to put into extensions.conf.

HTH
Anselm




More information about the asterisk-users mailing list