Changeset 3330 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
- Timestamp:
- Oct 1, 2010 2:03:42 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r3305 r3330 83 83 /* Create SDP for call hold. */ 84 84 static pj_status_t create_sdp_of_call_hold(pjsua_call *call, 85 pjmedia_sdp_session **p_ answer);85 pjmedia_sdp_session **p_sdp); 86 86 87 87 /* … … 405 405 /* Associate session with account */ 406 406 call->acc_id = acc_id; 407 call->call_hold_type = acc->cfg.call_hold_type; 407 408 408 409 /* Create temporary pool */ … … 759 760 */ 760 761 acc_id = call->acc_id = pjsua_acc_find_for_incoming(rdata); 762 call->call_hold_type = pjsua_var.acc[acc_id].cfg.call_hold_type; 761 763 762 764 /* Get call's secure level */ … … 3574 3576 3575 3577 3576 /* Create SDP for call hold. */ 3577 static pj_status_t create_sdp_of_call_hold(pjsua_call *call, 3578 pjmedia_sdp_session **p_answer) 3579 { 3580 pj_status_t status; 3581 pj_pool_t *pool; 3582 pjmedia_sdp_session *sdp; 3583 3584 /* Use call's provisional pool */ 3585 pool = call->inv->pool_prov; 3586 3587 /* Create new offer */ 3588 status = pjsua_media_channel_create_sdp(call->index, pool, NULL, &sdp, 3589 NULL); 3590 if (status != PJ_SUCCESS) { 3591 pjsua_perror(THIS_FILE, "Unable to create local SDP", status); 3592 return status; 3593 } 3594 3578 /* Modify SDP for call hold. */ 3579 static pj_status_t modify_sdp_of_call_hold(pjsua_call *call, 3580 pj_pool_t *pool, 3581 pjmedia_sdp_session *sdp) 3582 { 3595 3583 /* Call-hold is done by set the media direction to 'sendonly' 3596 3584 * (PJMEDIA_DIR_ENCODING), except when current media direction is … … 3601 3589 if (call->media_dir != PJMEDIA_DIR_ENCODING) { 3602 3590 */ 3603 if (1) { 3591 /* https://trac.pjsip.org/repos/ticket/1142: 3592 * configuration to use c=0.0.0.0 for call hold. 3593 */ 3594 if (call->call_hold_type == PJSUA_CALL_HOLD_TYPE_RFC2543) { 3595 pjmedia_sdp_conn *conn; 3596 pjmedia_sdp_attr *attr; 3597 3598 /* Get SDP media connection line */ 3599 conn = sdp->media[0]->conn; 3600 if (!conn) 3601 conn = sdp->conn; 3602 3603 /* Modify address */ 3604 conn->addr = pj_str("0.0.0.0"); 3605 3606 /* Remove existing directions attributes */ 3607 pjmedia_sdp_media_remove_all_attr(sdp->media[0], "sendrecv"); 3608 pjmedia_sdp_media_remove_all_attr(sdp->media[0], "sendonly"); 3609 pjmedia_sdp_media_remove_all_attr(sdp->media[0], "recvonly"); 3610 pjmedia_sdp_media_remove_all_attr(sdp->media[0], "inactive"); 3611 3612 /* Add inactive attribute */ 3613 attr = pjmedia_sdp_attr_create(pool, "inactive", NULL); 3614 pjmedia_sdp_media_add_attr(sdp->media[0], attr); 3615 3616 3617 } else { 3604 3618 pjmedia_sdp_attr *attr; 3605 3619 … … 3621 3635 } 3622 3636 3623 *p_answer = sdp; 3624 3625 return status; 3637 return PJ_SUCCESS; 3638 } 3639 3640 /* Create SDP for call hold. */ 3641 static pj_status_t create_sdp_of_call_hold(pjsua_call *call, 3642 pjmedia_sdp_session **p_sdp) 3643 { 3644 pj_status_t status; 3645 pj_pool_t *pool; 3646 pjmedia_sdp_session *sdp; 3647 3648 /* Use call's provisional pool */ 3649 pool = call->inv->pool_prov; 3650 3651 /* Create new offer */ 3652 status = pjsua_media_channel_create_sdp(call->index, pool, NULL, &sdp, 3653 NULL); 3654 if (status != PJ_SUCCESS) { 3655 pjsua_perror(THIS_FILE, "Unable to create local SDP", status); 3656 return status; 3657 } 3658 3659 status = modify_sdp_of_call_hold(call, pool, sdp); 3660 if (status != PJ_SUCCESS) 3661 return status; 3662 3663 *p_sdp = sdp; 3664 3665 return PJ_SUCCESS; 3626 3666 } 3627 3667 … … 3668 3708 /* Check if call is on-hold */ 3669 3709 if (call->local_hold) { 3670 pjmedia_sdp_attr *attr; 3671 3672 /* Remove existing directions attributes */ 3673 pjmedia_sdp_media_remove_all_attr(answer->media[0], "sendrecv"); 3674 pjmedia_sdp_media_remove_all_attr(answer->media[0], "sendonly"); 3675 pjmedia_sdp_media_remove_all_attr(answer->media[0], "recvonly"); 3676 pjmedia_sdp_media_remove_all_attr(answer->media[0], "inactive"); 3677 3678 /* Keep call on-hold by setting 'sendonly' attribute. 3679 * (See RFC 3264 Section 8.4 and RFC 4317 Section 3.1) 3680 */ 3681 attr = pjmedia_sdp_attr_create(call->inv->pool_prov, "sendonly", NULL); 3682 pjmedia_sdp_media_add_attr(answer->media[0], attr); 3710 modify_sdp_of_call_hold(call, call->inv->pool_prov, answer); 3683 3711 } 3684 3712
Note: See TracChangeset
for help on using the changeset viewer.