[SR-Users-ES] No Audio con clientes detras de una NAT, el audio funciona con clientes que usan IPs publicas (Estoy utilizando rtpproxy)

Iñaki Baz Castillo ibc en aliax.net
Jue Jun 25 13:18:35 CEST 2009


El Jueves, 25 de Junio de 2009, rubenrojas - Trc.es escribió:

> # Caller NAT detection route
> /* uncomment the whole following route for enabling Caller NAT Detection */
> route[4]{
> 	force_rport();
> 	if (nat_uac_test("19")) {
> 		if (method=="REGISTER") {
> 			fix_nated_register();
> 		} else {
> 			fix_nated_contact();
> 		}
> 		setflag(5);
> 	}
> 	return;
> }

Lo anterior NO se está ejecutando. Fíjate que el Contact del 200 Ok llega con 
la IP provada al llamante, por lo que el ACK que envía llega al proxy con el 
RURI conteniendo una IP privada del llamado, así que el proxy ruta el ACK a la 
IP privada (que obiviamente no llega). Por eso no oyes audio, porque la 
negociación del INVITE no acaba (no llega el ACK al llamado, y por eso hay 
tantas retransmissiones del 200 OK que no pareces haber observado).


> # RTPProxy control
> /* uncomment the whole following route for enabling RTPProxy Control */
> route[5] {
> 	if (is_method("BYE")) {
> 		unforce_rtp_proxy();
> 	} else if (is_method("INVITE")){
> 		force_rtp_proxy();
> 	}
> 	if (!has_totag()) add_rr_param(";nat=yes");
> 	return;
> }
>
> branch_route[1] {
> 	xdbg("new branch at $ru\n");
> }
>
>
> onreply_route[1] {
> 	xdbg("incoming reply\n");
>
> 	if ((isflagset(5) || isbflagset(6)) && status=~"(183)|(2[0-9][0-9])") {
> 		force_rtp_proxy();
> 	}
> 	if (isbflagset(6)) {
> 		fix_nated_contact();
> 	}
> }
>
>
> failure_route[1] {
> 	if (is_method("INVITE")
> 			&& (isbflagset(6) || isflagset(5))) {
> 		unforce_rtp_proxy();
> 	}
>
> 	if (t_was_cancelled()) {
> 		exit;
> 	}
>
> 	# uncomment the following lines if you want to block client
> 	# redirect based on 3xx replies.
> 	##if (t_check_status("3[0-9][0-9]")) {
> 	##t_reply("404","Not found");
> 	##	exit;
> 	##}
>
> 	# uncomment the following lines if you want to redirect the failed
> 	# calls to a different new destination
> 	##if (t_check_status("486|408")) {
> 	##	sethostport("192.168.2.100:5060");
> 	##	append_branch();
> 	##	# do not set the missed call flag again
> 	##	t_relay();
> 	##}
> }
>
> ***************************************************************************
>***********************
> ***************************************************************************
>***********************
>
> Aqui va el SIP Trace para una llamada de telefonos fisicos NATed to NATed:
> ***************************************************************************
>*********************** U +0.161561 212.4.97.115:35379 -> 212.4.107.250:5060
> INVITE sip:20000000 en 212.4.107.250;user=phone SIP/2.0
> Via: SIP/2.0/UDP 192.168.254.110:5060;branch=z9hG4bK8f809670adc00668
> From: "20000004"
> <sip:20000004 en 212.4.107.250;user=phone>;tag=ab6ba13b2f38a04e To:
> <sip:20000000 en 212.4.107.250;user=phone>
> Contact: <sip:20000004 en 192.168.254.110:5060;transport=udp;user=phone>
> Supported: replaces, timer, path
> Call-ID: c177cae013da224d en 192.168.254.110
> CSeq: 29653 INVITE
> User-Agent: Grandstream BT200 1.1.6.27
> Max-Forwards: 70
> Allow:
> INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK
> Content-Type: application/sdp
> Content-Length: 332
>
> v=0
> o=20000004 8000 8000 IN IP4 192.168.254.110
> s=SIP Call
> c=IN IP4 192.168.254.110
> t=0 0
> m=audio 40000 RTP/AVP 4 3 18 0 8 9 97
> a=sendrecv
> a=rtpmap:4 G723/8000
> a=rtpmap:3 GSM/8000
> a=rtpmap:18 G729/8000
> a=rtpmap:0 PCMU/8000
> a=rtpmap:8 PCMA/8000
> a=rtpmap:9 G722/8000
> a=rtpmap:97 iLBC/8000
> a=fmtp:97 mode=20
> a=ptime:60
>
> #
> U +0.000407 212.4.107.250:5060 -> 212.4.97.115:35379
> SIP/2.0 100 Giving a try
> Via: SIP/2.0/UDP
> 192.168.254.110:5060;branch=z9hG4bK8f809670adc00668;rport=35379;received=21
>2.4.97.115 From: "20000004"
> <sip:20000004 en 212.4.107.250;user=phone>;tag=ab6ba13b2f38a04e To:
> <sip:20000000 en 212.4.107.250;user=phone>
> Call-ID: c177cae013da224d en 192.168.254.110
> CSeq: 29653 INVITE
> Server: Kamailio (1.5.1-notls (i386/linux))
> Content-Length: 0
>
>
> #
> U +0.000034 212.4.107.250:5060 -> 212.4.97.115:55128
> INVITE sip:20000000 en 192.168.254.101:5060;user=phone SIP/2.0
> Record-Route: <sip:212.4.107.250;lr=on;nat=yes>
> Via: SIP/2.0/UDP 212.4.107.250;branch=z9hG4bK5974.c5c9aa24.0
> Via: SIP/2.0/UDP
> 192.168.254.110:5060;rport=35379;received=212.4.97.115;branch=z9hG4bK8f8096
>70adc00668 From: "20000004"
> <sip:20000004 en 212.4.107.250;user=phone>;tag=ab6ba13b2f38a04e To:
> <sip:20000000 en 212.4.107.250;user=phone>
> Contact: <sip:20000004 en 212.4.97.115:35379;transport=udp;user=phone>
> Supported: replaces, timer, path
> Call-ID: c177cae013da224d en 192.168.254.110
> CSeq: 29653 INVITE
> User-Agent: Grandstream BT200 1.1.6.27
> Max-Forwards: 69
> Allow:
> INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK
> Content-Type: application/sdp
> Content-Length: 348
>
> v=0
> o=20000004 8000 8000 IN IP4 192.168.254.110
> s=SIP Call
> c=IN IP4 212.4.107.250
> t=0 0
> m=audio 35752 RTP/AVP 4 3 18 0 8 9 97
> a=sendrecv
> a=rtpmap:4 G723/8000
> a=rtpmap:3 GSM/8000
> a=rtpmap:18 G729/8000
> a=rtpmap:0 PCMU/8000
> a=rtpmap:8 PCMA/8000
> a=rtpmap:9 G722/8000
> a=rtpmap:97 iLBC/8000
> a=fmtp:97 mode=20
> a=ptime:60
> a=nortpproxy:yes
>
> #
> U +0.019311 212.4.97.115:55128 -> 212.4.107.250:5060
> SIP/2.0 100 Trying
> Via: SIP/2.0/UDP 212.4.107.250;branch=z9hG4bK5974.c5c9aa24.0
> Via: SIP/2.0/UDP
> 192.168.254.110:5060;rport=35379;received=212.4.97.115;branch=z9hG4bK8f8096
>70adc00668 From:
> "20000004"<sip:20000004 en 212.4.107.250;user=phone>;tag=ab6ba13b2f38a04e To:
> <sip:20000000 en 212.4.107.250;user=phone>
> Call-ID: c177cae013da224d en 192.168.254.110
> CSeq: 29653 INVITE
> Content-Length: 0
>
>
> #
> U +0.030480 212.4.97.115:55128 -> 212.4.107.250:5060
> SIP/2.0 180 Ringing
> Via: SIP/2.0/UDP 212.4.107.250;branch=z9hG4bK5974.c5c9aa24.0
> Via: SIP/2.0/UDP
> 192.168.254.110:5060;rport=35379;received=212.4.97.115;branch=z9hG4bK8f8096
>70adc00668 From:
> "20000004"<sip:20000004 en 212.4.107.250;user=phone>;tag=ab6ba13b2f38a04e To:
> <sip:20000000 en 212.4.107.250;user=phone>;tag=c0a80101-21188
> Call-ID: c177cae013da224d en 192.168.254.110
> CSeq: 29653 INVITE
> Allow:
> INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,SUBSCRIBE,NOTIFY,UPDATE,REFER,REGISTER,
>INFO Contact: <sip:20000000 en 192.168.254.101:5060;user=phone>
> Record-Route: <sip:212.4.107.250;lr=on;nat=yes>
> Allow-Events: refer,dialog,message-summary,check-sync,talk,hold
> Content-Length: 0
>
>
> #
> U +0.000083 212.4.107.250:5060 -> 212.4.97.115:35379
> SIP/2.0 180 Ringing
> Via: SIP/2.0/UDP
> 192.168.254.110:5060;rport=35379;received=212.4.97.115;branch=z9hG4bK8f8096
>70adc00668 From:
> "20000004"<sip:20000004 en 212.4.107.250;user=phone>;tag=ab6ba13b2f38a04e To:
> <sip:20000000 en 212.4.107.250;user=phone>;tag=c0a80101-21188
> Call-ID: c177cae013da224d en 192.168.254.110
> CSeq: 29653 INVITE
> Allow:
> INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,SUBSCRIBE,NOTIFY,UPDATE,REFER,REGISTER,
>INFO Contact: <sip:20000000 en 192.168.254.101:5060;user=phone>
> Record-Route: <sip:212.4.107.250;lr=on;nat=yes>
> Allow-Events: refer,dialog,message-summary,check-sync,talk,hold
> Content-Length: 0
>
>
> #
> U +6.510103 212.4.97.115:55128 -> 212.4.107.250:5060
> SIP/2.0 200 OK
> Via: SIP/2.0/UDP 212.4.107.250;branch=z9hG4bK5974.c5c9aa24.0
> Via: SIP/2.0/UDP
> 192.168.254.110:5060;rport=35379;received=212.4.97.115;branch=z9hG4bK8f8096
>70adc00668 From:
> "20000004"<sip:20000004 en 212.4.107.250;user=phone>;tag=ab6ba13b2f38a04e To:
> <sip:20000000 en 212.4.107.250;user=phone>;tag=c0a80101-21188
> Call-ID: c177cae013da224d en 192.168.254.110
> CSeq: 29653 INVITE
> Require: timer
> Session-Expires: 100;refresher=uac
> Allow:
> INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,SUBSCRIBE,NOTIFY,UPDATE,REFER,REGISTER,
>INFO Contact: <sip:20000000 en 192.168.254.101:5060;user=phone>
> Record-Route: <sip:212.4.107.250;lr=on;nat=yes>
> Allow-Events: refer,dialog,message-summary,check-sync,talk,hold
> Content-Type: application/sdp
> Content-Length: 151
>
> v=0
> o=20000000 138812 138812 IN IP4 192.168.254.101
> s=-
> c=IN IP4 192.168.254.101
> t=0 0
> m=audio 32448 RTP/AVP 0
> a=rtpmap:0 PCMU/8000
> a=sendrecv
>
> #
> U +0.000365 212.4.107.250:5060 -> 212.4.97.115:35379
> SIP/2.0 200 OK
> Via: SIP/2.0/UDP
> 192.168.254.110:5060;rport=35379;received=212.4.97.115;branch=z9hG4bK8f8096
>70adc00668 From:
> "20000004"<sip:20000004 en 212.4.107.250;user=phone>;tag=ab6ba13b2f38a04e To:
> <sip:20000000 en 212.4.107.250;user=phone>;tag=c0a80101-21188
> Call-ID: c177cae013da224d en 192.168.254.110
> CSeq: 29653 INVITE
> Require: timer
> Session-Expires: 100;refresher=uac
> Allow:
> INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,SUBSCRIBE,NOTIFY,UPDATE,REFER,REGISTER,
>INFO Contact: <sip:20000000 en 192.168.254.101:5060;user=phone>
> Record-Route: <sip:212.4.107.250;lr=on;nat=yes>
> Allow-Events: refer,dialog,message-summary,check-sync,talk,hold
> Content-Type: application/sdp
> Content-Length: 167
>
> v=0
> o=20000000 138812 138812 IN IP4 192.168.254.101
> s=-
> c=IN IP4 212.4.107.250
> t=0 0
> m=audio 35754 RTP/AVP 0
> a=rtpmap:0 PCMU/8000
> a=sendrecv
> a=nortpproxy:yes
>
> #
> U +0.034122 212.4.97.115:35379 -> 212.4.107.250:5060
> ACK sip:20000000 en 192.168.254.101:5060;user=phone SIP/2.0
> Via: SIP/2.0/UDP 192.168.254.110:5060;branch=z9hG4bKdf5e0ceed72f3797
> Route: <sip:212.4.107.250;lr=on;nat=yes>
> From: "20000004"
> <sip:20000004 en 212.4.107.250;user=phone>;tag=ab6ba13b2f38a04e To:
> <sip:20000000 en 212.4.107.250;user=phone>;tag=c0a80101-21188
> Contact: <sip:20000004 en 192.168.254.110:5060;transport=udp;user=phone>
> Supported: path
> Call-ID: c177cae013da224d en 192.168.254.110
> CSeq: 29653 ACK
> User-Agent: Grandstream BT200 1.1.6.27
> Max-Forwards: 70
> Allow:
> INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK
> Content-Length: 0
>
>
> #
> U +0.000245 212.4.107.250:5060 -> 192.168.254.101:5060
> ACK sip:20000000 en 192.168.254.101:5060;user=phone SIP/2.0
> Via: SIP/2.0/UDP 212.4.107.250;branch=z9hG4bK5974.c5c9aa24.2
> Via: SIP/2.0/UDP
> 192.168.254.110:5060;rport=35379;received=212.4.97.115;branch=z9hG4bKdf5e0c
>eed72f3797 From: "20000004"
> <sip:20000004 en 212.4.107.250;user=phone>;tag=ab6ba13b2f38a04e To:
> <sip:20000000 en 212.4.107.250;user=phone>;tag=c0a80101-21188
> Contact: <sip:20000004 en 212.4.97.115:35379;transport=udp;user=phone>
> Supported: path
> Call-ID: c177cae013da224d en 192.168.254.110
> CSeq: 29653 ACK
> User-Agent: Grandstream BT200 1.1.6.27
> Max-Forwards: 69
> Allow:
> INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK
> Content-Length: 0
>
>
> #
> U +0.458031 212.4.97.115:55128 -> 212.4.107.250:5060
> SIP/2.0 200 OK
> Via: SIP/2.0/UDP 212.4.107.250;branch=z9hG4bK5974.c5c9aa24.0
> Via: SIP/2.0/UDP
> 192.168.254.110:5060;rport=35379;received=212.4.97.115;branch=z9hG4bK8f8096
>70adc00668 From:
> "20000004"<sip:20000004 en 212.4.107.250;user=phone>;tag=ab6ba13b2f38a04e To:
> <sip:20000000 en 212.4.107.250;user=phone>;tag=c0a80101-21188
> Call-ID: c177cae013da224d en 192.168.254.110
> CSeq: 29653 INVITE
> Require: timer
> Session-Expires: 100;refresher=uac
> Allow:
> INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,SUBSCRIBE,NOTIFY,UPDATE,REFER,REGISTER,
>INFO Contact: <sip:20000000 en 192.168.254.101:5060;user=phone>
> Record-Route: <sip:212.4.107.250;lr=on;nat=yes>
> Allow-Events: refer,dialog,message-summary,check-sync,talk,hold
> Content-Type: application/sdp
> Content-Length: 151
>
> v=0
> o=20000000 138812 138812 IN IP4 192.168.254.101
> s=-
> c=IN IP4 192.168.254.101
> t=0 0
> m=audio 32448 RTP/AVP 0
> a=rtpmap:0 PCMU/8000
> a=sendrecv
>
> #
> U +0.000246 212.4.107.250:5060 -> 212.4.97.115:35379
> SIP/2.0 200 OK
> Via: SIP/2.0/UDP
> 192.168.254.110:5060;rport=35379;received=212.4.97.115;branch=z9hG4bK8f8096
>70adc00668 From:
> "20000004"<sip:20000004 en 212.4.107.250;user=phone>;tag=ab6ba13b2f38a04e To:
> <sip:20000000 en 212.4.107.250;user=phone>;tag=c0a80101-21188
> Call-ID: c177cae013da224d en 192.168.254.110
> CSeq: 29653 INVITE
> Require: timer
> Session-Expires: 100;refresher=uac
> Allow:
> INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,SUBSCRIBE,NOTIFY,UPDATE,REFER,REGISTER,
>INFO Contact: <sip:20000000 en 192.168.254.101:5060;user=phone>
> Record-Route: <sip:212.4.107.250;lr=on;nat=yes>
> Allow-Events: refer,dialog,message-summary,check-sync,talk,hold
> Content-Type: application/sdp
> Content-Length: 167
>
> v=0
> o=20000000 138812 138812 IN IP4 192.168.254.101
> s=-
> c=IN IP4 212.4.107.250
> t=0 0
> m=audio 35754 RTP/AVP 0
> a=rtpmap:0 PCMU/8000
> a=sendrecv
> a=nortpproxy:yes
>
> #
> U +0.999724 212.4.97.115:55128 -> 212.4.107.250:5060
> SIP/2.0 200 OK
> Via: SIP/2.0/UDP 212.4.107.250;branch=z9hG4bK5974.c5c9aa24.0
> Via: SIP/2.0/UDP
> 192.168.254.110:5060;rport=35379;received=212.4.97.115;branch=z9hG4bK8f8096
>70adc00668 From:
> "20000004"<sip:20000004 en 212.4.107.250;user=phone>;tag=ab6ba13b2f38a04e To:
> <sip:20000000 en 212.4.107.250;user=phone>;tag=c0a80101-21188
> Call-ID: c177cae013da224d en 192.168.254.110
> CSeq: 29653 INVITE
> Require: timer
> Session-Expires: 100;refresher=uac
> Allow:
> INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,SUBSCRIBE,NOTIFY,UPDATE,REFER,REGISTER,
>INFO Contact: <sip:20000000 en 192.168.254.101:5060;user=phone>
> Record-Route: <sip:212.4.107.250;lr=on;nat=yes>
> Allow-Events: refer,dialog,message-summary,check-sync,talk,hold
> Content-Type: application/sdp
> Content-Length: 151
>
> v=0
> o=20000000 138812 138812 IN IP4 192.168.254.101
> s=-
> c=IN IP4 192.168.254.101
> t=0 0
> m=audio 32448 RTP/AVP 0
> a=rtpmap:0 PCMU/8000
> a=sendrecv
>
> #
> U +0.000295 212.4.107.250:5060 -> 212.4.97.115:35379
> SIP/2.0 200 OK
> Via: SIP/2.0/UDP
> 192.168.254.110:5060;rport=35379;received=212.4.97.115;branch=z9hG4bK8f8096
>70adc00668 From:
> "20000004"<sip:20000004 en 212.4.107.250;user=phone>;tag=ab6ba13b2f38a04e To:
> <sip:20000000 en 212.4.107.250;user=phone>;tag=c0a80101-21188
> Call-ID: c177cae013da224d en 192.168.254.110
> CSeq: 29653 INVITE
> Require: timer
> Session-Expires: 100;refresher=uac
> Allow:
> INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,SUBSCRIBE,NOTIFY,UPDATE,REFER,REGISTER,
>INFO Contact: <sip:20000000 en 192.168.254.101:5060;user=phone>
> Record-Route: <sip:212.4.107.250;lr=on;nat=yes>
> Allow-Events: refer,dialog,message-summary,check-sync,talk,hold
> Content-Type: application/sdp
> Content-Length: 167
>
> v=0
> o=20000000 138812 138812 IN IP4 192.168.254.101
> s=-
> c=IN IP4 212.4.107.250
> t=0 0
> m=audio 35754 RTP/AVP 0
> a=rtpmap:0 PCMU/8000
> a=sendrecv
> a=nortpproxy:yes
>
>
> _______________________________________________
> SR-Users-ES mailing list
> SR-Users-ES en lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users-es


-- 
Iñaki Baz Castillo <ibc en aliax.net>



Más información sobre la lista de distribución SR-Users-ES