]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
silly socket test
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 20 Apr 2007 00:29:18 +0000 (00:29 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 20 Apr 2007 00:29:18 +0000 (00:29 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4981 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_rtp.c

index aec2cb0e22ccfc0d0fc23bb81e39ae4229a9c085..fc533082f13032a70e75816a2a46b418b02201e9 100644 (file)
@@ -323,6 +323,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_s
        switch_socket_t *new_sock = NULL, *old_sock = NULL;
        switch_status_t status = SWITCH_STATUS_FALSE;
        *err = NULL;
+       char o[5] = "TEST", i[5] = "";
+       switch_size_t len;
 
        if (switch_sockaddr_info_get(&rtp_session->local_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS) {
                *err = "Local Address Error!";
@@ -348,6 +350,14 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_s
                goto done;
        }
 
+       len = sizeof(i);
+       switch_socket_sendto(new_sock, rtp_session->local_addr, 0, (void *) o, &len);
+       switch_socket_recvfrom(rtp_session->from_addr, new_sock, 0, (void *) i, &len);
+
+       if (!len) {
+               goto done;
+       }
+
        old_sock = rtp_session->sock;
        rtp_session->sock = new_sock;
        new_sock = NULL;