You will need to find a SIP provider and signup, I used voip.ms and dumped $25 into it for testing..
.
It has support for Asterisk
It will give you the sample configuration for Asterisk sip.conf
edit /etc/asterisk/sip.conf
find the line marked [general]
under there insert your registration tag you got from the sample and replace with needed information:
register => 220450_USERNAME:PASSWORD..@chicago.voip.ms:5060
Go to bottom need to insert the SIP CARRIER information do that before EXTENSIONS line
; ## SIP CARRIERS PEERS ###
[voipms]
canreinvite=no
context=mycontext
host=chicago.voip.ms ;(one of our multiple servers, you can choose the one closer to your location)
secret=PASSWORD.. ;your password
type=peer
username=220450_USERNAME ;(Replace with your 6 digit Main SIP Account User ID or Sub Account )
disallow=all
allow=ulaw
fromuser=220450_USERNAME;(Replace with your 6 digit Main SIP Account User ID or Sub Account username)
trustrpid=yes
sendrpid=yes
insecure=invite
nat=yes
edit /etc/asterisk/extensions.conf
** ADD THE FOLLOWING TO THE BOTTOM **
[mycontext]
; Make sure to include inbound prior to outbound because the _NXXNXXXXXX handler will match the incoming call and create a loop
include => voipms-inbound
include => voipms-outbound
[voipms-outbound]
exten => _1NXXNXXXXXX,1,Dial(SIP/${EXTEN}@voipms)
exten => _1NXXNXXXXXX,n,Hangup()
exten => _NXXNXXXXXX,1,Dial(SIP/1${EXTEN}@voipms)
exten => _NXXNXXXXXX,n,Hangup()
exten => _011.,1,Dial(SIP/${EXTEN}@voipms)
exten => _011.,n,Hangup()
exten => _00.,1,Dial(SIP/${EXTEN}@voipms)
exten => _00.,n,Hangup()
; inbound context example for your DID numbers, do not add the number 1 in front
[voipms-inbound]
exten => 7863643011,1,Answer() ;your DID
edit /etc/asterisk/sip.conf
go to our extensions we setup 101 and 102 need to replace context=internal to context=mycontext
go to asterisk -rvvv
reload
sip show peers
sip show registry