当前位置: 首页>>代码示例>>C++>>正文


C++ MRCP_SESSION_NAMESID函数代码示例

本文整理汇总了C++中MRCP_SESSION_NAMESID函数的典型用法代码示例。如果您正苦于以下问题:C++ MRCP_SESSION_NAMESID函数的具体用法?C++ MRCP_SESSION_NAMESID怎么用?C++ MRCP_SESSION_NAMESID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MRCP_SESSION_NAMESID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mrcp_app_control_message_raise

static apt_bool_t mrcp_app_control_message_raise(mrcp_client_session_t *session, mrcp_channel_t *channel, mrcp_message_t *mrcp_message)
{
	if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
		mrcp_app_message_t *response;
		mrcp_message_t *mrcp_request;
		if(!session->active_request || !session->active_request->control_message) {
			return FALSE;
		}
		response = mrcp_client_app_response_create(session->active_request,0,session->base.pool);
		mrcp_request = session->active_request->control_message;
		mrcp_message->start_line.method_id = mrcp_request->start_line.method_id;
		mrcp_message->start_line.method_name = mrcp_request->start_line.method_name;
		response->control_message = mrcp_message;
		apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App MRCP Response "APT_NAMESID_FMT, 
			MRCP_SESSION_NAMESID(session));
		session->application->handler(response);

		session->active_request = apt_list_pop_front(session->request_queue);
		if(session->active_request) {
			mrcp_app_request_dispatch(session,session->active_request);
		}
	}
	else if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
		mrcp_app_message_t *app_message;
		app_message = mrcp_client_app_control_message_create(session->base.pool);
		app_message->control_message = mrcp_message;
		app_message->application = session->application;
		app_message->session = &session->base;
		app_message->channel = channel;
		apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App MRCP Event "APT_NAMESID_FMT, 
			MRCP_SESSION_NAMESID(session));
		session->application->handler(app_message);
	}
	return TRUE;
}
开发者ID:JESalois,项目名称:telephony-unimrcp,代码行数:35,代码来源:mrcp_client_session.c

示例2: mrcp_client_message_send

static apt_bool_t mrcp_client_message_send(mrcp_client_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
{
	if(!session->base.id.length) {
		mrcp_message_t *response = mrcp_response_create(message,message->pool);
		response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
		apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Raise App Failure MRCP Response "APT_NAMESID_FMT, 
			MRCP_SESSION_NAMESID(session));
		mrcp_app_control_message_raise(session,channel,response);
		return TRUE;
	}

	message->channel_id.session_id = session->base.id;
	message->start_line.request_id = ++session->base.last_request_id;
	apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Send MRCP Request "APT_NAMESIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
					MRCP_SESSION_NAMESID(session),
					channel->resource->name.buf,
					message->start_line.request_id);

	if(channel->control_channel) {
		/* MRCPv2 */
		mrcp_client_control_message_send(channel->control_channel,message);
	}
	else {
		/* MRCPv1 */
		mrcp_session_control_request(channel->session,message);
	}

	return TRUE;
}
开发者ID:JESalois,项目名称:telephony-unimrcp,代码行数:29,代码来源:mrcp_client_session.c

示例3: mrcp_app_failure_message_raise

static apt_bool_t mrcp_app_failure_message_raise(mrcp_client_session_t *session)
{
	mrcp_app_message_t *response;
	const mrcp_app_message_t *request = session->active_request;
	if(!request) {
		return FALSE;
	}
	session->active_request = NULL;
	response = mrcp_client_app_response_create(request,session->status,session->base.pool);
	if(response->message_type == MRCP_APP_MESSAGE_TYPE_SIGNALING) {
		apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App Response "APT_NAMESID_FMT" [%d] %s [%d]",
			MRCP_SESSION_NAMESID(session),
			response->sig_message.command_id,
			session->status == MRCP_SIG_STATUS_CODE_SUCCESS ? "SUCCESS" : "FAILURE",
			session->status);
	}
	else if(response->control_message){
		mrcp_message_t *mrcp_response = mrcp_response_create(response->control_message,response->control_message->pool);
		mrcp_response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
		response->control_message = mrcp_response;
		apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App MRCP Response "APT_NAMESID_FMT, 
			MRCP_SESSION_NAMESID(session));
	}
	session->application->handler(response);
	return TRUE;
}
开发者ID:JESalois,项目名称:telephony-unimrcp,代码行数:26,代码来源:mrcp_client_session.c

示例4: mrcp_server_channel_create

static mrcp_channel_t* mrcp_server_channel_create(mrcp_server_session_t *session, const apt_str_t *resource_name, apr_size_t id, apr_array_header_t *cmid_arr)
{
	mrcp_channel_t *channel;
	apr_pool_t *pool = session->base.pool;

	channel = apr_palloc(pool,sizeof(mrcp_channel_t));
	channel->pool = pool;
	channel->session = &session->base;
	channel->resource = NULL;
	channel->control_channel = NULL;
	channel->state_machine = NULL;
	channel->engine_channel = NULL;
	channel->id = id;
	channel->cmid_arr = cmid_arr;
	channel->waiting_for_channel = FALSE;
	channel->waiting_for_termination = FALSE;

	if(resource_name && resource_name->buf) {
		mrcp_resource_t *resource;
		mrcp_engine_channel_t *engine_channel;
		resource = mrcp_resource_find(session->profile->resource_factory,resource_name);
		if(resource) {
			channel->resource = resource;
			if(mrcp_session_version_get(session) == MRCP_VERSION_2) {
				channel->control_channel = mrcp_server_control_channel_create(
									session->profile->connection_agent,
									channel,
									pool);
			}
			engine_channel = mrcp_server_engine_channel_create(session,channel,resource_name);
			if(engine_channel) {
				engine_channel->id = session->base.id;
				engine_channel->event_obj = channel;
				engine_channel->event_vtable = &engine_channel_vtable;
				channel->engine_channel = engine_channel;
			}
			else {
				apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Engine Channel "APT_NAMESID_FMT" [%s]",
					MRCP_SESSION_NAMESID(session),
					resource_name->buf);
				session->answer->status = MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE;
			}
		}
		else {
			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Resource "APT_NAMESID_FMT" [%s]",
				MRCP_SESSION_NAMESID(session),
				resource_name->buf);
			session->answer->status = MRCP_SESSION_STATUS_NO_SUCH_RESOURCE;
		}
	}
	else {
		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Resource Identifier "APT_NAMESID_FMT,
			MRCP_SESSION_NAMESID(session));
		session->answer->status = MRCP_SESSION_STATUS_NO_SUCH_RESOURCE;
	}

	return channel;
}
开发者ID:Jared-Prime,项目名称:UniMRCP,代码行数:58,代码来源:mrcp_server_session.c

示例5: mrcp_client_on_termination_subtract

static apt_bool_t mrcp_client_on_termination_subtract(mrcp_client_session_t *session, const mpf_message_t *mpf_message)
{
	rtp_termination_slot_t *termination_slot;
	if(!session) {
		return FALSE;
	}
	apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Media Termination Subtracted "APT_NAMESIDRES_FMT, 
		MRCP_SESSION_NAMESID(session),
		mpf_termination_name_get(mpf_message->termination));
	termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination);
	if(termination_slot) {
		/* rtp termination */
		if(termination_slot->waiting == FALSE) {
			return FALSE;
		}
		termination_slot->waiting = FALSE;
		if(mrcp_client_session_subrequest_remove(session) == TRUE) {
			mrcp_app_session_terminate_raise(session,MRCP_SIG_STATUS_CODE_SUCCESS);
		}
	}
	else {
		/* channel termination */
		mrcp_channel_t *channel = mrcp_client_channel_termination_find(session,mpf_message->termination);
		if(channel && channel->waiting_for_termination == TRUE) {
			channel->waiting_for_termination = FALSE;
			if(mrcp_client_session_subrequest_remove(session) == TRUE) {
				/* raise app response */
				mrcp_app_sig_response_raise(session,TRUE);
			}
		}
	}
	return TRUE;
}
开发者ID:JESalois,项目名称:telephony-unimrcp,代码行数:33,代码来源:mrcp_client_session.c

示例6: mrcp_server_engine_channel_create

static mrcp_engine_channel_t* mrcp_server_engine_channel_create(
								mrcp_server_session_t *session,
								mrcp_channel_t *channel, 
								const apt_str_t *resource_name)
{
	mrcp_engine_t *engine = apr_hash_get(
									session->profile->engine_table,
									resource_name->buf,
									resource_name->length);
	if(!engine) {
		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find MRCP Engine "APT_NAMESID_FMT" [%s]",
			MRCP_SESSION_NAMESID(session),
			resource_name->buf);
		return NULL;
	}

	channel->state_machine = engine->create_state_machine(
						channel,
						mrcp_session_version_get(session),
						channel->pool);
	if(channel->state_machine) {
		channel->state_machine->on_dispatch = state_machine_on_message_dispatch;
		channel->state_machine->on_deactivate = state_machine_on_deactivate;
	}

	return mrcp_engine_channel_virtual_create(engine,mrcp_session_version_get(session),session->base.pool);
}
开发者ID:Jared-Prime,项目名称:UniMRCP,代码行数:27,代码来源:mrcp_server_session.c

示例7: mrcp_client_channel_create

mrcp_channel_t* mrcp_client_channel_create(
					mrcp_client_session_t *session,
					mrcp_resource_t *resource,
					mpf_termination_t *termination,
					mpf_rtp_termination_descriptor_t *rtp_descriptor,
					void *obj)
{
	mrcp_channel_t *channel = apr_palloc(session->base.pool,sizeof(mrcp_channel_t));
	channel->pool = session->base.pool;
	channel->obj = obj;
	channel->session = &session->base;
	channel->control_channel = NULL;
	channel->termination = termination;
	channel->rtp_termination_slot = NULL;
	channel->resource = resource;
	channel->waiting_for_channel = FALSE;
	channel->waiting_for_termination = FALSE;

	if(rtp_descriptor) {
		rtp_termination_slot_t *termination_slot = apr_palloc(channel->pool,sizeof(rtp_termination_slot_t));
		termination_slot->descriptor = rtp_descriptor;
		termination_slot->termination = NULL;
		termination_slot->waiting = FALSE;
		termination_slot->channel = channel;
		termination_slot->id = 0;
		channel->rtp_termination_slot = termination_slot;
	}
	apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Create Channel "APT_NAMESID_FMT,
		MRCP_SESSION_NAMESID(session));
	return channel;
}
开发者ID:JESalois,项目名称:telephony-unimrcp,代码行数:31,代码来源:mrcp_client_session.c

示例8: mrcp_app_sig_response_raise

static apt_bool_t mrcp_app_sig_response_raise(mrcp_client_session_t *session, apt_bool_t process_pending_requests)
{
	mrcp_app_message_t *response;
	const mrcp_app_message_t *request = session->active_request;
	if(!request) {
		return FALSE;
	}
	session->active_request = NULL;
	if(session->disconnected == TRUE) {
		session->status = MRCP_SIG_STATUS_CODE_TERMINATE;
	}
	response = mrcp_client_app_response_create(request,session->status,session->base.pool);
	apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App Response " APT_NAMESID_FMT " [%d] %s [%d]", 
		MRCP_SESSION_NAMESID(session),
		response->sig_message.command_id,
		session->status == MRCP_SIG_STATUS_CODE_SUCCESS ? "SUCCESS" : "FAILURE",
		session->status);
	session->application->handler(response);

	if(process_pending_requests) {
		session->active_request = apt_list_pop_front(session->request_queue);
		if(session->active_request) {
			mrcp_app_request_dispatch(session,session->active_request);
		}
	}
	return TRUE;
}
开发者ID:unispeech,项目名称:unimrcp,代码行数:27,代码来源:mrcp_client_session.c

示例9: mrcp_server_resource_offer_process

static apt_bool_t mrcp_server_resource_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor)
{
	if(descriptor->resource_state == TRUE) {
		/* setup */
		mrcp_channel_t *channel;
		int count = session->channels->nelts;
		channel = mrcp_server_channel_find(session,&descriptor->resource_name);
		if(channel) {
			/* channel already exists */
			return TRUE;
		}
		/* create new MRCP channel instance */
		channel = mrcp_server_channel_create(session,&descriptor->resource_name,count,NULL);
		if(!channel || !channel->resource) {
			return FALSE;
		}
		/* add to channel array */
		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Control Channel "APT_NAMESIDRES_FMT" [%d]",
			MRCP_SESSION_NAMESID(session),
			channel->resource->name.buf,
			count);
		APR_ARRAY_PUSH(session->channels,mrcp_channel_t*) = channel;
		if(channel->engine_channel && channel->engine_channel->termination) {
			mpf_termination_t *termination = channel->engine_channel->termination;
			/* send add termination request (add to media context) */
			if(mpf_engine_termination_message_add(
					session->profile->media_engine,
					MPF_ADD_TERMINATION,session->context,termination,NULL,
					&session->mpf_task_msg) == TRUE) {
				channel->waiting_for_termination = TRUE;
				mrcp_server_session_subrequest_add(session);
			}
		}
	}
开发者ID:Jared-Prime,项目名称:UniMRCP,代码行数:34,代码来源:mrcp_server_session.c

示例10: mrcp_client_on_termination_modify

static apt_bool_t mrcp_client_on_termination_modify(mrcp_client_session_t *session, const mpf_message_t *mpf_message)
{
	rtp_termination_slot_t *termination_slot;
	if(!session) {
		return FALSE;
	}
	apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Media Termination Modified "APT_NAMESIDRES_FMT, 
		MRCP_SESSION_NAMESID(session),
		mpf_termination_name_get(mpf_message->termination));
	termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination);
	if(termination_slot) {
		/* rtp termination */
		if(termination_slot->waiting == FALSE) {
			return FALSE;
		}
		termination_slot->waiting = FALSE;
		termination_slot->descriptor = mpf_message->descriptor;;

		if(mrcp_client_session_subrequest_remove(session) == TRUE) {
			if(session->state == SESSION_STATE_GENERATING_OFFER) {
				/* send offer to server */
				mrcp_client_session_offer_send(session);
			}
			else if(session->state == SESSION_STATE_PROCESSING_ANSWER) {
				/* raise app response */
				mrcp_app_sig_response_raise(session,TRUE);
			}
		}
	}
	return TRUE;
}
开发者ID:JESalois,项目名称:telephony-unimrcp,代码行数:31,代码来源:mrcp_client_session.c

示例11: mrcp_server_on_engine_channel_close

apt_bool_t mrcp_server_on_engine_channel_close(mrcp_channel_t *channel)
{
	mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session;
	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Engine Channel Closed "APT_NAMESIDRES_FMT,
			MRCP_SESSION_NAMESID(session),
			channel->resource->name.buf);
	mrcp_server_session_subrequest_remove(session);
	return TRUE;
}
开发者ID:Jared-Prime,项目名称:UniMRCP,代码行数:9,代码来源:mrcp_server_session.c

示例12: mrcp_client_session_update

static apt_bool_t mrcp_client_session_update(mrcp_client_session_t *session)
{
	if(!session->offer) {
		return FALSE;
	}
	apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Update Session "APT_NAMESID_FMT, 
		MRCP_SESSION_NAMESID(session));
	return mrcp_client_session_offer_send(session);
}
开发者ID:JESalois,项目名称:telephony-unimrcp,代码行数:9,代码来源:mrcp_client_session.c

示例13: mrcp_client_mpf_message_process

apt_bool_t mrcp_client_mpf_message_process(mpf_message_container_t *mpf_message_container)
{
	apr_size_t i;
	mrcp_client_session_t *session;
	const mpf_message_t *mpf_message;
	for(i=0; i<mpf_message_container->count; i++) {
		mpf_message = &mpf_message_container->messages[i];
		if(mpf_message->context) {
			session = mpf_engine_context_object_get(mpf_message->context);
		}
		else {
			session = NULL;
		}
		if(!session) {
			apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Received MPF Message: NULL session");
			continue;
		}
		if(mpf_message->message_type == MPF_MESSAGE_TYPE_RESPONSE) {
			switch(mpf_message->command_id) {
				case MPF_ADD_TERMINATION:
					mrcp_client_on_termination_add(session,mpf_message);
					break;
				case MPF_MODIFY_TERMINATION:
					mrcp_client_on_termination_modify(session,mpf_message);
					break;
				case MPF_SUBTRACT_TERMINATION:
					mrcp_client_on_termination_subtract(session,mpf_message);
					break;
				case MPF_ADD_ASSOCIATION:
				case MPF_REMOVE_ASSOCIATION:
				case MPF_RESET_ASSOCIATIONS:
				case MPF_APPLY_TOPOLOGY:
				case MPF_DESTROY_TOPOLOGY:
					if(mrcp_client_session_subrequest_remove(session) == TRUE) {
						if(session->state == SESSION_STATE_GENERATING_OFFER) {
							/* send offer to server */
							mrcp_client_session_offer_send(session);
						}
						else if(session->state == SESSION_STATE_PROCESSING_ANSWER) {
							/* raise app response */
							mrcp_app_sig_response_raise(session,TRUE);
						}
					}
					break;
				default:
					break;
			}
		}
		else if(mpf_message->message_type == MPF_MESSAGE_TYPE_EVENT) {
			apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Process MPF Event " APT_NAMESID_FMT,
				MRCP_SESSION_NAMESID(session));
		}
	}
	return TRUE;
}
开发者ID:unispeech,项目名称:unimrcp,代码行数:55,代码来源:mrcp_client_session.c

示例14: mrcp_client_session_terminate_event_process

apt_bool_t mrcp_client_session_terminate_event_process(mrcp_client_session_t *session)
{
	if(session->state == SESSION_STATE_TERMINATING) {
		/* session termination request has been sent, still waiting for the response,
		   all the events must be ignored at this stage */
		apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Unexpected Event! " APT_NAMESID_FMT, 
			MRCP_SESSION_NAMESID(session));
		return FALSE;
	}

	apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Mark Session as Disconnected " APT_NAMESID_FMT,
		MRCP_SESSION_NAMESID(session));
	session->disconnected = TRUE;
	if(!session->active_request) {
		/* raise app event */
		mrcp_app_sig_event_raise(session,NULL);
	}

	return TRUE;
}
开发者ID:unispeech,项目名称:unimrcp,代码行数:20,代码来源:mrcp_client_session.c

示例15: mrcp_client_av_media_answer_process

static apt_bool_t mrcp_client_av_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor)
{
	rtp_termination_slot_t *slot;
	int i;
	int count = session->terminations->nelts;
	if(count != descriptor->audio_media_arr->nelts) {
		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of terminations [%d] != Number of audio media in answer [%d]",
			count,descriptor->audio_media_arr->nelts);
		count = descriptor->audio_media_arr->nelts;
	}
	
	/* update existing terminations */
	for(i=0; i<count; i++) {
		mpf_rtp_media_descriptor_t *remote_media;
		mpf_rtp_termination_descriptor_t *rtp_descriptor;
		/* get existing termination */
		slot = &APR_ARRAY_IDX(session->terminations,i,rtp_termination_slot_t);
		if(!slot) continue;

		remote_media = mrcp_session_audio_media_get(descriptor,i);
		if(slot->descriptor) {
			slot->descriptor->audio.remote = remote_media;
		}
		if(slot->termination) {
			/* construct termination descriptor */
			rtp_descriptor = apr_palloc(session->base.pool,sizeof(mpf_rtp_termination_descriptor_t));
			mpf_rtp_termination_descriptor_init(rtp_descriptor);
			rtp_descriptor->audio.local = NULL;
			rtp_descriptor->audio.remote = remote_media;

			/* send modify termination request */
			apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Modify Media Termination "APT_NAMESIDRES_FMT, 
				MRCP_SESSION_NAMESID(session),
				mpf_termination_name_get(slot->termination));
			if(mpf_engine_termination_message_add(
					session->profile->media_engine,
					MPF_MODIFY_TERMINATION,session->context,slot->termination,rtp_descriptor,
					&session->mpf_task_msg) == TRUE) {
				slot->waiting = TRUE;
				mrcp_client_session_subrequest_add(session);
			}
			if(slot->channel && slot->channel->termination) {
				if(mpf_engine_assoc_message_add(
						session->profile->media_engine,
						MPF_ADD_ASSOCIATION,session->context,slot->termination,slot->channel->termination,
						&session->mpf_task_msg) == TRUE) {
					mrcp_client_session_subrequest_add(session);
				}
			}
		}
	}
	return TRUE;
}
开发者ID:JESalois,项目名称:telephony-unimrcp,代码行数:53,代码来源:mrcp_client_session.c


注:本文中的MRCP_SESSION_NAMESID函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。