Changeset 3330
- Timestamp:
- Oct 1, 2010 2:03:42 AM (14 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r3326 r3330 2042 2042 2043 2043 /** 2044 * This enumeration specifies how we should offer call hold request to 2045 * remote peer. The default value is set by compile time constant 2046 * PJSUA_CALL_HOLD_TYPE_DEFAULT, and application may control the setting 2047 * on per-account basis by manipulating \a call_hold_type field in 2048 * #pjsua_acc_config. 2049 */ 2050 typedef enum pjsua_call_hold_type 2051 { 2052 /** 2053 * This will follow RFC 3264 recommendation to use a=sendonly, 2054 * a=recvonly, and a=inactive attribute as means to signal call 2055 * hold status. This is the correct value to use. 2056 */ 2057 PJSUA_CALL_HOLD_TYPE_RFC3264, 2058 2059 /** 2060 * This will use the old and deprecated method as specified in RFC 2543, 2061 * and will offer c=0.0.0.0 in the SDP instead. Using this has many 2062 * drawbacks such as inability to keep the media transport alive while 2063 * the call is being put on hold, and should only be used if remote 2064 * does not understand RFC 3264 style call hold offer. 2065 */ 2066 PJSUA_CALL_HOLD_TYPE_RFC2543 2067 2068 } pjsua_call_hold_type; 2069 2070 2071 /** 2072 * Specify the default call hold type to be used in #pjsua_acc_config. 2073 * 2074 * Default is PJSUA_CALL_HOLD_TYPE_RFC3264, and there's no reason to change 2075 * this except if you're communicating with an old/non-standard peer. 2076 */ 2077 #ifndef PJSUA_CALL_HOLD_TYPE_DEFAULT 2078 # define PJSUA_CALL_HOLD_TYPE_DEFAULT PJSUA_CALL_HOLD_TYPE_RFC3264 2079 #endif 2080 2081 2082 /** 2044 2083 * This structure describes account configuration to be specified when 2045 2084 * adding a new account with #pjsua_acc_add(). Application MUST initialize … … 2370 2409 pj_bool_t use_stream_ka; 2371 2410 #endif 2411 2412 /** 2413 * Specify how to offer call hold to remote peer. Please see the 2414 * documentation on #pjsua_call_hold_type for more info. 2415 * 2416 * Default: PJSUA_CALL_HOLD_TYPE_DEFAULT 2417 */ 2418 pjsua_call_hold_type call_hold_type; 2372 2419 2373 2420 } pjsua_acc_config; -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h
r3216 r3330 62 62 pjsua_acc_id acc_id; /**< Account index being used. */ 63 63 int secure_level;/**< Signaling security level. */ 64 pjsua_call_hold_type call_hold_type; /**< How to do call hold. */ 64 65 pj_bool_t local_hold;/**< Flag for call-hold by local. */ 65 66 pjsua_call_media_status media_st;/**< Media state. */ -
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 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r3326 r3330 190 190 #endif 191 191 pj_list_init(&cfg->reg_hdr_list); 192 cfg->call_hold_type = PJSUA_CALL_HOLD_TYPE_DEFAULT; 192 193 } 193 194
Note: See TracChangeset
for help on using the changeset viewer.