- Timestamp:
- Sep 19, 2006 1:37:53 PM (18 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r721 r729 1197 1197 PJ_UNUSED_ARG(timer_heap); 1198 1198 1199 if (call_id == PJSUA_INVALID_ID) { 1200 PJ_LOG(1,(THIS_FILE, "Invalid call ID in timer callback")); 1201 return; 1202 } 1203 1199 1204 /* Add warning header */ 1200 1205 pjsua_msg_data_init(&msg_data); -
pjproject/trunk/pjsip/include/pjsip/sip_dialog.h
r671 r729 357 357 358 358 /** 359 * Try to acquire dialog's lock, but return immediately if lock can not 360 * be acquired. 361 * 362 * @param dlg The dialog. 363 * 364 * @return PJ_SUCCESS if lock has been acquired. 365 */ 366 PJ_DECL(pj_status_t) pjsip_dlg_try_inc_lock( pjsip_dialog *dlg ); 367 368 /** 359 369 * Unlock dialog and decrement temporary session counter. After this function 360 370 * is called, dialog may be destroyed. -
pjproject/trunk/pjsip/include/pjsip/sip_ua_layer.h
r671 r729 82 82 83 83 /** 84 * Lock the dialog's hash table. This function is normally called by85 * dialog code only.86 *87 * @return PJ_SUCCESS on success or the appropriate error code.88 */89 PJ_DECL(pj_status_t) pjsip_ua_lock_dlg_table(void);90 91 92 /**93 * Unlock the dialog's hash table. This function is normally called by94 * dialog code only.95 *96 * @return PJ_SUCCESS on success or the appropriate error code.97 */98 PJ_DECL(pj_status_t) pjsip_ua_unlock_dlg_table(void);99 100 101 /**102 84 * Destroy the user agent layer. 103 85 * -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h
r685 r729 258 258 259 259 260 #if 0 261 #define PJSUA_LOCK() pj_mutex_lock(pjsua_var.mutex); 262 #define PJSUA_UNLOCK() pj_mutex_unlock(pjsua_var.mutex); 260 #if 1 261 #define PJSUA_LOCK() pj_mutex_lock(pjsua_var.mutex) 262 #define PJSUA_TRY_LOCK() pj_mutex_trylock(pjsua_var.mutex) 263 #define PJSUA_UNLOCK() pj_mutex_unlock(pjsua_var.mutex) 263 264 #else 264 265 #define PJSUA_LOCK() 266 #define PJSUA_TRY_LOCK() PJ_SUCCESS 265 267 #define PJSUA_UNLOCK() 266 268 #endif -
pjproject/trunk/pjsip/src/pjsip/sip_dialog.c
r675 r729 693 693 dlg->sess_count)); 694 694 695 pjsip_ua_lock_dlg_table();696 697 695 pj_mutex_lock(dlg->mutex_); 698 696 dlg->sess_count++; 699 697 700 //pjsip_ua_unlock_dlg_table();701 702 698 PJ_LOG(6,(dlg->obj_name, "Leaving pjsip_dlg_inc_lock(), sess_count=%d", 703 699 dlg->sess_count)); 704 700 } 705 701 702 /* Try to acquire dialog's mutex, but bail out if mutex can not be 703 * acquired immediately. 704 */ 705 PJ_DEF(pj_status_t) pjsip_dlg_try_inc_lock(pjsip_dialog *dlg) 706 { 707 pj_status_t status; 708 709 PJ_LOG(6,(dlg->obj_name,"Entering pjsip_dlg_try_inc_lock(), sess_count=%d", 710 dlg->sess_count)); 711 712 status = pj_mutex_trylock(dlg->mutex_); 713 if (status != PJ_SUCCESS) { 714 PJ_LOG(6,(dlg->obj_name, "pjsip_dlg_try_inc_lock() failed")); 715 return status; 716 } 717 718 dlg->sess_count++; 719 720 PJ_LOG(6,(dlg->obj_name, "Leaving pjsip_dlg_try_inc_lock(), sess_count=%d", 721 dlg->sess_count)); 722 723 return PJ_SUCCESS; 724 } 725 706 726 707 727 /* … … 713 733 PJ_LOG(6,(dlg->obj_name, "Entering pjsip_dlg_dec_lock(), sess_count=%d", 714 734 dlg->sess_count)); 715 716 //pjsip_ua_lock_dlg_table();717 735 718 736 pj_assert(dlg->sess_count > 0); … … 726 744 pj_mutex_unlock(dlg->mutex_); 727 745 } 728 729 pjsip_ua_unlock_dlg_table();730 746 731 747 PJ_LOG(6,(THIS_FILE, "Leaving pjsip_dlg_dec_lock() (dlg=%p)", dlg)); -
pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c
r673 r729 210 210 211 211 212 /**213 * Lock the dialog's hash table. This function is normally called by214 * dialog code only.215 *216 * @return PJ_SUCCESS on success or the appropriate error code.217 */218 PJ_DEF(pj_status_t) pjsip_ua_lock_dlg_table(void)219 {220 return pj_mutex_lock(mod_ua.mutex);221 }222 223 224 /**225 * Unlock the dialog's hash table. This function is normally called by226 * dialog code only.227 *228 * @return PJ_SUCCESS on success or the appropriate error code.229 */230 PJ_DEF(pj_status_t) pjsip_ua_unlock_dlg_table(void)231 {232 return pj_mutex_unlock(mod_ua.mutex);233 }234 235 236 212 /* 237 213 * Get the endpoint where this UA is currently registered. … … 500 476 pj_str_t *from_tag; 501 477 pjsip_dialog *dlg; 478 pj_status_t status; 502 479 503 480 /* Optimized path: bail out early if request is not CANCEL and it doesn't … … 509 486 return PJ_FALSE; 510 487 } 488 489 retry_on_deadlock: 511 490 512 491 /* Lock user agent before looking up the dialog hash table. */ … … 586 565 rdata->endpt_info.mod_data[mod_ua.mod.id] = dlg; 587 566 588 /* Lock the dialog */567 /* Try to lock the dialog */ 589 568 PJ_LOG(6,(dlg->obj_name, "UA layer acquiring dialog lock for request")); 590 pjsip_dlg_inc_lock(dlg); 569 status = pjsip_dlg_try_inc_lock(dlg); 570 if (status != PJ_SUCCESS) { 571 /* Failed to acquire dialog mutex immediately, this could be 572 * because of deadlock. Release UA mutex, yield, and retry 573 * the whole thing once again. 574 */ 575 pj_mutex_unlock(mod_ua.mutex); 576 pj_thread_sleep(0); 577 goto retry_on_deadlock; 578 } 579 580 /* Done with processing in UA layer, release lock */ 581 pj_mutex_unlock(mod_ua.mutex); 591 582 592 583 /* Pass to dialog. */ … … 596 587 pjsip_dlg_dec_lock(dlg); 597 588 598 /* Done processing in the UA */599 pj_mutex_unlock(mod_ua.mutex);600 601 589 /* Report as handled. */ 602 590 return PJ_TRUE; … … 610 598 pjsip_transaction *tsx; 611 599 struct dlg_set *dlg_set; 612 pjsip_dialog *dlg = NULL; 600 pjsip_dialog *dlg; 601 pj_status_t status; 613 602 614 603 /* … … 621 610 * the response is a forked response. 622 611 */ 612 613 retry_on_deadlock: 614 615 dlg = NULL; 623 616 624 617 /* Lock user agent dlg table before we're doing anything. */ … … 783 776 rdata->endpt_info.mod_data[mod_ua.mod.id] = dlg; 784 777 785 /* A cquire lock to the dialog. */778 /* Attempt to acquire lock to the dialog. */ 786 779 PJ_LOG(6,(dlg->obj_name, "UA layer acquiring dialog lock for response")); 787 pjsip_dlg_inc_lock(dlg); 780 status = pjsip_dlg_try_inc_lock(dlg); 781 if (status != PJ_SUCCESS) { 782 /* Failed to acquire dialog mutex. This could indicate a deadlock 783 * situation, and for safety, try to avoid deadlock by releasing 784 * UA mutex, yield, and retry the whole processing once again. 785 */ 786 pj_mutex_unlock(mod_ua.mutex); 787 pj_thread_sleep(0); 788 goto retry_on_deadlock; 789 } 790 791 /* We're done with processing in the UA layer, we can release the mutex */ 792 pj_mutex_unlock(mod_ua.mutex); 788 793 789 794 /* Pass the response to the dialog. */ … … 792 797 /* Unlock the dialog. This may destroy the dialog. */ 793 798 pjsip_dlg_dec_lock(dlg); 794 795 /* Unlock dialog hash table. */796 pj_mutex_unlock(mod_ua.mutex);797 799 798 800 /* Done. */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r719 r729 384 384 return PJ_FALSE; 385 385 386 PJSUA_LOCK(); 386 387 387 388 /* Verify that we can handle the request. */ … … 408 409 } 409 410 411 PJSUA_UNLOCK(); 410 412 return PJ_TRUE; 411 413 } … … 428 430 PJ_LOG(2,(THIS_FILE, 429 431 "Unable to accept incoming call (too many calls)")); 432 PJSUA_UNLOCK(); 430 433 return PJ_TRUE; 431 434 } … … 446 449 pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 500, NULL, 447 450 NULL, NULL); 451 PJSUA_UNLOCK(); 448 452 return PJ_TRUE; 449 453 } … … 463 467 pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 500, NULL, 464 468 NULL, NULL); 469 PJSUA_UNLOCK(); 465 470 return PJ_TRUE; 466 471 } … … 472 477 pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 500, NULL, 473 478 NULL, NULL); 474 479 PJSUA_UNLOCK(); 475 480 return PJ_TRUE; 476 481 } … … 500 505 pjsip_dlg_terminate(dlg); 501 506 */ 507 PJSUA_UNLOCK(); 502 508 return PJ_TRUE; 503 509 } … … 521 527 pjsip_dlg_respond(dlg, rdata, 500, NULL, NULL, NULL); 522 528 pjsip_inv_terminate(inv, 500, PJ_FALSE); 529 PJSUA_UNLOCK(); 523 530 return PJ_TRUE; 524 531 … … 537 544 538 545 /* This INVITE request has been handled. */ 546 PJSUA_UNLOCK(); 539 547 return PJ_TRUE; 540 548 } … … 566 574 567 575 576 /* Acquire lock to the specified call_id */ 577 static pj_status_t acquire_call(const char *title, 578 pjsua_call_id call_id, 579 pjsua_call **p_call) 580 { 581 enum { MAX_RETRY=50 }; 582 unsigned retry; 583 pjsua_call *call; 584 pj_bool_t has_pjsua_lock; 585 pj_status_t status; 586 587 for (retry=0; retry<MAX_RETRY; ++retry) { 588 589 has_pjsua_lock = PJ_FALSE; 590 591 status = PJSUA_TRY_LOCK(); 592 if (status != PJ_SUCCESS) { 593 pj_thread_sleep(retry/10); 594 continue; 595 } 596 597 has_pjsua_lock = PJ_TRUE; 598 call = &pjsua_var.calls[call_id]; 599 600 if (call->inv == NULL) { 601 PJSUA_UNLOCK(); 602 PJ_LOG(3,(THIS_FILE, "Invalid call_id %d in %s", call_id, title)); 603 return PJSIP_ESESSIONTERMINATED; 604 } 605 606 status = pjsip_dlg_try_inc_lock(call->inv->dlg); 607 if (status != PJ_SUCCESS) { 608 PJSUA_UNLOCK(); 609 pj_thread_sleep(retry/10); 610 continue; 611 } 612 613 PJSUA_UNLOCK(); 614 615 break; 616 } 617 618 if (status != PJ_SUCCESS) { 619 if (has_pjsua_lock == PJ_FALSE) 620 PJ_LOG(1,(THIS_FILE, "Timed-out trying to acquire PJSUA mutex " 621 "(possibly system has deadlocked) in %s", 622 title)); 623 else 624 PJ_LOG(1,(THIS_FILE, "Timed-out trying to acquire dialog mutex " 625 "(possibly system has deadlocked) in %s", 626 title)); 627 return PJ_ETIMEDOUT; 628 } 629 630 *p_call = call; 631 632 return PJ_SUCCESS; 633 } 634 635 568 636 /* 569 637 * Get the conference port identification associated with the call. … … 571 639 PJ_DEF(pjsua_conf_port_id) pjsua_call_get_conf_port(pjsua_call_id call_id) 572 640 { 641 pjsua_call *call; 642 pjsua_conf_port_id port_id; 643 pj_status_t status; 644 573 645 PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, 574 646 PJ_EINVAL); 575 return pjsua_var.calls[call_id].conf_slot; 576 } 647 648 status = acquire_call("pjsua_call_get_conf_port()", call_id, &call); 649 if (status != PJ_SUCCESS) 650 return -1; 651 652 port_id = call->conf_slot; 653 654 pjsip_dlg_dec_lock(call->inv->dlg); 655 656 return port_id; 657 } 658 577 659 578 660 … … 584 666 { 585 667 pjsua_call *call; 668 pj_status_t status; 586 669 587 670 PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, … … 590 673 pj_bzero(info, sizeof(*info)); 591 674 592 PJSUA_LOCK(); 593 594 call = &pjsua_var.calls[call_id]; 595 596 if (call->inv == NULL) { 597 PJSUA_UNLOCK(); 598 return PJ_SUCCESS; 599 } 600 601 pjsip_dlg_inc_lock(call->inv->dlg); 602 675 status = acquire_call("pjsua_call_get_info()", call_id, &call); 676 if (status != PJ_SUCCESS) { 677 return status; 678 } 603 679 604 680 /* id and role */ … … 697 773 698 774 pjsip_dlg_dec_lock(call->inv->dlg); 699 PJSUA_UNLOCK();700 775 701 776 return PJ_SUCCESS; … … 743 818 PJ_EINVAL); 744 819 745 PJSUA_LOCK(); 746 747 call = &pjsua_var.calls[call_id]; 748 749 if (call->inv == NULL) { 750 PJ_LOG(3,(THIS_FILE, "Call %d already disconnected", call_id)); 751 PJSUA_UNLOCK(); 752 return PJSIP_ESESSIONTERMINATED; 753 } 820 status = acquire_call("pjsua_call_answer()", call_id, &call); 821 if (status != PJ_SUCCESS) 822 return status; 754 823 755 824 if (call->res_time.sec == 0) … … 761 830 pjsua_perror(THIS_FILE, "Error creating response", 762 831 status); 763 PJSUA_UNLOCK();832 pjsip_dlg_dec_lock(call->inv->dlg); 764 833 return status; 765 834 } … … 774 843 status); 775 844 776 PJSUA_UNLOCK();845 pjsip_dlg_dec_lock(call->inv->dlg); 777 846 778 847 return status; … … 794 863 795 864 865 if (call_id<0 || call_id>=(int)pjsua_var.ua_cfg.max_calls) { 866 PJ_LOG(1,(THIS_FILE, "pjsua_call_hangup(): invalid call id %d", 867 call_id)); 868 } 869 796 870 PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, 797 871 PJ_EINVAL); 798 872 799 PJSUA_LOCK(); 800 801 call = &pjsua_var.calls[call_id]; 802 803 if (!call->inv) { 804 PJ_LOG(3,(THIS_FILE,"Invalid call or call has been disconnected")); 805 PJSUA_UNLOCK(); 806 return PJ_EINVAL; 807 } 873 status = acquire_call("pjsua_call_hangup()", call_id, &call); 874 if (status != PJ_SUCCESS) 875 return status; 808 876 809 877 if (code==0) { … … 821 889 "Failed to create end session message", 822 890 status); 823 PJSUA_UNLOCK();891 pjsip_dlg_dec_lock(call->inv->dlg); 824 892 return status; 825 893 } … … 830 898 */ 831 899 if (tdata == NULL) { 832 PJSUA_UNLOCK();900 pjsip_dlg_dec_lock(call->inv->dlg); 833 901 return PJ_SUCCESS; 834 902 } … … 843 911 "Failed to send end session message", 844 912 status); 845 PJSUA_UNLOCK();913 pjsip_dlg_dec_lock(call->inv->dlg); 846 914 return status; 847 915 } 848 916 849 PJSUA_UNLOCK();917 pjsip_dlg_dec_lock(call->inv->dlg); 850 918 851 919 return PJ_SUCCESS; … … 867 935 PJ_EINVAL); 868 936 869 PJSUA_LOCK(); 870 871 call = &pjsua_var.calls[call_id]; 872 873 if (!call->inv) { 874 PJ_LOG(3,(THIS_FILE,"Call has been disconnected")); 875 PJSUA_UNLOCK(); 876 return PJSIP_ESESSIONTERMINATED; 877 } 937 status = acquire_call("pjsua_call_set_hold()", call_id, &call); 938 if (status != PJ_SUCCESS) 939 return status; 940 878 941 879 942 if (call->inv->state != PJSIP_INV_STATE_CONFIRMED) { 880 943 PJ_LOG(3,(THIS_FILE, "Can not hold call that is not confirmed")); 881 PJSUA_UNLOCK();944 pjsip_dlg_dec_lock(call->inv->dlg); 882 945 return PJSIP_ESESSIONSTATE; 883 946 } … … 885 948 status = create_inactive_sdp(call, &sdp); 886 949 if (status != PJ_SUCCESS) { 887 PJSUA_UNLOCK();950 pjsip_dlg_dec_lock(call->inv->dlg); 888 951 return status; 889 952 } … … 893 956 if (status != PJ_SUCCESS) { 894 957 pjsua_perror(THIS_FILE, "Unable to create re-INVITE", status); 895 PJSUA_UNLOCK();958 pjsip_dlg_dec_lock(call->inv->dlg); 896 959 return status; 897 960 } … … 904 967 if (status != PJ_SUCCESS) { 905 968 pjsua_perror(THIS_FILE, "Unable to send re-INVITE", status); 906 PJSUA_UNLOCK();969 pjsip_dlg_dec_lock(call->inv->dlg); 907 970 return status; 908 971 } 909 972 910 PJSUA_UNLOCK();973 pjsip_dlg_dec_lock(call->inv->dlg); 911 974 912 975 return PJ_SUCCESS; … … 930 993 PJ_EINVAL); 931 994 932 PJSUA_LOCK(); 933 934 call = &pjsua_var.calls[call_id]; 935 936 if (!call->inv) { 937 PJ_LOG(3,(THIS_FILE,"Call has been disconnected")); 938 PJSUA_UNLOCK(); 939 return PJSIP_ESESSIONTERMINATED; 940 } 941 995 status = acquire_call("pjsua_call_reinvite()", call_id, &call); 996 if (status != PJ_SUCCESS) 997 return status; 942 998 943 999 if (call->inv->state != PJSIP_INV_STATE_CONFIRMED) { 944 1000 PJ_LOG(3,(THIS_FILE, "Can not re-INVITE call that is not confirmed")); 945 PJSUA_UNLOCK();1001 pjsip_dlg_dec_lock(call->inv->dlg); 946 1002 return PJSIP_ESESSIONSTATE; 947 1003 } … … 955 1011 pjsua_perror(THIS_FILE, "Unable to get SDP from media endpoint", 956 1012 status); 957 PJSUA_UNLOCK();1013 pjsip_dlg_dec_lock(call->inv->dlg); 958 1014 return status; 959 1015 } … … 963 1019 if (status != PJ_SUCCESS) { 964 1020 pjsua_perror(THIS_FILE, "Unable to create re-INVITE", status); 965 PJSUA_UNLOCK();1021 pjsip_dlg_dec_lock(call->inv->dlg); 966 1022 return status; 967 1023 } … … 974 1030 if (status != PJ_SUCCESS) { 975 1031 pjsua_perror(THIS_FILE, "Unable to send re-INVITE", status); 976 PJSUA_UNLOCK();1032 pjsip_dlg_dec_lock(call->inv->dlg); 977 1033 return status; 978 1034 } 979 1035 980 PJSUA_UNLOCK();1036 pjsip_dlg_dec_lock(call->inv->dlg); 981 1037 982 1038 return PJ_SUCCESS; … … 1000 1056 PJ_EINVAL); 1001 1057 1002 PJSUA_LOCK(); 1003 1004 call = &pjsua_var.calls[call_id]; 1005 1006 if (!call->inv) { 1007 PJ_LOG(3,(THIS_FILE,"Call has been disconnected")); 1008 PJSUA_UNLOCK(); 1009 return PJSIP_ESESSIONTERMINATED; 1010 } 1058 pjsip_dlg_dec_lock(call->inv->dlg); 1059 status = acquire_call("pjsua_call_xfer()", call_id, &call); 1060 if (status != PJ_SUCCESS) 1061 return status; 1062 1011 1063 1012 1064 /* Create xfer client subscription. … … 1017 1069 if (status != PJ_SUCCESS) { 1018 1070 pjsua_perror(THIS_FILE, "Unable to create xfer", status); 1019 PJSUA_UNLOCK();1071 pjsip_dlg_dec_lock(call->inv->dlg); 1020 1072 return status; 1021 1073 } … … 1027 1079 if (status != PJ_SUCCESS) { 1028 1080 pjsua_perror(THIS_FILE, "Unable to create REFER request", status); 1029 PJSUA_UNLOCK();1081 pjsip_dlg_dec_lock(call->inv->dlg); 1030 1082 return status; 1031 1083 } … … 1038 1090 if (status != PJ_SUCCESS) { 1039 1091 pjsua_perror(THIS_FILE, "Unable to send REFER request", status); 1040 PJSUA_UNLOCK();1092 pjsip_dlg_dec_lock(call->inv->dlg); 1041 1093 return status; 1042 1094 } … … 1047 1099 */ 1048 1100 1049 PJSUA_UNLOCK();1101 pjsip_dlg_dec_lock(call->inv->dlg); 1050 1102 1051 1103 return PJ_SUCCESS; … … 1066 1118 PJ_EINVAL); 1067 1119 1068 PJSUA_LOCK(); 1120 status = acquire_call("pjsua_call_dial_dtmf()", call_id, &call); 1121 if (status != PJ_SUCCESS) 1122 return status; 1069 1123 1070 1124 call = &pjsua_var.calls[call_id]; … … 1072 1126 if (!call->session) { 1073 1127 PJ_LOG(3,(THIS_FILE, "Media is not established yet!")); 1074 PJSUA_UNLOCK();1128 pjsip_dlg_dec_lock(call->inv->dlg); 1075 1129 return PJ_EINVALIDOP; 1076 1130 } … … 1078 1132 status = pjmedia_session_dial_dtmf( call->session, 0, digits); 1079 1133 1080 PJSUA_UNLOCK();1134 pjsip_dlg_dec_lock(call->inv->dlg); 1081 1135 1082 1136 return status; … … 1104 1158 PJ_EINVAL); 1105 1159 1106 PJSUA_LOCK(); 1107 1108 call = &pjsua_var.calls[call_id]; 1109 1110 if (!call->inv) { 1111 PJ_LOG(3,(THIS_FILE,"Call has been disconnected")); 1112 PJSUA_UNLOCK(); 1113 return PJSIP_ESESSIONTERMINATED; 1114 } 1115 1116 /* Lock dialog. */ 1117 pjsip_dlg_inc_lock(call->inv->dlg); 1118 1160 status = acquire_call("pjsua_call_send_im", call_id, &call); 1161 if (status != PJ_SUCCESS) 1162 return status; 1163 1119 1164 /* Set default media type if none is specified */ 1120 1165 if (mime_type == NULL) { … … 1168 1213 on_return: 1169 1214 pjsip_dlg_dec_lock(call->inv->dlg); 1170 PJSUA_UNLOCK();1171 1215 return status; 1172 1216 } … … 1184 1228 pj_status_t status; 1185 1229 1186 1187 1230 PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, 1188 1231 PJ_EINVAL); 1189 1232 1190 PJSUA_LOCK(); 1191 1192 call = &pjsua_var.calls[call_id]; 1193 1194 if (!call->inv) { 1195 PJ_LOG(3,(THIS_FILE,"Call has been disconnected")); 1196 PJSUA_UNLOCK(); 1197 return PJSIP_ESESSIONTERMINATED; 1198 } 1199 1200 /* Lock dialog. */ 1201 pjsip_dlg_inc_lock(call->inv->dlg); 1202 1233 status = acquire_call("pjsua_call_send_typing_ind", call_id, &call); 1234 if (status != PJ_SUCCESS) 1235 return status; 1236 1203 1237 /* Create request message. */ 1204 1238 status = pjsip_dlg_create_request( call->inv->dlg, &pjsip_message_method, … … 1225 1259 on_return: 1226 1260 pjsip_dlg_dec_lock(call->inv->dlg); 1227 PJSUA_UNLOCK();1228 1261 return status; 1229 1262 } … … 1502 1535 char tmp[128]; 1503 1536 char *p, *end; 1537 pj_status_t status; 1504 1538 int len; 1505 1539 … … 1507 1541 PJ_EINVAL); 1508 1542 1509 PJSUA_LOCK();1510 1511 call = &pjsua_var.calls[call_id];1543 status = acquire_call("pjsua_call_dump()", call_id, &call); 1544 if (status != PJ_SUCCESS) 1545 return status; 1512 1546 1513 1547 *buffer = '\0'; … … 1515 1549 end = buffer + maxlen; 1516 1550 len = 0; 1517 1518 if (call->inv == NULL) {1519 PJSUA_UNLOCK();1520 return PJ_EINVALIDOP;1521 }1522 1551 1523 1552 print_call(indent, call_id, tmp, sizeof(tmp)); … … 1570 1599 dump_media_session(indent, p, end-p, call->session); 1571 1600 1572 PJSUA_UNLOCK();1601 pjsip_dlg_dec_lock(call->inv->dlg); 1573 1602 1574 1603 return PJ_SUCCESS;
Note: See TracChangeset
for help on using the changeset viewer.