pinging remote on early session for opening FW/NAT/symmetric rtp

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@516 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 19 years ago
parent c461a95986
commit 7e9f32768c

@ -162,6 +162,30 @@ void AmRtpStream::setLocalPort()
DBG("local rtp port set to %i\n",l_port);
}
int AmRtpStream::ping()
{
unsigned char ping_chr[2];
ping_chr[0] = 0;
ping_chr[1] = 0;
AmRtpPacket rp;
rp.payload = payload;
rp.marker = true;
rp.sequence = sequence++;
rp.timestamp = 0;
rp.ssrc = l_ssrc;
rp.compile((unsigned char*)ping_chr,2);
rp.setAddr(&r_saddr);
if(rp.send(l_sd) < 0){
ERROR("while sending RTP packet.\n");
return -1;
}
return 2;
}
int AmRtpStream::send( unsigned int ts, unsigned char* buffer, unsigned int size )
{
if ((mute) || (hold))

@ -155,7 +155,10 @@ public:
int receive( unsigned char* buffer, unsigned int size,
unsigned int& ts, int& payload);
/** ping the remote side, to open NATs and enable symmetric RTP */
int ping();
/** Allocates resources for future use of RTP. */
AmRtpStream(AmSession* _s=0);
/** Stops the stream and frees all resources. */

@ -648,6 +648,9 @@ void AmSession::onSipReply(const AmSipReply& reply)
onEarlySessionStart(reply);
rtp_str.setMonitorRTPTimeout(false);
// ping the other side to open fw/NAT/symmetric RTP
rtp_str.ping();
if(input || output || local_input || local_output)
AmMediaProcessor::instance()->addSession(this,

Loading…
Cancel
Save