Need advice setup of asterisk with no PSTN phone line

Hi all,
I am new to asterisk and am planning to experiment with setting up two asterisk servers both having the ability to make calls in/out, but of course not on the regular PSTNetwork.

However, as I do not plan to utilize PSTN but still plan to utilize a hard phone setup with asterisk itself whereas the servers have the ability to talk with each other through IP and possible with ohter individuals via IP. I plan to hook up phones to a Linksys PAP2 T Voip Analog Adapter (which will be connected to my asterisk servers) for the mouth and ear capabilities of a regular phone. Also, these servers will both be utilizing static IP addresses, or possibly one will have a static IP while the other a dynamic IP which I can update with my own IP updating program. Also, I plan to set them both up as gatekeepers but would like to know if this, too, is feasable?

Is this possible? If so, could you elaborate on the methods I should take (IAX, H.323, SIP. iax.conf, extensions.conf, sip.conf)?

Everything you are asking about is doable with *, but you have a lot of reading to do to get started.

I would start with the docs and then hit the wiki for more specific information. I would suggest getting a server up and running and start modifying it to do what you need it to do. The other option is to utilize something like TrixBox (trixbox.org) which may be easier for you to set up and get running. I have linked several A@H (pre trixbox) servers together and have had no problems doing so.

As far as actual configuration, well, it can be done a lot of different ways. Personally I would stick with IAX trunks between your * systems. The PAP-2NA is a nice little box, but beware that if those boxes are behind a NAT’d firewall, you may have other issues with them (and many other SIP devices).

Until you’re familiar with the system and configurations, I’d recommend using just one asterisk box to begin with. You’ll be able to create two extensions/numbers for your linksys and setup other extensions for friends and family that have broadband. They can use any softphone though the PC or use an gateway adapter such as pcphoneline.com/pcphoneline/ … ta1000.htm to interface a regular phone with the softphone on the PC. That way you can use the features of the softphone with your regular phone.

As far as methods, I’m a bit biased to SIP. SIP does have a few limitiations compared to MGCP, but is very easy to use and is becoming one of the most popular protocols in the voip telcom industry. (once you get both asterisk boxes up, you’d use IAX to communicate between the two)

For a quick bare bone setup w/out features, you would configure something like this:

– extensions.conf –
[general]
static=yes
writeprotect=yes

[internal] ; context name
exten => 1000,1,Dial(SIP/${EXTEN},30) ;Dial using extension variable so you don’t have to enter the extension manually. This setup here dials extension 1000. 30 is how long it will dial before going to next priority(2) which disconnects the call.
exten => 1000,2,Hangup

exten => 1001,1,Dial(SIP/1001,30) ; Dialing extension w/out variable. You can choose which method you prefer
exten => 1001,2,Hangup

– sip.conf –
[1000]
type=friend
regexten=1000 ;username
secret=1000 ;password
host=dynamic
nat=yes
canreinvite=no
disallow=all ; codecs - enable the ones you want… I’d recommend ulaw/alow for now. (g711)
allow=ulaw
allow=alaw
dtmfmode=rfc2833 ;many need to play with depending what hardware you’re using. Usually works with this or ‘inband’. This is for when you setup voice mail or IVR system to read the dtmf tones genereated when you hit the option. If you’re in VM or IVR and nothing happens when you press the options, try changing this setting.
callerid=“Linksys” <1000> ; caller id name and number/extension
context=internal ; references internal context in extensions.conf

[1001]
type=friend
regexten=1001
secret=1001
host=dynamic
nat=yes
canreinvite=no
disallow=all
allow=ulaw
allow=alaw
dtmfmode=rfc2833
callerid=“Friend” <1001>
context=internal


This is barely touching the extent of features and capabilities, but should be able to get going and feel for how it works. From there you can add features as you learn.

Thanks all,

I appreciate the quick responses. If there is someone who has already setup two servers preferably using IAX please let me know your setup as I do not plan to have either of these servers on the PSTN at all.

I appreciate the advice for the SIP utilization method, setting up friends and family and understand it is a way to get started but I will not have a PSTN in the equation at all. However, your suggestion was not unduly noted one iota.

Now, from what you posted flyboySR22 as long as my asterisk servers are not behind a nat’d firewall then I should be fine using PAP-2tNA even though my client’s (i.e. family, friends) will more than likely be behind nat’d firewalls?

thanks in advance to all.

Take a look at this thread to see how to have two * boxes talk on an IAX trunk:

forums.digium.com/viewtopic.php?t=7297

Hi,
I had already seen that thread, copied it and saved it. The main difference with this thread is that the system configuration is using a voip provider (one * server), a pstn (another * server) and a standalone * server, but I intend to use it if i cannot find a setup more similiar to my needs.

Thanks again.

The other thread showed how to have two * systems talking and transferring calls to one another for various reasons. When you want your two * boxes to talk to each other, you can use that thread as a means to have them trunked together.

Don’t mistake trunking two * boxes together with some requirement for PSTN, VOIP, etc. You can trunk boxes without the need for either.

You can have one * box set up as your VOIP gateway and have a IAX trunk to that box. You can have another setup as a VOIP gateway and have an IAX trunk to that box as well. You can have another * box setup to handle only internal extensions and have yet another IAX trunk setup to that box.

I will give that one a try. Again, thanks a lot for the advice.

Also, when I was referring to friends and family, I was refering to direct ip to ip calling so there is no PSTN or VOIP provider involved. I have 3 family members in 2 different states and they can register with my asterisk pbx with their IP phone or softphone and we can call eachother for free. Just dial the other persons extension and will ring their number no matter where they are in the world as long as their ip phone or softphone is registered with your asterisk box. To register, they’d enter your asterisk IP address or URL and enter the user/pass you configured for them in your SIP.CONF file.

Thanks WebMasterX,

I appreciate all the help and advice you have provided me with, and I am glad you clarified the PSTN issue because I had painted a different picture in my mind.

Is the ${EXTEN} variable a predefined * variable?

${EXTEN} will be the value you assign to “exten => XXXX”. The nice thing about using variables like that is you can setup multiple extensions and have them function the same and only have to change the extension number. Here’s another example with voicemail. the “${EXTEN}@voicemail” calls the extension number @ voicemail context (located in voicemail.conf)

Example

Macro(vm) is actually yet another context in extensions.conf to call the voicemail app and also uses variables to dynamically know the correct extension vm to send the call.

Another way it can be used is when your making an outbound call… Lets say internally you’re using 10 digit extensions (nothing to do with PSTN or VoIP carrier)… The ${EXTEN} can be dynamically set like this:

Now ${EXTEN} will be whatever 10 digit numbe you dialed… so if you dialed 5555555555, that’s you’re new variable value.

Or if you wanted 10 digit dialing but only the last 4 digits to be the variable, you’d code it like this:

The added :7 removes the 1st 7 digits. Again, these examples are very basic but hopefully gives you an indea what you can do. Then depending on what you want to do, you can make your own. Variables are great for dynamic routing with GotoIf app.

For now though unless there is something specific you want to do, I’d recommend just practicing with the basics and branch out from there as you complete each project or objective. Because of how much information is out there and all you can do with it, if you randomly read posts online you’ll end up all over the place with things you can do and potentially get derailed because something else seems interesting. For me, I found it easier to learn by taking on task or objective at a time and move to the next once I understood what I was doing. For example, one day was working on voicemail. Another was mass calling, then move on to variable routing, and time of day routing, billing, AGI scripts, etc. Then when I needed assistance for that particular task, I found a lot of information for the one thing I was trying to do. Then continued same pattern when I moved onto the next task I wanted to do. I still do it today. :smile: Just a suggestion.

Thanks for the helpful and useful information. I guess I was expecting the variable ${EXTEN} to be globally declared in extensions.conf (i.e. EXTEN =), or if not there then in some other file, (i.e. similar to other programming languages) so i suppose it is a predefined extension variable within the * language. But then I suppose it could not be global because (per your examples) it only relates to just the timeframe of the current call, then on to the next, etc.

Thanks.

The examples I gave you were based on an example [internal] context. You can create a global variable by using the context name “global” then add that to your internal context. (or whatever other context you want)

extensions.conf Example:

You could also so something like this, in globals context have:

Then your internal context could look like this:

You can have your extension and global variable the same, I was just trying to show you can force it to be whatever you want by calling your defined variable in the globals context.

Thanks I will be taking all of your useful information into consideration when configuring and setting up my asterisk servers.

Hi again,
I cannot figure out what the problem is but i registered a test user and then I went to a machine which is behind a firewall and tried the portsip sip phone that did not register, even though I regsitered [tracy] as type=friend. Can someone look at these simplified files of mine and see if anything looks incorrect and let me know. * itself seems to be fine, with five warnings and one error:

  1. WARNING[5311]: cdr_addon_mysql.c:295 my_load_module: Unable to load config for mysql CDR’s: cdr_mysql.conf
  2. Jun 20 18:38:30 ERROR[5311]: res_config_mysql.c:615 mysql_reconnect: MySQL RealTime: Failed to connect database server on . Check debug for more info.
  3. Jun 20 18:38:30 WARNING[5311]: res_config_mysql.c:450 load_module: MySQL RealTime: Couldn’t establish connection. Check debug.
  4. Jun 20 18:38:30 NOTICE[5311]: config.c:863 ast_config_engine_register: Registered Config Engine mysql
  5. 8:38:31 WARNING[5311]: acl.c:244 ast_get_ip_or_srv: Unable to lookup ‘dymamic’
  6. chan_iax2.c:9592 load_module: Unable to open IAX timing interface: No such file or directory
    any suggestions to fix these issues will of course be great and appreciated too.

sip.conf
[tracy]
type=friend
username=tracy
secret=pwd_tracy
host=dynamic ;note * is static but machine placing calls is dynamic
context=tutorial

extensions.conf
[general]
static=yes
writeprotect=yes

[internal]
exten => 1000,1,Dial(SIP/${EXTEN},10)
exten => 1000,2,Hangup
exten => 1001,1,Dial(SIP/1001,10)
exten => 1001,2,Hangup

[tutorial]
exten => 1234,1,Dial(SIP/kevin) ; setting an extension for kevin
exten => 4321,1,Dial(SIP/tracy, 10) ; setting an extension for tracy to test
exten => 4321,2,Playback(tt-monkeys)
exten => 4321,3,Hangup
exten => 1111,1,Dial(IAX2/kevin_iax@kevin_iax) ; iax setup (username@username)
exten => 2222,2,Dial(IAX2/tracy_iax@tracy_iax) ; iax setup for tracy

Please note, only extension 4321 is of primary focus right now.

Thanks in advance… Oh, yeah, can i setup my server as a slave rather than a primary server to run * on?
~