[Freeswitch-branches] [commit] r2064 - freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip
Freeswitch SVN
stkn at freeswitch.org
Sun Jul 23 19:59:57 EDT 2006
Author: stkn
Date: Sun Jul 23 19:59:57 2006
New Revision: 2064
Modified:
freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c
Log:
Only use IP addresses in SIP messages.
Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c (original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c Sun Jul 23 19:59:57 2006
@@ -1273,7 +1273,7 @@
sdp->origin.version = sdp->origin.id = 0;
sdp->origin.net_type = pj_str( "IN" );
sdp->origin.addr_type = pj_str( "IP4" );
- sdp->origin.addr = *pj_gethostname();
+ sdp->origin.addr = pj_str( profile->local_addr );
sdp->name = pj_str( "pjsip" );
sdp->conn = pj_pool_zalloc( pool, sizeof(pjmedia_sdp_conn) );
@@ -1683,16 +1683,22 @@
#endif
/* */
{
- const pj_str_t *hostname;
- pj_sockaddr_in tmp_addr;
char *addr;
char local_uri[64];
- hostname = pj_gethostname();
- pj_sockaddr_in_init( &tmp_addr, hostname, 0 );
- addr = pj_inet_ntoa( tmp_addr.sin_addr );
+ /* if bind addr is 0.0.0.0 use local hostname to get the primary ip */
+ if( !profile->sip_addr.sin_addr.s_addr ) {
+ const pj_str_t *hostname;
+ pj_sockaddr_in tmp_addr;
+
+ hostname = pj_gethostname();
+ pj_sockaddr_in_init( &tmp_addr, hostname, 0 );
+ addr = pj_inet_ntoa( tmp_addr.sin_addr );
+ } else
+ addr = profile->sip_ip;
+
pj_ansi_strcpy( profile->local_addr, addr );
- pj_ansi_sprintf( local_uri, "sip:%s:%d", hostname->ptr, profile->sip_port );
+ pj_ansi_sprintf( local_uri, "sip:%s:%d", addr, profile->sip_port );
pj_strdup2( pjsip_pool, &profile->local_uri, local_uri );
pj_strdup2( pjsip_pool, &profile->local_contact, local_uri );
}
More information about the Freeswitch-branches
mailing list