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

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

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

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

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

示例1: spy_on_hangup

static switch_status_t spy_on_hangup(switch_core_session_t *session){	switch_channel_t *channel = switch_core_session_get_channel(session);	const char *data = switch_channel_get_private(channel, "_userspy_");	const char *uuid = switch_core_session_get_uuid(session);	spy_t *spy = NULL, *p = NULL, *prev = NULL;	switch_thread_rwlock_wrlock(globals.spy_hash_lock);	spy = switch_core_hash_find(globals.spy_hash, data);	for (p = spy; p; p = p->next) {		if (p->uuid == uuid) {			if (prev) {				prev->next = p->next;			} else {				spy = p->next;			}			globals.spy_count--;			break;		}		prev = p;	}	switch_core_hash_insert(globals.spy_hash, data, spy);	switch_thread_rwlock_unlock(globals.spy_hash_lock);		return SWITCH_STATUS_SUCCESS;}
开发者ID:DastanIqbal,项目名称:FreeSWITCH,代码行数:29,


示例2: init_vars

SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(char *nuuid, CoreSession *a_leg){	switch_channel_t *other_channel = NULL;	init_vars();	if (a_leg && a_leg->session) {		other_channel = switch_core_session_get_channel(a_leg->session);	}	if (!strchr(nuuid, '/') && (session = switch_core_session_force_locate(nuuid))) {		uuid = strdup(nuuid);		channel = switch_core_session_get_channel(session);		allocated = 1;    } else {		cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;		if (switch_ivr_originate(a_leg ? a_leg->session : NULL, &session, &cause, nuuid, 60, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL) 			== SWITCH_STATUS_SUCCESS) {			channel = switch_core_session_get_channel(session);			allocated = 1;			switch_set_flag(this, S_HUP);			uuid = strdup(switch_core_session_get_uuid(session));			switch_channel_set_state(switch_core_session_get_channel(session), CS_SOFT_EXECUTE);			switch_channel_wait_for_state(channel, other_channel, CS_SOFT_EXECUTE);		}	}}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:27,


示例3: sizeof

WSChannel* WSClientParser::CreateChannel(switch_core_session_t *session) {	WSChannel *wsChannel = NULL;	// 创建channel//	switch_memory_pool_t *pool = switch_core_session_get_pool(session);	wsChannel = (WSChannel *)switch_core_alloc(mpPool, sizeof(WSChannel));	wsChannel->session = session;	wsChannel->parser = this;	wsChannel->uuid_str = switch_core_strdup(mpPool, switch_core_session_get_uuid(session));	switch_log_printf(			SWITCH_CHANNEL_UUID_LOG(this->GetUUID()),			SWITCH_LOG_INFO,			"WSClientParser::CreateChannel( "			"this : %p, "			"wsChannel : %p "			") /n",			this,			wsChannel			);	if( InitChannel(wsChannel) ) {		mpChannel = wsChannel;	} else {		DestroyChannel(wsChannel);	}	return wsChannel;}
开发者ID:KingsleyYau,项目名称:CamShareMiddleware,代码行数:29,


示例4: conference_event_adv_la

void conference_event_adv_la(conference_obj_t *conference, conference_member_t *member, switch_bool_t join){	//if (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) {	switch_channel_set_flag(member->channel, CF_VIDEO_REFRESH_REQ);	switch_core_media_gen_key_frame(member->session);	//}	if (conference && conference->la && member->session &&		!switch_channel_test_flag(member->channel, CF_VIDEO_ONLY)) {		cJSON *msg, *data;		const char *uuid = switch_core_session_get_uuid(member->session);		const char *cookie = switch_channel_get_variable(member->channel, "event_channel_cookie");		const char *event_channel = cookie ? cookie : uuid;		switch_event_t *variables;		switch_event_header_t *hp;		msg = cJSON_CreateObject();		data = json_add_child_obj(msg, "pvtData", NULL);		cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(event_channel));		cJSON_AddItemToObject(msg, "eventType", cJSON_CreateString("channelPvtData"));		cJSON_AddItemToObject(data, "action", cJSON_CreateString(join ? "conference-liveArray-join" : "conference-liveArray-part"));		cJSON_AddItemToObject(data, "laChannel", cJSON_CreateString(conference->la_event_channel));		cJSON_AddItemToObject(data, "laName", cJSON_CreateString(conference->la_name));		cJSON_AddItemToObject(data, "role", cJSON_CreateString(conference_utils_member_test_flag(member, MFLAG_MOD) ? "moderator" : "participant"));		cJSON_AddItemToObject(data, "chatID", cJSON_CreateString(conference->chat_id));		cJSON_AddItemToObject(data, "canvasCount", cJSON_CreateNumber(conference->canvas_count));		if (conference_utils_member_test_flag(member, MFLAG_SECOND_SCREEN)) {			cJSON_AddItemToObject(data, "secondScreen", cJSON_CreateTrue());		}		if (conference_utils_member_test_flag(member, MFLAG_MOD)) {			cJSON_AddItemToObject(data, "modChannel", cJSON_CreateString(conference->mod_event_channel));		}		cJSON_AddItemToObject(data, "chatChannel", cJSON_CreateString(conference->chat_event_channel));		switch_core_get_variables(&variables);		for (hp = variables->headers; hp; hp = hp->next) {			if (!strncasecmp(hp->name, "conference_verto_", 17)) {				char *var = hp->name + 17;				if (var) {					cJSON_AddItemToObject(data, var, cJSON_CreateString(hp->value));				}			}		}		switch_event_destroy(&variables);		switch_event_channel_broadcast(event_channel, &msg, "mod_conference", conference_globals.event_channel_id);		if (cookie) {			switch_event_channel_permission_modify(cookie, conference->la_event_channel, join);			switch_event_channel_permission_modify(cookie, conference->mod_event_channel, join);			switch_event_channel_permission_modify(cookie, conference->chat_event_channel, join);		}	}}
开发者ID:prashantchoudhary,项目名称:FreeswitchModified,代码行数:60,


示例5: rayo_component_send_start

/** * Start execution of call output component * @param component to start * @param session the session to output to * @param output the output request * @param iq the original request */static iks *start_call_output(struct rayo_component *component, switch_core_session_t *session, iks *output, iks *iq){	switch_stream_handle_t stream = { 0 };	/* acknowledge command */	rayo_component_send_start(component, iq);	/* build playback command */	SWITCH_STANDARD_STREAM(stream);	stream.write_function(&stream, "{id=%s,session=%s,pause=%s",		RAYO_JID(component), switch_core_session_get_uuid(session),		OUTPUT_COMPONENT(component)->start_paused ? "true" : "false");	if (OUTPUT_COMPONENT(component)->max_time > 0) {		stream.write_function(&stream, ",timeout=%i", OUTPUT_COMPONENT(component)->max_time * 1000);	}	stream.write_function(&stream, "}fileman://rayo://%s", RAYO_JID(component));	if (switch_ivr_displace_session(session, stream.data, 0, "m") == SWITCH_STATUS_SUCCESS) {		RAYO_UNLOCK(component);	} else {		if (OUTPUT_COMPONENT(component)->document) {			iks_delete(OUTPUT_COMPONENT(component)->document);		}		if (switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {			rayo_component_send_complete(component, COMPONENT_COMPLETE_HANGUP);			component = NULL;		} else {			rayo_component_send_complete(component, COMPONENT_COMPLETE_ERROR);			component = NULL;		}	}	switch_safe_free(stream.data);	return NULL;}
开发者ID:alleywind,项目名称:FreeSWITCH,代码行数:41,


示例6: tech_attach

static void tech_attach(private_t *tech_pvt, modem_t *modem){	tech_pvt->modem = modem;	switch_set_string(modem->uuid_str, switch_core_session_get_uuid(tech_pvt->session));	switch_channel_set_variable_printf(tech_pvt->channel, "modem_slot", "%d", modem->slot);	switch_channel_set_variable(tech_pvt->channel, "modem_devlink", modem->devlink);	switch_channel_set_variable(tech_pvt->channel, "modem_digits", modem->digits);	switch_channel_export_variable(tech_pvt->channel, "rtp_autoflush_during_bridge", "false", SWITCH_EXPORT_VARS_VARIABLE);}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:9,


示例7: callprogress_detector_process_buffer

/** * Process a buffer of audio data for call progress tones * * @param bug the session's media bug  * @param user_data the detector * @param type the type of data available from the bug * @return SWITCH_TRUE */static switch_bool_t callprogress_detector_process_buffer(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type){	uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];	switch_frame_t frame = { 0 };	tone_detector_t *detector = (tone_detector_t *)user_data;	switch_core_session_t *session = switch_core_media_bug_get_session(bug);	switch_channel_t *channel = switch_core_session_get_channel(session);	frame.data = data;	frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;	switch(type) {	case SWITCH_ABC_TYPE_INIT:		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) initializing tone detector/n", switch_channel_get_name(channel));		tone_detector_init(detector);		break;	case SWITCH_ABC_TYPE_READ:	{		const char *detected_tone = NULL;		if (!detector->spandsp_detector) {			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) detector is destroyed/n", switch_channel_get_name(channel));			return SWITCH_FALSE;		}		if (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) error reading frame/n", switch_channel_get_name(channel));			return SWITCH_FALSE;		}		tone_detector_process_buffer(detector, frame.data, frame.samples, &detected_tone);		if (detected_tone) {			switch_event_t *event = NULL;			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) DETECTED TONE: %s/n", switch_channel_get_name(channel), detected_tone);			if (switch_event_create(&event, SWITCH_EVENT_DETECTED_TONE) == SWITCH_STATUS_SUCCESS) {				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detected-Tone", detected_tone);				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(session));				switch_event_fire(&event);			}		}		break;	}	case SWITCH_ABC_TYPE_WRITE:		break;	case SWITCH_ABC_TYPE_WRITE_REPLACE:		break;	case SWITCH_ABC_TYPE_READ_REPLACE:		break;	case SWITCH_ABC_TYPE_READ_PING:		break;	case SWITCH_ABC_TYPE_CLOSE:		if (detector->spandsp_detector) {			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) destroying tone detector/n", switch_channel_get_name(channel));			tone_detector_destroy(detector);		}		break;	}	return SWITCH_TRUE;}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:64,


示例8: switch_core_standard_on_reset

static void switch_core_standard_on_reset(switch_core_session_t *session){	switch_channel_set_variable(session->channel, "call_uuid", switch_core_session_get_uuid(session));	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard RESET/n", switch_channel_get_name(session->channel));	if (switch_channel_test_flag(session->channel, CF_RECOVERING_BRIDGE)) {		switch_core_session_t *other_session = NULL;		const char *uuid = switch_core_session_get_uuid(session);		if (switch_channel_test_flag(session->channel, CF_BRIDGE_ORIGINATOR)) {			const char *other_uuid = switch_channel_get_partner_uuid(session->channel);			int x = 0;			if (other_uuid) {				for (x = 0; other_session == NULL && x < 20; x++) {					if (!switch_channel_up(session->channel)) {						break;					}					other_session = switch_core_session_locate(other_uuid);					switch_yield(100000);				}			}			if (other_session) {				switch_channel_t *other_channel = switch_core_session_get_channel(other_session);				switch_channel_clear_flag(session->channel, CF_BRIDGE_ORIGINATOR);				switch_channel_wait_for_state_timeout(other_channel, CS_RESET, 5000);				switch_channel_wait_for_flag(other_channel, CF_MEDIA_ACK, SWITCH_TRUE, 2000, NULL);				if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) && switch_channel_test_flag(other_channel, CF_PROXY_MODE)) {					switch_ivr_signal_bridge(session, other_session);				} else {					switch_ivr_uuid_bridge(uuid, other_uuid);				}				switch_core_session_rwunlock(other_session);			}		}		switch_channel_clear_flag(session->channel, CF_RECOVERING_BRIDGE);	}}
开发者ID:odmanV2,项目名称:freecenter,代码行数:43,


示例9: init_vars

SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(switch_core_session_t *new_session){	init_vars();	if (new_session) {		session = new_session;		channel = switch_core_session_get_channel(session);		allocated = 1;		switch_core_session_read_lock_hangup(session);		uuid = strdup(switch_core_session_get_uuid(session));	}}
开发者ID:gujun,项目名称:sscore,代码行数:12,


示例10: eventpipe_events_handler

void eventpipe_events_handler(switch_event_t *event){	struct eventpipe_call *current = NULL;	const char *uuid1 = "";	const char *uuid2 = "";        switch_assert(event != NULL);	if ((event->event_id != SWITCH_EVENT_CUSTOM) && (event->event_id != SWITCH_EVENT_DTMF)) {		return;	}	uuid1 = switch_event_get_header(event, "unique-id");	if (zstr(uuid1)) {		return;	}	switch_mutex_lock(globals.eventpipe_call_list_mutex);	if (!head) {		goto eventpipe_events_handler_done;	}	if (!head->session) {		goto eventpipe_events_handler_done;	}	current = head;	while (current) {		if (current->session) {			uuid2 = "";			uuid2 = switch_core_session_get_uuid(current->session);				/* check if event unique-id is matching a call uuid in eventpipe */			if ((uuid2) && (!zstr(uuid2) && (!strcmp(uuid1, uuid2)))) {				/* conference event case */				if (event->event_id == SWITCH_EVENT_CUSTOM) {					const char *event_subclass = switch_str_nil(switch_event_get_header(event, "event-subclass"));					if (!strcmp(event_subclass, PLIVO_EVENT_CONFERENCE)) {						eventpipe_events_on_conference(current->session, event);					}				/* dtmf event case */				} else if (event->event_id == SWITCH_EVENT_DTMF) {					eventpipe_events_on_dtmf(current->session, event);				}				goto eventpipe_events_handler_done;			}		}		current = current->next;	}eventpipe_events_handler_done:	switch_mutex_unlock(globals.eventpipe_call_list_mutex);}
开发者ID:tamiel,项目名称:mod_eventpipe,代码行数:50,


示例11: SWITCH_DECLARE

SWITCH_DECLARE(int) CoreSession::originate(CoreSession *a_leg_session, char *dest, int timeout, switch_state_handler_table_t *handlers){	switch_core_session_t *aleg_core_session = NULL;	this_check(0);	cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;	if (a_leg_session != NULL) {		aleg_core_session = a_leg_session->session;	}	// this session has no valid switch_core_session_t at this point, and therefore	// no valid channel.  since the threadstate is stored in the channel, and there 	// is none, if we try to call begin_alllow_threads it will fail miserably.	// use the 'a leg session' to do the thread swapping stuff.    if (a_leg_session) a_leg_session->begin_allow_threads();	if (switch_ivr_originate(aleg_core_session, 							 &session, 							 &cause, 							 dest, 							 timeout,							 handlers, 							 NULL, 							 NULL, 							 NULL,							 NULL,							 SOF_NONE,							 NULL) != SWITCH_STATUS_SUCCESS) {		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error Creating Outgoing Channel! [%s]/n", dest);		goto failed;	}    if (a_leg_session) a_leg_session->end_allow_threads();	channel = switch_core_session_get_channel(session);	allocated = 1;	switch_safe_free(uuid);	uuid = strdup(switch_core_session_get_uuid(session));	switch_channel_set_state(switch_core_session_get_channel(session), CS_SOFT_EXECUTE);	return SWITCH_STATUS_SUCCESS; failed:    if (a_leg_session) a_leg_session->end_allow_threads();	return SWITCH_STATUS_FALSE;}
开发者ID:gujun,项目名称:sscore,代码行数:49,


示例12: perl_function

static void perl_function(switch_core_session_t *session, char *data){	char *uuid = switch_core_session_get_uuid(session);	PerlInterpreter *my_perl = clone_perl();	char code[1024] = "";	perl_parse(my_perl, xs_init, 3, embedding, NULL);	switch_snprintf(code, sizeof(code),					"use lib '%s/perl';/n"					"use freeswitch;/n"					"$SWITCH_ENV{UUID} = /"%s/";/n" "$session = new freeswitch::Session(/"%s/")", SWITCH_GLOBAL_dirs.base_dir, uuid, uuid);	perl_parse_and_execute(my_perl, data, code);	destroy_perl(&my_perl);}
开发者ID:AricGod,项目名称:FreeSWITCH,代码行数:16,


示例13: callprogress_detector_process_buffer

/** * Process a buffer of audio data for call progress tones * * @param bug the session's media bug  * @param user_data the detector * @param type the type of data available from the bug * @return SWITCH_TRUE */static switch_bool_t callprogress_detector_process_buffer(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type){	tone_detector_t *detector = (tone_detector_t *)user_data;	switch_core_session_t *session = detector->session;	switch(type) {	case SWITCH_ABC_TYPE_INIT:		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "initializing tone detector/n");		tone_detector_init(detector);		break;	case SWITCH_ABC_TYPE_READ_REPLACE:	{		switch_frame_t *frame;		const char *detected_tone = NULL;		if (!detector->spandsp_detector) {			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "detector is destroyed/n");			return SWITCH_FALSE;		}		if (!(frame = switch_core_media_bug_get_read_replace_frame(bug))) {			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "error reading frame/n");			return SWITCH_FALSE;		}		tone_detector_process_buffer(detector, frame->data, frame->samples, &detected_tone);		if (detected_tone) {			switch_event_t *event = NULL;			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "DETECTED TONE: %s/n", detected_tone);			if (switch_event_create(&event, SWITCH_EVENT_DETECTED_TONE) == SWITCH_STATUS_SUCCESS) {				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detected-Tone", detected_tone);				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(session));				switch_event_fire(&event);			}		}		break;	}	case SWITCH_ABC_TYPE_CLOSE:		if (detector->spandsp_detector) {			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "destroying tone detector/n");			tone_detector_destroy(detector);		}		break;	default:		break;	}	return SWITCH_TRUE;}
开发者ID:RodrigoNieves,项目名称:FreeSWITCH,代码行数:53,


示例14: eventpipe_events_on_conference

void eventpipe_events_on_conference(switch_core_session_t *session, switch_event_t *event) {	char args[8192];	char record_args[8192];	const char *action = switch_str_nil(switch_event_get_header(event, "action"));	const char *member_id = switch_str_nil(switch_event_get_header(event, "member-id"));	const char *conf_room = switch_str_nil(switch_event_get_header(event, "conference-name"));	const char *calluuid = switch_core_session_get_uuid(session);	switch_channel_t *channel = switch_core_session_get_channel(session);	if (!channel) {		return;	}	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 				"Event-Name: %s, Event-Subclass: %s, Conference-Name: %s, Action: %s, Member-ID: %s, Unique-ID: %s/n", 				switch_str_nil(switch_event_get_header(event, "event-name")), 				switch_str_nil(switch_event_get_header(event, "event-subclass")), 				conf_room, action, member_id, calluuid);	if (!strcmp(action, "add-member")) {		const char *enter_sound = switch_str_nil(switch_channel_get_variable(channel, "eventpipe_conference_enter_sound"));		const char *record_file = switch_str_nil(switch_channel_get_variable(channel, "eventpipe_conference_record_file"));		switch_channel_set_variable(channel, "eventpipe_conference_member_id", member_id);		switch_channel_set_variable(channel, "eventpipe_conference_room", conf_room);		if (!zstr(enter_sound)) {			switch_snprintf(args, sizeof(args), "%s play %s async",					conf_room, enter_sound);			eventpipe_execute_api(session, "conference", args);		}		if (!zstr(record_file)) {			switch_snprintf(record_args, sizeof(record_args), "%s record %s",					conf_room, record_file);			eventpipe_execute_api(session, "conference", record_args);		}	} else if (!strcmp(action, "del-member")) {		const char *exit_sound = switch_str_nil(switch_channel_get_variable(channel, "eventpipe_conference_exit_sound"));		switch_channel_set_variable(channel, "eventpipe_conference_member_id", "");		switch_channel_set_variable(channel, "eventpipe_conference_room", "");		switch_channel_set_variable(channel, "eventpipe_conference_record_file", "");		if (!zstr(exit_sound)) {			switch_snprintf(args, sizeof(args), "conference %s play %s async",					conf_room, exit_sound);			eventpipe_execute_api(session, "conference", args);		}	}}
开发者ID:tamiel,项目名称:mod_eventpipe,代码行数:45,


示例15: switch_core_session_get_channel

char *sofia_media_get_multipart(switch_core_session_t *session, const char *prefix, const char *sdp, char **mp_type){	char *extra_headers = NULL;	switch_stream_handle_t stream = { 0 };	switch_event_header_t *hi = NULL;	int x = 0;	switch_channel_t *channel = switch_core_session_get_channel(session);	const char *boundary = switch_core_session_get_uuid(session);	SWITCH_STANDARD_STREAM(stream);	if ((hi = switch_channel_variable_first(channel))) {		for (; hi; hi = hi->next) {			const char *name = (char *) hi->name;			char *value = (char *) hi->value;			if (!strncasecmp(name, prefix, strlen(prefix))) {				const char *hname = name + strlen(prefix);				if (*value == '~') {					stream.write_function(&stream, "--%s/nContent-Type: %s/nContent-Length: %d/n%s/n", boundary, hname, strlen(value), value + 1);				} else {					stream.write_function(&stream, "--%s/nContent-Type: %s/nContent-Length: %d/n/n%s/n", boundary, hname, strlen(value) + 1, value);				}				x++;			}		}		switch_channel_variable_last(channel);	}	if (x) {		*mp_type = switch_core_session_sprintf(session, "multipart/mixed; boundary=%s", boundary);		if (sdp) {			stream.write_function(&stream, "--%s/nContent-Type: application/sdp/nContent-Length: %d/n/n%s/n", boundary, strlen(sdp) + 1, sdp);		}		stream.write_function(&stream, "--%s--/n", boundary);	}	if (!zstr((char *) stream.data)) {		extra_headers = stream.data;	} else {		switch_safe_free(stream.data);	}	return extra_headers;}
开发者ID:syam218,项目名称:FreeSWITCH,代码行数:44,


示例16: put_text_msg

static void put_text_msg(void *user_data, const uint8_t *msg, int len){	switch_tdd_t *pvt = (switch_tdd_t *) user_data;	switch_event_t *event, *clone;	switch_channel_t *channel = switch_core_session_get_channel(pvt->session);	switch_core_session_t *other_session;	switch_channel_add_variable_var_check(channel, "tdd_messages", (char *)msg, SWITCH_FALSE, SWITCH_STACK_PUSH);	if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_TDD_RECV_MESSAGE) == SWITCH_STATUS_SUCCESS) {		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", "mod_spandsp");		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "tdd");		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", "TDD MESSAGE");		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "TDD-Data", (char *)msg);		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(pvt->session));		switch_event_add_body(event, "%s/n/n", (char *)msg);		if (switch_core_session_get_partner(pvt->session, &other_session) == SWITCH_STATUS_SUCCESS) {			if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {				switch_core_session_receive_event(other_session, &clone);			}			if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {				switch_core_session_queue_event(other_session, &clone);			}			switch_core_session_rwunlock(other_session);		}		switch_event_fire(&event);	}	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s got TDD Message [%s]/n", switch_channel_get_name(channel), (char *)msg);}
开发者ID:RodrigoNieves,项目名称:FreeSWITCH,代码行数:41,


示例17: navigate_entrys

switch_status_t navigate_entrys(switch_core_session_t *session, dir_profile_t *profile, search_params_t *params){	switch_status_t status = SWITCH_STATUS_SUCCESS;	char *sql = NULL, *sql_where = NULL;	char entry_count[80] = "";	callback_t cbt = { 0 };	int result_count;	char macro[256] = "";	listing_callback_t listing_cbt;	int cur_entry = 0;	cbt.buf = entry_count;	cbt.len = sizeof(entry_count);	if (params->search_by == SEARCH_BY_FIRST_AND_LAST_NAME) {		sql_where = switch_mprintf("hostname = '%q' and uuid = '%q' and name_visible = 1 and (%s like '%q%%' or %s like '%q%%')",				globals.hostname, switch_core_session_get_uuid(session), "last_name_digit", params->digits, "first_name_digit", params->digits);	} else if (params->search_by == SEARCH_BY_FULL_NAME) {		sql_where = switch_mprintf("hostname = '%q' and uuid = '%q' and name_visible = 1 and full_name_digit like '%%%q%%'",				globals.hostname, switch_core_session_get_uuid(session), "last_name_digit", params->digits, "first_name_digit", params->digits);	} else {		sql_where = switch_mprintf("hostname = '%q' and uuid = '%q' and name_visible = 1 and %s like '%q%%'",				globals.hostname, switch_core_session_get_uuid(session), (params->search_by == SEARCH_BY_LAST_NAME ? "last_name_digit" : "first_name_digit"), params->digits);	}	sql = switch_mprintf("select count(*) from directory_search where %s", sql_where);	directory_execute_sql_callback(globals.mutex, sql, sql2str_callback, &cbt);	switch_safe_free(sql);	result_count = atoi(entry_count);	if (result_count == 0) {		switch_snprintf(macro, sizeof(macro), "%d", result_count);		switch_ivr_phrase_macro(session, DIR_RESULT_COUNT, macro, NULL, NULL);		params->try_again = 1;		status = SWITCH_STATUS_BREAK;		goto end;	} else if (profile->max_result != 0 && result_count > profile->max_result) {		switch_ivr_phrase_macro(session, DIR_RESULT_COUNT_TOO_LARGE, NULL, NULL, NULL);		params->try_again = 1;		status = SWITCH_STATUS_BREAK;		goto end;	} else {		switch_snprintf(macro, sizeof(macro), "%d", result_count);		switch_ivr_phrase_macro(session, DIR_RESULT_COUNT, macro, NULL, NULL);	}	memset(&listing_cbt, 0, sizeof(listing_cbt));	listing_cbt.params = params;	sql = switch_mprintf("select extension, full_name, last_name, first_name, name_visible, exten_visible from directory_search where %s order by last_name, first_name", sql_where);	for (cur_entry = 0; cur_entry < result_count; cur_entry++) {		listing_cbt.index = 0;		listing_cbt.want = cur_entry;		listing_cbt.move = ENTRY_MOVE_NEXT;		directory_execute_sql_callback(globals.mutex, sql, listing_callback, &listing_cbt);		status = listen_entry(session, profile, &listing_cbt);		if (!zstr(listing_cbt.transfer_to)) {			switch_copy_string(params->transfer_to, listing_cbt.transfer_to, 255);			break;		}		if (listing_cbt.new_search) {			params->try_again = 1;			goto end;		}		if (listing_cbt.move == ENTRY_MOVE_NEXT) {			if (cur_entry == result_count - 1) {				switch_snprintf(macro, sizeof(macro), "%d", result_count);				switch_ivr_phrase_macro(session, DIR_RESULT_LAST, macro, NULL, NULL);				cur_entry -= 1;			}		}		if (listing_cbt.move == ENTRY_MOVE_PREV) {			if (cur_entry <= 0) {				cur_entry = -1;			} else {				cur_entry -= 2;			}		}		if (status == SWITCH_STATUS_TIMEOUT) {			goto end;		}		if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {			goto end;		}	}  end:	switch_safe_free(sql);	switch_safe_free(sql_where);	return status;}
开发者ID:DrumTechnologiesLtd,项目名称:FreeSWITCH,代码行数:96,


示例18: SWITCH_DECLARE

//.........这里部分代码省略.........	ret = switch_vasprintf(&data, fmt, ap);	if (ret == -1) {		fprintf(stderr, "Memory Error/n");		goto end;	}	if (channel == SWITCH_CHANNEL_ID_LOG_CLEAN) {		content = data;	} else {		if ((content = strchr(data, 128))) {			*content = ' ';		}	}	if (channel == SWITCH_CHANNEL_ID_EVENT) {		switch_event_t *event;		if (switch_event_running() == SWITCH_STATUS_SUCCESS && switch_event_create(&event, SWITCH_EVENT_LOG) == SWITCH_STATUS_SUCCESS) {			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-Data", data);			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-File", filep);			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-Function", funcp);			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Line", "%d", line);			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Level", "%d", (int) level);			if (!zstr(userdata)) {				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "User-Data", userdata);			}			switch_event_fire(&event);			data = NULL;		}		goto end;	}	if (console_mods_loaded == 0 || !do_mods) {		if (handle) {			int aok = 1;#ifndef WIN32			fd_set can_write;			int fd;			struct timeval to;			fd = fileno(handle);			memset(&to, 0, sizeof(to));			FD_ZERO(&can_write);			FD_SET(fd, &can_write);			to.tv_sec = 0;			to.tv_usec = 100000;			if (select(fd + 1, NULL, &can_write, NULL, &to) > 0) {				aok = FD_ISSET(fd, &can_write);			} else {				aok = 0;			}#endif			if (aok) {				if (COLORIZE) {#ifdef WIN32					SetConsoleTextAttribute(hStdout, COLORS[level]);					WriteFile(hStdout, data, (DWORD) strlen(data), NULL, NULL);					SetConsoleTextAttribute(hStdout, wOldColorAttrs);#else					fprintf(handle, "%s%s%s", COLORS[level], data, SWITCH_SEQ_DEFAULT_COLOR);#endif				} else {					fprintf(handle, "%s", data);				}			}		}	}	if (do_mods && level <= MAX_LEVEL) {		switch_log_node_t *node = switch_log_node_alloc();		node->data = data;		data = NULL;		switch_set_string(node->file, filep);		switch_set_string(node->func, funcp);		node->line = line;		node->level = level;		node->content = content;		node->timestamp = now;		node->channel = channel;		if (channel == SWITCH_CHANNEL_ID_SESSION) {			node->userdata = userdata ? strdup(switch_core_session_get_uuid((switch_core_session_t *) userdata)) : NULL;		} else {			node->userdata = !zstr(userdata) ? strdup(userdata) : NULL;		}		if (switch_queue_trypush(LOG_QUEUE, node) != SWITCH_STATUS_SUCCESS) {			switch_log_node_free(&node);		}	}  end:	switch_safe_free(data);	switch_safe_free(new_fmt);}
开发者ID:konradwyr,项目名称:FreeSwitch,代码行数:101,


示例19: channel_on_init

/*    State methods they get called when the state changes to the specific state    returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next   so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.*/static switch_status_t channel_on_init(switch_core_session_t *session){	switch_channel_t *channel, *b_channel;	private_t *tech_pvt = NULL, *b_tech_pvt = NULL;	switch_core_session_t *b_session;	char name[128];	switch_caller_profile_t *caller_profile;	tech_pvt = switch_core_session_get_private(session);	switch_assert(tech_pvt != NULL);	channel = switch_core_session_get_channel(session);	switch_assert(channel != NULL);	if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && !switch_test_flag(tech_pvt, TFLAG_BLEG)) {		if (!(b_session = switch_core_session_request(loopback_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL))) {			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Failure./n");			goto end;		}		if (switch_core_session_read_lock(b_session) != SWITCH_STATUS_SUCCESS) {			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Failure./n");			switch_core_session_destroy(&b_session);			goto end;		}		switch_core_session_add_stream(b_session, NULL);		b_channel = switch_core_session_get_channel(b_session);		b_tech_pvt = (private_t *) switch_core_session_alloc(b_session, sizeof(*b_tech_pvt));		switch_snprintf(name, sizeof(name), "loopback/%s-b", tech_pvt->caller_profile->destination_number);		switch_channel_set_name(b_channel, name);		if (tech_init(b_tech_pvt, b_session, switch_core_session_get_read_codec(session)) != SWITCH_STATUS_SUCCESS) {			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);			switch_core_session_destroy(&b_session);			goto end;		}		caller_profile = switch_caller_profile_clone(b_session, tech_pvt->caller_profile);		caller_profile->source = switch_core_strdup(caller_profile->pool, modname);		switch_channel_set_caller_profile(b_channel, caller_profile);		b_tech_pvt->caller_profile = caller_profile;		switch_channel_set_state(b_channel, CS_INIT);		tech_pvt->other_session = b_session;		tech_pvt->other_tech_pvt = b_tech_pvt;		tech_pvt->other_channel = b_channel;		//b_tech_pvt->other_session = session;		//b_tech_pvt->other_tech_pvt = tech_pvt;		//b_tech_pvt->other_channel = channel;		b_tech_pvt->other_uuid = switch_core_session_strdup(b_session, switch_core_session_get_uuid(session));		switch_set_flag_locked(tech_pvt, TFLAG_LINKED);		switch_set_flag_locked(b_tech_pvt, TFLAG_LINKED);		switch_set_flag_locked(b_tech_pvt, TFLAG_BLEG);		switch_channel_set_flag(channel, CF_ACCEPT_CNG);		//switch_ivr_transfer_variable(session, tech_pvt->other_session, "process_cdr");		switch_ivr_transfer_variable(session, tech_pvt->other_session, NULL);		switch_channel_set_variable(channel, "other_loopback_leg_uuid", switch_channel_get_uuid(b_channel));		switch_channel_set_variable(b_channel, "other_loopback_leg_uuid", switch_channel_get_uuid(channel));		if (switch_core_session_thread_launch(b_session) != SWITCH_STATUS_SUCCESS) {			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Error spawning thread/n");			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);			goto end;		}	} else if ((tech_pvt->other_session = switch_core_session_locate(tech_pvt->other_uuid))) {		tech_pvt->other_tech_pvt = switch_core_session_get_private(tech_pvt->other_session);		tech_pvt->other_channel = switch_core_session_get_channel(tech_pvt->other_session);	}	if (!tech_pvt->other_session) {		switch_clear_flag_locked(tech_pvt, TFLAG_LINKED);		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);		goto end;	}	switch_channel_set_variable(channel, "loopback_leg", switch_test_flag(tech_pvt, TFLAG_BLEG) ? "B" : "A");	switch_channel_set_state(channel, CS_ROUTING);  end:	return SWITCH_STATUS_SUCCESS;}
开发者ID:gujun,项目名称:sscore,代码行数:97,


示例20: iks_find

/** * Start execution of call receivefax component * @param call the call to receive fax from * @param msg the original request * @param session_data the call's session */static iks *start_receivefax_component(struct rayo_actor *call, struct rayo_message *msg, void *session_data){	iks *iq = msg->payload;	switch_core_session_t *session = (switch_core_session_t *)session_data;	struct receivefax_component *receivefax_component = NULL;	iks *receivefax = iks_find(iq, "receivefax");	iks *response = NULL;	switch_event_t *execute_event = NULL;	switch_channel_t *channel = switch_core_session_get_channel(session);	switch_memory_pool_t *pool;	int file_no;	/* validate attributes */	if (!VALIDATE_RAYO_RECEIVEFAX(receivefax)) {		return iks_new_error(iq, STANZA_ERROR_BAD_REQUEST);	}	/* fax is only allowed if the call is not currently joined */	if (rayo_call_is_joined(RAYO_CALL(call))) {		return iks_new_error_detailed(iq, STANZA_ERROR_UNEXPECTED_REQUEST, "can't receive fax on a joined call");	}	if (rayo_call_is_faxing(RAYO_CALL(call))) {		return iks_new_error_detailed(iq, STANZA_ERROR_UNEXPECTED_REQUEST, "fax already in progress");	}	/* create receivefax component */	switch_core_new_memory_pool(&pool);	receivefax_component = switch_core_alloc(pool, sizeof(*receivefax_component));	rayo_component_init((struct rayo_component *)receivefax_component, pool, RAT_CALL_COMPONENT, "receivefax", NULL, call, iks_find_attrib(iq, "from"));	file_no = rayo_actor_seq_next(call);	receivefax_component->filename = switch_core_sprintf(pool, "%s%s%s-%d.tif",		globals.file_prefix, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session), file_no);	if (!strncmp(receivefax_component->filename, "http://", 7) || !strncmp(receivefax_component->filename, "https://", 8)) {		/* This is an HTTP URL, need to PUT after fax is received */		receivefax_component->local_filename = switch_core_sprintf(pool, "%s%s%s-%d",			SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session), file_no);		receivefax_component->http_put_after_receive = 1;		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s save fax to HTTP URL/n", RAYO_JID(receivefax_component));	} else {		/* assume file.. */		receivefax_component->local_filename = receivefax_component->filename;		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s save fax to local file/n", RAYO_JID(receivefax_component));	}	/* add channel variable so that fax component can be located from fax events */	switch_channel_set_variable(channel, "rayo_fax_jid", RAYO_JID(receivefax_component));	/* clear fax result variables */	switch_channel_set_variable(channel, "fax_success", NULL);	switch_channel_set_variable(channel, "fax_result_code", NULL);	switch_channel_set_variable(channel, "fax_result_text", NULL);	switch_channel_set_variable(channel, "fax_document_transferred_pages", NULL);	switch_channel_set_variable(channel, "fax_document_total_pages", NULL);	switch_channel_set_variable(channel, "fax_image_resolution", NULL);	switch_channel_set_variable(channel, "fax_image_size", NULL);	switch_channel_set_variable(channel, "fax_bad_rows", NULL);	switch_channel_set_variable(channel, "fax_transfer_rate", NULL);	switch_channel_set_variable(channel, "fax_ecm_used", NULL);	switch_channel_set_variable(channel, "fax_local_station_id", NULL);	switch_channel_set_variable(channel, "fax_remote_station_id", NULL);	/* clear fax interrupt variable */	switch_channel_set_variable(switch_core_session_get_channel(session), "rayo_read_frame_interrupt", NULL);	rayo_call_set_faxing(RAYO_CALL(call), 1);	/* execute rxfax APP */	if (switch_event_create(&execute_event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) {		switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "call-command", "execute");		switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-name", "rxfax");		switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-arg", receivefax_component->local_filename);		if (!switch_channel_test_flag(channel, CF_PROXY_MODE)) {			switch_channel_set_flag(channel, CF_BLOCK_BROADCAST_UNTIL_MEDIA);		}		if (switch_core_session_queue_private_event(session, &execute_event, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) {			response = iks_new_error_detailed(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "failed to rxfax (queue event failed)");			if (execute_event) {				switch_event_destroy(&execute_event);			}			rayo_call_set_faxing(RAYO_CALL(call), 0);			RAYO_UNLOCK(receivefax_component);		} else {			/* component starting... */			rayo_component_send_start(RAYO_COMPONENT(receivefax_component), iq);		}	} else {		response = iks_new_error_detailed(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "failed to create rxfax event");		rayo_call_set_faxing(RAYO_CALL(call), 0);		RAYO_UNLOCK(receivefax_component);	}	return response;//.........这里部分代码省略.........
开发者ID:lzcykevin,项目名称:FreeSWITCH,代码行数:101,


示例21: populate_database

static switch_status_t populate_database(switch_core_session_t *session, dir_profile_t *profile, const char *domain_name){	switch_status_t status = SWITCH_STATUS_SUCCESS;	char *sql = NULL;	char *sqlvalues = NULL;	char *sqltmp = NULL;	int count = 0;	switch_xml_t xml_root = NULL, x_domain;	switch_xml_t ut;	switch_event_t *xml_params = NULL;	switch_xml_t group = NULL, groups = NULL, users = NULL, x_params = NULL, x_param = NULL, x_vars = NULL, x_var = NULL;	switch_event_create(&xml_params, SWITCH_EVENT_REQUEST_PARAMS);	switch_assert(xml_params);	if (switch_xml_locate_domain(domain_name, xml_params, &xml_root, &x_domain) != SWITCH_STATUS_SUCCESS) {		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate domain %s/n", domain_name);		status = SWITCH_STATUS_FALSE;		goto end;	}	if ((groups = switch_xml_child(x_domain, "groups"))) {		for (group = switch_xml_child(groups, "group"); group; group = group->next) {			if ((users = switch_xml_child(group, "users"))) {				for (ut = switch_xml_child(users, "user"); ut; ut = ut->next) {					int name_visible = 1;					int exten_visible = 1;					const char *type = switch_xml_attr_soft(ut, "type");					const char *id = switch_xml_attr_soft(ut, "id");					char *fullName = NULL;					char *caller_name = NULL;					char *caller_name_override = NULL;					char *firstName = NULL;					char *lastName = NULL;					char *fullNameDigit = NULL;					char *firstNameDigit = NULL;					char *lastNameDigit = NULL;					if (!strcasecmp(type, "pointer")) {						continue;					}					/* Check all the user params */					if ((x_params = switch_xml_child(ut, "params"))) {						for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {							const char *var = switch_xml_attr_soft(x_param, "name");							const char *val = switch_xml_attr_soft(x_param, "value");							if (!strcasecmp(var, "directory-visible")) {								name_visible = switch_true(val);							}							if (!strcasecmp(var, "directory-exten-visible")) {								exten_visible = switch_true(val);							}						}					}					/* Check all the user variables */					if ((x_vars = switch_xml_child(ut, "variables"))) {						for (x_var = switch_xml_child(x_vars, "variable"); x_var; x_var = x_var->next) {							const char *var = switch_xml_attr_soft(x_var, "name");							const char *val = switch_xml_attr_soft(x_var, "value");							if (!strcasecmp(var, "effective_caller_id_name")) {								caller_name = switch_core_session_strdup(session, val);							}							if (!strcasecmp(var, "directory_full_name")) {								caller_name_override = switch_core_session_strdup(session, val);							}						}					}					if (caller_name_override) {						fullName = caller_name_override;					} else {						fullName = caller_name;					}					if (zstr(fullName)) {						continue;					}					firstName = switch_core_session_strdup(session, fullName);					if ((lastName = strrchr(firstName, ' '))) {						*lastName++ = '/0';					} else {						lastName = switch_core_session_strdup(session, firstName);					}					/* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "FullName %s firstName [%s] lastName [%s]/n", fullName, firstName, lastName); */					/* Generate Digits key mapping */					fullNameDigit = string_to_keypad_digit(fullName);					lastNameDigit = string_to_keypad_digit(lastName);					firstNameDigit = string_to_keypad_digit(firstName);					/* add user into DB */					sql = switch_mprintf("insert into directory_search values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%d','%d')",										 globals.hostname, switch_core_session_get_uuid(session), id, fullName, fullNameDigit, firstName, firstNameDigit,										 lastName, lastNameDigit, name_visible, exten_visible);					if (sqlvalues) {						sqltmp = sqlvalues;//.........这里部分代码省略.........
开发者ID:DrumTechnologiesLtd,项目名称:FreeSWITCH,代码行数:101,


示例22: iks_find

/** * Start CPA */iks *rayo_cpa_component_start(struct rayo_actor *call, struct rayo_message *msg, void *session_data){    iks *iq = msg->payload;    switch_core_session_t *session = (switch_core_session_t *)session_data;    iks *input = iks_find(iq, "input");    switch_memory_pool_t *pool = NULL;    struct cpa_component *component = NULL;    int have_grammar = 0;    iks *grammar = NULL;    /* create CPA component */    switch_core_new_memory_pool(&pool);    component = switch_core_alloc(pool, sizeof(*component));    component = CPA_COMPONENT(rayo_component_init((struct rayo_component *)component, pool, RAT_CALL_COMPONENT, "cpa", NULL, call, iks_find_attrib(iq, "from")));    if (!component) {        switch_core_destroy_memory_pool(&pool);        return iks_new_error_detailed(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "Failed to create CPA entity");    }    switch_core_hash_init(&component->signals);    /* start CPA detectors */    for (grammar = iks_find(input, "grammar"); grammar; grammar = iks_next_tag(grammar)) {        if (!strcmp("grammar", iks_name(grammar))) {            const char *error_str = "";            const char *url = iks_find_attrib_soft(grammar, "url");            char *url_dup;            char *url_params;            if (zstr(url)) {                stop_cpa_detectors(component);                RAYO_UNLOCK(component);                RAYO_DESTROY(component);                return iks_new_error_detailed(iq, STANZA_ERROR_BAD_REQUEST, "Missing grammar URL");            }            have_grammar = 1;            url_dup = strdup(url);            if ((url_params = strchr(url_dup, '?'))) {                *url_params = '/0';                url_params++;            }            if (switch_core_hash_find(component->signals, url)) {                free(url_dup);                stop_cpa_detectors(component);                RAYO_UNLOCK(component);                RAYO_DESTROY(component);                return iks_new_error_detailed(iq, STANZA_ERROR_BAD_REQUEST, "Duplicate URL");            }            /* start detector */            /* TODO return better reasons... */            if (rayo_cpa_detector_start(switch_core_session_get_uuid(session), url_dup, &error_str)) {                struct cpa_signal *cpa_signal = switch_core_alloc(pool, sizeof(*cpa_signal));                cpa_signal->terminate = !zstr(url_params) && strstr(url_params, "terminate=true");                cpa_signal->name = switch_core_strdup(pool, url_dup);                switch_core_hash_insert(component->signals, cpa_signal->name, cpa_signal);                subscribe(switch_core_session_get_uuid(session), cpa_signal->name, RAYO_JID(component));            } else {                free(url_dup);                stop_cpa_detectors(component);                RAYO_UNLOCK(component);                RAYO_DESTROY(component);                return iks_new_error_detailed(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, error_str);            }            free(url_dup);        }    }    if (!have_grammar) {        stop_cpa_detectors(component);        RAYO_UNLOCK(component);        RAYO_DESTROY(component);        return iks_new_error_detailed(iq, STANZA_ERROR_BAD_REQUEST, "No grammar defined");    }    /* acknowledge command */    rayo_component_send_start(RAYO_COMPONENT(component), iq);    /* TODO hangup race condition */    subscribe(switch_core_session_get_uuid(session), "hangup", RAYO_JID(component));    /* ready to forward detector events */    component->ready = 1;    return NULL;}
开发者ID:bodji,项目名称:freeswitch,代码行数:92,



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


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