Ignore:
Timestamp:
Jun 20, 2007 10:03:46 AM (15 years ago)
Author:
bennylp
Message:

More on ticket #399: a)send full offer on 200/OK response when re-INVITE does not have SDP, b) added on_create_offer() callback, c) handle some error cases

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r1291 r1379  
    5151 
    5252/* 
     53 * Called to generate new offer. 
     54 */ 
     55static void pjsua_call_on_create_offer(pjsip_inv_session *inv, 
     56                                       pjmedia_sdp_session **offer); 
     57 
     58/* 
    5359 * This callback is called when transaction state has changed in INVITE 
    5460 * session. We use this to trap: 
     
    119125    inv_cb.on_media_update = &pjsua_call_on_media_update; 
    120126    inv_cb.on_rx_offer = &pjsua_call_on_rx_offer; 
     127    inv_cb.on_create_offer = &pjsua_call_on_create_offer; 
    121128    inv_cb.on_tsx_state_changed = &pjsua_call_on_tsx_state_changed; 
    122129 
     
    22962303 
    22972304/* 
     2305 * Called to generate new offer. 
     2306 */ 
     2307static void pjsua_call_on_create_offer(pjsip_inv_session *inv, 
     2308                                       pjmedia_sdp_session **offer) 
     2309{ 
     2310    pjsua_call *call; 
     2311    pj_status_t status; 
     2312 
     2313    PJSUA_LOCK(); 
     2314 
     2315    call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id]; 
     2316 
     2317    /* See if we've put call on hold. */ 
     2318    if (call->media_st == PJSUA_CALL_MEDIA_LOCAL_HOLD) { 
     2319        PJ_LOG(4,(THIS_FILE,  
     2320                  "Call %d: call is on-hold locally, creating inactive SDP ", 
     2321                  call->index)); 
     2322        status = create_inactive_sdp( call, offer ); 
     2323    } else { 
     2324 
     2325        PJ_LOG(4,(THIS_FILE, "Call %d: asked to send a new offer", 
     2326                  call->index)); 
     2327 
     2328        /* Init media channel */ 
     2329        status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC); 
     2330        if (status != PJ_SUCCESS) { 
     2331            pjsua_perror(THIS_FILE, "Error initializing media channel", status); 
     2332            PJSUA_UNLOCK(); 
     2333            return; 
     2334        } 
     2335 
     2336        status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, offer); 
     2337    } 
     2338 
     2339    if (status != PJ_SUCCESS) { 
     2340        pjsua_perror(THIS_FILE, "Unable to create local SDP", status); 
     2341        PJSUA_UNLOCK(); 
     2342        return; 
     2343    } 
     2344 
     2345 
     2346    PJSUA_UNLOCK(); 
     2347} 
     2348 
     2349 
     2350/* 
    22982351 * Callback called by event framework when the xfer subscription state 
    22992352 * has changed. 
Note: See TracChangeset for help on using the changeset viewer.