Changeset 2032 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
- Timestamp:
- Jun 19, 2008 2:10:28 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r2027 r2032 213 213 214 214 215 #define LATE_SDP 0216 217 215 /* Allocate one call id */ 218 216 static pjsua_call_id alloc_call_id(void) … … 288 286 } 289 287 288 /* 290 289 static int call_get_secure_level(pjsua_call *call) 291 290 { … … 317 316 return 0; 318 317 } 318 */ 319 319 320 320 … … 450 450 /* Init media channel */ 451 451 status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC, 452 call->secure_level, NULL); 452 call->secure_level, dlg->pool, 453 NULL, NULL); 453 454 if (status != PJ_SUCCESS) { 454 455 pjsua_perror(THIS_FILE, "Error initializing media channel", status); … … 456 457 } 457 458 458 /* Create SDP offer */ 459 #if LATE_SDP 460 offer = NULL; 461 #else 462 status = pjsua_media_channel_create_sdp(call->index, dlg->pool, NULL, 459 /* Create offer */ 460 status = pjsua_media_channel_create_sdp(call->index, dlg->pool, NULL, 463 461 &offer, NULL); 464 462 if (status != PJ_SUCCESS) { 465 pjsua_perror(THIS_FILE, " pjmedia unable to create SDP", status);463 pjsua_perror(THIS_FILE, "Error initializing media channel", status); 466 464 goto on_error; 467 465 } 468 #endif469 466 470 467 /* Create the INVITE session: */ … … 719 716 call->secure_level = 0; 720 717 721 /* Init media channel */722 status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAS,723 call->secure_level, &sip_err_code);724 if (status != PJ_SUCCESS) {725 pjsua_perror(THIS_FILE, "Error initializing media channel", status);726 pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata,727 sip_err_code, NULL,728 NULL, NULL);729 PJSUA_UNLOCK();730 return PJ_TRUE;731 }732 733 718 /* Parse SDP from incoming request */ 734 719 if (rdata->msg_info.msg->body) { … … 740 725 pjsua_perror(THIS_FILE, "Error parsing SDP in incoming INVITE", 741 726 status); 742 pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 400, &reason, 743 NULL, NULL); 744 pjsua_media_channel_deinit(call->index); 727 pjsip_endpt_respond(pjsua_var.endpt, NULL, rdata, 400, 728 &reason, NULL, NULL, NULL); 745 729 PJSUA_UNLOCK(); 746 730 return PJ_TRUE; … … 762 746 } 763 747 764 /* Get media capability from media endpoint: */ 748 /* Init media channel */ 749 status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAS, 750 call->secure_level, 751 rdata->tp_info.pool, offer, 752 &sip_err_code); 753 if (status != PJ_SUCCESS) { 754 pjsua_perror(THIS_FILE, "Error initializing media channel", status); 755 pjsip_endpt_respond(pjsua_var.endpt, NULL, rdata, 756 sip_err_code, NULL, NULL, NULL, NULL); 757 PJSUA_UNLOCK(); 758 return PJ_TRUE; 759 } 760 761 /* Create answer */ 765 762 status = pjsua_media_channel_create_sdp(call->index, rdata->tp_info.pool, 766 763 offer, &answer, &sip_err_code); 767 764 if (status != PJ_SUCCESS) { 768 765 pjsua_perror(THIS_FILE, "Error creating SDP answer", status); 769 pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 770 sip_err_code, NULL, 771 NULL, NULL); 772 pjsua_media_channel_deinit(call->index); 766 pjsip_endpt_respond(pjsua_var.endpt, NULL, rdata, 767 sip_err_code, NULL, NULL, NULL, NULL); 773 768 PJSUA_UNLOCK(); 774 769 return PJ_TRUE; 775 770 } 771 776 772 777 773 /* Verify that we can handle the request. */ … … 795 791 796 792 } else { 797 798 793 /* Respond with 500 (Internal Server Error) */ 799 pjsip_endpt_respond _stateless(pjsua_var.endpt, rdata, 500, NULL,800 794 pjsip_endpt_respond(pjsua_var.endpt, NULL, rdata, 500, NULL, 795 NULL, NULL, NULL); 801 796 } 802 797 … … 1475 1470 } 1476 1471 1477 /* Update call secure level */1478 call->secure_level = call_get_secure_level(call);1479 1480 /* Init media channel */1481 status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC,1482 call->secure_level, NULL);1483 if (status != PJ_SUCCESS) {1484 pjsua_perror(THIS_FILE, "Error initializing media channel", status);1485 pjsip_dlg_dec_lock(dlg);1486 return PJSIP_ESESSIONSTATE;1487 }1488 1489 1472 /* Create SDP */ 1490 1473 PJ_UNUSED_ARG(unhold); … … 1548 1531 return status; 1549 1532 1550 /* Update call's secure level */1551 call->secure_level = call_get_secure_level(call);1552 1553 /* Init media channel */1554 status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC,1555 call->secure_level, NULL);1556 if (status != PJ_SUCCESS) {1557 pjsua_perror(THIS_FILE, "Error initializing media channel", status);1558 pjsip_dlg_dec_lock(dlg);1559 return PJSIP_ESESSIONSTATE;1560 }1561 1562 1533 /* Create SDP */ 1563 1534 status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, … … 1570 1541 } 1571 1542 1572 /* Create re-INVITE with new offer */ 1543 update_sdp_version(call, sdp); 1544 1545 /* Create UPDATE with new offer */ 1573 1546 status = pjsip_inv_update(call->inv, NULL, sdp, &tdata); 1574 1547 if (status != PJ_SUCCESS) { … … 2538 2511 { 2539 2512 pjsua_call *call; 2540 const pjmedia_sdp_session *c_local; 2541 pjmedia_sdp_session *local_sdp; 2513 const pjmedia_sdp_session *local_sdp; 2542 2514 const pjmedia_sdp_session *remote_sdp; 2543 2515 … … 2568 2540 2569 2541 /* Get local and remote SDP */ 2570 status = pjmedia_sdp_neg_get_active_local(call->inv->neg, & c_local);2542 status = pjmedia_sdp_neg_get_active_local(call->inv->neg, &local_sdp); 2571 2543 if (status != PJ_SUCCESS) { 2572 2544 pjsua_perror(THIS_FILE, … … 2577 2549 return; 2578 2550 } 2579 local_sdp = (pjmedia_sdp_session*) c_local;2580 2551 2581 2552 status = pjmedia_sdp_neg_get_active_remote(call->inv->neg, &remote_sdp); … … 2713 2684 call->index)); 2714 2685 2715 /* Update call's secure level */2716 call->secure_level = call_get_secure_level(call);2717 2718 /* Init media channel */2719 status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAS,2720 call->secure_level, NULL);2721 if (status != PJ_SUCCESS) {2722 pjsua_perror(THIS_FILE, "Error initializing media channel", status);2723 PJSUA_UNLOCK();2724 return;2725 }2726 2727 2686 status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, 2728 2687 offer, &answer, NULL); … … 2768 2727 PJ_LOG(4,(THIS_FILE, "Call %d: asked to send a new offer", 2769 2728 call->index)); 2770 2771 /* Update call's secure level */2772 call->secure_level = call_get_secure_level(call);2773 2774 /* Init media channel */2775 status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC,2776 call->secure_level, NULL);2777 if (status != PJ_SUCCESS) {2778 pjsua_perror(THIS_FILE, "Error initializing media channel", status);2779 PJSUA_UNLOCK();2780 return;2781 }2782 2729 2783 2730 status = pjsua_media_channel_create_sdp(call->index, call->inv->pool,
Note: See TracChangeset
for help on using the changeset viewer.