Saturday, 29 June 2013

My Raspbx

Pre-requisites:

-Connectivity to your Raspbx. Im connecting to the box over SSH

-A couple of soft phones (I'm using SFLphone and Ekiga) for testing and calling internally and externally.
All configuration information for the raspbx is located in /etc/asterisk.
All information for SIP users is stored in sip.conf Numbers are read from extensions.conf. Voicemails are stored in voicemail.conf etc.


To place a call through Asterisk, registration to Asterisk is not required. However, you do need a username and password which will allow you to call someone who is registered.

To receive a call, you must be a registered user and have an extension.

To Register SIP Users:

First of all all users must be registered in sip.conf and have a valid extension  declared in extensions.conf

Follow these steps for:


-Lets first register some users in sip.conf


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

Note that ALL lines beginning with ‘;’ (semi-colomn) are interpreted by Asterisk as a comment. 



[1000]

This means we are registering user '1000'

type=friend

This means the user can place or receive calls. For INBOUND calls only, use ‘peer’ as type. For outbound calls only use ‘user’ as type.

username=1000

This declares that our user will be named '1000'

secret=S3cretPa55w0rd

This creates the password for the user to login/authenticate on Asterisk

host=dynamic

This sets dynamic IP for the host. You may also define this as a static IP

context=test

This defines the dial context for the user which in this case is testing. In Asterisk, outgoing numbers are divided in groups called contexts in order to separate/define different needs for different user types. For example, a context for local calls, local area, international calls etc.


This completes the user registration process on Asterisk. Now let us register an extension for the users we created earlier.


-Registering a number in extensions.conf


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


[tutorial]

This registers the context ‘tutorial’

exten => 1000,1,Dial(SIP/1000)

when dialing number 1000, Asterisk will first Dial the user SFLphone through SIP protocol. The command is : exten => number, priority, Dial(protocol/user). The priority determines the sequence in which the extensions will be executed.
exten => 2000,1,Dial(SIP/2000)

when dialing number 2000, Asterisk will first Dial the user with SFLphone through SIP protocol. The command is : exten => number, priority, Dial(protocol/user). The priority determines the sequence in which the extensions will be executed.


We now have a registered SIP user and extension on Asterisk. Follow this same process to register another SIP user and extension in order to place test calls.

Start by registering the second user in the same way in /etc/asterisk/sip.conf



Register the extension(1000) in /etc/asterisk/extensions.conf in the same context = test.



Now when user '1000' or any other user from the test context dials 1000, the user '1000' will be called.

3. The final step is to register the user to a compatible softphones. However, softphones will be reviewed later. For now, just make sure you have registered the users and extensions