Why is my softphone not able to connect to Asterisk?

I'm familiarizing myself with Asterisk, and I'm reading the book "Asterisk: The Future of Telephony."

I'm up to the point where I've configured sip.conf and extensions.conf according to the book.


sip.conf:

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

[1000]
type=friend
context=phones
host=dynamic

extensions.conf:

[globals]

[general]
autofallthrough=yes

[default]
exten => s,1,Verbose(1|Unrouted call handler)
exten => s,n,Answer()
exten => s,n,Wait(1)
exten => s,n,Playback(tt-weasels)
exten => s,n,Hangup()

[incoming_calls]

[internal]
exten => 500,1,Verbose(1|Echo test application)
exten => 500,n,Echo()
exten => 500,n,Hangup()

[phones]
include => internal

My Asterisk server is running on my desktop, as well as my softphone (Ekiga). When I add an account it says Could not register sip:1000@localhost. I've also tried setting the registrar in Ekiga to 127.0.0.1.

I'm just trying to get Asterisk to work with a basic setup so I can experiment with it.


System details:

blaine :: /etc/asterisk » uname -a
Linux blaine 2.6.32-24-generic #38-Ubuntu SMP Mon Jul 5 09:20:59 UTC 2010 x86_64 GNU/Linux

blaine :: /etc/asterisk » cat /etc/issue
Ubuntu 10.04.1 LTS

Update

I ran an nmap on localhost and found the following

blaine :: /etc/asterisk » nmap localhost

Starting Nmap 5.00 ( http://nmap.org ) at 2010-08-04 10:38 MDT
Warning: Hostname localhost resolves to 2 IPs. Using 127.0.0.1.
Interesting ports on localhost (127.0.0.1):
Not shown: 987 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
631/tcp  open  ipp
1720/tcp open  H.323/Q.931
2000/tcp open  callbook
3306/tcp open  mysql
5222/tcp open  unknown
5269/tcp open  unknown
7070/tcp open  realserver
7443/tcp open  unknown
7777/tcp open  unknown
9090/tcp open  zeus-admin
9091/tcp open  unknown

Nmap done: 1 IP address (1 host up) scanned in 0.35 seconds

I believe I've figured it out. Since SIP clients and servers both operate on port 5060, I can't have an Asterisk server running on the same box as my softphone. I've installed Asterisk on a remote server, and I can connect to it with Ekiga with the instructions from the book just fine.

Ha, the book even says the same. Shame on me.

If you are running Asterisk and a softphone on the same system (i.e.,
running an X-Lite softphone and Asterisk on a laptop or desktop), then
you will need to modify the SIP port that client listens on. It will need
to be changed from 5060 to 5061 (or some other unused port) so that
Asterisk and the softphone do not interfere with each other.

When running both asterisk and a SIP softphone on the same system, I usually change the softphone to use port 5070.

As long as asterisk starts before the softphone, asterisk will get port 5060 and everything works, but that's not perfectly reliable...