[Asterisk-Users] voip to pstn

Tianu Mihai - Cristian mihait at terranet.ro
Fri Nov 12 18:04:51 MST 2004


Is there an example config for asterisk voip to pstn ?

I have the following scenario 

TDM400P with 2xFXO connected to the phone lines + asterisk ----> internet 
-----> TDM400P 2x FXS + asterisk !

So far i have managed to Pick -up a call incoming from pstn to the fxs , but 
it's not working in the other way ! 

Configs :

---> sip.conf

Asterisk 1 (FXO)
[general]
context=from-sip                ; Default context for incoming calls
port=5060                       ; UDP Port to bind to (SIP standard port is 
5060)
bindaddr=0.0.0.0                ; IP address to bind to (0.0.0.0 binds to all)
;srvlookup=yes                  ; Enable DNS SRV lookups on outbound calls
                                ; Note: Asterisk only uses the first host
                                ; in SRV records
                                ; Disabling DNS SRV lookups disables the
                                ; ability to place SIP calls based on domain
                                ; names to some other SIP users on the 
Internet
;tos=184                        ; Set IP QoS to either a keyword or numeric 
val
;tos=lowdelay                   ; lowdelay,throughput,reliability,mincost,none
;maxexpirey=3600                ; Max length of incoming registration we allow
;defaultexpirey=120             ; Default length of incoming/outoing 
registration
notifymimetype=text/plain       ; Allow overriding of mime type in MWI NOTIFY
;videosupport=yes               ; Turn on support for SIP video


allow=all
allow=gsm
allow=g723.1
allow=g729
allow=ulaw

musicclass=default              ; Sets the default music on hold class for all 
SIP calls
                                ; This may also be set for individual 
users/peers
language=en                     ; Default language setting for all users/peers
                                ; This may also be set for individual 
users/peers
relaxdtmf=yes                   ; Relax dtmf handling
                                ; when we're on hold (must be > rtptimeout)
;trustrpid = no                 ; If Remote-Party-ID should be trusted
;progressinband=no              ; If we should generate in-band ringing always
useragent=Asterisk PBX          ; Allows you to change the user agent string
nat=no                          ; NAT settings
                                ; yes = Always ignore info and assume NAT
                                ; no = Use NAT mode only according to RFC3581

promiscredir=yes
register => asterisk at ip_of_the_other_machine

[21]
type=friend
user=21
fromuser=21
secret=1234
host=dynamic
nat=0
allow=all

[22]
type=friend
user=22
fromuser=22
secret=1234
host=dynamic
nat=0
allow=all
----------------------------------------------------------------------------------------------------------------
extensions.conf

[globals]



[general]
;
static=yes
writeprotect=yes
;

[extensions]
;
;ton de test
;
exten => 11,1,Milliwatt()
exten => 11,2,Hangup
;
; Data si Timp
;
exten => 13,1,DateTime()
exten => 13,2,Wait(1)
exten => 13,3,DateTime()
exten => 13,4,Hangup
;
exten => 21,1,Dial(SIP/21,20)     
exten => 21,2,Voicemail(u21)
exten => 21,3,Hangup
;
exten => 22,1,Dial(SIP/22,20)   ;
exten => 22,2,Voicemail(u22)
exten => 22,3,Hangup

[linia1-centrala]
exten => s,1,Dial(SIP/21,20)
exten => s,2,Hangup

[linia2-centrala]
exten => s,1,Dial(SIP/22|20)
exten => s,2,Hangup

[default]
include => linia1-centrala
include => linia2-centrala
;
[from-sip]
include => extensions
exten => 0,1,Dial(Zap/g1/${EXTEN},70)
exten => _XX,1,Dial(Zap/g1/${EXTEN},70)
;

--------------------------------------------
the other machine 

sip.conf

[general]
context=from-sip                ; Default context for incoming calls
port=5060                       ; UDP Port to bind to (SIP standard port is 
5060)
bindaddr=0.0.0.0                ; IP address to bind to (0.0.0.0 binds to all)
;srvlookup=yes                  ; Enable DNS SRV lookups on outbound calls
                                ; Note: Asterisk only uses the first host
                                ; in SRV records
                                ; Disabling DNS SRV lookups disables the
                                ; ability to place SIP calls based on domain
                                ; names to some other SIP users on the 
Internet
;tos=184                        ; Set IP QoS to either a keyword or numeric 
val
;tos=lowdelay                   ; lowdelay,throughput,reliability,mincost,none
;maxexpirey=3600                ; Max length of incoming registration we allow
;defaultexpirey=120             ; Default length of incoming/outoing 
registration
notifymimetype=text/plain       ; Allow overriding of mime type in MWI NOTIFY
;videosupport=yes               ; Turn on support for SIP video


allow=all
allow=gsm
allow=g723.1
allow=g729
allow=ulaw

musicclass=default              ; Sets the default music on hold class for all 
SIP calls
                                ; This may also be set for individual 
users/peers
language=en                     ; Default language setting for all users/peers
                                ; This may also be set for individual 
users/peers
relaxdtmf=yes                   ; Relax dtmf handling
                                ; when we're on hold (must be > rtptimeout)
;trustrpid = no                 ; If Remote-Party-ID should be trusted
;progressinband=no              ; If we should generate in-band ringing always
useragent=Asterisk PBX          ; Allows you to change the user agent string
nat=no                          ; NAT settings
                                ; yes = Always ignore info and assume NAT
                                ; no = Use NAT mode only according to RFC3581

promiscredir=yes

register => 21:xxxx at xxx.xxx.xxx.xxx
register => 22:xxxx at xxx.xxx.xxx.xxx

[sip1-out]
type=friend
secret=1234
username=21
fromuser=21
host=xxxxxxxxxxx
nat=no
canreinvite=no
allow=all

[sip2-out]
type=friend
secret=1234
username=22
fromuser=22
host=xxxxxxxxxxxxx
canreinvite=no
nat=no
allow=all

[asterisk]
user=asterisk
type=friend
host=dynamic

-------------------------------------------------------------------------

extensions.conf

[incoming1]
exten => _2XXXXXXXXXXXX,1,Dial,SIP/${EXTEN:1}@sip1-out|20
exten => _1XX,1,Dial,SIP/${EXTEN:1}@sip1-out,20
exten => _1XX,2,Voicemail,u21
[incoming2]
exten => _1XX,1,Dial,SIP/${EXTEN:1}@sip1-out,20
exten => _1XX,2,Voicemail,u22


[from-sip]
include => tel1
include => tel2

[tel1]
exten => 21,1,Dial(Zap/1|25)

[tel2]
exten => 22,1,Dial(Zap/2|25)

Sincerly yours,
Mike



More information about the asterisk-users mailing list