Changeset 576 for pjproject/trunk
- Timestamp:
- Jul 2, 2006 2:53:05 PM (18 years ago)
- Location:
- pjproject/trunk/pjsip/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c
r500 r576 233 233 method = &rdata->msg_info.msg->line.req.method; 234 234 235 if (method->id == PJSIP_INVITE_METHOD || 236 method->id == PJSIP_CANCEL_METHOD || 237 method->id == PJSIP_BYE_METHOD) 235 if (method->id == PJSIP_INVITE_METHOD) { 236 return PJ_TRUE; 237 } 238 239 /* BYE and CANCEL must have existing invite session */ 240 if (method->id == PJSIP_BYE_METHOD || 241 method->id == PJSIP_CANCEL_METHOD) 238 242 { 243 if (inv == NULL) 244 return PJ_FALSE; 245 239 246 return PJ_TRUE; 240 247 } … … 781 788 782 789 *p_tdata = tdata; 790 791 /* Can not return PJ_SUCCESS when response message is produced. 792 * Ref: PROTOS test ~#2490 793 */ 794 if (status == PJ_SUCCESS) 795 status = PJSIP_ERRNO_FROM_SIP_STATUS(code); 796 783 797 } 784 798 … … 2205 2219 2206 2220 } 2207 2221 else if (tsx->method.id == PJSIP_CANCEL_METHOD && 2222 tsx->role == PJSIP_ROLE_UAS && 2223 tsx->status_code < 200 && 2224 e->body.tsx_state.type == PJSIP_EVENT_RX_MSG) 2225 { 2226 2227 /* 2228 * Handle strandled incoming CANCEL. 2229 */ 2230 pjsip_rx_data *rdata = e->body.tsx_state.src.rdata; 2231 pjsip_tx_data *tdata; 2232 pj_status_t status; 2233 2234 status = pjsip_dlg_create_response(dlg, rdata, 200, NULL, &tdata); 2235 if (status != PJ_SUCCESS) return; 2236 2237 status = pjsip_dlg_send_response(dlg, tsx, tdata); 2238 if (status != PJ_SUCCESS) return; 2239 2240 } 2208 2241 } 2209 2242 … … 2243 2276 2244 2277 inv_respond_incoming_bye( inv, tsx, e->body.tsx_state.src.rdata, e ); 2278 2279 } 2280 else if (tsx->method.id == PJSIP_CANCEL_METHOD && 2281 tsx->role == PJSIP_ROLE_UAS && 2282 tsx->status_code < 200 && 2283 e->body.tsx_state.type == PJSIP_EVENT_RX_MSG) 2284 { 2285 2286 /* 2287 * Handle strandled incoming CANCEL. 2288 */ 2289 pjsip_rx_data *rdata = e->body.tsx_state.src.rdata; 2290 pjsip_tx_data *tdata; 2291 pj_status_t status; 2292 2293 status = pjsip_dlg_create_response(dlg, rdata, 200, NULL, &tdata); 2294 if (status != PJ_SUCCESS) return; 2295 2296 status = pjsip_dlg_send_response(dlg, tsx, tdata); 2297 if (status != PJ_SUCCESS) return; 2245 2298 2246 2299 } … … 2378 2431 PJ_ASSERT_ON_FAIL(tsx && dlg, return); 2379 2432 2380 if (tsx->method.id == PJSIP_BYE_METHOD && 2381 tsx->role == PJSIP_ROLE_UAS && 2433 if (tsx->role == PJSIP_ROLE_UAS && 2382 2434 tsx->status_code < 200 && 2383 2435 e->body.tsx_state.type == PJSIP_EVENT_RX_MSG) 2384 2436 { 2437 pjsip_rx_data *rdata = e->body.tsx_state.src.rdata; 2385 2438 2386 2439 /* 2387 * Be nice, handle incoming BYE.2440 * Respond BYE with 200/OK 2388 2441 */ 2389 2390 inv_respond_incoming_bye( inv, tsx, e->body.tsx_state.src.rdata, e ); 2391 2392 } 2393 } 2394 2442 if (tsx->method.id == PJSIP_BYE_METHOD) { 2443 inv_respond_incoming_bye( inv, tsx, rdata, e ); 2444 } else if (tsx->method.id == PJSIP_CANCEL_METHOD) { 2445 /* 2446 * Respond CANCEL with 200/OK too. 2447 */ 2448 pjsip_tx_data *tdata; 2449 pj_status_t status; 2450 2451 status = pjsip_dlg_create_response(dlg, rdata, 200, NULL, &tdata); 2452 if (status != PJ_SUCCESS) return; 2453 2454 status = pjsip_dlg_send_response(dlg, tsx, tdata); 2455 if (status != PJ_SUCCESS) return; 2456 2457 } 2458 } 2459 } 2460 -
pjproject/trunk/pjsip/src/pjsip/sip_dialog.c
r446 r576 703 703 --dlg->sess_count; 704 704 705 if (dlg->sess_count==0 && dlg->tsx_count==0) 705 if (dlg->sess_count==0 && dlg->tsx_count==0) { 706 pj_mutex_unlock(dlg->mutex); 707 pj_mutex_lock(dlg->mutex); 706 708 unregister_and_destroy_dialog(dlg); 707 else {709 } else { 708 710 pj_mutex_unlock(dlg->mutex); 709 711 } … … 972 974 */ 973 975 if (msg->line.req.method.id != PJSIP_ACK_METHOD) { 976 int tsx_count; 977 974 978 status = pjsip_tsx_create_uac(dlg->ua, tdata, &tsx); 975 979 if (status != PJ_SUCCESS) … … 986 990 987 991 /* Increment transaction counter. */ 988 ++dlg->tsx_count;992 tsx_count = ++dlg->tsx_count; 989 993 990 994 /* Send the message. */ 991 995 status = pjsip_tsx_send_msg(tsx, tdata); 992 996 if (status != PJ_SUCCESS) { 993 pjsip_tsx_terminate(tsx, tsx->status_code); 997 if (dlg->tsx_count == tsx_count) 998 pjsip_tsx_terminate(tsx, tsx->status_code); 994 999 goto on_error; 995 1000 } … … 1260 1265 pj_status_t status; 1261 1266 pjsip_transaction *tsx = NULL; 1267 pj_bool_t processed = PJ_FALSE; 1262 1268 unsigned i; 1263 1269 … … 1317 1323 /* Report the request to dialog usages. */ 1318 1324 for (i=0; i<dlg->usage_cnt; ++i) { 1319 pj_bool_t processed;1320 1325 1321 1326 if (!dlg->usage[i]->on_rx_request) … … 1331 1336 if (tsx) 1332 1337 pjsip_tsx_recv_msg(tsx, rdata); 1338 1339 /* If no dialog usages has claimed the processing of the transaction, 1340 * and if transaction has not sent final response, respond with 1341 * 500/Internal Server Error. 1342 */ 1343 if (!processed && tsx && tsx->status_code < 200) { 1344 pjsip_tx_data *tdata; 1345 const pj_str_t reason = { "No session found", 16}; 1346 1347 PJ_LOG(4,(tsx->obj_name, "Incoming request was unhandled by " 1348 "dialog usages, sending 500 response")); 1349 1350 status = pjsip_dlg_create_response(dlg, rdata, 500, &reason, &tdata); 1351 if (status == PJ_SUCCESS) { 1352 status = pjsip_dlg_send_response(dlg, tsx, tdata); 1353 } 1354 } 1333 1355 1334 1356 on_return: -
pjproject/trunk/pjsip/src/pjsip/sip_parser.c
r515 r576 479 479 rec.hname_len = strlen(name); 480 480 if (rec.hname_len >= sizeof(rec.hname)) { 481 pj_assert(!"Header name is too long!"); 481 482 return PJ_ENAMETOOLONG; 482 483 } … … 546 547 547 548 if (hname->slen >= PJSIP_MAX_HNAME_LEN) { 548 pj_assert(!"Header name is too long!"); 549 /* Guaranteed not to be able to find handler. */ 549 550 return NULL; 550 551 } … … 832 833 pjsip_parse_hdr_func * handler; 833 834 pjsip_hdr *hdr = NULL; 835 836 /* Init hname just in case parsing fails. 837 * Ref: PROTOS #2412 838 */ 839 hname.slen = 0; 834 840 835 841 /* Get hname. */ … … 914 920 if (parsing_headers) 915 921 err_info->hname = hname; 922 else if (msg && msg->type == PJSIP_REQUEST_MSG) 923 err_info->hname = pj_str("Request Line"); 924 else if (msg && msg->type == PJSIP_RESPONSE_MSG) 925 err_info->hname = pj_str("Status Line"); 916 926 else 917 927 err_info->hname.slen = 0; … … 1126 1136 pj_bool_t parse_params) 1127 1137 { 1138 /* Bug: 1139 * This function should not call back int_parse_name_addr() because 1140 * it is called by that function. This would cause stack overflow 1141 * with PROTOS test #1223. 1128 1142 if (*scanner->curptr=='"' || *scanner->curptr=='<') { 1129 1143 return (pjsip_uri*)int_parse_name_addr( scanner, pool ); 1130 1144 } else { 1145 */ 1131 1146 pj_str_t scheme; 1132 1147 int colon; … … 1148 1163 UNREACHED({ return NULL; /* Not reached. */ }) 1149 1164 } 1150 } 1165 1166 /* 1167 } 1168 */ 1151 1169 } 1152 1170 -
pjproject/trunk/pjsip/src/pjsip/sip_transport.c
r563 r576 984 984 985 985 PJ_LOG(1, (THIS_FILE, 986 "Error processing packet from %s:%d %.*s:\n"987 "% s\n"986 "Error processing %d bytes packet from %s:%d %.*s:\n" 987 "%.*s\n" 988 988 "-- end of packet.", 989 msg_fragment_size, 989 990 rdata->pkt_info.src_name, 990 991 rdata->pkt_info.src_port, 991 992 (int)tmp.slen, tmp.ptr, 993 (int)msg_fragment_size, 992 994 rdata->msg_info.msg_buf)); 993 995
Note: See TracChangeset
for help on using the changeset viewer.