asterisk ot able to register sip user

Hi,

I’ve installed asterisk 1.4, configured sip.config:
[general]
port = 5060 ; Port to bind to
bindaddr = 192.168.1.2 ; Address to bind to
context = from-sip ; Default for incoming calls
callerid=NoCallID
srvlookup=yes
dtmfmode=rfc2833

[1052]
type=friend
username=1052
secret=1052
host=dynamic

Whatever softphone I use I’m not able to register. I don’t even get any output in asterisk cli and I’ve set sip debug on. Firewall is down. netstat -tunap has line
udp 0 0 127.0.0.1:5060 0.0.0.0:* 23867/asterisk

Note that I’m connecting to local asterisk - on the same machine.

Any suggestions how should I debug, since it seems like the client is not able to rich asterisk at all.

Thanks

SIP negotiation is quite simple, just snoop the network and see what is happening. You may use tethereal. (Install wireshark package).

Thanks for the quick answer.

Actually not sure what I did but now I can see sip debug from cli but still not able to register:( I’m trying different phones: ekiga, kphone, kcall, x-lite, sjphone…and seems like only sj connects but it’s working very bad on linux - takes over 30% CPU?!

Based on SIP debug seems like phones are not responding to
SIP/2.0 401 Unauthorized
They are not sending pass but plain REGISTER again:

REGISTER sip:127.0.0.1 SIP/2.0
CSeq: 14 REGISTER
Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bK16a1cf40-454f-de11-88d9-0015f201d7a2;rport
User-Agent: Ekiga/3.0.1
From: <sip:1052@127.0.0.1>
Call-ID: b231c93e-444f-de11-88d9-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=z9hG4bK16a1cf40-454f-de11-88d9-0015f201d7a2;received=127.0.0.1;rport=5061
From: <sip:1052@127.0.0.1>
To: <sip:1052@127.0.0.1>
Call-ID: b231c93e-444f-de11-88d9-0015f201d7a2@linux
CSeq: 14 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=z9hG4bK16a1cf40-454f-de11-88d9-0015f201d7a2;received=127.0.0.1;rport=5061
From: <sip:1052@127.0.0.1>
To: <sip:1052@127.0.0.1>;tag=as2cd5cd66
Call-ID: b231c93e-444f-de11-88d9-0015f201d7a2@linux
CSeq: 14 REGISTER
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce=“4391daa2”
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘b231c93e-444f-de11-88d9-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: 14 REGISTER
Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bK16a1cf40-454f-de11-88d9-0015f201d7a2;rport
User-Agent: Ekiga/3.0.1
From: <sip:1052@127.0.0.1>
Call-ID: b231c93e-444f-de11-88d9-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=z9hG4bK16a1cf40-454f-de11-88d9-0015f201d7a2;received=127.0.0.1;rport=5061
From: <sip:1052@127.0.0.1>
To: <sip:1052@127.0.0.1>
Call-ID: b231c93e-444f-de11-88d9-0015f201d7a2@linux
CSeq: 14 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=z9hG4bK16a1cf40-454f-de11-88d9-0015f201d7a2;received=127.0.0.1;rport=5061
From: <sip:1052@127.0.0.1>
To: <sip:1052@127.0.0.1>;tag=as2cd5cd66
Call-ID: b231c93e-444f-de11-88d9-0015f201d7a2@linux
CSeq: 14 REGISTER
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce=“4391daa2”
Content-Length: 0

Any ideas?
Also I know that wireshark is a great tool. Is there any tips/tutories how to use it, especially for SIP and voip in general?

Thanks again,
Milan

Can you try a couple of things?
You said the sjphone worked. Can you debug the registration log of that and compare with others?
Can you set up an additional IP address on the eth0 interface and use that on the phone?
(I think it is getting confused by seeing the same IP for the phone as well as the server).

For wireshark help:

man wireshark

Example, to capture and display packets (run it as root):

tethereal -i eth0

There is a front-end too.

Actually it worked from remote PC from the same network.

Can you set up an additional IP address on the eth0 interface and use that on the phone?

Not sure how to do that :frowning: I believe there are 2 steps:

  1. add new ip
  2. make phone to use that ip
    But I’m not sure how to make either.

Also in order to access asterisk from the remote host from the same network I stopped firewall. Do you happen to know which ports should be opened ( I know 5060 but what about RTP ) or what’s the best practice in general for sip hosts.

Thanks

Yes, if it worked from a remote machine means, your problem is solved. I suggested to try out with a new IP address because I found the phone was sending “localhost” as the address location to register and it does not look very logical and in all probability, server may not be responding to that correctly.

On an ethernet interface, you can set up additional addresses using the following command (example):

ifconfig eth0:0 192.168.1.15 netmask 255.255.255.0 up

(This can be done from Yast too).

Firewall rules for asterisk (do not run the rules which are not required. However, RTP is anyway needed):

# SIP on UDP port 5060. Other SIP servers may need TCP port 5060 as well
iptables -A INPUT -p udp -m udp --dport 5060 -j ACCEPT

# IAX2- the IAX protocol
iptables -A INPUT -p udp -m udp --dport 4569 -j ACCEPT

# IAX - most have switched to IAX v2, or ought to
iptables -A INPUT -p udp -m udp --dport 5036 -j ACCEPT

# RTP - the media stream
iptables -A INPUT -p udp -m udp --dport 10000:20000 -j ACCEPT

# MGCP - if you use media gateway control protocol in your configuration
iptables -A INPUT -p udp -m udp --dport 2727 -j ACCEPT 

Thanks for the answer.

Still I’m not sure how to force the softphone to use the new ip. If you call asterisk on the new ip, the client is still sending from the localhost and it’s no good.

BTW. I used yast > network settings to add additional addresses. However there seems to be a bug since I’m not able to remove that ip now :frowning: It’s deletes it from the list but seems like it doesn’t updates settings and after coming back to network settings, the ip is still there…anyway this is not related to this thread.

Thanks again

The soft-phone should have a feature to use a specified interface (eth0, eth0:0, eth1 etc.). If it is not there, it can not make it work. But, I am wondering how it can use localhost. By the by, no one runs Asterisk on a machine at level 5 (GUI mode) and it may not have been tested ever with a phone connected on the same machine.

Regarding the yast bug, just go to /etc/sysconfig/network directory and you can see all the configuration files there. It is safe to delete/modify them directly but be careful.

You’re right. I wanted to install vmware win guest os anyway, so I’ll use that one for sip softphone client.

Thanks,
Milan

Try VirtualBox. VirtualBox
If you don’t want the latest version, you can install from the openSUSE CD/DVD. Otherwise, download and install it.
Network setup under VirtualBox is very easy.