1. Asterisk Tutorial (First Steps)     ( Back to Tutorials Page  |   next tutorial » )

Asterisk allows people to communicate using the internet. It is the cheapest way to talk to each other. The clients are connected to each other with asterisk machine which use Linux/Unix OS.

The calls are passed throung different channels. Most popular of them are H323, SIP, IAX, Zap. Depending on the channel you are using the users must have the appropriate software for this. For example if are a registered on Asterisk (or other PBX) as SIP user you have to use SIP phone client as X-Lite or SIPPS, and if you are registered as IAX client you have to use IAX phone client as iaxcomm for example.

Now we will have a look at registring SIP and IAX users and adjust all the Asterisk and clien phone settings.

First make sure you have installed Asterisk. Most of the files you will modify are stored in /etc/astersik.

To make calls with such kind of telephone system you should have
1. An Asterisk PBX where each call is passing through
2. Clients using PCs with SoftPhones to call each other

Everything the Asterisk PBX knows is what is written to the conf files in /etc/asterisk. For example everything for SIP users is stored in sip.conf and for IAX users in iax.conf. All numbers are read from extensions.conf. All voicemails are stored in voicemail.conf etc.

To call anybody through Asterisk you do not need to be registered to asterisk itself, you just should have username and password and you may call somebody who is registered.

To be called you must have a registered user and extension.
 

Register SIP users

We will have a look at sip.conf where every single user must be registered and extensions.conf where every valid extension has to be declared.

We are going to follow these steps:
registring user to sip.conf
registring number to extensions.conf


1. Go to /etc/asterisk at your asterisk server. Open sip.conf and register the following test user.



Note that the every single character after ‘;’ (semi-colomn) is interpreted from asterisk as comment.
[ivan]
means we register the user ivan
type=friend
means this user can call and can be called. If you want just to be called use ‘peer’ or ‘user’ if you want only to call.
username=ivan
here you declare that our user will be named ivan
secret=pwd_ivan
this is the password that the user will use for authentication on the asterisk
host=dynamic
this sets dynamic IP for the host. You may also put a static IP
context=tutorial
means that the context the user will dial from will be tutorial. In astrisk the outgoing numbers are devided in groups called context in order to separate the different needs for the different user. For example one for local calls, one for within the city, one for international calls and so on.

You have registered the user on the asterisk, and now let us register an extension which will dial the user.

2. Go to /etc/asterisk and open extensions.conf



[tutorial]
this is registing the context ‘tutorial’
exten => 1234,1,Dial(SIP/ivan)
when dialing number 1234, asterisk will first Dial the user xlite through SIP protocol. The command is : exten => number, priority, Dial(protocol/user). The priority shows the concequency the extensions will be executed.

We have a registered user and extension on Asterisk. Now you have to register another user and extension in order to call each other.

Register the second user in the same way in /etc/asterisk/sip.conf



Register extension for him/her on /etc/asterisk/extensions.conf in the same context – tutorial.



Now when user ivan or anybody else from the context dials 4321 user test will be called.

3. The last step is to register the user to any SoftPhone. We will have a look at softphones later on. Now just make sure you have installed Asterisk and registered the users and extensions in the way described above.
 

Register IAX users

IAX (Inter Asterisk Exchange)is another imortant protocol supported by Asterisk. If you want to use type of communication the users must be registered on /etc/asterisk/iax.conf.

We will again first register the user to iax.conf and then register the extension to extensions.conf.

Register an user in iax.conf as shown bellow.

We name a user ivan_iax with the same username and join it to the tutorial context. Setting the host IP to dynamic and typing some password.



The user is ivan_iax and the type is friend again (can call and can be called). Put some secret whatever, dynamic IP for host and join the user to the tutorila context.

Now we will register second IAX user in the same way.



To dial the first user ivan_iax you have to call 1111. Note that the Dial command when using IAX2 protocol is : Dial(IAX2/username@username)



To dial the second registered user make extension 2222.



Everything is registered and now you have to reload Asterisk. Remember that when you make any change in any conf file from /etc/asterisk/ or any changes related with some of the files you must type reload in asterisk Command Line Interface (CLI) to make the changes effective.

The users and extensions are now registered on the Asterisk but the users must be registered also on any IAX client softphone. We will have a look at these softphones in a while.

contact us at: support@asteriskguru.com - asterisKGuru.com © all rights reserved   |   *asterisk is registered trademark of © Digium™