Changeset 4920


Ignore:
Timestamp:
Sep 9, 2014 8:31:37 AM (10 years ago)
Author:
ming
Message:

Fixed #1785: Add support for sending initial INVITE/re-INVITE/UPDATE without SDP

Location:
pjproject/trunk/pjsip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r4889 r4920  
    871871    /** 
    872872     * Notify application when call has received new offer from remote 
    873      * (i.e. re-INVITE/UPDATE with SDP is received). Application can 
     873     * (i.e. re-INVITE/UPDATE with SDP is received, or from the 
     874     * INVITE response in the case that the initial outgoing INVITE 
     875     * has no SDP). Application can 
    874876     * decide to accept/reject the offer by setting the code (default 
    875877     * is 200). If the offer is accepted, application can update the  
     
    41064108     * for #pjsua_call_make_call(). 
    41074109     */ 
    4108     PJSUA_CALL_INCLUDE_DISABLED_MEDIA = 4 
     4110    PJSUA_CALL_INCLUDE_DISABLED_MEDIA = 4, 
     4111     
     4112    /** 
     4113     * Do not send SDP when sending INVITE or UPDATE. This flag is only valid 
     4114     * for #pjsua_call_make_call(), #pjsua_call_reinvite()/reinvite2(), or 
     4115     * #pjsua_call_update()/update2(). For re-invite/update, specifying 
     4116     * PJSUA_CALL_UNHOLD will take precedence over this flag. 
     4117     */ 
     4118    PJSUA_CALL_NO_SDP_OFFER = 8 
    41094119 
    41104120} pjsua_call_flag; 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r4856 r4920  
    364364                             const pjsua_med_tp_state_info *info) 
    365365{ 
    366     pjmedia_sdp_session *offer; 
     366    pjmedia_sdp_session *offer = NULL; 
    367367    pjsip_inv_session *inv = NULL; 
    368368    pjsua_call *call = &pjsua_var.calls[call_id]; 
     
    412412 
    413413    /* Create offer */ 
    414     status = pjsua_media_channel_create_sdp(call->index, dlg->pool, NULL, 
    415                                             &offer, NULL); 
    416     if (status != PJ_SUCCESS) { 
    417         pjsua_perror(THIS_FILE, "Error initializing media channel", status); 
    418         goto on_error; 
     414    if ((call->opt.flag & PJSUA_CALL_NO_SDP_OFFER) == 0) { 
     415        status = pjsua_media_channel_create_sdp(call->index, dlg->pool, NULL, 
     416                                                &offer, NULL); 
     417        if (status != PJ_SUCCESS) { 
     418            pjsua_perror(THIS_FILE, "Error initializing media channel", status); 
     419            goto on_error; 
     420        } 
    419421    } 
    420422 
     
    582584    call->opt = *opt; 
    583585 
    584     /* If call is established, reinit media channel */ 
    585     if (call->inv && call->inv->state == PJSIP_INV_STATE_CONFIRMED) { 
     586    /* If call is established or media channel hasn't been initialized, 
     587     * reinit media channel. 
     588     */ 
     589    if ((call->inv && call->inv->state == PJSIP_INV_STATE_CONNECTING && 
     590         call->med_cnt == 0) || 
     591        (call->inv && call->inv->state == PJSIP_INV_STATE_CONFIRMED)) 
     592    { 
    586593        pjsip_role_e role = rem_sdp? PJSIP_ROLE_UAS : PJSIP_ROLE_UAC; 
    587594        pj_status_t status; 
     
    619626    pj_str_t contact; 
    620627    pj_status_t status; 
    621  
    622628 
    623629    /* Check that account is valid */ 
     
    680686        goto on_error; 
    681687    } 
    682  
     688     
    683689    /* Create temporary pool */ 
    684690    tmp_pool = pjsua_pool_create("tmpcall10", 512, 256); 
     
    766772    pjsip_dlg_inc_session(dlg, &pjsua_var.mod); 
    767773 
    768     /* Init media channel */ 
    769     status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC, 
    770                                       call->secure_level, dlg->pool, 
    771                                       NULL, NULL, PJ_TRUE, 
    772                                       &on_make_call_med_tp_complete); 
     774    if ((call->opt.flag & PJSUA_CALL_NO_SDP_OFFER) == 0) { 
     775        /* Init media channel */ 
     776        status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC, 
     777                                          call->secure_level, dlg->pool, 
     778                                          NULL, NULL, PJ_TRUE, 
     779                                          &on_make_call_med_tp_complete); 
     780    } 
    773781    if (status == PJ_SUCCESS) { 
    774782        status = on_make_call_med_tp_complete(call->index, NULL); 
     
    23842392                                         const pjsua_msg_data *msg_data) 
    23852393{ 
    2386     pjmedia_sdp_session *sdp; 
     2394    pjmedia_sdp_session *sdp = NULL; 
    23872395    pj_str_t *new_contact = NULL; 
    23882396    pjsip_tx_data *tdata; 
     
    24232431    if (call->local_hold && (call->opt.flag & PJSUA_CALL_UNHOLD)==0) { 
    24242432        status = create_sdp_of_call_hold(call, &sdp); 
    2425     } else { 
     2433    } else if ((call->opt.flag & PJSUA_CALL_NO_SDP_OFFER) == 0) { 
    24262434        status = pjsua_media_channel_create_sdp(call->index, 
    24272435                                                call->inv->pool_prov, 
     
    24982506                                       const pjsua_msg_data *msg_data) 
    24992507{ 
    2500     pjmedia_sdp_session *sdp; 
     2508    pjmedia_sdp_session *sdp = NULL; 
    25012509    pj_str_t *new_contact = NULL; 
    25022510    pjsip_tx_data *tdata; 
     
    25302538    if (call->local_hold && (call->opt.flag & PJSUA_CALL_UNHOLD)==0) { 
    25312539        status = create_sdp_of_call_hold(call, &sdp); 
    2532     } else { 
     2540    } else if ((call->opt.flag & PJSUA_CALL_NO_SDP_OFFER) == 0) { 
    25332541        status = pjsua_media_channel_create_sdp(call->index, 
    25342542                                                call->inv->pool_prov, 
Note: See TracChangeset for help on using the changeset viewer.