1

I am getting started with Asterisk. All I want to do is to call a PSTN number from a SIP softphone. I have gone through the latest edition of the book: Asterisk, the Definitive Guide and done the usual googling for a solution but to no avail.

Here is what I have done so far using Ekiga softphone.

I was able to register using the softphone. Asterisk "sip show peers" lists the registered extensions correctly. I set up chan_dahdi.conf for the PRI card. I set up sip.conf file. In both these files, I have named contexts and these are then defined in the extensions.conf file.

When I try to call in the PRI number from outside, the dialplan extension which matches a generic pattern is triggered. I am able to execute the application Dial(DAHDI/g0/1234567890) in one of the steps. It does call the PSTN number. So I know that the hardware setup and the basic installation of Dahdi drivers, PRI card drivers, etc. are in place.

I am not able to figure out how I can make an external call through the soft phone. What needs to be done to connect a URI in the SIP phone to the Dahdi extension in a dial plan to call out. In other words, how do I, for example, reach this:

exten => _X.,1, Dial(DAHDI/g0/1234567890)

from a soft phone?

Here the number is statically specified in the dialplan.

If I have this as an action in another SIP extension and then try to reach that SIP URI from the softphone, it complains that the user is not reachable.

1 Answer 1

4

There is not an unique way to do it.

This is one way:

I defined my extensions starting with anything but 9, and use 9 to signal that it's a PSTN call.

In extensions.conf add something like this:

exten => _9X.,1,NoOp(Call to PSTN)
exten => _9X.,n,Dial(DAHDI/g0/${EXTEN:1})

Put it on the same context where you put the dialplan for the extensions. The context is defined in a bracketed title like [internal]or [default].

It means that whenever you dial 9+something it will strip the first digit and take the rest of the number and dial it through DAHDI/g0. 9is the outside indicator.

Keep in mind that any extension in the same context will be able to call to PSTN.


This is other way to do it:

If you know the length of the digits to call outside, suppose it's always 7 digits then you can do this:

exten => _XXXXXXX,1,NoOp(Call to PSTN)
exten => _XXXXXXX,n,Dial(DAHDI/g0/${EXTEN})

Whenever you dial a 7-digit-length number it will go to PSTN. Your extension numbers must be shorter than that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .