Changeset 733 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
- Timestamp:
- Sep 22, 2006 12:48:18 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r729 r733 68 68 pjmedia_sdp_session **p_answer); 69 69 70 /* 71 * Callback called by event framework when the xfer subscription state 72 * has changed. 73 */ 74 static void xfer_on_evsub_state( pjsip_evsub *sub, pjsip_event *event); 70 75 71 76 /* … … 581 586 enum { MAX_RETRY=50 }; 582 587 unsigned retry; 583 pjsua_call *call ;584 pj_bool_t has_pjsua_lock ;585 pj_status_t status ;588 pjsua_call *call = NULL; 589 pj_bool_t has_pjsua_lock = PJ_FALSE; 590 pj_status_t status = PJ_SUCCESS; 586 591 587 592 for (retry=0; retry<MAX_RETRY; ++retry) { … … 648 653 status = acquire_call("pjsua_call_get_conf_port()", call_id, &call); 649 654 if (status != PJ_SUCCESS) 650 return -1;655 return PJSUA_INVALID_ID; 651 656 652 657 port_id = call->conf_slot; … … 1050 1055 pjsip_tx_data *tdata; 1051 1056 pjsua_call *call; 1057 struct pjsip_evsub_user xfer_cb; 1052 1058 pj_status_t status; 1053 1059 … … 1056 1062 PJ_EINVAL); 1057 1063 1058 pjsip_dlg_dec_lock(call->inv->dlg);1059 1064 status = acquire_call("pjsua_call_xfer()", call_id, &call); 1060 1065 if (status != PJ_SUCCESS) … … 1062 1067 1063 1068 1064 /* Create xfer client subscription. 1065 * We're not interested in knowing the transfer result, so we1066 * put NULL as the callback.1067 */ 1068 status = pjsip_xfer_create_uac(call->inv->dlg, NULL, &sub);1069 /* Create xfer client subscription. */ 1070 pj_bzero(&xfer_cb, sizeof(xfer_cb)); 1071 xfer_cb.on_evsub_state = &xfer_on_evsub_state; 1072 1073 status = pjsip_xfer_create_uac(call->inv->dlg, &xfer_cb, &sub); 1069 1074 if (status != PJ_SUCCESS) { 1070 1075 pjsua_perror(THIS_FILE, "Unable to create xfer", status); … … 1121 1126 if (status != PJ_SUCCESS) 1122 1127 return status; 1123 1124 call = &pjsua_var.calls[call_id];1125 1128 1126 1129 if (!call->session) { … … 2131 2134 2132 2135 /* 2133 * W e're only interested when subscription is terminated, to2134 * clear the xfer_sub member ofthe inv_data.2136 * When subscription is terminated, clear the xfer_sub member of 2137 * the inv_data. 2135 2138 */ 2136 2139 if (pjsip_evsub_get_state(sub) == PJSIP_EVSUB_STATE_TERMINATED) { … … 2144 2147 call->xfer_sub = NULL; 2145 2148 2146 PJ_LOG(3,(THIS_FILE, "Xfer subscription terminated")); 2149 PJ_LOG(4,(THIS_FILE, "Xfer subscription terminated")); 2150 2151 } 2152 /* 2153 * When subscription is accepted (got 200/OK to REFER), check if 2154 * subscription suppressed. 2155 */ 2156 else if (pjsip_evsub_get_state(sub) == PJSIP_EVSUB_STATE_ACCEPTED) { 2157 2158 pjsip_rx_data *rdata; 2159 pjsip_generic_string_hdr *refer_sub; 2160 const pj_str_t REFER_SUB = { "Refer-Sub", 9 }; 2161 2162 /* Must be receipt of response message */ 2163 pj_assert(event->type == PJSIP_EVENT_TSX_STATE && 2164 event->body.tsx_state.type == PJSIP_EVENT_RX_MSG); 2165 rdata = event->body.tsx_state.src.rdata; 2166 2167 /* Find Refer-Sub header */ 2168 refer_sub = (pjsip_generic_string_hdr*) 2169 pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, 2170 &REFER_SUB, NULL); 2171 2172 /* Check if subscription is suppressed */ 2173 if (refer_sub && pj_stricmp2(&refer_sub->hvalue, "false")==0) { 2174 /* Yes, subscription is suppressed. 2175 * Terminate our subscription now. 2176 */ 2177 PJ_LOG(4,(THIS_FILE, "Xfer subscription suppressed, terminating " 2178 "event subcription...")); 2179 pjsip_evsub_terminate(sub, PJ_TRUE); 2180 } 2147 2181 } 2148 2182 }
Note: See TracChangeset
for help on using the changeset viewer.