Asterisk for Noobs..Please help
Moderators: Pilot, Bill Smith
Asterisk for Noobs..Please help
Hello. I am totally new to asterisk and really just want it set up to play around with. I got it up and running on a Fonera running dd-wrt. I cant seem to get a working combination of sip.conf and extensions.conf. I want to set up 2 extns. I want them both to be able to dial out without having to dial a prefix. I want a gizmo project and voipdiscount sip providers with voipd as my outgoing for all calls with 800#s allowed from line 2 to be placed on gizmo. If anyone can point me in the right direction or at lease get me started I would really appreciate it. I wont even get into caller ID spoofing yet Thanks for looking
-
- Dan Should Pay Me
- Posts: 784
- Joined: Fri Nov 16, 2007 9:32 pm
Re: Asterisk for Noobs..Please help
You would definitely benefit from a long visit to www.nerdvittles.com. Uncle Ward has a very clear style of writing. EnjoyPoo619 wrote:Hello. I am totally new to asterisk and really just want it set up to play around with. I got it up and running on a Fonera running dd-wrt. I cant seem to get a working combination of sip.conf and extensions.conf. I want to set up 2 extns. I want them both to be able to dial out without having to dial a prefix. I want a gizmo project and voipdiscount sip providers with voipd as my outgoing for all calls with 800#s allowed from line 2 to be placed on gizmo. If anyone can point me in the right direction or at lease get me started I would really appreciate it. I wont even get into caller ID spoofing yet Thanks for looking
Good Luck
CrackerJack
MagicJack Customer #73
MagicJack user since May 2007
MagicJack abuser since June 2007
"I gots mo' numbers than a Lotto machine!!!"
CrackerJack
MagicJack Customer #73
MagicJack user since May 2007
MagicJack abuser since June 2007
"I gots mo' numbers than a Lotto machine!!!"
-
- Dan isn't smart enough to hire me
- Posts: 296
- Joined: Fri Jan 25, 2008 9:50 am
- Location: HIghland Village, Texas
- Contact:
Try asteriskNOW. By far the easiest way to get started with asterisk. Another alternative is to install asterisk gui on top of asterisk. It's basically the same thing as asteriskNOW.
"Looking for a new job. I have worked for Adelphia, Enron, Health South, Worldcom, and most recently British Petroleum."
-
- Dan isn't smart enough to hire me
- Posts: 296
- Joined: Fri Jan 25, 2008 9:50 am
- Location: HIghland Village, Texas
- Contact:
I am not familiar with the setup you have, but I can give you a rundown on configuring asterisk. Keep in mind that there is more than one way to accomplish what you desire, and I am going to show you just one way based on my personal configuration, under asterisk 1.4.18. My config also includes analog adapters so you will adjust to taste accordingly.
Let's start with sip.conf. I only use a general config of sip params here:
[general]
context = default
include = trunk_users
allowoverlap = no
bindport = 5060
bindaddr = 0.0.0.0
srvlookup = no
allowexternaldomains = yes
allowexternalinvites = yes
allowguest = yes
allowsubscribe = no
allowtransfer = yes
alwaysauthreject = no
autodomain = no
callevents = no
compactheaders = no
dumphistory = no
g726nonstandard = no
ignoreregexpire = no
jbenable = yes
jbforce = no
jblog = no
maxcallbitrate = 384
maxexpiry = 3600
minexpiry = 120
notifyringing = no
pedantic = no
promiscredir = no
recordhistory = no
allow = ulaw,alaw,gsm,ilbc,g729,g726
defaultexpiry = 300
disallow = speex,adpcm,lpc10
progressinband = never
relaxdtmf = no
rtcachefriends = no
rtsavesysname = no
rtupdate = no
sendrpid = no
sipdebug = no
t1min = 100
t38pt_udptl = yes
tos_audio = ef
tos_sip = CS3
tos_video = AF41
trustrpid = no
useragent = Gizmo
usereqphone = no
videosupport = no
canreinvite = yes
nat = no
dtmfmode = rfc2833
jbimpl = adaptive
jbmaxsize = 120
localnet =
jbresyncthreshold = 2500
mohinterpret =
mohsuggest =
registertimeout =
registerattempts =
fromdomain =
domain =
realm =
register = 1747XXXXXXX:<password here>:[email protected]:5060 ;Optional, not required here but if used then "registersip=no" in users.conf
Moving forward...
I use the users.conf file to configure peers. The default settings should work in the general section, so I will give examples of contexts that could accomplish your goal.
[trunk_1]
allow = ulaw,alaw,gsm,ilbc
disallow = adpcm,lpc10,speex,g729,g726
context = DID_trunk_1 ;context used in extensions.conf for inbound call routing
dialformat = ${EXTEN:0}
hasexten = no
hasiax = no
hassip = yes
host = proxy01.sipphone.com
port = 5060
registeriax = no
registersip = yes
secret = <your-password>
trunkname = Custom - sipphone
trunkstyle = customvoip
username = 1747XXXXXXX
insecure = port,invite
canreinvite = yes
[<your-phone-number-or gizmo-account-name>] ;The exact name you use for this context not really important unless it is a local sip extension, and is the target of the <DID_XXX_X> contexts in extensions.conf.
fullname = Willy Gates ;
email = [email protected]
hasexten = yes
zapchan = 3 ;Don't use, use "hassip = yes" instead
hasvoicemail = yes
vmsecret = 1234
callwaiting = no
context = numberplan-custom-1 ;context used for outbound calling in extensions.conf
The preceding example in the users.conf file sets up a gizmo account. Now, in extensions.conf we will setup a global trunk. My extensions.conf looks like this:
[[general]
static => yes
writeprotect => no
autofallthrough => yes
clearglobalvars => yes
[globals]
CONSOLE => Console/dsp
IAXINFO => guest
TRUNK => Zap/g5
TRUNKMSD => 1
zap_1 = Zap/1
zap_2 = Zap/2
ipkall_1 = SIP/ipkall_1
ipkall_2 = SIP/ipkall_2
trunk_1 = SIP/trunk_1 ;setup gizmo account context
trunk_2 = SIP/trunk_2
trunk_3 = SIP/trunk_3
trunk_4 = SIP/trunk_4
trunk_5 = SIP/trunk_5
trunk_6 = SIP/trunk_6
trunk_7 = SIP/trunk_7
trunk_8 = SIP/trunk_8
trunk_9 = SIP/trunk_9
trunk_10 = SIP/trunk_10
[default]
include => ringroups-custom-1
include => voicemenu-custom-1
exten => 8500,1,VoicemailMain
exten => 8500,n,Hangup
[from-zap1]
include => default
exten => _X.,1,Dial(Zap/3&Zap/4)
exten => s,1,Dial(Zap/3&Zap/4)
[from-zap2]
include => default
exten => _X.,1,Dial(Zap/3&Zap/4)
exten => s,1,Dial(Zap/3&Zap/4)
[DID_ipkall_1]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[from-internal] ;this context is not used in this example
include => default
exten => _91NXXNXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _1747XXXXXXX,1,Macro(privacy,${trunk_2}/${EXTEN:0})
exten => _1NXXNXXXXXX,1,Macro(privacy,${trunk_1}/${EXTEN:1})
exten => _747XXXXXXX,1,Macro(privacy,${trunk_2}/1${EXTEN:0})
exten => _NXXNXXXXXX,1,Macro(privacy,${trunk_1}/${EXTEN:0})
[macro-privacy] ;used for caller-id blocking or can be used for orange-boxing
exten => s,1,SIPAddHeader(P-Asserted-Identity: <sip:+1${CALLERID(num)}\; user=phone>)
exten => s,n,SIPAddHeader(Privacy: id)
exten => s,n.SetCallerPres(prohib_not_screened)
exten => s,n,Set(CALLERID(num)=)
exten => s,n,Set(CALLERID(name)=anonymous)
exten => s,n,Dial(${ARG1})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Hangup
exten => s-BUSY,1,Hangup
exten => _s-.,1,NoOp
[DID_ipkall_1]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_ipkall_2]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_1]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_2]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_3]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_4]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_5]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_6]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_7]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_8]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_9]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_10]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[macro-trunkdial]
exten => s,1,Dial(${ARG1})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Hangup
exten => s-BUSY,1,Hangup
exten => _s-.,1,NoOp
[macro-stdexten]
exten => s,1,Dial(${ARG2},20)
exten => s,2,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Voicemail(${ARG1},u)
exten => s-NOANSWER,2,Goto(default,s,1)
exten => s-BUSY,1,Voicemail(${ARG1},b)
exten => s-BUSY,2,Goto(default,s,1)
exten => _s-.,1,Goto(s-NOANSWER,1)
exten => a,1,VoicemailMain(${ARG1})
[voicemenu-custom-1]
comment => main
alias_exten => 4000
exten => s,1,Answer
exten => s,n,Wait(3)
exten => s,n,Playback(/var/lib/asterisk/sounds/pls-wait-connect-call)
exten => s,n,Goto(default|6000|1)
include = default
[numberplan-custom-1]
include = default
include = parkedcalls
exten = _1747XXXXXXX!,1,Macro(trunkdial,${trunk_1}/${EXTEN:0}) ;used to dial gizmo accounts, for 800 numbers substitute 800 for 747
exten = _1NXXXXXXXXX!,1,Macro(trunkdial,${trunk_8}/${EXTEN:1})
exten = _NXXXXXXXXX!,1,Macro(trunkdial,${trunk_8}/${EXTEN:0})
[numberplan-custom-2]
include = default
include = parkedcalls
exten = _1747XXXXXXX!,1,Macro(trunkdial,${trunk_4}/${EXTEN:0})
exten = _1NXXXXXXXXX!,1,Macro(trunkdial,${trunk_9}/${EXTEN:1})
exten = _NXXXXXXXXX!,1,Macro(trunkdial,${trunk_9}/${EXTEN:0})
[ringroups-custom-1]
exten = s,1,NoOp(RINGGROUP)
exten = s,n,Dial(Zap/3&Zap/4,20)
exten = s,n,Hangup
Extra notes: If you noticed that the <DID_XXX_X> contexts seem redundant, you are right. I copied and pasted these for use as I develop my dialplan. They will ultimately reference other contexts in users.conf or other asterisk servers. The contexts <trunk_8> and <trunk_9> used with the <macro-trunkdial> and <custom-numberplan-X> contexts show no corresponding reference in my users.conf simply because I did not include them in this example. They are other voip accounts I am using on this server, and they are setup similar to the gizmo project account used in <trunk_1>. The "s" extension is asterisk internal used for internal (within asterisk) call routing such as voicemail, analog channels, other non-sip channels or cross-channel coupling (sip to zap, sip to iax, etc.). I included my complete extensions.conf so other readers might benefit from this example, and it represents the overall dialplan.
As an option you may modify rtp.conf to use the port range (40,000-50,000) instead of the default (10,000-20,000). My experience shows that range to be more universally compatible. I am open to and welcome any further discussion of this topic.
Let's start with sip.conf. I only use a general config of sip params here:
[general]
context = default
include = trunk_users
allowoverlap = no
bindport = 5060
bindaddr = 0.0.0.0
srvlookup = no
allowexternaldomains = yes
allowexternalinvites = yes
allowguest = yes
allowsubscribe = no
allowtransfer = yes
alwaysauthreject = no
autodomain = no
callevents = no
compactheaders = no
dumphistory = no
g726nonstandard = no
ignoreregexpire = no
jbenable = yes
jbforce = no
jblog = no
maxcallbitrate = 384
maxexpiry = 3600
minexpiry = 120
notifyringing = no
pedantic = no
promiscredir = no
recordhistory = no
allow = ulaw,alaw,gsm,ilbc,g729,g726
defaultexpiry = 300
disallow = speex,adpcm,lpc10
progressinband = never
relaxdtmf = no
rtcachefriends = no
rtsavesysname = no
rtupdate = no
sendrpid = no
sipdebug = no
t1min = 100
t38pt_udptl = yes
tos_audio = ef
tos_sip = CS3
tos_video = AF41
trustrpid = no
useragent = Gizmo
usereqphone = no
videosupport = no
canreinvite = yes
nat = no
dtmfmode = rfc2833
jbimpl = adaptive
jbmaxsize = 120
localnet =
jbresyncthreshold = 2500
mohinterpret =
mohsuggest =
registertimeout =
registerattempts =
fromdomain =
domain =
realm =
register = 1747XXXXXXX:<password here>:[email protected]:5060 ;Optional, not required here but if used then "registersip=no" in users.conf
Moving forward...
I use the users.conf file to configure peers. The default settings should work in the general section, so I will give examples of contexts that could accomplish your goal.
[trunk_1]
allow = ulaw,alaw,gsm,ilbc
disallow = adpcm,lpc10,speex,g729,g726
context = DID_trunk_1 ;context used in extensions.conf for inbound call routing
dialformat = ${EXTEN:0}
hasexten = no
hasiax = no
hassip = yes
host = proxy01.sipphone.com
port = 5060
registeriax = no
registersip = yes
secret = <your-password>
trunkname = Custom - sipphone
trunkstyle = customvoip
username = 1747XXXXXXX
insecure = port,invite
canreinvite = yes
[<your-phone-number-or gizmo-account-name>] ;The exact name you use for this context not really important unless it is a local sip extension, and is the target of the <DID_XXX_X> contexts in extensions.conf.
fullname = Willy Gates ;
email = [email protected]
hasexten = yes
zapchan = 3 ;Don't use, use "hassip = yes" instead
hasvoicemail = yes
vmsecret = 1234
callwaiting = no
context = numberplan-custom-1 ;context used for outbound calling in extensions.conf
The preceding example in the users.conf file sets up a gizmo account. Now, in extensions.conf we will setup a global trunk. My extensions.conf looks like this:
[[general]
static => yes
writeprotect => no
autofallthrough => yes
clearglobalvars => yes
[globals]
CONSOLE => Console/dsp
IAXINFO => guest
TRUNK => Zap/g5
TRUNKMSD => 1
zap_1 = Zap/1
zap_2 = Zap/2
ipkall_1 = SIP/ipkall_1
ipkall_2 = SIP/ipkall_2
trunk_1 = SIP/trunk_1 ;setup gizmo account context
trunk_2 = SIP/trunk_2
trunk_3 = SIP/trunk_3
trunk_4 = SIP/trunk_4
trunk_5 = SIP/trunk_5
trunk_6 = SIP/trunk_6
trunk_7 = SIP/trunk_7
trunk_8 = SIP/trunk_8
trunk_9 = SIP/trunk_9
trunk_10 = SIP/trunk_10
[default]
include => ringroups-custom-1
include => voicemenu-custom-1
exten => 8500,1,VoicemailMain
exten => 8500,n,Hangup
[from-zap1]
include => default
exten => _X.,1,Dial(Zap/3&Zap/4)
exten => s,1,Dial(Zap/3&Zap/4)
[from-zap2]
include => default
exten => _X.,1,Dial(Zap/3&Zap/4)
exten => s,1,Dial(Zap/3&Zap/4)
[DID_ipkall_1]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[from-internal] ;this context is not used in this example
include => default
exten => _91NXXNXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _1747XXXXXXX,1,Macro(privacy,${trunk_2}/${EXTEN:0})
exten => _1NXXNXXXXXX,1,Macro(privacy,${trunk_1}/${EXTEN:1})
exten => _747XXXXXXX,1,Macro(privacy,${trunk_2}/1${EXTEN:0})
exten => _NXXNXXXXXX,1,Macro(privacy,${trunk_1}/${EXTEN:0})
[macro-privacy] ;used for caller-id blocking or can be used for orange-boxing
exten => s,1,SIPAddHeader(P-Asserted-Identity: <sip:+1${CALLERID(num)}\; user=phone>)
exten => s,n,SIPAddHeader(Privacy: id)
exten => s,n.SetCallerPres(prohib_not_screened)
exten => s,n,Set(CALLERID(num)=)
exten => s,n,Set(CALLERID(name)=anonymous)
exten => s,n,Dial(${ARG1})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Hangup
exten => s-BUSY,1,Hangup
exten => _s-.,1,NoOp
[DID_ipkall_1]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_ipkall_2]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_1]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_2]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_3]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_4]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_5]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_6]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_7]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_8]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_9]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[DID_trunk_10]
include = default
exten = _X.,1,Goto(ringroups-custom-1,s,1)
exten = s,1,Goto(ringroups-custom-1,s,1)
[macro-trunkdial]
exten => s,1,Dial(${ARG1})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Hangup
exten => s-BUSY,1,Hangup
exten => _s-.,1,NoOp
[macro-stdexten]
exten => s,1,Dial(${ARG2},20)
exten => s,2,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Voicemail(${ARG1},u)
exten => s-NOANSWER,2,Goto(default,s,1)
exten => s-BUSY,1,Voicemail(${ARG1},b)
exten => s-BUSY,2,Goto(default,s,1)
exten => _s-.,1,Goto(s-NOANSWER,1)
exten => a,1,VoicemailMain(${ARG1})
[voicemenu-custom-1]
comment => main
alias_exten => 4000
exten => s,1,Answer
exten => s,n,Wait(3)
exten => s,n,Playback(/var/lib/asterisk/sounds/pls-wait-connect-call)
exten => s,n,Goto(default|6000|1)
include = default
[numberplan-custom-1]
include = default
include = parkedcalls
exten = _1747XXXXXXX!,1,Macro(trunkdial,${trunk_1}/${EXTEN:0}) ;used to dial gizmo accounts, for 800 numbers substitute 800 for 747
exten = _1NXXXXXXXXX!,1,Macro(trunkdial,${trunk_8}/${EXTEN:1})
exten = _NXXXXXXXXX!,1,Macro(trunkdial,${trunk_8}/${EXTEN:0})
[numberplan-custom-2]
include = default
include = parkedcalls
exten = _1747XXXXXXX!,1,Macro(trunkdial,${trunk_4}/${EXTEN:0})
exten = _1NXXXXXXXXX!,1,Macro(trunkdial,${trunk_9}/${EXTEN:1})
exten = _NXXXXXXXXX!,1,Macro(trunkdial,${trunk_9}/${EXTEN:0})
[ringroups-custom-1]
exten = s,1,NoOp(RINGGROUP)
exten = s,n,Dial(Zap/3&Zap/4,20)
exten = s,n,Hangup
Extra notes: If you noticed that the <DID_XXX_X> contexts seem redundant, you are right. I copied and pasted these for use as I develop my dialplan. They will ultimately reference other contexts in users.conf or other asterisk servers. The contexts <trunk_8> and <trunk_9> used with the <macro-trunkdial> and <custom-numberplan-X> contexts show no corresponding reference in my users.conf simply because I did not include them in this example. They are other voip accounts I am using on this server, and they are setup similar to the gizmo project account used in <trunk_1>. The "s" extension is asterisk internal used for internal (within asterisk) call routing such as voicemail, analog channels, other non-sip channels or cross-channel coupling (sip to zap, sip to iax, etc.). I included my complete extensions.conf so other readers might benefit from this example, and it represents the overall dialplan.
As an option you may modify rtp.conf to use the port range (40,000-50,000) instead of the default (10,000-20,000). My experience shows that range to be more universally compatible. I am open to and welcome any further discussion of this topic.
"Looking for a new job. I have worked for Adelphia, Enron, Health South, Worldcom, and most recently British Petroleum."
-
- Dan Should Pay Me
- Posts: 703
- Joined: Tue Nov 13, 2007 2:36 pm
- Contact:
Dude, you are SICK ... but oh-so-helpful. LOL
mufon wrote:I am not familiar with the setup you have, but I can give you a rundown on configuring asterisk. Keep in mind that there is more than one way to accomplish what you desire, and I am going to show you just one way based on my personal configuration, under asterisk 1.4.18. My config also includes analog adapters so you will adjust to taste accordingly.
Let's start with sip.conf. I only use a general config of sip params here:
...
...
...
As an option you may modify rtp.conf to use the port range (40,000-50,000) instead of the default (10,000-20,000). My experience shows that range to be more universally compatible. I am open to and welcome any further discussion of this topic.