您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ switch_channel_get_name函数代码示例

51自学网 2021-06-03 08:35:00
  C++
这篇教程C++ switch_channel_get_name函数代码示例写得很实用,希望能帮到您。

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

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

示例1: loopback_bowout_on_execute_state_handler

static switch_status_t loopback_bowout_on_execute_state_handler(switch_core_session_t *session){	switch_channel_t *channel = switch_core_session_get_channel(session);	switch_channel_state_t state = switch_channel_get_state(channel);	private_t *tech_pvt = NULL;	if (state == CS_EXECUTE) {		const char *uuid;		switch_core_session_t *other_session = NULL;		switch_channel_t *b_channel = NULL;		tech_pvt = switch_core_session_get_private(session);		if (switch_core_session_read_lock(tech_pvt->other_session) == SWITCH_STATUS_SUCCESS) {			b_channel = switch_core_session_get_channel(tech_pvt->other_session);			/* Wait for b_channel to be fully bridged */			switch_channel_wait_for_flag(b_channel, CF_BRIDGED, SWITCH_TRUE, 5000, NULL);			uuid = switch_channel_get_partner_uuid(b_channel);			if (uuid && (other_session = switch_core_session_locate(uuid))) {				switch_channel_t *other_channel = switch_core_session_get_channel(other_session);				switch_caller_profile_t *cp, *clone;				switch_channel_wait_for_state(other_channel, NULL, CS_EXCHANGE_MEDIA);				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->other_session), SWITCH_LOG_INFO, "Replacing loopback channel: %s with real channel: %s/n",								  switch_channel_get_name(b_channel), switch_channel_get_name(other_channel));				if ((cp = switch_channel_get_caller_profile(channel))) {					clone = switch_caller_profile_clone(other_session, cp);					clone->originator_caller_profile = NULL;					clone->originatee_caller_profile = NULL;					switch_channel_set_caller_profile(other_channel, clone);				}				switch_channel_caller_extension_masquerade(channel, other_channel, 0);				switch_channel_set_state(other_channel, CS_RESET);				switch_channel_wait_for_state(other_channel, NULL, CS_RESET);				switch_channel_set_variable(channel, "process_cdr", "false");				switch_channel_set_variable(b_channel, "process_cdr", "false");				switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);				switch_channel_set_state(other_channel, CS_EXECUTE);				switch_core_session_rwunlock(other_session);			}			switch_core_session_rwunlock(tech_pvt->other_session);		}				switch_core_event_hook_remove_state_change(session, loopback_bowout_on_execute_state_handler);	}	return SWITCH_STATUS_SUCCESS;}
开发者ID:hsaid,项目名称:FreeSWITCH,代码行数:56,


示例2: switch_core_standard_on_hangup

static void switch_core_standard_on_hangup(switch_core_session_t *session){	switch_caller_extension_t *extension;	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard HANGUP, cause: %s/n",					  switch_channel_get_name(session->channel), switch_channel_cause2str(switch_channel_get_cause(session->channel)));		if (!switch_channel_test_flag(session->channel, CF_ZOMBIE_EXEC)) {		return;	}	if ((extension = switch_channel_get_caller_extension(session->channel)) == 0) {		return;	}	while(extension->current_application) {		switch_caller_application_t *current_application = extension->current_application;		switch_status_t status;		extension->current_application = extension->current_application->next;		status = switch_core_session_execute_application(session,														 current_application->application_name, current_application->application_data);														 				if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_IGNORE) {			return;		}	}}
开发者ID:AricGod,项目名称:FreeSWITCH,代码行数:32,


示例3: channel_on_hibernate

static switch_status_t channel_on_hibernate(switch_core_session_t *session){	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s HIBERNATE/n",					  switch_channel_get_name(switch_core_session_get_channel(session)));	return SWITCH_STATUS_SUCCESS;}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:8,


示例4: channel_on_reset

static switch_status_t channel_on_reset(switch_core_session_t *session){	private_t *tech_pvt = (private_t *) switch_core_session_get_private(session);	switch_assert(tech_pvt != NULL);	do_reset(tech_pvt);	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s RESET/n",					  switch_channel_get_name(switch_core_session_get_channel(session)));	return SWITCH_STATUS_SUCCESS;}
开发者ID:gujun,项目名称:sscore,代码行数:11,


示例5: channel_write_frame

static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id){    ftdm_wait_flag_t wflags = FTDM_WRITE;    ctdm_private_t *tech_pvt;    const char *name;    switch_channel_t *channel;    uint32_t span_id, chan_id;    ftdm_size_t len;    unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0};        channel = switch_core_session_get_channel(session);	assert(channel != NULL);		tech_pvt = switch_core_session_get_private(session);	assert(tech_pvt != NULL);    	span_id = ftdm_channel_get_span_id(tech_pvt->ftdm_channel);	chan_id = ftdm_channel_get_id(tech_pvt->ftdm_channel);    	name = switch_channel_get_name(channel);           if (switch_test_flag(frame, SFF_CNG)) {		frame->data = data;		frame->buflen = sizeof(data);		if ((frame->datalen = tech_pvt->write_codec.implementation->encoded_bytes_per_packet) > frame->buflen) {			goto fail;		}		memset(data, 255, frame->datalen);	}        wflags = FTDM_WRITE;		ftdm_channel_wait(tech_pvt->ftdm_channel, &wflags, ftdm_channel_get_io_interval(tech_pvt->ftdm_channel) * 10);		if (!(wflags & FTDM_WRITE)) {		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Dropping frame! (write not ready) in channel %s device %d:%d!/n", name, span_id, chan_id);		return SWITCH_STATUS_SUCCESS;	}    	len = frame->datalen;	if (ftdm_channel_write(tech_pvt->ftdm_channel, frame->data, frame->buflen, &len) != FTDM_SUCCESS) {		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Failed to write to channel %s device %d:%d!/n", name, span_id, chan_id);	}        return SWITCH_STATUS_SUCCESS;fail:    return SWITCH_STATUS_GENERR;}
开发者ID:Catorpilor,项目名称:FreeSWITCH,代码行数:48,


示例6: switch_core_standard_on_execute

static void switch_core_standard_on_execute(switch_core_session_t *session){	switch_caller_extension_t *extension;	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard EXECUTE/n", switch_channel_get_name(session->channel));	if (switch_channel_get_variable(session->channel, "recovered") && !switch_channel_test_flag(session->channel, CF_RECOVERED)) {		switch_channel_set_flag(session->channel, CF_RECOVERED);	}  top:	switch_channel_clear_flag(session->channel, CF_RESET);		if ((extension = switch_channel_get_caller_extension(session->channel)) == 0) {		switch_channel_hangup(session->channel, SWITCH_CAUSE_NORMAL_CLEARING);		return;	}	while (switch_channel_get_state(session->channel) == CS_EXECUTE && extension->current_application) {		switch_caller_application_t *current_application = extension->current_application;		extension->current_application = extension->current_application->next;		if (switch_core_session_execute_application(session,													current_application->application_name,													current_application->application_data) != SWITCH_STATUS_SUCCESS) {			return;		}		if (switch_channel_test_flag(session->channel, CF_RESET)) {			goto top;		}	}	if (switch_channel_ready(session->channel) && switch_channel_get_state(session->channel) == CS_EXECUTE) {		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "%s has executed the last dialplan instruction, hanging up./n",						  switch_channel_get_name(session->channel));		switch_channel_hangup(session->channel, SWITCH_CAUSE_NORMAL_CLEARING);	}}
开发者ID:kgrofelnik,项目名称:mod_portaudio-endpoints,代码行数:41,


示例7: SWITCH_DECLARE

SWITCH_DECLARE(switch_status_t) switch_core_media_bug_close(switch_media_bug_t **bug){	switch_media_bug_t *bp = *bug;	if (bp) {		if ((bp->thread_id && bp->thread_id != switch_thread_self()) || switch_test_flag(bp, SMBF_LOCK)) {			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(*bug)), SWITCH_LOG_DEBUG, "BUG is thread locked skipping./n");			return SWITCH_STATUS_FALSE;		}		if (bp->callback) {			bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_CLOSE);			bp->ready = 0;		}		switch_core_media_bug_destroy(bp);		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(*bug)), SWITCH_LOG_DEBUG, "Removing BUG from %s/n",						  switch_channel_get_name(bp->session->channel));		*bug = NULL;		return SWITCH_STATUS_SUCCESS;	}	return SWITCH_STATUS_FALSE;}
开发者ID:benlangfeld,项目名称:FreeSWITCH,代码行数:22,


示例8: SWITCH_DECLARE

SWITCH_DECLARE(void) CoreSession::destroy(void){	this_check_void();		if (!allocated) {		return;	}	allocated = 0;	switch_safe_free(xml_cdr_text);	switch_safe_free(uuid);		switch_safe_free(tts_name);	switch_safe_free(voice_name);	if (session) {		if (!channel) {			channel = switch_core_session_get_channel(session);		}		if (channel) {			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 							  "%s destroy/unlink session from object/n", switch_channel_get_name(channel));			switch_channel_set_private(channel, "CoreSession", NULL);			if (switch_channel_up(channel) && switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {				switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);			}		}        switch_core_session_rwunlock(session);		session = NULL;		channel = NULL;    }	init_vars();	}
开发者ID:gujun,项目名称:sscore,代码行数:37,


示例9: SWITCH_DECLARE

SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_core_session_t *session, switch_codec_t *codec){	switch_event_t *event;	switch_channel_t *channel = switch_core_session_get_channel(session);	char tmp[30];	switch_status_t status = SWITCH_STATUS_SUCCESS;	int changed_read_codec = 0;	switch_mutex_lock(session->codec_read_mutex);	if (codec && (!codec->implementation || !switch_core_codec_ready(codec))) {		codec = NULL;	}	if (codec) {		/* set real_read_codec and read_codec */		if (!session->real_read_codec) {			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Original read codec set to %s:%d/n",							  switch_channel_get_name(session->channel), codec->implementation->iananame, codec->implementation->ianacode);			session->read_codec = session->real_read_codec = codec;			changed_read_codec = 1;			if (codec->implementation) {				session->read_impl = *codec->implementation;				session->real_read_impl = *codec->implementation;			} else {				memset(&session->read_impl, 0, sizeof(session->read_impl));			}		} else { /* replace real_read_codec */			switch_codec_t *cur_codec;			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Original read codec replaced with %s:%d/n",							  switch_channel_get_name(session->channel), codec->implementation->iananame, codec->implementation->ianacode);			/* Set real_read_codec to front of the list of read_codecs */			cur_codec = session->read_codec;			while (cur_codec != NULL) {				if (cur_codec->next == session->real_read_codec) {					cur_codec->next = codec;					break;				}				cur_codec = cur_codec->next;			}			session->real_read_codec = codec;			/* set read_codec with real_read_codec if it no longer is ready */			if (!switch_core_codec_ready(session->read_codec)) {				session->read_codec = codec;				changed_read_codec = 1;				if (codec->implementation) {					session->read_impl = *codec->implementation;					session->real_read_impl = *codec->implementation;				} else {					memset(&session->read_impl, 0, sizeof(session->read_impl));				}			}		}		/* force media bugs to copy the read codec from the next frame */		switch_thread_rwlock_wrlock(session->bug_rwlock);		if (switch_core_codec_ready(&session->bug_codec)) {			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Destroying BUG Codec %s:%d/n",				session->bug_codec.implementation->iananame, session->bug_codec.implementation->ianacode);			switch_core_codec_destroy(&session->bug_codec);		}		switch_thread_rwlock_unlock(session->bug_rwlock);	} else {		status = SWITCH_STATUS_FALSE;		goto end;	}	if (changed_read_codec && session->read_codec && session->read_impl.decoded_bytes_per_packet) {		if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {			switch_channel_event_set_data(session->channel, event);			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", session->read_impl.iananame);			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-rate", "%d", session->read_impl.actual_samples_per_second);			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-bit-rate", "%d", session->read_impl.bits_per_second);			if (session->read_impl.actual_samples_per_second != session->read_impl.samples_per_second) {				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-read-codec-rate", "%d", session->read_impl.samples_per_second);			}			switch_event_fire(&event);		}		switch_channel_set_variable(channel, "read_codec", session->read_impl.iananame);		switch_snprintf(tmp, sizeof(tmp), "%d", session->read_impl.actual_samples_per_second);		switch_channel_set_variable(channel, "read_rate", tmp);		session->raw_read_frame.codec = session->read_codec;		session->raw_write_frame.codec = session->read_codec;		session->enc_read_frame.codec = session->read_codec;		session->enc_write_frame.codec = session->read_codec;	}  end:	if (session->read_codec) {		switch_channel_set_flag(channel, CF_MEDIA_SET);	}	switch_mutex_unlock(session->codec_read_mutex);	return status;}
开发者ID:hsaid,项目名称:FreeSWITCH,代码行数:98,



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


C++ switch_channel_get_state函数代码示例
C++ switch_channel_event_set_data函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。