Changeset 5978
- Timestamp:
- May 6, 2019 10:55:35 AM (6 years ago)
- Location:
- pjproject/trunk/pjsip/src/pjsua-lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r5977 r5978 1232 1232 1233 1233 if (status != PJ_SUCCESS) { 1234 err_code = PJSIP_SC_ NOT_ACCEPTABLE_HERE;1234 err_code = PJSIP_SC_INTERNAL_SERVER_ERROR; 1235 1235 pjsua_perror(THIS_FILE, "Error creating SDP answer", status); 1236 1236 } … … 1241 1241 1242 1242 if (status != PJ_SUCCESS) { 1243 err_code = *sip_err_code; 1243 1244 pjsua_perror(THIS_FILE, "Error creating SDP answer", status); 1244 1245 } else { 1245 1246 status = pjsip_inv_set_local_sdp(call->inv, answer); 1246 1247 if (status != PJ_SUCCESS) { 1248 err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; 1247 1249 pjsua_perror(THIS_FILE, "Error setting local SDP", status); 1248 err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE;1249 1250 } 1250 1251 } … … 1268 1269 err_code = (*response)->msg->line.status.code; 1269 1270 else 1270 err_code = PJSIP_ERRNO_TO_SIP_STATUS(status); 1271 } 1272 } 1273 if (sip_err_code) 1274 *sip_err_code = err_code; 1271 err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; 1272 } 1273 } 1274 1275 if (sip_err_code && status != PJ_SUCCESS) 1276 *sip_err_code = err_code? err_code:PJSIP_ERRNO_TO_SIP_STATUS(status); 1275 1277 1276 1278 return status; … … 1293 1295 PJSUA_LOCK(); 1294 1296 1295 if (sip_err_code)1296 *sip_err_code = err_code;1297 1298 1297 /* Increment the dialog's lock to prevent it to be destroyed prematurely, 1299 1298 * such as in case of transport error. … … 1322 1321 on_return: 1323 1322 if (status != PJ_SUCCESS) { 1323 if (err_code == 0) 1324 err_code = PJSIP_ERRNO_TO_SIP_STATUS(status); 1325 1326 if (sip_err_code) 1327 *sip_err_code = err_code; 1328 1324 1329 /* If the callback is called from pjsua_call_on_incoming(), the 1325 1330 * invite's state is PJSIP_INV_STATE_NULL, so the invite session … … 1359 1364 1360 1365 pjsip_dlg_dec_lock(dlg); 1361 1362 if (sip_err_code)1363 *sip_err_code = err_code;1364 1366 1365 1367 if (tdata) … … 1805 1807 if (response) { 1806 1808 pjsip_dlg_send_response(dlg, call->inv->invite_tsx, response); 1807 1808 1809 } else { 1809 1810 pjsip_dlg_respond(dlg, rdata, sip_err_code, NULL, NULL, NULL); … … 2490 2491 pjsip_tx_data *tdata; 2491 2492 pj_status_t status_; 2493 2494 if (sip_err_code == 0) 2495 sip_err_code = PJSIP_ERRNO_TO_SIP_STATUS(status); 2492 2496 2493 2497 status_ = pjsip_inv_end_session(call->inv, sip_err_code, NULL, -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r5944 r5978 1687 1687 1688 1688 on_return: 1689 if (status != PJ_SUCCESS && call_med->tp) { 1690 pjsua_set_media_tp_state(call_med, PJSUA_MED_TP_NULL); 1691 pjmedia_transport_close(call_med->tp); 1692 call_med->tp = NULL; 1693 } 1694 1695 if (sip_err_code) 1696 *sip_err_code = err_code; 1689 if (status != PJ_SUCCESS) { 1690 if (call_med->tp) { 1691 pjsua_set_media_tp_state(call_med, PJSUA_MED_TP_NULL); 1692 pjmedia_transport_close(call_med->tp); 1693 call_med->tp = NULL; 1694 } 1695 1696 if (err_code == 0) 1697 err_code = PJSIP_ERRNO_TO_SIP_STATUS(status); 1698 1699 if (sip_err_code) 1700 *sip_err_code = err_code; 1701 } 1697 1702 1698 1703 if (call_med->med_init_cb) { … … 1783 1788 1784 1789 if (status != PJ_SUCCESS) { 1790 if (sip_err_code) 1791 *sip_err_code = PJSIP_SC_INTERNAL_SERVER_ERROR; 1785 1792 call_med->tp_ready = status; 1786 1793 pjsua_set_media_tp_state(call_med, PJSUA_MED_TP_NULL); … … 1993 2000 1994 2001 if (pjsua_get_state() != PJSUA_STATE_RUNNING) { 1995 if (sip_err_code) *sip_err_code = PJSIP_SC_SERVICE_UNAVAILABLE; 2002 if (sip_err_code) 2003 *sip_err_code = PJSIP_SC_SERVICE_UNAVAILABLE; 1996 2004 return PJ_EBUSY; 1997 2005 } … … 2002 2010 2003 2011 status = pj_mutex_create_simple(tmppool, NULL, &call->med_ch_mutex); 2004 if (status != PJ_SUCCESS) 2012 if (status != PJ_SUCCESS) { 2013 if (sip_err_code) 2014 *sip_err_code = PJSIP_SC_INTERNAL_SERVER_ERROR; 2005 2015 return status; 2016 } 2006 2017 } 2007 2018 … … 2063 2074 if (maudcnt + mvidcnt == 0) { 2064 2075 /* Expecting audio or video in the offer */ 2065 if (sip_err_code) *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; 2076 if (sip_err_code) 2077 *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; 2066 2078 status = PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_NOT_ACCEPTABLE_HERE); 2067 2079 goto on_error; … … 2179 2191 if (call->med_prov_cnt == 0) { 2180 2192 /* Expecting at least one media */ 2181 if (sip_err_code) *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; 2193 if (sip_err_code) 2194 *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; 2182 2195 status = PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_NOT_ACCEPTABLE_HERE); 2183 2196 goto on_error; … … 2293 2306 2294 2307 status = media_channel_init_cb(call_id, NULL); 2295 if (status != PJ_SUCCESS && sip_err_code) 2296 *sip_err_code = call->med_ch_info.sip_err_code; 2308 if (status != PJ_SUCCESS && sip_err_code) { 2309 if (call->med_ch_info.sip_err_code) 2310 *sip_err_code = call->med_ch_info.sip_err_code; 2311 else 2312 *sip_err_code = PJSIP_ERRNO_TO_SIP_STATUS(status); 2313 } 2297 2314 2298 2315 pj_log_pop_indent(); … … 2304 2321 call->med_ch_mutex = NULL; 2305 2322 } 2323 2324 if (sip_err_code && *sip_err_code == 0) 2325 *sip_err_code = PJSIP_ERRNO_TO_SIP_STATUS(status); 2306 2326 2307 2327 pj_log_pop_indent(); … … 2331 2351 pj_status_t status; 2332 2352 2333 if (pjsua_get_state() != PJSUA_STATE_RUNNING) 2334 return PJ_EBUSY; 2353 if (pjsua_get_state() != PJSUA_STATE_RUNNING) { 2354 status = PJ_EBUSY; 2355 goto on_error; 2356 } 2335 2357 2336 2358 #if 0 … … 2397 2419 &origin, &sdp); 2398 2420 if (status != PJ_SUCCESS) 2399 return status;2421 goto on_error; 2400 2422 2401 2423 /* Process each media line */ … … 2512 2534 default: 2513 2535 pj_assert(!"Invalid call_med media type"); 2514 returnPJ_EBUG;2536 status = PJ_EBUG; 2515 2537 } 2516 2538 2517 2539 if (status != PJ_SUCCESS) 2518 return status;2540 goto on_error; 2519 2541 2520 2542 /* Add ssrc and cname attribute */ … … 2530 2552 if (status != PJ_SUCCESS) { 2531 2553 if (sip_err_code) *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE; 2532 return status;2554 goto on_error; 2533 2555 } 2534 2556 … … 2674 2696 *p_sdp = sdp; 2675 2697 return PJ_SUCCESS; 2698 2699 on_error: 2700 if (sip_err_code && *sip_err_code == 0) 2701 *sip_err_code = PJSIP_SC_INTERNAL_SERVER_ERROR; 2702 2703 return status; 2676 2704 } 2677 2705
Note: See TracChangeset
for help on using the changeset viewer.