Open hanswang73 opened 10 months ago
TCP can REGISTRY successful, but can not be called
cm = CredentialsManager()
cm.add(
username="6001",
password="6001"
)
params = VoIPPhoneParameter(
server="8.130.79.242",
port=9991, ##### UDP 9990、TCP 9991、TLS 9992
user="6001",
credentials_manager=cm,
call_class=Call,
bind_ip=socket.gethostbyname(socket.gethostname()),
bind_port=9999, ##### 本地端口,无所谓
transport_mode=TransportMode.TCP
)
phone = VoIPPhone(params)
phone.start()
input('Press enter to disable the phone\n')
phone.stop()
It seems it should keep the TCP connection alway alive ? Instead of close it.
Asterisk as server, pyvoip client is behind symmetric NAPT, UDP is OK, but TCP failed
[transport-udp-nat] type=transport protocol=udp bind=0.0.0.0:9990 local_net=172.17.86.201/24 external_media_address=8.130.79.242 external_signaling_address=8.130.79.242 external_signaling_port=9990 [transport-tcp-nat] type=transport protocol=tcp bind=0.0.0.0:9991 local_net=172.17.86.201/24 external_media_address=8.130.79.242 external_signaling_address=8.130.79.242 external_signaling_port=9991 [transport-tls-nat] type=transport protocol=tls bind=0.0.0.0:9992 local_net=172.17.86.201/24 external_media_address=8.130.79.242 external_signaling_address=8.130.79.242 external_signaling_port=9992 cert_file=/etc/asterisk/cacert.pem priv_key_file=/etc/asterisk/privkey.pem cipher=ECDHE-RSA-AES256-GCM-SHA384,ECDHE-RSA-CHACHA20-POLY1305,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-RSA-AES256-SHA384,ECDHE-RSA-AES128-SHA256,ECDHE-RSA-AES256-SHA,ECDHE-RSA-AES128-SHA,AES256-GCM-SHA384,AES128-GCM-SHA256,AES256-SHA256,AES128-SHA256,AES256-SHA,AES128-SHA method=tlsv1_2 [6001] type=endpoint context=sipcall rtp_symmetric=yes direct_media=no rewrite_contact=yes force_rport=yes ice_support=yes disallow=all allow=alaw auth=6001 aors=6001 [6001] type=auth auth_type=userpass password=6001 username=6001 [6001] type=aor max_contacts=1 [6002] type=endpoint context=sipcall rtp_symmetric=yes direct_media=no rewrite_contact=yes force_rport=yes ice_support=yes disallow=all allow=alaw auth=6002 aors=6002 [6002] type=auth auth_type=userpass password=6002 username=6002 [6002] type=aor max_contacts=1