Changeset 160 for pjproject/trunk/pjsip/src/pjsua/pjsua_core.c
- Timestamp:
- Feb 8, 2006 10:44:25 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua/pjsua_core.c
r147 r160 102 102 static pj_bool_t mod_pjsua_on_rx_request(pjsip_rx_data *rdata) 103 103 { 104 PJ_UNUSED_ARG(rdata); 105 PJ_TODO(IMPLEMENT_UAS); 104 pjsip_dialog *dlg = pjsip_rdata_get_dlg(rdata); 105 pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata); 106 pjsip_msg *msg = rdata->msg_info.msg; 107 108 /* 109 * Handle incoming INVITE outside dialog. 110 */ 111 if (dlg == NULL && tsx == NULL && 112 msg->line.req.method.id == PJSIP_INVITE_METHOD) 113 { 114 pj_status_t status; 115 pjsip_tx_data *response = NULL; 116 unsigned options = 0; 117 118 /* Verify that we can handle the request. */ 119 status = pjsip_inv_verify_request(rdata, &options, NULL, NULL, 120 pjsua.endpt, &response); 121 if (status != PJ_SUCCESS) { 122 123 /* 124 * No we can't handle the incoming INVITE request. 125 */ 126 127 if (response) { 128 pjsip_response_addr res_addr; 129 130 pjsip_get_response_addr(response->pool, rdata, &res_addr); 131 pjsip_endpt_send_response(pjsua.endpt, &res_addr, response, 132 NULL, NULL); 133 134 } else { 135 136 /* Respond with 500 (Internal Server Error) */ 137 pjsip_endpt_respond_stateless(pjsua.endpt, rdata, 500, NULL, 138 NULL, NULL); 139 } 140 141 } else { 142 /* 143 * Yes we can handle the incoming INVITE request. 144 */ 145 pjsip_inv_session *inv; 146 pjmedia_sdp_session *answer; 147 148 /* Create dummy SDP answer: */ 149 150 151 status = pjmedia_sdp_parse(pjsua.pool, PJSUA_DUMMY_SDP_ANSWER, 152 pj_native_strlen(PJSUA_DUMMY_SDP_ANSWER), 153 &answer); 154 if (status != PJ_SUCCESS) { 155 156 pjsip_endpt_respond_stateless(pjsua.endpt, rdata, 500, NULL, 157 NULL, NULL); 158 return PJ_TRUE; 159 } 160 161 /* Create dialog: */ 162 163 status = pjsip_dlg_create_uas( pjsip_ua_instance(), rdata, 164 &pjsua.contact_uri, &dlg); 165 if (status != PJ_SUCCESS) 166 return PJ_TRUE; 167 168 169 /* Create invite session: */ 170 171 status = pjsip_inv_create_uas( dlg, rdata, answer, 0, &inv); 172 if (status != PJ_SUCCESS) { 173 174 status = pjsip_dlg_create_response( dlg, rdata, 500, NULL, 175 &response); 176 if (status == PJ_SUCCESS) 177 status = pjsip_dlg_send_response(dlg, 178 pjsip_rdata_get_tsx(rdata), 179 response); 180 return PJ_TRUE; 181 182 } 183 184 /* Answer with 100 (using the dialog, not invite): */ 185 186 status = pjsip_dlg_create_response(dlg, rdata, 100, NULL, &response); 187 if (status == PJ_SUCCESS) 188 status = pjsip_dlg_send_response(dlg, pjsip_rdata_get_tsx(rdata), response); 189 } 190 191 /* This INVITE request has been handled. */ 192 return PJ_TRUE; 193 } 194 195 196 106 197 return PJ_FALSE; 107 198 } … … 122 213 { 123 214 PJ_UNUSED_ARG(rdata); 124 PJ_TODO(IMPLEMENT_UAS);125 215 return PJ_FALSE; 126 216 }
Note: See TracChangeset
for help on using the changeset viewer.