Ignore:
Timestamp:
Sep 15, 2007 8:30:16 AM (17 years ago)
Author:
bennylp
Message:

Ticket #370: Implemented callback notification to application when ICE negotiation fails (via on_call_media_state callback)

File:
1 edited

Legend:

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

    r1417 r1435  
    538538 
    539539 
     540/* This callback is called when ICE negotiation completes */ 
     541static void on_ice_complete(pjmedia_transport *tp, pj_status_t result) 
     542{ 
     543    unsigned id, c; 
     544    pj_bool_t found = PJ_FALSE; 
     545 
     546    /* We're only interested with failure case */ 
     547    if (result == PJ_SUCCESS) 
     548        return; 
     549 
     550    /* Find call which has this media transport */ 
     551 
     552    PJSUA_LOCK(); 
     553 
     554    for (id=0, c=0; id<PJSUA_MAX_CALLS && c<pjsua_var.call_cnt; ++id) { 
     555        pjsua_call *call = &pjsua_var.calls[id]; 
     556        if (call->inv) { 
     557            ++c; 
     558 
     559            if (call->med_tp == tp) { 
     560                call->media_st = PJSUA_CALL_MEDIA_ERROR; 
     561                call->media_dir = PJMEDIA_DIR_NONE; 
     562                found = PJ_TRUE; 
     563                break; 
     564            } 
     565        } 
     566    } 
     567 
     568    PJSUA_UNLOCK(); 
     569 
     570    if (found && pjsua_var.ua_cfg.cb.on_call_media_state) { 
     571        pjsua_var.ua_cfg.cb.on_call_media_state(id); 
     572    } 
     573} 
     574 
     575 
    540576/* Create ICE media transports (when ice is enabled) */ 
    541577static pj_status_t create_ice_media_transports(pjsua_transport_config *cfg) 
     
    557593    for (i=0; i<pjsua_var.ua_cfg.max_calls; ++i) { 
    558594        pj_ice_strans_comp comp; 
     595        pjmedia_ice_cb ice_cb; 
    559596        int next_port; 
    560597#if PJMEDIA_ADVERTISE_RTCP 
     
    564601#endif 
    565602 
     603        pj_bzero(&ice_cb, sizeof(pjmedia_ice_cb)); 
     604        ice_cb.on_ice_complete = &on_ice_complete; 
     605 
    566606        status = pjmedia_ice_create(pjsua_var.med_endpt, NULL, COMP_CNT, 
    567                                     &pjsua_var.stun_cfg,  
     607                                    &pjsua_var.stun_cfg, &ice_cb, 
    568608                                    &pjsua_var.calls[i].med_tp); 
    569609        if (status != PJ_SUCCESS) { 
Note: See TracChangeset for help on using the changeset viewer.