- Timestamp:
- Feb 10, 2006 2:04:05 PM (19 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/build
- Property svn:ignore
-
old new 5 5 .pj* 6 6 *.swp 7 *.log
-
- Property svn:ignore
-
pjproject/trunk/pjsip/include/pjsip-ua/sip_inv.h
r169 r175 167 167 struct pjsip_inv_session 168 168 { 169 pj_pool_t *pool; 170 pjsip_inv_state state; 171 pjsip_dialog *dlg; 172 pjsip_role_e role; 173 unsigned options; 174 pjmedia_sdp_neg *neg; 175 pjsip_transaction *invite_tsx; 176 void *mod_data[PJSIP_MAX_MODULE]; 169 char obj_name[PJ_MAX_OBJ_NAME]; /**< Log identification. */ 170 pj_pool_t *pool; /**< Dialog's pool. */ 171 pjsip_inv_state state; /**< Invite sess state. */ 172 pjsip_dialog *dlg; /**< Underlying dialog. */ 173 pjsip_role_e role; /**< Invite role. */ 174 unsigned options; /**< Options in use. */ 175 pjmedia_sdp_neg *neg; /**< Negotiator. */ 176 pjsip_transaction *invite_tsx; /**< 1st invite tsx. */ 177 void *mod_data[PJSIP_MAX_MODULE];/**< Modules data. */ 177 178 }; 178 179 -
pjproject/trunk/pjsip/include/pjsip/sip_dialog.h
r160 r175 184 184 * (after created) the dialog has the session counter set to zero. 185 185 */ 186 PJ_DECL(pj_status_t) pjsip_dlg_inc_session( pjsip_dialog *dlg ); 186 PJ_DECL(pj_status_t) pjsip_dlg_inc_session( pjsip_dialog *dlg, 187 pjsip_module *mod); 187 188 188 189 … … 193 194 * if there is no pending transaction when this function is called. 194 195 */ 195 PJ_DECL(pj_status_t) pjsip_dlg_dec_session( pjsip_dialog *dlg ); 196 PJ_DECL(pj_status_t) pjsip_dlg_dec_session( pjsip_dialog *dlg, 197 pjsip_module *mod); 196 198 197 199 /** -
pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c
r171 r175 131 131 132 132 if (inv->state == PJSIP_INV_STATE_DISCONNECTED) 133 pjsip_dlg_dec_session(inv->dlg );133 pjsip_dlg_dec_session(inv->dlg, &mod_inv.mod); 134 134 } 135 135 … … 142 142 pjsip_tx_data *tdata; 143 143 pj_status_t status; 144 145 PJ_LOG(5,(inv->obj_name, "Received %s, sending ACK", 146 pjsip_rx_data_get_info(rdata))); 144 147 145 148 status = pjsip_dlg_create_request(inv->dlg, &pjsip_ack_method, … … 371 374 inv->options = options; 372 375 376 /* Object name will use the same dialog pointer. */ 377 pj_snprintf(inv->obj_name, PJ_MAX_OBJ_NAME, "inv%p", dlg); 378 373 379 /* Create negotiator if local_sdp is specified. */ 374 380 if (local_sdp) { … … 385 391 386 392 /* Increment dialog session */ 387 pjsip_dlg_inc_session(dlg );393 pjsip_dlg_inc_session(dlg, &mod_inv.mod); 388 394 389 395 /* Done */ 390 396 *p_inv = inv; 397 398 PJ_LOG(5,(inv->obj_name, "UAC invite session created for dialog %s", 399 dlg->obj_name)); 400 391 401 return PJ_SUCCESS; 392 402 } … … 760 770 inv->options = options; 761 771 772 /* Object name will use the same dialog pointer. */ 773 pj_snprintf(inv->obj_name, PJ_MAX_OBJ_NAME, "inv%p", dlg); 774 762 775 /* Parse SDP in message body, if present. */ 763 776 if (msg->body) { … … 795 808 796 809 /* Increment session in the dialog. */ 797 pjsip_dlg_inc_session(dlg );810 pjsip_dlg_inc_session(dlg, &mod_inv.mod); 798 811 799 812 /* Save the invite transaction. */ … … 808 821 /* Done */ 809 822 *p_inv = inv; 823 824 PJ_LOG(5,(inv->obj_name, "UAS invite session created for dialog %s", 825 dlg->obj_name)); 826 810 827 return PJ_SUCCESS; 811 828 } … … 912 929 913 930 status = pjmedia_sdp_neg_negotiate(inv->pool, inv->neg, 0); 931 932 PJ_LOG(5,(inv->obj_name, "SDP negotiation done, status=%d", status)); 914 933 915 934 if (mod_inv.cb.on_media_update) … … 982 1001 /* This is an offer. */ 983 1002 1003 PJ_LOG(5,(inv->obj_name, "Got SDP offer in %s", 1004 pjsip_rx_data_get_info(rdata))); 1005 984 1006 if (inv->neg == NULL) { 985 1007 status=pjmedia_sdp_neg_create_w_remote_offer(inv->pool, NULL, … … 1009 1031 * Process and negotiate remote answer. 1010 1032 */ 1033 1034 PJ_LOG(5,(inv->obj_name, "Got SDP answer in %s", 1035 pjsip_rx_data_get_info(rdata))); 1011 1036 1012 1037 status = pjmedia_sdp_neg_set_remote_answer(inv->pool, inv->neg, sdp); … … 1260 1285 /* Verify arguments. */ 1261 1286 PJ_ASSERT_RETURN(inv && tdata, PJ_EINVAL); 1287 1288 PJ_LOG(5,(inv->obj_name, "Sending %s", 1289 pjsip_tx_data_get_info(tdata))); 1262 1290 1263 1291 if (tdata->msg->type == PJSIP_REQUEST_MSG) { … … 1582 1610 break; 1583 1611 } 1612 1613 } else if (inv->role == PJSIP_ROLE_UAC && 1614 tsx->role == PJSIP_ROLE_UAC && 1615 tsx->method.id == PJSIP_CANCEL_METHOD) 1616 { 1617 /* 1618 * Handle case when outgoing CANCEL is answered with 481 (Call/ 1619 * Transaction Does Not Exist), 408, or when it's timed out. In these 1620 * cases, disconnect session (i.e. dialog usage only). 1621 */ 1622 if (tsx->status_code == PJSIP_SC_CALL_TSX_DOES_NOT_EXIST || 1623 tsx->status_code == PJSIP_SC_REQUEST_TIMEOUT || 1624 tsx->status_code == PJSIP_SC_TSX_TIMEOUT || 1625 PJSIP_SC_TSX_TRANSPORT_ERROR) 1626 { 1627 inv_set_state(inv, PJSIP_INV_STATE_DISCONNECTED, e); 1628 } 1584 1629 } 1585 1630 } … … 1738 1783 inv_respond_incoming_cancel(inv, tsx, e->body.tsx_state.src.rdata); 1739 1784 1785 } else if (inv->role == PJSIP_ROLE_UAC && 1786 tsx->role == PJSIP_ROLE_UAC && 1787 tsx->method.id == PJSIP_CANCEL_METHOD) 1788 { 1789 /* 1790 * Handle case when outgoing CANCEL is answered with 481 (Call/ 1791 * Transaction Does Not Exist), 408, or when it's timed out. In these 1792 * cases, disconnect session (i.e. dialog usage only). 1793 */ 1794 if (tsx->status_code == PJSIP_SC_CALL_TSX_DOES_NOT_EXIST || 1795 tsx->status_code == PJSIP_SC_REQUEST_TIMEOUT || 1796 tsx->status_code == PJSIP_SC_TSX_TIMEOUT || 1797 PJSIP_SC_TSX_TRANSPORT_ERROR) 1798 { 1799 inv_set_state(inv, PJSIP_INV_STATE_DISCONNECTED, e); 1800 } 1740 1801 } 1741 1802 } -
pjproject/trunk/pjsip/src/pjsip/sip_dialog.c
r169 r175 201 201 *p_dlg = dlg; 202 202 203 204 PJ_LOG(5,(dlg->obj_name, "UAC dialog created")); 205 203 206 return PJ_SUCCESS; 204 207 … … 381 384 /* Done. */ 382 385 *p_dlg = dlg; 386 PJ_LOG(5,(dlg->obj_name, "UAS dialog created")); 383 387 return PJ_SUCCESS; 384 388 … … 496 500 *new_dlg = dlg; 497 501 502 PJ_LOG(5,(dlg->obj_name, "Forked dialog created")); 498 503 return PJ_SUCCESS; 499 504 … … 577 582 * Increment session counter. 578 583 */ 579 PJ_DEF(pj_status_t) pjsip_dlg_inc_session( pjsip_dialog *dlg ) 580 { 581 PJ_ASSERT_RETURN(dlg, PJ_EINVAL); 584 PJ_DEF(pj_status_t) pjsip_dlg_inc_session( pjsip_dialog *dlg, 585 pjsip_module *mod ) 586 { 587 PJ_ASSERT_RETURN(dlg && mod, PJ_EINVAL); 582 588 583 589 pj_mutex_lock(dlg->mutex); … … 585 591 pj_mutex_unlock(dlg->mutex); 586 592 593 PJ_LOG(5,(dlg->obj_name, "Session count inc to %d by %.*s", 594 dlg->sess_count, (int)mod->name.slen, mod->name.ptr)); 595 587 596 return PJ_SUCCESS; 588 597 } … … 591 600 * Decrement session counter. 592 601 */ 593 PJ_DEF(pj_status_t) pjsip_dlg_dec_session( pjsip_dialog *dlg ) 602 PJ_DEF(pj_status_t) pjsip_dlg_dec_session( pjsip_dialog *dlg, 603 pjsip_module *mod) 594 604 { 595 605 pj_status_t status; 596 606 597 607 PJ_ASSERT_RETURN(dlg, PJ_EINVAL); 608 609 PJ_LOG(5,(dlg->obj_name, "Session count dec to %d by %.*s", 610 dlg->sess_count-1, (int)mod->name.slen, mod->name.ptr)); 598 611 599 612 pj_mutex_lock(dlg->mutex); … … 626 639 PJ_EINVAL); 627 640 PJ_ASSERT_RETURN(dlg->usage_cnt < PJSIP_MAX_MODULE, PJ_EBUG); 641 642 PJ_LOG(5,(dlg->obj_name, "Module %.*s added as dialog usage", 643 (int)mod->name.slen, mod->name.ptr)); 628 644 629 645 pj_mutex_lock(dlg->mutex); … … 795 811 PJSIP_ENOTREQUESTMSG); 796 812 813 PJ_LOG(5,(dlg->obj_name, "Sending %s", 814 pjsip_tx_data_get_info(tdata))); 815 797 816 /* Update CSeq */ 798 817 pj_mutex_lock(dlg->mutex); … … 1024 1043 PJ_ASSERT_RETURN(tsx->mod_data[dlg->ua->id] == dlg, PJ_EINVALIDOP); 1025 1044 1045 PJ_LOG(5,(dlg->obj_name, "Sending %s", 1046 pjsip_tx_data_get_info(tdata))); 1047 1026 1048 /* Check that transaction method and cseq match the response. 1027 1049 * This operation is sloooww (search CSeq header twice), that's why … … 1078 1100 pjsip_transaction *tsx = NULL; 1079 1101 unsigned i; 1102 1103 PJ_LOG(5,(dlg->obj_name, "Received %s", 1104 pjsip_rx_data_get_info(rdata))); 1080 1105 1081 1106 /* Lock the dialog. */ … … 1144 1169 int res_code; 1145 1170 1171 PJ_LOG(5,(dlg->obj_name, "Received %s", 1172 pjsip_rx_data_get_info(rdata))); 1173 1146 1174 /* Lock the dialog. */ 1147 1175 pj_mutex_lock(dlg->mutex); … … 1250 1278 unsigned i; 1251 1279 1280 PJ_LOG(5,(dlg->obj_name, "Transaction %s state changed to %s", 1281 tsx->obj_name, pjsip_tsx_state_str(tsx->state))); 1282 1252 1283 /* Lock the dialog. */ 1253 1284 pj_mutex_lock(dlg->mutex); -
pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
r162 r175 882 882 if (tsx->transport_flag & TSX_HAS_PENDING_TRANSPORT) { 883 883 tsx->transport_flag |= TSX_HAS_PENDING_DESTROY; 884 PJ_LOG( 5,(tsx->obj_name, "Will destroy later because transport is "884 PJ_LOG(4,(tsx->obj_name, "Will destroy later because transport is " 885 885 "in progress")); 886 886 return; … … 915 915 PJ_UNUSED_ARG(theap); 916 916 917 PJ_LOG( 6,(tsx->obj_name, "%s timer event",917 PJ_LOG(5,(tsx->obj_name, "%s timer event", 918 918 (entry->id==TSX_TIMER_RETRANSMISSION ? "Retransmit":"Timeout"))); 919 919 … … 1286 1286 { 1287 1287 struct tsx_lock_data lck; 1288 1289 PJ_LOG(5,(tsx->obj_name, "Request to terminate transaction")); 1288 1290 1289 1291 PJ_ASSERT_RETURN(tsx != NULL, PJ_EINVAL); -
pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c
r169 r175 497 497 pj_mutex_unlock(mod_ua.mutex); 498 498 499 /* Respond with 481 . */ 500 pjsip_endpt_respond_stateless( mod_ua.endpt, rdata, 481, NULL, NULL, 501 NULL ); 499 if (rdata->msg_info.msg->line.req.method.id != PJSIP_ACK_METHOD) { 500 PJ_LOG(5,(THIS_FILE, 501 "Unable to find dialogset for %s, answering with 481", 502 pjsip_rx_data_get_info(rdata))); 503 504 /* Respond with 481 . */ 505 pjsip_endpt_respond_stateless( mod_ua.endpt, rdata, 481, NULL, 506 NULL, NULL ); 507 } 502 508 return PJ_TRUE; 503 509 } … … 518 524 /* Dialog MUST be found! */ 519 525 if (dlg == (pjsip_dialog*)&dlg_set->dlg_list) { 526 520 527 /* Not found. Mulfunction UAC? */ 521 528 pj_mutex_unlock(mod_ua.mutex); 529 530 PJ_LOG(5,(THIS_FILE, 531 "Unable to find dialog for %s, answering with 481", 532 pjsip_rx_data_get_info(rdata))); 533 522 534 pjsip_endpt_respond_stateless(mod_ua.endpt, rdata, 523 535 PJSIP_SC_CALL_TSX_DOES_NOT_EXIST, … … 662 674 ((st_code/100==1 && st_code!=100) || st_code/100==2)) 663 675 { 676 677 PJ_LOG(5,(THIS_FILE, 678 "Received forked %s for existing dialog %s", 679 pjsip_rx_data_get_info(rdata), 680 dlg_set->dlg_list.next->obj_name)); 681 664 682 /* Report to application about forked condition. 665 683 * Application can either create a dialog or ignore the response. -
pjproject/trunk/pjsip/src/pjsip/sip_util.c
r174 r175 357 357 req_msg = rdata->msg_info.msg; 358 358 pj_assert(req_msg->type == PJSIP_REQUEST_MSG); 359 360 /* Request MUST NOT be ACK request! */ 361 PJ_ASSERT_RETURN(req_msg->line.req.method.id != PJSIP_ACK_METHOD, 362 PJ_EINVALIDOP); 359 363 360 364 /* Create a new transmit buffer. */ -
pjproject/trunk/pjsip/src/pjsua/pjsua_core.c
r173 r175 487 487 status = init_sockets(); 488 488 if (status != PJ_SUCCESS) { 489 pj_caching_pool_destroy(&pjsua.cp);490 489 pjsua_perror("init_sockets() has returned error", status); 491 490 return status; … … 621 620 pj_thread_destroy(pjsua.threads[i]); 622 621 } 623 pj_caching_pool_destroy(&pjsua.cp);624 622 return status; 625 623 } … … 666 664 pjsua.quit_flag = 1; 667 665 668 /* Destroy sound framework: */ 666 /* Destroy sound framework: 667 * (this should be done in pjmedia_shutdown()) 668 */ 669 669 pj_snd_deinit(); 670 670 … … 673 673 for (i=0; i<pjsua.thread_cnt; ++i) { 674 674 675 pj_thread_join(pjsua.threads[i]); 676 pj_thread_destroy(pjsua.threads[i]); 675 if (pjsua.threads[i]) { 676 pj_thread_join(pjsua.threads[i]); 677 pj_thread_destroy(pjsua.threads[i]); 678 pjsua.threads[i] = NULL; 679 } 677 680 } 678 681
Note: See TracChangeset
for help on using the changeset viewer.