Help me with creating my first extension

Hi I’m new to Asterisk. I had installed and configured Asterisk and it’s working great.
But I need some help with creating my first extension. I mean the right command line.
Let’s say if I want to create an extension 6000.
Do I use “nano” as shwon below ?
chris@chrisserver:~$ nano extensions.conf
Or do I use the CLI command line ?
I’m using ubuntu.
Can somebody show me step by step how to do that ?

There are 3 steps to create an extension (2 if dialout only).

Step 1 is to set up a user for the extension in users.conf like this
[131]
username = 131
transfer = yes
mailbox = 131
call-limit = 1
fullname = user 131
registersip => no
host = dynamic
callgroup = 1
context = DLPN_DialPlan1
cid_number = 131
hasvoicemail = yes
vmsecret = 1234
email = xxxxx@yahoo.com
threewaycalling = yes
hasdirectory = yes
callwaiting = yes
hasmanager = yes
managerread = system,call,log,verbose,command,agent,user,config
managerwrite = system,call,log,verbose,command,agent,user,config
hasagent = no
hassip = yes
hasiax = no
secret = xxxxxx
nat = yes
canreinvite = no
dtmfmode = rfc2833
insecure = no
pickupgroup = 1
macaddress = 000000001316
autoprov = yes
label = 131
linenumber = 3
disallow = all
allow = ulaw,gsm

Step 2 is to define the extension in sip.conf
[131]
type=peer
context=phones
host=dynamic
call-limit=2
fromuser=131
secret=xxxxxxx
canreinvite=yes
directrtpsetup=no
nat=yes
qualify=yes
register=no
session-timers=accept
session-expires=90
session-minse=120
session-refresher=uac
register => 131:xxxxxx@mypbx.com/131
defaultip=192.168.xx.xxx
disallow=all
allow=ulaw,alaw,gsm

Step 3 is to set up the extension in your dialplan (extensions.conf)
This may not be necessary because the catch all dialing covers lots of this, but this is an example
exten => s,1,Dial(SIP/131,m)

This will dial the extension and play music on hold until you answer it

A prefferable dial would be
exten => s,1,Dial(SIP/131,20,ikKtT)

This rings for 20 seconds and allows transfer on pickup.

Here is a quick 2 sip phone setup. They have the ability to call each other and leave voicemail as well as check their voicemail at extension 6666.

Sip.conf:

[general]
context=default
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0

[6601]
type=friend
dtmfmode=inband
context=default
disallow=all
allow=ulaw
mailbox=6601@default
host=dynamic
username=6601
secret=6601
canreinvite=no

[6602]
type=friend
dtmfmode=inband
context=default
disallow=all
allow=ulaw
mailbox=6602@default
host=dynamic
username=6602
secret=6602
canreinvite=no

extensions.conf:

[general]
static=yes
autofallthrough=yes
writeprotect=no
clearglobalvars=no

[globals]
CONSOLE=Console/dsp

[local]
include=>default

[default]
include=>voicemail
include=>internal

[internal]
exten => _66XX,1,answer()
exten => _66XX,2,Dial(SIP/${EXTEN},15)
exten => _66XX,3,Voicemail(${EXTEN}@default) 

[voicemail]
exten => _6666,1,answer()
exten => _6666,n,VoiceMailMain(${CALLERID(num)}@default)
exten => _6666,n,hangup()

Append these lines to the end of voicemail.conf (1234 is the password for that mailbox):

6601 => 1234,Firstname Lastname,usersemailaddress@work.com
6602 => 1234,Firstname Lastname,usersemailaddress@work.com

Thanks guys !!!
But how do I access the extensions.file to create an extension.
What syntax to write from my terminal ?
do I need to do " sudo add extension" and it will take me to the extension file so I can use the steps you described above ?
Or is it done from the CLI command line by simply tipping “add extensions” and it will take me to the extension.file.
How do I have access to the exetnsion file or the sip file in order to create the extension ?
Thanks guys.

sudo nano /etc/asterisk/extensions.conf —> is your dialplan
sudo nano /etc/asterisk/sip.conf —> is where you add the extension

riddlebox
Asterisk Freak

Joined: 22 Dec 2006
Posts: 274

New postPosted: 23 May 2009 12:06 Post subject: Reply with quote
sudo nano /etc/asterisk/extensions.conf —> is your dialplan
sudo nano /etc/asterisk/sip.conf —> is where you add the extension

[quote]

Thanks Riddlebox