Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ unsigned int call::wake()
return wake;
}

#if defined(PCAPPLAY) || defined(RTP_STREAM) || defined(GTEST)
static std::string find_in_sdp(std::string const &pattern, std::string const &msg)
{
std::string::size_type begin, end;
Expand All @@ -180,7 +179,6 @@ static std::string find_in_sdp(std::string const &pattern, std::string const &ms

return msg.substr(begin, end - begin);
}
#endif

#ifdef PCAPPLAY
void call::get_remote_media_addr(std::string const &msg)
Expand Down Expand Up @@ -959,6 +957,19 @@ char * call::get_last_header(const char * name)
ERROR("call::get_last_header: Header to parse bigger than %d (%zu)", MAX_HEADER_LEN, strlen(name));
}

if(strcmp(name, "media_ip")==0) {
// get media ip from sdp
static std::string host;
host = find_in_sdp(media_ip_is_ipv6 ? "c=IN IP6 " : "c=IN IP4 ", last_recv_msg);
return const_cast<char*>(host.c_str());
}
if(strcmp(name, "media_port")==0) {
// get media port from sdp
static std::string port;
port = find_in_sdp("m=audio ", last_recv_msg);
return const_cast<char*>(port.c_str());
}

if (name[len - 1] == ':') {
return get_header(last_recv_msg, name, false);
} else {
Expand Down