Calls from Asterisk to PSTN


I have installed asterisk on my machine & have tested through soft phone. It has been registered successfully & test calls r going through it perfectly.
Now, i’ hv to check it through PSTN line.Please let me know what should i do to make dialplan for the calls ( e.g 91-41-6699400 )
Also, in which files should i hv to configure rest of the things to implement the call routing from asterisk to outgoing via Digium FXO card.


I have configured everything and able to register also by SIP phones now the problem is that when i want to dial out by my asterisk to some outside gateway, it does’nt allow to do that.
For this should i have to make changes in sip.conf and extension.conf ?? but could any body give me an example of doing so…i have FXO TDM808B card attached.


O’Reilly has a very good book on Asterisk that should get you going. You can actually download a PDF version from Digium:

Nevertheless, here is roughly what I’ve got working on my machine:

In the general part I have the register commands for the external sip gateways. Then you also need a section [sipWhatever] with macthing credentials for each gateway. In this section, you define a context, for example context=from_GW1. We’ll need this later in the dialplan.
Also in sip.conf are sections for each phone, for example [sipPhone1]. Again, they need a context, for example context=PrivatePhones

You need this to define your cards that connect to PSTN. There might be other config files for the drivers, but that depends on your hardware. Again, we need a context, for example context=from_PSTN

This is the dial plan that ties everything together. For each of the contexts that we mentioned earlier, we now need a section.

; here we can dial our internal SIP phones that reference this context
exten => 101,1,Dial(SIP/sipPhone1,r)
exten => 102,1,Dial(SIP/sipPhone2,r)
; here we also tell it how to do outgoing calls, now we need some prefixes,
; for example 8xxxxx sends xxxxx to the SIP gateway, 9 goes to PSTN
exten => _8.,1,Dial(SIP/${EXTEN:1},60,trg))
exten => _9.,1,Dial(ZAP/1/${EXTEN:1},r)

; Incoming calls:

; our phone number at GW1 is 87654321
exten => 87654321,1,Dial(SIP/sipPhone1,20,r)
exten => 87654321,2,VoiceMail(u101@default)
exten => 87654321,102,VoiceMail(b101@default)

; since this is hardware, we accept anything
exten => s,1,Dial(SIP/sipPhone1,20,r)
exten => s,2,VoiceMail(u101@default)
exten => s,102,VoiceMail(b101@default)

The voice mail bit is another story, leave those lines out in the beginning.

What I wrote up here is really just an example that should explain the principle how the configurations files are tied together. I have not copied them verbatim from a working system. Have a look at the book I mentioned in the first line. They explain all these things much better.

Thank you so much for the help.