pjsip

pjsip 视频通话 语音通话基础上增加 

pj_status_t status;

        pj_str_tdest_uri =pj_str((char*)targetUri.UTF8String);


        self.sipState = kSIP_STATE_CALLING_COTACT_CENTRE;

        pjsua_vid_preview_param parm;

        pjsua_vid_preview_param_default(&parm);

        _call_id=0;

        parm.rend_id = PJMEDIA_VID_DEFAULT_RENDER_DEV;

        parm.show=PJ_TRUE;

        pj_status_t r = pjsua_vid_preview_start(PJMEDIA_VID_DEFAULT_CAPTURE_DEV,&parm);


        if(r ==PJ_SUCCESS) {


            NSLog(@"视频预览功能");

        }


        pjsua_acc_config cfg;

        pjsua_acc_config_default(&cfg);

        cfg.vid_in_auto_show = PJ_TRUE;

        cfg.vid_cap_dev=PJ_TRUE;

        pjsua_vid_win_id wid;


        intvid_idx;

        vid_idx =pjsua_call_get_vid_stream_idx(_call_id);

        if(vid_idx >=0) {

            pjsua_call_infoci;


            pjsua_call_get_info(_call_id, &ci);

            wid = ci.media[vid_idx].stream.vid.win_in;

        }

        /* Make call to the URL. */

        pjsua_call_setting call_opt;

        call_opt.flag = PJSUA_CALL_INCLUDE_DISABLED_MEDIA;

        call_opt.vid_cnt=1;

        arrange_window(PJSUA_INVALID_ID);


        pjsua_call_setting_default(&call_opt);


        constpjmedia_orientpj_ori[4] =

        {

            PJMEDIA_ORIENT_ROTATE_90DEG,  /* UIDeviceOrientationPortrait */

            PJMEDIA_ORIENT_ROTATE_270DEG, /* UIDeviceOrientationPortraitUpsideDown */

            PJMEDIA_ORIENT_ROTATE_180DEG, /* UIDeviceOrientationLandscapeLeft,

                                           home button on the right side */

            PJMEDIA_ORIENT_NATURAL        /* UIDeviceOrientationLandscapeRight,

                                           home button on the left side */

        };

        staticpj_thread_desca_thread_desc;

        staticpj_thread_t*a_thread;

        UIDeviceOrientation dev_ori = [[UIDevice currentDevice] orientation];

        inti;


        if (dev_ori >= UIDeviceOrientationPortrait &&

            dev_ori <=UIDeviceOrientationLandscapeRight)

        {

            if (!pj_thread_is_registered()) {

                pj_thread_register("ipjsua", a_thread_desc, &a_thread);

            }


            /* Here we set the orientation for all video devices.

             * This may return failure for renderer devices or for

             * capture devices which do not support orientation setting,

             * we can simply ignore them.

             */

            for(i =pjsua_vid_dev_count()-1; i >=0; i--) {

                pjsua_vid_dev_set_setting(i, PJMEDIA_VID_DEV_CAP_ORIENTATION,

                                          &pj_ori[dev_ori-1],PJ_TRUE);

            }

        }

        status =pjsua_call_make_call(acct_id, &dest_uri, &call_opt,NULL,NULL, &_call_id);

        if(status !=PJ_SUCCESS) {

            char  errMessage[PJ_ERR_MSG_SIZE];

            pj_strerror(status, errMessage,sizeof(errMessage));

            NSLog(@"外拨错误, 错误信息:%d(%s) !", status, errMessage);

        }

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。