Changeset 448 for pjproject/trunk/pjsip/src/pjsip/sip_util.c
- Timestamp:
- May 16, 2006 1:20:00 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_util.c
r266 r448 1258 1258 1259 1259 /* 1260 * Send response statefully.1261 */1262 PJ_DEF(pj_status_t) pjsip_endpt_respond( pjsip_endpoint *endpt,1263 pjsip_module *tsx_user,1264 pjsip_rx_data *rdata,1265 int st_code,1266 const pj_str_t *st_text,1267 const pjsip_hdr *hdr_list,1268 const pjsip_msg_body *body,1269 pjsip_transaction **p_tsx )1270 {1271 pj_status_t status;1272 pjsip_tx_data *tdata;1273 pjsip_transaction *tsx;1274 1275 /* Validate arguments. */1276 PJ_ASSERT_RETURN(endpt && rdata, PJ_EINVAL);1277 1278 if (p_tsx) *p_tsx = NULL;1279 1280 /* Create response message */1281 status = pjsip_endpt_create_response( endpt, rdata, st_code, st_text,1282 &tdata);1283 if (status != PJ_SUCCESS)1284 return status;1285 1286 /* Add the message headers, if any */1287 if (hdr_list) {1288 const pjsip_hdr *hdr = hdr_list->next;1289 while (hdr != hdr_list) {1290 pjsip_msg_add_hdr( tdata->msg, pjsip_hdr_clone(tdata->pool, hdr) );1291 hdr = hdr->next;1292 }1293 }1294 1295 /* Add the message body, if any. */1296 if (body) {1297 tdata->msg->body = pjsip_msg_body_clone( tdata->pool, body );1298 if (tdata->msg->body == NULL) {1299 pjsip_tx_data_dec_ref(tdata);1300 return status;1301 }1302 }1303 1304 /* Create UAS transaction. */1305 status = pjsip_tsx_create_uas(tsx_user, rdata, &tsx);1306 if (status != PJ_SUCCESS) {1307 pjsip_tx_data_dec_ref(tdata);1308 return status;1309 }1310 1311 /* Feed the request to the transaction. */1312 pjsip_tsx_recv_msg(tsx, rdata);1313 1314 /* Send the message. */1315 status = pjsip_tsx_send_msg(tsx, tdata);1316 if (status != PJ_SUCCESS) {1317 pjsip_tx_data_dec_ref(tdata);1318 } else if (p_tsx) {1319 *p_tsx = tsx;1320 }1321 1322 return status;1323 }1324 1325 1326 /*1327 1260 * Get the event string from the event ID. 1328 1261 */
Note: See TracChangeset
for help on using the changeset viewer.