Commit 3ad9baed authored by Ghislain MARY's avatar Ghislain MARY

Use the RTP sending function to send the dummy STUN packets.

This is needed in the case where the client is using the tunnel. Using
the RTP sending function will cause the dummy STUN packets to be sent
through the tunnel. Otherwise it is sent directly to the destination.
parent ec5b0369
...@@ -57,14 +57,18 @@ typedef struct SenderData SenderData; ...@@ -57,14 +57,18 @@ typedef struct SenderData SenderData;
static void send_stun_packet(RtpSession *s) static void send_stun_packet(RtpSession *s)
{ {
StunMessage msg; StunMessage msg;
struct sockaddr_in *destaddr = (struct sockaddr_in *)&s->rtp.rem_addr; mblk_t *mp;
char buf[STUN_MAX_MESSAGE_SIZE]; char buf[STUN_MAX_MESSAGE_SIZE];
int len = STUN_MAX_MESSAGE_SIZE; int len = STUN_MAX_MESSAGE_SIZE;
memset(&msg, 0, sizeof(StunMessage)); memset(&msg, 0, sizeof(StunMessage));
stunBuildReqSimple(&msg, NULL, FALSE, FALSE, 1); stunBuildReqSimple(&msg, NULL, FALSE, FALSE, 1);
len = stunEncodeMessage(&msg, buf, len, NULL); len = stunEncodeMessage(&msg, buf, len, NULL);
if (len > 0) { if (len > 0) {
sendMessage(s->rtp.socket, buf, len, htonl(destaddr->sin_addr.s_addr), htons(destaddr->sin_port)); mp = allocb(len, BPRI_MED);
memcpy(mp->b_wptr, buf, len);
mp->b_wptr += len;
rtp_session_sendm_with_ts(s, mp, 0);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment