Changeset 3777
- Timestamp:
- Oct 3, 2011 2:04:36 AM (13 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsip-ua/sip_inv.h
r3553 r3777 546 546 547 547 /** 548 * Variant of #pjsip_inv_verify_request() which allows application not to 549 * specify the rdata (i.e. pass NULL as the rdata parameter) and specify 550 * the parsed SDP in the \a offer argument and a temporary pool in the 551 * \a tmp_pool argument. 552 * This is useful if application no longer has access to the rdata. 553 * 554 * @see pjsip_inv_verify_request() 555 */ 556 PJ_DECL(pj_status_t) pjsip_inv_verify_request3( pjsip_rx_data *rdata, 557 pj_pool_t *tmp_pool, 558 unsigned *options, 559 const pjmedia_sdp_session *offer, 560 const pjmedia_sdp_session *answer, 561 pjsip_dialog *dlg, 562 pjsip_endpoint *endpt, 563 pjsip_tx_data **tdata); 564 565 566 /** 548 567 * Create UAS invite session for the specified dialog in dlg. Application 549 568 * SHOULD call the verification function before calling this function, … … 712 731 713 732 /** 733 * Set local offer or answer depending on negotiator state (it may also 734 * create a negotiator if it doesn't exist yet). 735 * 736 * @param inv The invite session. 737 * @param sdp The SDP description which will be set as 738 * an offer/answer to remote. 739 * 740 * @return PJ_SUCCESS if local offer/answer can be accepted by 741 * SDP negotiator. 742 */ 743 PJ_DECL(pj_status_t) pjsip_inv_set_local_sdp(pjsip_inv_session *inv, 744 const pjmedia_sdp_session *sdp ); 745 746 747 /** 714 748 * Set local answer to respond to remote SDP offer, to be carried by 715 749 * subsequent response (or request). -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h
r3767 r3777 101 101 #define PJSUA_MAX_CALL_MEDIA PJMEDIA_MAX_SDP_MEDIA 102 102 103 /* Call answer's list. */ 104 typedef struct call_answer 105 { 106 PJ_DECL_LIST_MEMBER(struct call_answer); 107 pjsua_msg_data *msg_data; /**< Answer's headers list. */ 108 pj_str_t *reason; /**< Answer's reason phrase. */ 109 unsigned code; /**< Answer's status code. */ 110 } call_answer; 111 112 103 113 /** 104 114 * Structure to be attached to invite dialog. … … 152 162 pjsua_msg_data *msg_data;/**< Headers for outgoing INVITE. */ 153 163 } out_call; 164 struct { 165 call_answer answers;/**< A list of call answers. */ 166 } inc_call; 154 167 } call_var; 155 168 } async_call; /**< Temporary storage for async -
pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c
r3753 r3777 812 812 * Verify incoming INVITE request. 813 813 */ 814 PJ_DEF(pj_status_t) pjsip_inv_verify_request2(pjsip_rx_data *rdata, 814 PJ_DEF(pj_status_t) pjsip_inv_verify_request3(pjsip_rx_data *rdata, 815 pj_pool_t *tmp_pool, 815 816 unsigned *options, 816 817 const pjmedia_sdp_session *r_sdp, … … 820 821 pjsip_tx_data **p_tdata) 821 822 { 822 pjsip_msg *msg ;823 pjsip_allow_hdr *allow ;824 pjsip_supported_hdr *sup_hdr ;825 pjsip_require_hdr *req_hdr ;826 pjsip_contact_hdr *c_hdr ;823 pjsip_msg *msg = NULL; 824 pjsip_allow_hdr *allow = NULL; 825 pjsip_supported_hdr *sup_hdr = NULL; 826 pjsip_require_hdr *req_hdr = NULL; 827 pjsip_contact_hdr *c_hdr = NULL; 827 828 int code = 200; 828 829 unsigned rem_option = 0; … … 835 836 836 837 /* Verify arguments. */ 837 PJ_ASSERT_RETURN( rdata!= NULL && options != NULL, PJ_EINVAL);838 PJ_ASSERT_RETURN(tmp_pool != NULL && options != NULL, PJ_EINVAL); 838 839 839 840 /* Normalize options */ … … 845 846 *options |= PJSIP_INV_SUPPORT_ICE; 846 847 847 /* Get the message in rdata */ 848 msg = rdata->msg_info.msg; 849 850 /* Must be INVITE request. */ 851 PJ_ASSERT_RETURN(msg->type == PJSIP_REQUEST_MSG && 852 msg->line.req.method.id == PJSIP_INVITE_METHOD, 853 PJ_EINVAL); 848 if (rdata) { 849 /* Get the message in rdata */ 850 msg = rdata->msg_info.msg; 851 852 /* Must be INVITE request. */ 853 PJ_ASSERT_RETURN(msg && msg->type == PJSIP_REQUEST_MSG && 854 msg->line.req.method.id == PJSIP_INVITE_METHOD, 855 PJ_EINVAL); 856 } 854 857 855 858 /* If tdata is specified, then either dlg or endpt must be specified */ … … 863 866 864 867 /* Check the Contact header */ 865 c_hdr = (pjsip_contact_hdr*) 866 pjsip_msg_find_hdr(msg, PJSIP_H_CONTACT, NULL); 867 if (!c_hdr || !c_hdr->uri) { 868 /* Missing Contact header or Contact contains "*" */ 868 if (msg) { 869 c_hdr = (pjsip_contact_hdr*) 870 pjsip_msg_find_hdr(msg, PJSIP_H_CONTACT, NULL); 871 } 872 if (msg && (!c_hdr || !c_hdr->uri)) { 873 /* Missing Contact header or Contact contains "*" */ 869 874 pjsip_warning_hdr *w; 870 875 pj_str_t warn_text; 871 876 872 877 warn_text = pj_str("Bad/missing Contact header"); 873 w = pjsip_warning_hdr_create( rdata->tp_info.pool, 399,878 w = pjsip_warning_hdr_create(tmp_pool, 399, 874 879 pjsip_endpt_name(endpt), 875 880 &warn_text); … … 886 891 * only when the body hasn't been parsed before. 887 892 */ 888 if (r_sdp == NULL ) {893 if (r_sdp == NULL && rdata) { 889 894 sdp_info = pjsip_rdata_get_sdp_info(rdata); 890 895 } else { … … 892 897 } 893 898 894 if (r_sdp==NULL && msg ->body) {899 if (r_sdp==NULL && msg && msg->body) { 895 900 896 901 /* Check if body really contains SDP. */ … … 904 909 pjsip_accept_hdr *acc; 905 910 906 acc = pjsip_accept_hdr_create( rdata->tp_info.pool);911 acc = pjsip_accept_hdr_create(tmp_pool); 907 912 PJ_ASSERT_RETURN(acc, PJ_ENOMEM); 908 913 acc->values[acc->count++] = pj_str("application/sdp"); … … 921 926 pjsip_warning_hdr *w; 922 927 923 w = pjsip_warning_hdr_create_from_status( rdata->tp_info.pool,928 w = pjsip_warning_hdr_create_from_status(tmp_pool, 924 929 pjsip_endpt_name(endpt), 925 930 sdp_info->sdp_err); … … 946 951 /* Create SDP negotiator */ 947 952 status = pjmedia_sdp_neg_create_w_remote_offer( 948 rdata->tp_info.pool, l_sdp, r_sdp, &neg);953 tmp_pool, l_sdp, r_sdp, &neg); 949 954 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 950 955 951 956 /* Negotiate SDP */ 952 status = pjmedia_sdp_neg_negotiate( rdata->tp_info.pool, neg, 0);957 status = pjmedia_sdp_neg_negotiate(tmp_pool, neg, 0); 953 958 if (status != PJ_SUCCESS) { 954 959 … … 962 967 /* Add Warning header. */ 963 968 w = pjsip_warning_hdr_create_from_status( 964 rdata->tp_info.pool,969 tmp_pool, 965 970 pjsip_endpt_name(endpt), status); 966 971 PJ_ASSERT_RETURN(w, PJ_ENOMEM); … … 969 974 970 975 /* Add Accept header to response */ 971 acc = pjsip_accept_hdr_create( rdata->tp_info.pool);976 acc = pjsip_accept_hdr_create(tmp_pool); 972 977 PJ_ASSERT_RETURN(acc, PJ_ENOMEM); 973 978 acc->values[acc->count++] = pj_str("application/sdp"); … … 985 990 * implicitly by sending this INVITE. 986 991 */ 987 allow = (pjsip_allow_hdr*) pjsip_msg_find_hdr(msg, PJSIP_H_ALLOW, NULL); 992 if (msg) { 993 allow = (pjsip_allow_hdr*) pjsip_msg_find_hdr(msg, PJSIP_H_ALLOW, 994 NULL); 995 } 988 996 if (allow) { 989 997 unsigned i; … … 1003 1011 1004 1012 /* Check Supported header */ 1005 sup_hdr = (pjsip_supported_hdr*) 1006 pjsip_msg_find_hdr(msg, PJSIP_H_SUPPORTED, NULL); 1013 if (msg) { 1014 sup_hdr = (pjsip_supported_hdr*) 1015 pjsip_msg_find_hdr(msg, PJSIP_H_SUPPORTED, NULL); 1016 } 1007 1017 if (sup_hdr) { 1008 1018 unsigned i; … … 1022 1032 1023 1033 /* Check Require header */ 1024 req_hdr = (pjsip_require_hdr*) 1025 pjsip_msg_find_hdr(msg, PJSIP_H_REQUIRE, NULL); 1034 if (msg) { 1035 req_hdr = (pjsip_require_hdr*) 1036 pjsip_msg_find_hdr(msg, PJSIP_H_REQUIRE, NULL); 1037 } 1026 1038 if (req_hdr) { 1027 1039 unsigned i; … … 1075 1087 1076 1088 /* Add Unsupported header. */ 1077 unsupp_hdr = pjsip_unsupported_hdr_create( rdata->tp_info.pool);1089 unsupp_hdr = pjsip_unsupported_hdr_create(tmp_pool); 1078 1090 PJ_ASSERT_RETURN(unsupp_hdr != NULL, PJ_ENOMEM); 1079 1091 … … 1090 1102 if (h) { 1091 1103 sup_hdr = (pjsip_supported_hdr*) 1092 pjsip_hdr_clone( rdata->tp_info.pool, h);1104 pjsip_hdr_clone(tmp_pool, h); 1093 1105 pj_list_push_back(&res_hdr_list, sup_hdr); 1094 1106 } … … 1102 1114 * by peer. 1103 1115 */ 1104 if ( ((*options & PJSIP_INV_REQUIRE_100REL)!=0 &&1116 if ( msg && (((*options & PJSIP_INV_REQUIRE_100REL)!=0 && 1105 1117 (rem_option & PJSIP_INV_SUPPORT_100REL)==0) || 1106 1118 ((*options & PJSIP_INV_REQUIRE_TIMER)!=0 && 1107 (rem_option & PJSIP_INV_SUPPORT_TIMER)==0)) 1119 (rem_option & PJSIP_INV_SUPPORT_TIMER)==0))) 1108 1120 { 1109 1121 code = PJSIP_SC_EXTENSION_REQUIRED; … … 1114 1126 1115 1127 /* Add Require header. */ 1116 req_hdr = pjsip_require_hdr_create( rdata->tp_info.pool);1128 req_hdr = pjsip_require_hdr_create(tmp_pool); 1117 1129 PJ_ASSERT_RETURN(req_hdr != NULL, PJ_ENOMEM); 1118 1130 … … 1130 1142 if (h) { 1131 1143 sup_hdr = (pjsip_supported_hdr*) 1132 pjsip_hdr_clone( rdata->tp_info.pool, h);1144 pjsip_hdr_clone(tmp_pool, h); 1133 1145 pj_list_push_back(&res_hdr_list, sup_hdr); 1134 1146 } … … 1158 1170 const pjsip_hdr *h; 1159 1171 1172 if (!rdata) { 1173 return PJSIP_ERRNO_FROM_SIP_STATUS(code); 1174 } 1175 1160 1176 if (dlg) { 1161 1177 status = pjsip_dlg_create_response(dlg, rdata, code, NULL, … … 1199 1215 * Verify incoming INVITE request. 1200 1216 */ 1217 PJ_DEF(pj_status_t) pjsip_inv_verify_request2(pjsip_rx_data *rdata, 1218 unsigned *options, 1219 const pjmedia_sdp_session *r_sdp, 1220 const pjmedia_sdp_session *l_sdp, 1221 pjsip_dialog *dlg, 1222 pjsip_endpoint *endpt, 1223 pjsip_tx_data **p_tdata) 1224 { 1225 return pjsip_inv_verify_request3(rdata, rdata->tp_info.pool, 1226 options, r_sdp, l_sdp, dlg, 1227 endpt, p_tdata); 1228 } 1229 1230 1231 /* 1232 * Verify incoming INVITE request. 1233 */ 1201 1234 PJ_DEF(pj_status_t) pjsip_inv_verify_request( pjsip_rx_data *rdata, 1202 1235 unsigned *options, … … 1206 1239 pjsip_tx_data **p_tdata) 1207 1240 { 1208 return pjsip_inv_verify_request2(rdata, options, NULL, l_sdp, dlg, 1241 return pjsip_inv_verify_request3(rdata, rdata->tp_info.pool, 1242 options, NULL, l_sdp, dlg, 1209 1243 endpt, p_tdata); 1210 1244 } … … 2023 2057 pjsip_dlg_dec_lock(inv->dlg); 2024 2058 pj_log_pop_indent(); 2059 return status; 2060 } 2061 2062 2063 /* 2064 * Set local SDP offer/answer. 2065 */ 2066 PJ_DEF(pj_status_t) pjsip_inv_set_local_sdp(pjsip_inv_session *inv, 2067 const pjmedia_sdp_session *sdp ) 2068 { 2069 const pjmedia_sdp_session *offer; 2070 pj_status_t status; 2071 2072 PJ_ASSERT_RETURN(inv && sdp, PJ_EINVAL); 2073 2074 /* If we have remote SDP offer, set local answer to respond to the offer, 2075 * otherwise we set/modify our local offer (and create an SDP negotiator 2076 * if we don't have one yet). 2077 */ 2078 if (inv->neg) { 2079 pjmedia_sdp_neg_state neg_state = pjmedia_sdp_neg_get_state(inv->neg); 2080 2081 if ((neg_state == PJMEDIA_SDP_NEG_STATE_REMOTE_OFFER || 2082 neg_state == PJMEDIA_SDP_NEG_STATE_WAIT_NEGO) && 2083 pjmedia_sdp_neg_get_neg_remote(inv->neg, &offer) == PJ_SUCCESS) 2084 { 2085 status = pjsip_inv_set_sdp_answer(inv, sdp); 2086 } else if (neg_state == PJMEDIA_SDP_NEG_STATE_DONE) { 2087 status = pjmedia_sdp_neg_modify_local_offer(inv->pool, 2088 inv->neg, sdp); 2089 } else 2090 return PJMEDIA_SDPNEG_EINSTATE; 2091 } else { 2092 status = pjmedia_sdp_neg_create_w_local_offer(inv->pool, 2093 sdp, &inv->neg); 2094 } 2095 2025 2096 return status; 2026 2097 } -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r3775 r3777 332 332 */ 333 333 334 /* Outgoing call callback when media transport creation is completed. */ 334 335 static pj_status_t 335 336 on_make_call_med_tp_complete(pjsua_call_id call_id, … … 612 613 call->user_data = user_data; 613 614 615 /* Store variables required for the callback after the async 616 * media transport creation is completed. 617 */ 614 618 call->async_call.call_var.out_call.options = options; 615 619 if (msg_data) { … … 686 690 687 691 692 /* Incoming call callback when media transport creation is completed. */ 693 static pj_status_t 694 on_incoming_call_med_tp_complete(pjsua_call_id call_id, 695 const pjsua_med_tp_state_info *info) 696 { 697 pjsua_call *call = &pjsua_var.calls[call_id]; 698 const pjmedia_sdp_session *offer=NULL; 699 pjmedia_sdp_session *answer; 700 pjsip_tx_data *response = NULL; 701 unsigned options = 0; 702 int sip_err_code = (info? info->sip_err_code: 0); 703 pj_status_t status = (info? info->status: PJ_SUCCESS); 704 705 PJSUA_LOCK(); 706 707 if (status != PJ_SUCCESS) { 708 pjsua_perror(THIS_FILE, "Error initializing media channel", status); 709 goto on_return; 710 } 711 712 /* Get remote SDP offer (if any). */ 713 if (call->inv->neg) 714 pjmedia_sdp_neg_get_neg_remote(call->inv->neg, &offer); 715 716 status = pjsua_media_channel_create_sdp(call_id, 717 call->async_call.dlg->pool, 718 offer, &answer, &sip_err_code); 719 if (status != PJ_SUCCESS) { 720 pjsua_perror(THIS_FILE, "Error creating SDP answer", status); 721 goto on_return; 722 } 723 724 status = pjsip_inv_set_local_sdp(call->inv, answer); 725 if (status != PJ_SUCCESS) { 726 pjsua_perror(THIS_FILE, "Error setting local SDP", status); 727 sip_err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; 728 goto on_return; 729 } 730 731 /* Verify that we can handle the request. */ 732 status = pjsip_inv_verify_request3(NULL, 733 call->inv->pool_prov, &options, offer, 734 answer, NULL, pjsua_var.endpt, &response); 735 if (status != PJ_SUCCESS) { 736 /* 737 * No we can't handle the incoming INVITE request. 738 */ 739 goto on_return; 740 } 741 742 on_return: 743 if (status != PJ_SUCCESS) { 744 pjsip_tx_data *tdata; 745 pj_status_t status_; 746 747 status_ = pjsip_inv_end_session(call->inv, sip_err_code, NULL, &tdata); 748 if (status_ == PJ_SUCCESS && tdata) 749 status_ = pjsip_inv_send_msg(call->inv, tdata); 750 751 pjsua_media_channel_deinit(call->index); 752 } 753 754 /* Set the callback to NULL to indicate that the async operation 755 * has completed. 756 */ 757 call->med_ch_cb = NULL; 758 759 if (status == PJ_SUCCESS && 760 !pj_list_empty(&call->async_call.call_var.inc_call.answers)) 761 { 762 struct call_answer *answer, *next; 763 764 answer = call->async_call.call_var.inc_call.answers.next; 765 while (answer != &call->async_call.call_var.inc_call.answers) { 766 next = answer->next; 767 pjsua_call_answer(call_id, answer->code, answer->reason, 768 answer->msg_data); 769 pj_list_erase(answer); 770 answer = next; 771 } 772 } 773 774 PJSUA_UNLOCK(); 775 return status; 776 } 777 778 688 779 /** 689 780 * Handle incoming INVITE request. … … 704 795 int call_id = -1; 705 796 int sip_err_code; 706 pjmedia_sdp_session *offer=NULL , *answer;797 pjmedia_sdp_session *offer=NULL; 707 798 pj_status_t status; 708 799 … … 865 956 } else { 866 957 offer = NULL; 867 }868 869 /* Init media channel */870 status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAS,871 call->secure_level,872 rdata->tp_info.pool,873 offer,874 &sip_err_code, PJ_FALSE,875 NULL);876 if (status != PJ_SUCCESS) {877 pjsua_perror(THIS_FILE, "Error initializing media channel", status);878 pjsip_endpt_respond(pjsua_var.endpt, NULL, rdata,879 sip_err_code, NULL, NULL, NULL, NULL);880 goto on_return;881 }882 883 /* Create answer */884 status = pjsua_media_channel_create_sdp(call->index, rdata->tp_info.pool,885 offer, &answer, &sip_err_code);886 if (status != PJ_SUCCESS) {887 pjsua_perror(THIS_FILE, "Error creating SDP answer", status);888 pjsip_endpt_respond(pjsua_var.endpt, NULL, rdata,889 sip_err_code, NULL, NULL, NULL, NULL);890 goto on_return;891 958 } 892 959 … … 903 970 options |= PJSIP_INV_ALWAYS_USE_TIMER; 904 971 905 status = pjsip_inv_verify_request2(rdata, &options, offer, answer, NULL,972 status = pjsip_inv_verify_request2(rdata, &options, offer, NULL, NULL, 906 973 pjsua_var.endpt, &response); 907 974 if (status != PJ_SUCCESS) { … … 923 990 } 924 991 925 pjsua_media_channel_deinit(call->index);926 992 goto on_return; 927 993 } 928 929 994 930 995 /* Get suitable Contact header */ … … 939 1004 pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 500, NULL, 940 1005 NULL, NULL); 941 pjsua_media_channel_deinit(call->index);942 1006 goto on_return; 943 1007 } … … 950 1014 pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 500, NULL, 951 1015 NULL, NULL); 952 pjsua_media_channel_deinit(call->index);953 1016 goto on_return; 954 1017 } … … 975 1038 976 1039 /* Create invite session: */ 977 status = pjsip_inv_create_uas( dlg, rdata, answer, options, &inv);1040 status = pjsip_inv_create_uas( dlg, rdata, NULL, options, &inv); 978 1041 if (status != PJ_SUCCESS) { 979 1042 pjsip_hdr hdr_list; … … 995 1058 } 996 1059 1060 /* Create and attach pjsua_var data to the dialog: */ 1061 call->inv = inv; 1062 dlg->mod_data[pjsua_var.mod.id] = call; 1063 inv->mod_data[pjsua_var.mod.id] = call; 1064 1065 /* Store variables required for the callback after the async 1066 * media transport creation is completed. 1067 */ 1068 call->async_call.dlg = dlg; 1069 pj_list_init(&call->async_call.call_var.inc_call.answers); 1070 1071 /* Init media channel */ 1072 status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAS, 1073 call->secure_level, 1074 rdata->tp_info.pool, 1075 offer, 1076 &sip_err_code, PJ_TRUE, 1077 (pjsua_med_tp_state_cb) 1078 &on_incoming_call_med_tp_complete); 1079 if (status == PJ_SUCCESS) { 1080 status = on_incoming_call_med_tp_complete(call_id, NULL); 1081 if (status != PJ_SUCCESS) { 1082 sip_err_code = PJSIP_SC_NOT_ACCEPTABLE; 1083 pjsip_dlg_respond(dlg, rdata, sip_err_code, NULL, NULL, NULL); 1084 goto on_return; 1085 } 1086 } else if (status != PJ_EPENDING) { 1087 pjsua_perror(THIS_FILE, "Error initializing media channel", status); 1088 pjsip_dlg_respond(dlg, rdata, sip_err_code, NULL, NULL, NULL); 1089 goto on_return; 1090 } 1091 1092 /* Create answer */ 1093 /* 1094 status = pjsua_media_channel_create_sdp(call->index, rdata->tp_info.pool, 1095 offer, &answer, &sip_err_code); 1096 if (status != PJ_SUCCESS) { 1097 pjsua_perror(THIS_FILE, "Error creating SDP answer", status); 1098 pjsip_endpt_respond(pjsua_var.endpt, NULL, rdata, 1099 sip_err_code, NULL, NULL, NULL, NULL); 1100 goto on_return; 1101 } 1102 */ 1103 997 1104 /* Init Session Timers */ 998 1105 status = pjsip_timer_init_session(inv, … … 1013 1120 * incoming INVITE! 1014 1121 */ 1015 if (pjsua_var.ua_cfg.nat_type_in_sdp && 1122 if (pjsua_var.ua_cfg.nat_type_in_sdp && inv->neg && 1016 1123 pjmedia_sdp_neg_get_state(inv->neg) > PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER) 1017 1124 { … … 1063 1170 } 1064 1171 } 1065 1066 /* Create and attach pjsua_var data to the dialog: */1067 call->inv = inv;1068 1069 dlg->mod_data[pjsua_var.mod.id] = call;1070 inv->mod_data[pjsua_var.mod.id] = call;1071 1172 1072 1173 ++pjsua_var.call_cnt; … … 1637 1738 if (status != PJ_SUCCESS) 1638 1739 goto on_return; 1740 1741 PJSUA_LOCK(); 1742 /* If media transport creation is not yet completed, we will answer 1743 * the call in the media transport creation callback instead. 1744 */ 1745 if (call->med_ch_cb) { 1746 struct call_answer *answer; 1747 1748 PJ_LOG(4,(THIS_FILE, "Pending answering call %d upon completion " 1749 "of media transport", call_id)); 1750 1751 answer = PJ_POOL_ZALLOC_T(call->inv->pool_prov, struct call_answer); 1752 answer->code = code; 1753 if (reason) { 1754 pj_strdup(call->inv->pool_prov, answer->reason, reason); 1755 } 1756 if (msg_data) { 1757 answer->msg_data = pjsua_msg_data_clone(call->inv->pool_prov, 1758 msg_data); 1759 } 1760 pj_list_push_back(&call->async_call.call_var.inc_call.answers, 1761 answer); 1762 1763 PJSUA_UNLOCK(); 1764 if (dlg) pjsip_dlg_dec_lock(dlg); 1765 pj_log_pop_indent(); 1766 return status; 1767 } 1768 PJSUA_UNLOCK(); 1639 1769 1640 1770 if (call->res_time.sec == 0) -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r3775 r3777 1657 1657 call->med_ch_cb = cb; 1658 1658 if (rem_sdp) { 1659 /* TODO: change rem_sdp to non-const parameter. */1660 1659 call->async_call.rem_sdp = 1661 1660 pjmedia_sdp_session_clone(call->inv->pool_prov, rem_sdp); … … 2113 2112 pjsua_call *call = &pjsua_var.calls[call_id]; 2114 2113 unsigned mi; 2114 2115 for (mi=0; mi<call->med_cnt; ++mi) { 2116 pjsua_call_media *call_med = &call->media[mi]; 2117 2118 if (call_med->tp_st == PJSUA_MED_TP_CREATING) 2119 return PJ_EBUSY; 2120 } 2115 2121 2116 2122 PJ_LOG(4,(THIS_FILE, "Call %d: deinitializing media..", call_id));
Note: See TracChangeset
for help on using the changeset viewer.