SIP over UDP and TCP

Hello,

I have Asterisk 11.14.1. I have a mix of Cisco phones on the system. Using a mix of SCCP, SIP TCP, and SIP UDP. I also have a SIP trunk using UDP.

The SCCP phones work fine and I have enabled SIP TCP and those phones work fine as well. The issue I’m having is with the Cisco 7961s. Even though in the config file, I specified to use UDP, when they connect, I get an error in the Asterisk log that status they only support UDP and cannot connect on TCP.

Any ideas how I can get them working without breaking anything else.

What is your sip.conf entry for the device in question? Have you specified that only udp is allowed for the transport there?

[2225]
deny=0.0.0.0/0.0.0.0
secret=xxxxxx
dtmfmode=rfc2833
canreinvite=no
context=from-internal
host=dynamic
trustrpid=yes
mediaencryption=no
sendrpid=pai
type=friend
nat=no
port=5060
qualify=yes
qualifyfreq=60
transport=udp
avpf=no
force_avp=no
icesupport=no
encryption=no
callgroup=
pickupgroup=
dial=SIP/2225
mailbox=2225@default
permit=0.0.0.0/0.0.0.0
callerid=RICHARD MURPHY <2225>
callcounter=yes
faxdetect=no
cc_monitor_policy=generic

You have specified “transport=udp” which means it won’t accept TCP. You can set that to “transport=udp,tcp” to allow both.

1 Like

Thanks. The TCP SIP phones are working fine. The Cisco 7961 only supports UDP SIP. The sip.config I posted is for the 7961. It seems to be ignoring the transport=UDP because the Asterisk logs states it’s trying to communicate over TCP but the phone only supports UDP. In sip_general_custom.conf I have tcpenable=yes tcpbindaddr=0.0.0.0. When I checked the asterisk server it was only listening on 5060 TCP, not UDP. I just checked again and it’s listening on both now. I’ll do some testing and get back to you.

It looks like only SIP TCP is listening:

[root@PBX ~]# netstat --listen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:5038 : LISTEN
tcp 0 0 10.10.30.4:sieve-filter : LISTEN
tcp 0 0 *:domain : LISTEN
tcp 0 0 *:ssh : LISTEN
tcp 0 0 *:radan-http : LISTEN
tcp 0 0 localhost:smtp : LISTEN
tcp 0 0 *:sip : LISTEN
tcp 0 0 localhost:mysql : LISTEN
tcp 0 0 *:http : LISTEN
tcp 0 0 *:81 : LISTEN
tcp 0 0 *:xfer : LISTEN
tcp 0 0 *:mit-ml-dev : LISTEN
tcp 0 0 *:ctf : LISTEN
tcp 0 0 *:85 : LISTEN
tcp 0 0 *:domain : LISTEN
tcp 0 0 *:ssh : LISTEN
tcp 0 0 *:51000 : LISTEN
tcp 0 0 localhost:smtp : LISTEN
tcp 0 0 *:58080 : LISTEN
udp 0 0 *:38149 :
udp 0 0 *:domain :
udp 0 0 *:sip :
udp 0 0 *:tftp :
udp 0 0 *:iax :
udp 0 0 *:mdns :
udp 0 0 *:domain :

You have both TCP and UDP listed in that list listening on the SIP port.

All of the tcp ports show LISTEN and the UDP ports do not.

Here is another output. All TCP ports show LISTEN or ESTABLISHED except for the UDP ports.

[root@PBX ~]# netstat -anp | grep asterisk
tcp 0 0 0.0.0.0:5038 0.0.0.0:* LISTEN 29985/asterisk
tcp 0 0 10.10.30.4:2000 0.0.0.0:* LISTEN 29985/asterisk
tcp 0 0 0.0.0.0:8088 0.0.0.0:* LISTEN 29985/asterisk
tcp 0 0 0.0.0.0:5060 0.0.0.0:* LISTEN 29985/asterisk
tcp 0 0 10.10.30.4:2000 10.10.30.15:49305 ESTABLISHED 29985/asterisk
tcp 0 0 10.10.30.4:2000 10.10.24.53:1222 ESTABLISHED 29985/asterisk
tcp 0 0 127.0.0.1:5038 127.0.0.1:44348 ESTABLISHED 29985/asterisk
tcp 0 0 10.10.30.4:2000 10.10.24.52:1230 ESTABLISHED 29985/asterisk
tcp 0 0 10.10.30.4:2000 10.10.30.16:14888 ESTABLISHED 29985/asterisk
tcp 0 0 10.10.30.4:2000 10.10.30.11:52725 ESTABLISHED 29985/asterisk
tcp 0 0 10.10.30.4:2000 10.10.30.17:53159 ESTABLISHED 29985/asterisk
tcp 0 0 10.10.30.4:2000 10.10.30.10:50085 ESTABLISHED 29985/asterisk
tcp 0 0 10.10.30.4:2000 10.10.30.13:52019 ESTABLISHED 29985/asterisk
tcp 0 0 10.10.30.4:5060 107.3.57.142:51513 ESTABLISHED 29985/asterisk
udp 0 0 0.0.0.0:5060 0.0.0.0:* 29985/asterisk
udp 0 0 0.0.0.0:4569 0.0.0.0:* 29985/asterisk

That’s normal. Provided the port is shown for UDP it is open and accepting packets.

I was under the impression that Cisco phones only supported TCP. Maybe some support both, but I doubt that any only do UDP.

It seems that your “UDP” phone is actually trying to connect to using TCP, so isn’t a pure UDP phone.

This is what’s in the asterisk log when the phone tries to register:

[2017-01-21 19:59:36] ERROR[32235]: chan_sip.c:16899 register_verify: ‘TCP’ is not a valid transport for ‘2225’. we only use ‘UDP’! ending call.
[2017-01-21 19:59:36] NOTICE[32235]: chan_sip.c:28091 handle_request_register: Registration from ‘sip:2225@10.10.30.4’ failed for ‘10.10.30.15:27655’ - Device not configured to use this transport type

transport=udp,tcp worked. The previous error was really confusing me.

Thanks again.

Also, when I first tried to register the phone, I think the issue was related to the firmware. The latest firmware for this phone causes it not to register, you have to use the previous version. This also caused confusion as well as TCP not being enabled in asterisk when I was first trying to register the SIP phones. This was an all SCCP system and I recently started adding SIP phones.

I just tested and transport=tcp works for this as well. I’m not sure why I was so hung up on UDP.

All good now. Thanks.

As we said, you are trying to use a TCP phone, but forcing Asterisk to only accept UDP.