shraddha k vaishanani
shraddha k vaishanani

Reputation: 454

How to implement pjsip video call in ios

Implement audio call using pjsip working proper but not working video call.

i applied following changes :

//Sip init

pj_status_t sip_startup(app_config_t *app_config) 
{

pjsua_config cfg;
pjsua_config_default (&cfg);

cfg.cb.on_incoming_call = &on_incoming_call;
cfg.cb.on_call_media_state = &on_call_media_state;
cfg.cb.on_call_state = &on_call_state;
cfg.cb.on_reg_state2 = &on_reg_state2;
cfg.cb.on_call_media_event = &on_call_media_event;

// Init the logging config structure
pjsua_logging_config log_cfg;
pjsua_logging_config_default(&log_cfg);
log_cfg.console_level = 4;

// Init PJ Media
pjsua_media_config me_cfg;
pjsua_media_config_default(&me_cfg);


// Init the pjsua
status = pjsua_init(&cfg, &log_cfg, &me_cfg);
if (status != PJ_SUCCESS) error_exit("Error in pjsua_init()", status);

}

//following code add when apply sip connection

pjsua_call_setting _call_setting;
 pjsua_call_setting_default(&_call_setting);

_call_setting.aud_cnt = 1;
_call_setting.vid_cnt = 1;

//when press call button from app call this funtion for video call.

pj_status_t sip_dial(pjsua_acc_id acc_id, const char *number, 
 pjsua_call_id *call_id)
{
    pj_status_t status;
    pj_str_t uri = pj_str(destUri);

     status = pjsua_call_make_call(_acc_id, &uri, &(_call_setting), 
     NULL, NULL, NULL);
     if (status != PJ_SUCCESS) 
     error_exit("Error making call",  status);
}

//Apply changes related to video code

static void on_call_media_state(pjsua_call_id call_id)
{
   pjsua_call_info ci;

   unsigned mi;

    pjsua_call_get_info(call_id, &ci);
    sip_ring_stop([SharedAppDelegate.aVoipManager pjsipConfig]);

    if(ci.media_status == PJMEDIA_TYPE_VIDEO)
    {
       NSLog(@"windows id : %d",ci.media[mi].stream.vid.win_in);
       NSLog(@"media id : %d",mi);
       if (ci.media_status != PJSUA_CALL_MEDIA_ACTIVE)
         return;
         [[XCPjsua sharedXCPjsua] 
         displayWindow:ci.media[mi].stream.vid.win_in];

    }
}

i applied above code but not place video call using pjsip.

Any one have idea or steps related to video call then please help me.

Thank you

Upvotes: 2

Views: 2361

Answers (1)

Shane Powell
Shane Powell

Reputation: 14148

This subject is too large, I think you need to refine your questions to a smaller more specific question if you wish to get a good answer.

Make sure you have read and understood the pjsip video support: PJSip Video_Users_Guide PJSIP IOS Video Support

I would look for what other people have done (even if it's on another platform, e.g. Android, Windows, etc.) and the look into the pjsip pjsua sample which I believe has video support but I'm not sure if it support ios video.

Get a known good examples of pjsip video calls going so you know that it looks like and what the logs look like when it works.

Then try against your ios code against the known good example clients to see where they differ. If you can't figure it out at least you should have enough info to be able to ask a more specific question about a specific situation that is not working for you.

Upvotes: 3

Related Questions