Changeset 350 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
- Timestamp:
- Mar 22, 2006 11:59:11 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r324 r350 95 95 pjsip_endpt_schedule_timer( pjsua.endpt, e, &timeout); 96 96 } 97 } 98 99 100 /* Close and reopen socket. */ 101 static pj_status_t reopen_sock( pj_sock_t *sock) 102 { 103 pj_sockaddr_in addr; 104 int addrlen; 105 pj_status_t status; 106 107 addrlen = sizeof(pj_sockaddr_in); 108 status = pj_sock_getsockname(*sock, &addr, &addrlen); 109 if (status != PJ_SUCCESS) { 110 pjsua_perror(THIS_FILE, "Error getting RTP/RTCP socket name", status); 111 return status; 112 } 113 114 pj_sock_close(*sock); 115 116 status = pj_sock_socket(PJ_AF_INET, PJ_SOCK_DGRAM, 0, sock); 117 if (status != PJ_SUCCESS) { 118 pjsua_perror(THIS_FILE, "Unable to create socket", status); 119 return status; 120 } 121 122 status = pj_sock_bind(*sock, &addr, sizeof(pj_sockaddr_in)); 123 if (status != PJ_SUCCESS) { 124 pjsua_perror(THIS_FILE, "Unable to re-bind RTP/RTCP socket", status); 125 return status; 126 } 127 128 return PJ_SUCCESS; 129 } 130 131 /* 132 * Destroy the call's media 133 */ 134 static pj_status_t call_destroy_media(int call_index) 135 { 136 pjsua_call *call = &pjsua.calls[call_index]; 137 138 if (call->conf_slot > 0) { 139 pjmedia_conf_remove_port(pjsua.mconf, call->conf_slot); 140 call->conf_slot = 0; 141 } 142 143 if (call->session) { 144 145 /* Close and reopen RTP socket. 146 * This is necessary to get the socket unregistered from ioqueue, 147 * when IOCompletionPort is used. 148 */ 149 reopen_sock(&call->skinfo.rtp_sock); 150 151 /* Close and reopen RTCP socket too. */ 152 reopen_sock(&call->skinfo.rtcp_sock); 153 154 /* Must destroy session after socket is closed. */ 155 pjmedia_session_destroy(call->session); 156 call->session = NULL; 157 158 } 159 160 PJ_LOG(3,(THIS_FILE, "Media session for call %d is destroyed", 161 call_index)); 162 163 return PJ_SUCCESS; 97 164 } 98 165 … … 495 562 pj_assert(call != NULL); 496 563 497 if (call && call->session) { 498 pjmedia_conf_remove_port(pjsua.mconf, call->conf_slot); 499 pjmedia_session_destroy(call->session); 500 call->session = NULL; 501 502 PJ_LOG(3,(THIS_FILE,"Media session is destroyed")); 503 } 564 if (call) 565 call_destroy_media(call->index); 504 566 505 567 /* Remove timers. */ … … 879 941 /* Destroy existing media session, if any. */ 880 942 881 if (call && call->session) { 882 pjmedia_conf_remove_port(pjsua.mconf, call->conf_slot); 883 pjmedia_session_destroy(call->session); 884 call->session = NULL; 885 } 943 if (call) 944 call_destroy_media(call->index); 886 945 887 946 /* Get local and remote SDP */ … … 948 1007 pjsua_perror(THIS_FILE, "Unable to create conference slot", 949 1008 status); 950 pjmedia_session_destroy(call->session); 951 call->session = NULL; 1009 call_destroy_media(call->index); 952 1010 //call_disconnect(inv, PJSIP_SC_INTERNAL_SERVER_ERROR); 953 1011 return;
Note: See TracChangeset
for help on using the changeset viewer.