Asterisk and softphone on the same host

Hi All,

I’ve installed asterisk on opensuse 11.1. It’s up and running. I wanted to create sip test dial plan but I’m unable to register local softphone - so asterisk and softphone are on the same machine. I was wondering if this is a special case - is there something particular to be done on the both sides?

Relevant sip.conf lines:

[general]
port = 5060			; Port to bind to
bindaddr = 0.0.0.0	; Address to bind to
context = from-sip		; Default for incoming calls
callerid=NoCallID
srvlookup=no
dtmfmode=rfc2833
allow=all
nat=no

[1052]
type=friend
username=1052
secret=ruka
host=dynamic
mailbox=1052
canreinvite=yes
dtmfmode=rfc2833
group=1
callgroup=1
pickupgroup=1

and here’s sip debug log:

<--- SIP read from 127.0.0.1:5061 --->
REGISTER sip:127.0.0.1 SIP/2.0
CSeq: 1 REGISTER
Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bK42352c3d-1c50-de11-9bb8-0015f201d7a2;rport
User-Agent: Ekiga/3.0.1
From: <sip:1052@127.0.0.1>
Call-ID: 329b2b3d-1c50-de11-9bb8-0015f201d7a2@linux
To: <sip:1052@127.0.0.1>
Contact: <sip:1052@127.0.0.1:5061>;q=1, <sip:1052@192.168.1.2>;q=0.500
Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,SUBSCRIBE,NOTIFY,REFER,MESSAGE,INFO,PING
Expires: 36000
Content-Length: 0
Max-Forwards: 70


<------------->
--- (12 headers 0 lines) ---
Using latest REGISTER request as basis request
Sending to 127.0.0.1 : 5061 (NAT)

<--- Transmitting (no NAT) to 127.0.0.1:5061 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bK42352c3d-1c50-de11-9bb8-0015f201d7a2;received=127.0.0.1;rport=5061
From: <sip:1052@127.0.0.1>
To: <sip:1052@127.0.0.1>
Call-ID: 329b2b3d-1c50-de11-9bb8-0015f201d7a2@linux
CSeq: 1 REGISTER
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Length: 0


<------------>

<--- Transmitting (no NAT) to 127.0.0.1:5061 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bK42352c3d-1c50-de11-9bb8-0015f201d7a2;received=127.0.0.1;rport=5061
From: <sip:1052@127.0.0.1>
To: <sip:1052@127.0.0.1>;tag=as1a677423
Call-ID: 329b2b3d-1c50-de11-9bb8-0015f201d7a2@linux
CSeq: 1 REGISTER
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="3008d53a"
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '329b2b3d-1c50-de11-9bb8-0015f201d7a2@linux' in 32000 ms (Method: REGISTER)
linux*CLI> 
<--- SIP read from 127.0.0.1:5061 --->
REGISTER sip:127.0.0.1 SIP/2.0
CSeq: 1 REGISTER
Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bK42352c3d-1c50-de11-9bb8-0015f201d7a2;rport
User-Agent: Ekiga/3.0.1
From: <sip:1052@127.0.0.1>
Call-ID: 329b2b3d-1c50-de11-9bb8-0015f201d7a2@linux
To: <sip:1052@127.0.0.1>
Contact: <sip:1052@127.0.0.1:5061>;q=1, <sip:1052@192.168.1.2>;q=0.500
Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,SUBSCRIBE,NOTIFY,REFER,MESSAGE,INFO,PING
Expires: 36000
Content-Length: 0
Max-Forwards: 70


<------------->
--- (12 headers 0 lines) ---
Using latest REGISTER request as basis request
Sending to 127.0.0.1 : 5061 (NAT)

<--- Transmitting (no NAT) to 127.0.0.1:5061 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bK42352c3d-1c50-de11-9bb8-0015f201d7a2;received=127.0.0.1;rport=5061
From: <sip:1052@127.0.0.1>
To: <sip:1052@127.0.0.1>
Call-ID: 329b2b3d-1c50-de11-9bb8-0015f201d7a2@linux
CSeq: 1 REGISTER
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Length: 0


<------------>

<--- Transmitting (no NAT) to 127.0.0.1:5061 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bK42352c3d-1c50-de11-9bb8-0015f201d7a2;received=127.0.0.1;rport=5061
From: <sip:1052@127.0.0.1>
To: <sip:1052@127.0.0.1>;tag=as1a677423
Call-ID: 329b2b3d-1c50-de11-9bb8-0015f201d7a2@linux
CSeq: 1 REGISTER
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="3008d53a"
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '329b2b3d-1c50-de11-9bb8-0015f201d7a2@linux' in 32000 ms (Method: REGISTER)
linux*CLI> 
<--- SIP read from 127.0.0.1:5061 --->
REGISTER sip:127.0.0.1 SIP/2.0
CSeq: 1 REGISTER
Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bK42352c3d-1c50-de11-9bb8-0015f201d7a2;rport
User-Agent: Ekiga/3.0.1
From: <sip:1052@127.0.0.1>
Call-ID: 329b2b3d-1c50-de11-9bb8-0015f201d7a2@linux
To: <sip:1052@127.0.0.1>
Contact: <sip:1052@127.0.0.1:5061>;q=1, <sip:1052@192.168.1.2>;q=0.500
Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,SUBSCRIBE,NOTIFY,REFER,MESSAGE,INFO,PING
Expires: 36000
Content-Length: 0
Max-Forwards: 70


<------------->
--- (12 headers 0 lines) ---
Using latest REGISTER request as basis request
Sending to 127.0.0.1 : 5061 (NAT)

<--- Transmitting (no NAT) to 127.0.0.1:5061 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bK42352c3d-1c50-de11-9bb8-0015f201d7a2;received=127.0.0.1;rport=5061
From: <sip:1052@127.0.0.1>
To: <sip:1052@127.0.0.1>
Call-ID: 329b2b3d-1c50-de11-9bb8-0015f201d7a2@linux
CSeq: 1 REGISTER
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Length: 0


<------------>

<--- Transmitting (no NAT) to 127.0.0.1:5061 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bK42352c3d-1c50-de11-9bb8-0015f201d7a2;received=127.0.0.1;rport=5061
From: <sip:1052@127.0.0.1>
To: <sip:1052@127.0.0.1>;tag=as1a677423
Call-ID: 329b2b3d-1c50-de11-9bb8-0015f201d7a2@linux
CSeq: 1 REGISTER
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="3008d53a"
Content-Length: 0
...

Seems like softphone (Ekiga) is not getting responses from asterisk - since it doesn’t send authorization credentials but keeps repeating REGISTER and ignores 401.

Any ideas what could be wrong?

Thanks,
Milan

You need to setup Asterisk and Ekiga to use different ports for signalling and rtp streams, the udp ports for signalling are ok, as Asterisk uses 5060 and Ekiga 5061, better to check the rtp ports used for the audio stream too.

Your problem isn’t related to the port allocation though, are you sure you are using the right password in Ekiga (secret parameter in sip.conf under the section 1052) ?

Cheers.

Marco Bruni
www.marcobruni.net

Possible rtp problems would come after sip registration, right?

This might be client’s issue since it seems like asterisk is responding to 127.0.0.1:5061 as it should.

Actually it worked from the other pc in the network. As expected I had to stop firewall but is there good reference about how should firewall be opened in order to make sip work ( 5060 port, rtp ports, etc )?

Thanks

Right.

Just open the udp port 5060 for the sip protocol and the udp ports used for the rtp streams, default is from 10000 to 20000 and are set in rtp.conf.

Cheers.

Marco Bruni