Changeset 2370 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
- Timestamp:
- Nov 27, 2008 12:06:46 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r2315 r2370 65 65 pjsip_transaction *tsx, 66 66 pjsip_event *e); 67 68 /* 69 * Redirection handler. 70 */ 71 static void pjsua_call_on_redirected(pjsip_inv_session *inv, 72 const pjsip_uri *target, 73 pjsip_redirect_op *cmd, 74 const pjsip_event *e); 67 75 68 76 … … 157 165 inv_cb.on_create_offer = &pjsua_call_on_create_offer; 158 166 inv_cb.on_tsx_state_changed = &pjsua_call_on_tsx_state_changed; 159 167 inv_cb.on_redirected = &pjsua_call_on_redirected; 160 168 161 169 /* Initialize invite session module: */ … … 1431 1439 1432 1440 return PJ_SUCCESS; 1441 } 1442 1443 1444 /* 1445 * Accept or reject redirection. 1446 */ 1447 PJ_DEF(pj_status_t) pjsua_call_process_redirect( pjsua_call_id call_id, 1448 pjsip_redirect_op cmd) 1449 { 1450 pjsua_call *call; 1451 pjsip_dialog *dlg; 1452 pj_status_t status; 1453 1454 PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, 1455 PJ_EINVAL); 1456 1457 status = acquire_call("pjsua_call_process_redirect()", call_id, 1458 &call, &dlg); 1459 if (status != PJ_SUCCESS) 1460 return status; 1461 1462 status = pjsip_inv_process_redirect(call->inv, cmd, NULL); 1463 1464 pjsip_dlg_dec_lock(dlg); 1465 1466 return status; 1433 1467 } 1434 1468 … … 2828 2862 if (call->res_time.sec == 0) 2829 2863 pj_gettimeofday(&call->res_time); 2830 if (e->body.tsx_state.tsx->status_code > call->last_code) { 2864 if (e->type == PJSIP_EVENT_TSX_STATE && 2865 e->body.tsx_state.tsx->status_code > call->last_code) 2866 { 2831 2867 call->last_code = (pjsip_status_code) 2832 2868 e->body.tsx_state.tsx->status_code; 2833 2869 pj_strncpy(&call->last_text, 2834 2870 &e->body.tsx_state.tsx->status_text, 2871 sizeof(call->last_text_buf_)); 2872 } else { 2873 call->last_code = PJSIP_SC_REQUEST_TERMINATED; 2874 pj_strncpy(&call->last_text, 2875 pjsip_get_status_text(call->last_code), 2835 2876 sizeof(call->last_text_buf_)); 2836 2877 } … … 3771 3812 PJSUA_UNLOCK(); 3772 3813 } 3814 3815 3816 /* Redirection handler */ 3817 static void pjsua_call_on_redirected(pjsip_inv_session *inv, 3818 const pjsip_uri *target, 3819 pjsip_redirect_op *cmd, 3820 const pjsip_event *e) 3821 { 3822 pjsua_call *call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id]; 3823 3824 PJSUA_LOCK(); 3825 3826 if (pjsua_var.ua_cfg.cb.on_call_redirected) { 3827 (*pjsua_var.ua_cfg.cb.on_call_redirected)(call->index, target, cmd, e); 3828 } else { 3829 PJ_LOG(4,(THIS_FILE, "Unhandled redirection for call %d " 3830 "(callback not implemented by application). Disconnecting " 3831 "call.", 3832 call->index)); 3833 *cmd = PJSIP_REDIRECT_STOP; 3834 } 3835 3836 PJSUA_UNLOCK(); 3837 } 3838
Note: See TracChangeset
for help on using the changeset viewer.