コード例 #1
0
ファイル: unimrcp_client.c プロジェクト: odmanV2/freecenter
/** Load MRCPv2 profile */
static apt_bool_t unimrcp_client_mrcpv2_profile_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id, const char *tag)
{
	const apr_xml_elem *elem;
	mrcp_client_profile_t *profile;
	mrcp_sa_factory_t *sa_factory = NULL;
	mrcp_ca_factory_t *ca_factory = NULL;
	mpf_engine_factory_t *mpf_factory = NULL;
	mpf_termination_factory_t *rtp_factory = NULL;
	mpf_rtp_settings_t *rtp_settings = NULL;
	mrcp_sig_settings_t *sip_settings = NULL;

	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv2 Profile <%s>",id);
	for(elem = root->first_child; elem; elem = elem->next) {
		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);

		if(is_cdata_valid(elem) == FALSE) {
			continue;
		}

		if(strcasecmp(elem->name,"sip-uac") == 0) {
			sa_factory = unimrcp_client_sa_factory_create(loader,elem);
		}
		else if(strcasecmp(elem->name,"mrcpv2-uac") == 0) {
			ca_factory = unimrcp_client_ca_factory_create(loader,elem);
		}
		else if(strcasecmp(elem->name,"media-engine") == 0) {
			mpf_factory = unimrcp_client_mpf_factory_create(loader,elem);
		}
		else if(strcasecmp(elem->name,"rtp-factory") == 0) {
			rtp_factory = mrcp_client_rtp_factory_get(loader->client,cdata_text_get(elem));
		}
		else if(strcasecmp(elem->name,"sip-settings") == 0) {
			sip_settings = mrcp_client_signaling_settings_get(loader->client,cdata_text_get(elem));
		}
		else if(strcasecmp(elem->name,"rtp-settings") == 0) {
			rtp_settings = mrcp_client_rtp_settings_get(loader->client,cdata_text_get(elem));
		}
		else {
			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
		}
	}

	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv2 Profile [%s]",id);
	profile = mrcp_client_profile_create_ex(
		MRCP_VERSION_2,NULL,
		sa_factory,ca_factory,
		mpf_factory,rtp_factory,
		rtp_settings,sip_settings,
		loader->pool);
	if(tag) {
		mrcp_client_profile_tag_set(profile,tag);
	}
	return mrcp_client_profile_register(loader->client,profile,id);
}
コード例 #2
0
ファイル: unimrcp_client.c プロジェクト: Jared-Prime/UniMRCP
/** Load MRCPv1 profile */
static apt_bool_t unimrcp_client_mrcpv1_profile_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id)
{
	const apr_xml_elem *elem;
	mrcp_profile_t *profile;
	mrcp_sig_agent_t *rtsp_agent = NULL;
	mpf_engine_t *media_engine = NULL;
	mpf_termination_factory_t *rtp_factory = NULL;
	mpf_rtp_settings_t *rtp_settings = NULL;
	mrcp_sig_settings_t *rtsp_settings = NULL;

	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv1 Profile <%s>",id);
	for(elem = root->first_child; elem; elem = elem->next) {
		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);

		if(is_cdata_valid(elem) == FALSE) {
			continue;
		}

		if(strcasecmp(elem->name,"rtsp-uac") == 0) {
			rtsp_agent = mrcp_client_signaling_agent_get(loader->client,cdata_text_get(elem));
		}
		else if(strcasecmp(elem->name,"media-engine") == 0) {
			media_engine = mrcp_client_media_engine_get(loader->client,cdata_text_get(elem));
		}
		else if(strcasecmp(elem->name,"rtp-factory") == 0) {
			rtp_factory = mrcp_client_rtp_factory_get(loader->client,cdata_text_get(elem));
		}
		else if(strcasecmp(elem->name,"rtsp-settings") == 0) {
			rtsp_settings = mrcp_client_signaling_settings_get(loader->client,cdata_text_get(elem));
		}
		else if(strcasecmp(elem->name,"rtp-settings") == 0) {
			rtp_settings = mrcp_client_rtp_settings_get(loader->client,cdata_text_get(elem));
		}
		else {
			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
		}
	}

	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv1 Profile [%s]",id);
	profile = mrcp_client_profile_create(
		NULL,rtsp_agent,NULL,
		media_engine,rtp_factory,
		rtp_settings,rtsp_settings,
		loader->pool);
	return mrcp_client_profile_register(loader->client,profile,id);
}