[asterisk-commits] file: branch group/pimp_my_sip r382938 - /team/group/pimp_my_sip/res/res_sip/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 12 15:23:33 CDT 2013


Author: file
Date: Tue Mar 12 15:23:29 2013
New Revision: 382938

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382938
Log:
Add support for IPv6 TCP and TLS transports now that we are using a recent pjproject.

Modified:
    team/group/pimp_my_sip/res/res_sip/config_transport.c

Modified: team/group/pimp_my_sip/res/res_sip/config_transport.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip/config_transport.c?view=diff&rev=382938&r1=382937&r2=382938
==============================================================================
--- team/group/pimp_my_sip/res/res_sip/config_transport.c (original)
+++ team/group/pimp_my_sip/res/res_sip/config_transport.c Tue Mar 12 15:23:29 2013
@@ -100,7 +100,6 @@
 		pj_sockaddr_set_port(&transport->host, (transport->type == AST_SIP_TRANSPORT_TLS) ? 5061 : 5060);
 	}
 
-	/* TODO: Upgrade pjproject so we get IPv6 TCP and TLS */
 	if (transport->type == AST_SIP_TRANSPORT_UDP) {
 		if (transport->host.addr.sa_family == pj_AF_INET()) {
 			res = pjsip_udp_transport_start(ast_sip_get_pjsip_endpoint(), &transport->host.ipv4, NULL, transport->async_operations, &transport->state->transport);
@@ -108,18 +107,20 @@
 			res = pjsip_udp_transport_start6(ast_sip_get_pjsip_endpoint(), &transport->host.ipv6, NULL, transport->async_operations, &transport->state->transport);
 		}
 	} else if (transport->type == AST_SIP_TRANSPORT_TCP) {
-		if (transport->host.addr.sa_family == pj_AF_INET()) {
-			res = pjsip_tcp_transport_start(ast_sip_get_pjsip_endpoint(), &transport->host.ipv4, transport->async_operations, &transport->state->factory);
-		}
+		pjsip_tcp_transport_cfg cfg;
+
+		pjsip_tcp_transport_cfg_default(&cfg, transport->host.addr.sa_family);
+		cfg.bind_addr = transport->host;
+		cfg.async_cnt = transport->async_operations;
+
+		res = pjsip_tcp_transport_start3(ast_sip_get_pjsip_endpoint(), &cfg, &transport->state->factory);
 	} else if (transport->type == AST_SIP_TRANSPORT_TLS) {
 		transport->tls.ca_list_file = pj_str((char*)transport->ca_list_file);
 		transport->tls.cert_file = pj_str((char*)transport->cert_file);
 		transport->tls.privkey_file = pj_str((char*)transport->privkey_file);
 		transport->tls.password = pj_str((char*)transport->password);
 
-		if (transport->host.addr.sa_family == pj_AF_INET()) {
-			res = pjsip_tls_transport_start(ast_sip_get_pjsip_endpoint(), &transport->tls, &transport->host.ipv4, NULL, transport->async_operations, &transport->state->factory);
-		}
+		res = pjsip_tls_transport_start2(ast_sip_get_pjsip_endpoint(), &transport->tls, &transport->host, NULL, transport->async_operations, &transport->state->factory);
 	}
 
 	if (res != PJ_SUCCESS) {




More information about the asterisk-commits mailing list