filter out unwanted media on rtp
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15284 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
5de0ad3c02
commit
d646547bdb
|
@ -186,6 +186,9 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(_Out_opt_bytecapcount_(len)
|
|||
*/
|
||||
SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct sockaddr *sa, socklen_t salen);
|
||||
|
||||
SWITCH_DECLARE(int) get_addr_int(switch_sockaddr_t *sa);
|
||||
SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2);
|
||||
|
||||
/*!
|
||||
\brief get the port number of an ip address
|
||||
\param sa the struct sockaddr * to get the port from
|
||||
|
|
|
@ -1934,11 +1934,13 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (bytes && ((rtp_session->cng_pt && rtp_session->recv_msg.header.pt == rtp_session->cng_pt) || rtp_session->recv_msg.header.pt == 13)) {
|
||||
|
||||
if (bytes && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) &&
|
||||
(!switch_cmp_addr(rtp_session->from_addr, rtp_session->remote_addr) ||
|
||||
((rtp_session->cng_pt && rtp_session->recv_msg.header.pt == rtp_session->cng_pt) || rtp_session->recv_msg.header.pt == 13))) {
|
||||
bytes = 0;
|
||||
goto recvfrom;
|
||||
goto recvfrom;
|
||||
|
||||
}
|
||||
|
||||
if (bytes &&
|
||||
|
|
|
@ -1338,10 +1338,28 @@ static const char *switch_inet_ntop6(unsigned char const *src, char *dst, size_t
|
|||
|
||||
#endif
|
||||
|
||||
SWITCH_DECLARE(int) get_addr_int(switch_sockaddr_t *sa)
|
||||
{
|
||||
struct sockaddr_in *s = (struct sockaddr_in *)&sa->sa;
|
||||
|
||||
return ntohs(s->sin_addr.s_addr);
|
||||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2)
|
||||
{
|
||||
struct sockaddr_in *s1 = (struct sockaddr_in *)&sa1->sa;
|
||||
struct sockaddr_in *s2 = (struct sockaddr_in *)&sa2->sa;
|
||||
|
||||
return (ntohs(s1->sin_addr.s_addr) == ntohs(s2->sin_addr.s_addr) && ntohs(s1->sin_port) == ntohs(s2->sin_port));
|
||||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct sockaddr *sa, socklen_t salen)
|
||||
{
|
||||
switch_assert(buf);
|
||||
*buf = '\0';
|
||||
|
||||
if (sa) {
|
||||
getnameinfo(sa, salen, buf, (socklen_t)len, NULL, 0, NI_NUMERICHOST);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue