Ignore:
Timestamp:
Dec 7, 2011 10:43:28 AM (12 years ago)
Author:
nanang
Message:

Re #1234: Initial version of keyframe request/response via SIP INFO.

File:
1 edited

Legend:

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

    r3892 r3901  
    3535#define LOCK_CODEC_MAX_RETRY         5 
    3636 
     37 
     38/* 
     39 * The INFO method. 
     40 */ 
     41const pjsip_method pjsip_info_method =  
     42{ 
     43    PJSIP_OTHER_METHOD, 
     44    { "INFO", 4 } 
     45}; 
     46 
     47 
    3748/* This callback receives notification from invite session when the 
    3849 * session state has changed. 
     
    501512#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0) 
    502513    opt->video_cnt = 1; 
    503     //{ 
    504     //  unsigned i; 
    505     //  for (i = 0; i < PJ_ARRAY_SIZE(opt->vid_cap_dev); ++i) 
    506     //      opt->vid_cap_dev[i] = PJMEDIA_VID_DEFAULT_CAPTURE_DEV; 
    507     //} 
     514    opt->req_keyframe_method = PJSUA_VID_REQ_KEYFRAME_SIP_INFO | 
     515                             PJSUA_VID_REQ_KEYFRAME_RTCP_PLI; 
    508516#endif 
    509517} 
     
    41914199                      call->index, tsx->status_code)); 
    41924200        } 
     4201    } else if (tsx->role==PJSIP_ROLE_UAS && 
     4202        tsx->state==PJSIP_TSX_STATE_TRYING && 
     4203        pjsip_method_cmp(&tsx->method, &pjsip_info_method)==0) 
     4204    { 
     4205        /* 
     4206         * Incoming INFO request for media control. 
     4207         */ 
     4208        const pj_str_t STR_APPLICATION       = { "application", 11}; 
     4209        const pj_str_t STR_MEDIA_CONTROL_XML = { "media_control+xml", 17 }; 
     4210        pjsip_rx_data *rdata = e->body.tsx_state.src.rdata; 
     4211        pjsip_msg_body *body = rdata->msg_info.msg->body; 
     4212 
     4213        if (body && body->len && 
     4214            pj_stricmp(&body->content_type.type, &STR_APPLICATION)==0 && 
     4215            pj_stricmp(&body->content_type.subtype, &STR_MEDIA_CONTROL_XML)==0) 
     4216        { 
     4217            pjsip_tx_data *tdata; 
     4218            pj_str_t control_st; 
     4219            pj_status_t status; 
     4220 
     4221            /* Apply and answer the INFO request */ 
     4222            pj_strset(&control_st, (char*)body->data, body->len); 
     4223            status = pjsua_media_apply_xml_control(call->index, &control_st); 
     4224            if (status == PJ_SUCCESS) { 
     4225                status = pjsip_endpt_create_response(tsx->endpt, rdata, 
     4226                                                     200, NULL, &tdata); 
     4227                if (status == PJ_SUCCESS) 
     4228                    status = pjsip_tsx_send_msg(tsx, tdata); 
     4229            } else { 
     4230                status = pjsip_endpt_create_response(tsx->endpt, rdata, 
     4231                                                     400, NULL, &tdata); 
     4232                if (status == PJ_SUCCESS) 
     4233                    status = pjsip_tsx_send_msg(tsx, tdata); 
     4234            } 
     4235        } 
    41934236    } 
    41944237 
Note: See TracChangeset for help on using the changeset viewer.