|
|
@@ -608,21 +608,6 @@ static int get_media_direction(const sdp_media_t *lm, const sdp_media_t *rm)
|
|
|
}
|
|
|
|
|
|
|
|
|
-static int endpoint_get_ipaddress_by_domain(endpoint_call_t *call, const char* plocalip, char* premoteip, size_t ulen, const char* pdomain)
|
|
|
-{
|
|
|
- if (0 != endpoint_getip_bydomain(premoteip, ulen, pdomain)){
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get ip by domain failed!");
|
|
|
- }
|
|
|
- if (0 == strlen(premoteip) || 0 == strcmp(plocalip, premoteip)){
|
|
|
- char strmsg[MAX_PATH] = {0};
|
|
|
- _snprintf(strmsg, MAX_PATH, "get server ip by domain(%s -> %s) failed!", pdomain, premoteip);
|
|
|
- LogWarn(Severity_Low, Error_Debug, ERROR_MOD_SIP_GET_IP_BY_DOMAIN_FAILED, strmsg);
|
|
|
- call->func_cb.on_function(premoteip, ulen, pdomain, call->func_cb.user_data);
|
|
|
- }
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
static int negotiate_audio(endpoint_call_t *call, media_desc_t *audio_desc, const sdp_media_t *lm, const sdp_media_t *rm)
|
|
|
{
|
|
|
memset(audio_desc, 0, sizeof(media_desc_t));
|
|
|
@@ -633,11 +618,6 @@ static int negotiate_audio(endpoint_call_t *call, media_desc_t *audio_desc, cons
|
|
|
local_ip = lm->m_connections ? lm->m_connections->c_address : lm->m_session->sdp_connection->c_address;
|
|
|
remote_ip = rm->m_connections ? rm->m_connections->c_address : rm->m_session->sdp_connection->c_address;
|
|
|
|
|
|
- if (endpoint_addr_is_domain(remote_ip)){
|
|
|
- endpoint_get_ipaddress_by_domain(call, local_ip, str_domain_ip, MAX_PATH, remote_ip);
|
|
|
- remote_ip = str_domain_ip;
|
|
|
- }
|
|
|
-
|
|
|
//audio_desc->local_ip = local_ip ? inet_addr(local_ip) : 0;
|
|
|
//audio_desc->local_port = lm->m_port;
|
|
|
audio_desc->local_ip = strlen(call->local_ip) ? inet_addr(call->local_ip) : 0;
|
|
|
@@ -675,11 +655,6 @@ static int negotiate_video(endpoint_call_t *call, media_desc_t *video_desc, cons
|
|
|
local_ip = lm->m_connections ? lm->m_connections->c_address : lm->m_session->sdp_connection->c_address;
|
|
|
remote_ip = rm->m_connections ? rm->m_connections->c_address : rm->m_session->sdp_connection->c_address;
|
|
|
|
|
|
- if (endpoint_addr_is_domain(remote_ip)){
|
|
|
- endpoint_get_ipaddress_by_domain(call, local_ip, str_domain_ip, MAX_PATH, remote_ip);
|
|
|
- remote_ip = str_domain_ip;
|
|
|
- }
|
|
|
-
|
|
|
//video_desc->local_ip = local_ip ? inet_addr(local_ip) : 0;
|
|
|
//video_desc->local_port = lm->m_port;
|
|
|
video_desc->local_ip = strlen(call->local_ip) ? inet_addr(call->local_ip) : 0;
|
|
|
@@ -1589,50 +1564,4 @@ int translate_ipaddr_from_int(char* strdst, size_t ulen, unsigned long uip)
|
|
|
}
|
|
|
|
|
|
|
|
|
-int endpoint_getip_bydomain(char* strbuffer, size_t ulen, const char* pdomain)
|
|
|
-{
|
|
|
- int iret = -1;
|
|
|
- int i = 0;
|
|
|
- struct hostent *phst = NULL;
|
|
|
- if (NULL == strbuffer || NULL == pdomain){
|
|
|
- return iret;
|
|
|
- }
|
|
|
-
|
|
|
- phst = gethostbyname(pdomain);
|
|
|
- if (!phst){
|
|
|
- return iret;
|
|
|
- }
|
|
|
-
|
|
|
- for (; phst->h_aliases[i]; i++){
|
|
|
- }
|
|
|
-
|
|
|
- for (i = 0; phst->h_addr_list[i]; i++){
|
|
|
- char* strip = inet_ntoa(*(struct in_addr*)phst->h_addr_list[i]);
|
|
|
- if (0 == i){
|
|
|
- if (NULL != strip){
|
|
|
- _snprintf(strbuffer, ulen, "%s", strip);
|
|
|
- iret = 0;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return iret;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-bool endpoint_addr_is_domain(const char* pserver_addr)
|
|
|
-{
|
|
|
- bool bret = false;
|
|
|
- if (NULL == pserver_addr){
|
|
|
- return bret;
|
|
|
- }
|
|
|
-
|
|
|
- if (strstr(pserver_addr, ".com") ||strstr(pserver_addr, ".cn")){
|
|
|
- bret = true;
|
|
|
- }
|
|
|
-
|
|
|
- return bret;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
IMPLEMENT_REF_COUNT_MT_STATIC(endpoint_call, endpoint_call_t, ref_cnt, __endpoint_call_destroy)
|