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

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

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

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

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

示例1: ei_encode_switch_event_headers

void ei_encode_switch_event_headers(ei_x_buff * ebuf, switch_event_t *event){	int i;	char *uuid = switch_event_get_header(event, "unique-id");	switch_event_header_t *hp;	for (i = 0, hp = event->headers; hp; hp = hp->next, i++);	if (event->body)		i++;	ei_x_encode_list_header(ebuf, i + 1);	if (uuid) {		_ei_x_encode_string(ebuf, switch_event_get_header(event, "unique-id"));	} else {		ei_x_encode_atom(ebuf, "undefined");	}	for (hp = event->headers; hp; hp = hp->next) {		ei_x_encode_tuple_header(ebuf, 2);		_ei_x_encode_string(ebuf, hp->name);		switch_url_decode(hp->value);		_ei_x_encode_string(ebuf, hp->value);	}	if (event->body) {		ei_x_encode_tuple_header(ebuf, 2);		_ei_x_encode_string(ebuf, "body");		_ei_x_encode_string(ebuf, event->body);	}	ei_x_encode_empty_list(ebuf);}
开发者ID:DrumTechnologiesLtd,项目名称:FreeSWITCH,代码行数:35,


示例2: cari_net_ne_reboot

/*重启服务的通知*/int cari_net_ne_reboot(int notifyCode,			//通知码 					   switch_event_t *event)	//事件{	inner_ResultResponse_Frame	*inner_respFrame = NULL;	char						*result			 = NULL;	char						*cmdCode		 = NULL;	char						*cmdName		 = NULL;	result = switch_event_get_header(event, CARICCP_RESULTDESC);	cmdCode = switch_event_get_header(event, CARICCP_CMDCODE);	cmdName = switch_event_get_header(event, CARICCP_CMDNAME);	//new响应帧	inner_respFrame = CARI_CCP_VOS_NEW(inner_ResultResponse_Frame);	//初始化"内部响应帧"结构体	memset(inner_respFrame, 0, sizeof(inner_ResultResponse_Frame));	//初始化赋值,设置了"通知类型的标识"和"通知码"	initInnerResponseFrame(inner_respFrame, event);		//将通知类型的事件发送给所有客户端	CMsgProcess::getInstance()->notifyResult(inner_respFrame);	//销毁"响应帧"	CARI_CCP_VOS_DEL(inner_respFrame);	return CARICCP_SUCCESS_STATE_CODE;}
开发者ID:gujun,项目名称:sscore,代码行数:30,


示例3: event_handler

static void event_handler(switch_event_t *event) {	const char *dest_proto = switch_event_get_header(event, "dest_proto");	const char *check_failure = switch_event_get_header(event, "Delivery-Failure");	const char *check_nonblocking = switch_event_get_header(event, "Nonblocking-Delivery");	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "skip_global_process", "true");	if (switch_true(check_failure)) {		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Delivery Failure/n");		DUMP_EVENT(event);		send_report(event, "Failure");		return;	} else if ( check_failure && switch_false(check_failure) ) {		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SMS Delivery Success/n");		send_report(event, "Success");		return;	} else if ( check_nonblocking && switch_true(check_nonblocking) ) {		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SMS Delivery assumed successful due to being sent in non-blocking manner/n");		send_report(event, "Accepted");		return;	}	switch_core_chat_send(dest_proto, event);}
开发者ID:odmanV2,项目名称:freecenter,代码行数:26,


示例4: xpass_encode_switch_event_headers

void xpass_encode_switch_event_headers(char *ebuf, int buf_len, switch_event_t *event) {    switch_event_header_t *hp;    char *uuid = switch_event_get_header(event, "unique-id");    int i;    int left_buf_len = buf_len;    char * tmp = ebuf;    for (i = 0, hp = event->headers; hp; hp = hp->next, i++);    if (event->body)        i++;    if (uuid) {		char *unique_id = switch_event_get_header(event, "unique-id");		tmp = encode_data(tmp, unique_id, strlen(unique_id));    } else {        tmp = encode_data(tmp, "undefined", 9);    }    tmp  = encode_data(tmp, "/r/n", 2);    for (hp = event->headers; hp; hp = hp->next) {        tmp = encode_data(tmp, hp->name, strlen(hp->name));        tmp = encode_data(tmp, ":", 1);        switch_url_decode(hp->value);        tmp = encode_data(tmp, hp->value, strlen(hp->value));        tmp = encode_data(tmp, "/r/n", 2);    }    tmp = encode_data(tmp, "/r/n", 2);    if (event->body) {        tmp = encode_data(tmp, event->body, strlen(event->body));    }}
开发者ID:jasonmsoft,项目名称:freeswitch_mod_xpass,代码行数:34,


示例5: do_index

void do_index(switch_stream_handle_t *stream){	switch_cache_db_handle_t *db;	const char *sql = "select * from channels";	struct holder holder;	char *errmsg;	if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {		return;	}	holder.host = switch_event_get_header(stream->param_event, "http-host");	holder.port = switch_event_get_header(stream->param_event, "http-port");	holder.uri = switch_event_get_header(stream->param_event, "http-uri");	holder.stream = stream;	stream->write_function(stream, "Content-type: text/html/r/n/r/n");	stream->write_function(stream,						   "<table align=center border=1 cellpadding=6 cellspacing=0>"						   "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>/n",						   "Created", "CID Name", "CID Num", "Ext", "App", "Data", "Codec", "Rate", "Listen");	switch_cache_db_execute_sql_callback(db, sql, web_callback, &holder, &errmsg);	stream->write_function(stream, "</table>");	if (errmsg) {		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error [%s]/n", errmsg);		switch_safe_free(errmsg);	}}
开发者ID:moises-silva,项目名称:mod_handsfree,代码行数:31,


示例6: mtvm_menu_preference

void mtvm_menu_preference(switch_core_session_t *session, vmivr_profile_t *profile) {	switch_channel_t *channel = switch_core_session_get_channel(session);	int retry;	vmivr_menu_profile_t menu = { "std_preference" };	/* Initialize Menu Configs */	populate_profile_menu_event(profile, &menu);	if (!menu.event_keys_dtmf || !menu.event_phrases) {		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases and Keys/n");		return;	}	for (retry = MAX_ATTEMPT; switch_channel_ready(channel) && retry > 0; retry--) {		dtmf_ss_t loc;		char *dtmfa[16] = { 0 };		switch_event_t *phrase_params = NULL;		switch_event_create(&phrase_params, SWITCH_EVENT_REQUEST_PARAMS);		append_event_profile(phrase_params, profile, menu);		populate_dtmfa_from_event(phrase_params, profile, menu, dtmfa);		captureMenuInitialize(&loc, dtmfa);		captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, phrase_params, NULL, DEFAULT_IVR_TIMEOUT);		if (loc.result == RES_TIMEOUT) {			/* TODO Ask for the prompt Again IF retry != 0 */		} else if (loc.result == RES_INVALID) {			/* TODO Say invalid option, and ask for the prompt again IF retry != 0 */		} else if (loc.result == RES_FOUND) {  /* Matching DTMF Key Pressed */			const char *action = switch_event_get_header(menu.event_keys_dtmf, loc.dtmf_stored);			/* Reset the try count */			retry = MAX_ATTEMPT;			if (action) {				if (!strcasecmp(action, "return")) { /* Return to the previous menu */					retry = -1;				} else if (!strncasecmp(action, "menu:", 5)) { /* Sub Menu */					void (*fPtr)(switch_core_session_t *session, vmivr_profile_t *profile) = mtvm_get_menu_function(action+5);					if (fPtr) {						fPtr(session, profile);					}				}			}		}		switch_event_destroy(&phrase_params);	}	free_profile_menu_event(&menu);}
开发者ID:kgrofelnik,项目名称:mod_portaudio-endpoints,代码行数:55,


示例7: vmivr_menu_preference

void vmivr_menu_preference(switch_core_session_t *session, vmivr_profile_t *profile) {	switch_channel_t *channel = switch_core_session_get_channel(session);	int retry;	vmivr_menu_t menu = { "std_preference" };	/* Initialize Menu Configs */	menu_init(profile, &menu);	if (!menu.event_keys_dtmf || !menu.event_phrases) {		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases or Keys in menu '%s'/n", menu.name);		goto end;	}	for (retry = menu.ivr_maximum_attempts; switch_channel_ready(channel) && retry > 0; retry--) {		menu_instance_init(&menu);		switch_event_add_header(menu.phrase_params, SWITCH_STACK_BOTTOM, "IVR-Retry-Left", "%d", retry);		ivre_init(&menu.ivre_d, menu.dtmfa);		ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, menu.phrase_params, NULL, menu.ivr_entry_timeout);		if (menu.ivre_d.result == RES_TIMEOUT) {			ivre_playback_dtmf_buffered(session, switch_event_get_header(menu.event_phrases, "timeout"), NULL, NULL, NULL, 0);		} else if (menu.ivre_d.result == RES_INVALID) {			ivre_playback_dtmf_buffered(session, switch_event_get_header(menu.event_phrases, "invalid"), NULL, NULL, NULL, 0);		} else if (menu.ivre_d.result == RES_FOUND) {  /* Matching DTMF Key Pressed */			const char *action = switch_event_get_header(menu.event_keys_dtmf, menu.ivre_d.dtmf_stored);			/* Reset the try count */			retry = menu.ivr_maximum_attempts;			if (action) {				if (!strcasecmp(action, "return")) { /* Return to the previous menu */					retry = -1;				} else if (!strncasecmp(action, "menu:", 5)) { /* Sub Menu */					void (*fPtr)(switch_core_session_t *session, vmivr_profile_t *profile) = vmivr_get_menu_function(action+5);					if (fPtr) {						fPtr(session, profile);					}				}			}		}		menu_instance_free(&menu);	}end:	menu_free(&menu);}
开发者ID:odmanV2,项目名称:freecenter,代码行数:52,


示例8: switch_core_session_get_channel

char *vmivr_menu_get_input_set(switch_core_session_t *session, vmivr_profile_t *profile, vmivr_menu_t *menu, const char *input_mask) {	char *result = NULL;	int retry;	const char *terminate_key = NULL;	switch_channel_t *channel = switch_core_session_get_channel(session);	if (!menu->event_keys_dtmf || !menu->event_phrases) {		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases or Keys in menu '%s'/n", menu->name);		goto end;	}	terminate_key = switch_event_get_header(menu->event_keys_action, "ivrengine:terminate_entry");	for (retry = menu->ivr_maximum_attempts; switch_channel_ready(channel) && retry > 0; retry--) {		int i;		menu_instance_init(menu);		switch_event_add_header(menu->phrase_params, SWITCH_STACK_BOTTOM, "IVR-Retry-Left", "%d", retry);		/* Find the last entry and append this one to it */		for (i=0; i < 16 && menu->dtmfa[i]; i++){		}		menu->dtmfa[i] = (char *) input_mask;		ivre_init(&menu->ivre_d, menu->dtmfa);		if (terminate_key) {			menu->ivre_d.terminate_key = terminate_key[0];		}		ivre_playback(session, &menu->ivre_d, switch_event_get_header(menu->event_phrases, "instructions"), NULL, menu->phrase_params, NULL, menu->ivr_entry_timeout);		if (menu->ivre_d.result == RES_TIMEOUT) {			ivre_playback_dtmf_buffered(session, switch_event_get_header(menu->event_phrases, "timeout"), NULL, NULL, NULL, 0);		} else if (menu->ivre_d.result == RES_INVALID) {			ivre_playback_dtmf_buffered(session, switch_event_get_header(menu->event_phrases, "invalid"), NULL, NULL, NULL, 0);		} else if (menu->ivre_d.result == RES_FOUND) {  /* Matching DTMF Key Pressed */			/* Reset the try count */			retry = menu->ivr_maximum_attempts;			if (!strncasecmp(menu->ivre_d.completeMatch, input_mask, 1)) {				result = switch_core_session_strdup(session, menu->ivre_d.dtmf_stored);				retry = -1;			}		}		menu_instance_free(menu);	}end:	return result;}
开发者ID:odmanV2,项目名称:freecenter,代码行数:51,


示例9: rayo_cpa_detector_event

/** * Forward CPA signal to client */static void rayo_cpa_detector_event(const char *jid, void *user_data){    struct rayo_actor *component = RAYO_LOCATE(jid);    if (component) {        if (CPA_COMPONENT(component)->ready) {            switch_event_t *event = (switch_event_t *)user_data;            const char *signal_type = switch_event_get_header(event, "signal-type");            struct cpa_signal *cpa_signal = switch_core_hash_find(CPA_COMPONENT(component)->signals, signal_type);            switch_log_printf(SWITCH_CHANNEL_UUID_LOG(RAYO_COMPONENT(component)->parent->id), SWITCH_LOG_DEBUG, "Handling CPA event/n");            if (cpa_signal) {                const char *value = switch_event_get_header(event, "value");                const char *duration = switch_event_get_header(event, "duration");                if (cpa_signal->terminate) {                    iks *complete_event;                    iks *signal_xml;                    stop_cpa_detectors(CPA_COMPONENT(component));                    /* send complete event to client */                    complete_event = rayo_component_create_complete_event(RAYO_COMPONENT(component), "signal", RAYO_CPA_NS);                    signal_xml = iks_find(complete_event, "complete");                    signal_xml = iks_find(signal_xml, "signal");                    iks_insert_attrib(signal_xml, "type", signal_type);                    if (!zstr(value)) {                        iks_insert_attrib(signal_xml, "value", value);                    }                    if (!zstr(duration)) {                        iks_insert_attrib(signal_xml, "duration", duration);                    }                    rayo_component_send_complete_event(RAYO_COMPONENT(component), complete_event);                } else {                    /* send event to client */                    iks *signal_event = iks_new_presence("signal", RAYO_CPA_NS, RAYO_JID(component), RAYO_COMPONENT(component)->client_jid);                    iks *signal_xml = iks_find(signal_event, "signal");                    iks_insert_attrib(signal_xml, "type", signal_type);                    if (!zstr(value)) {                        iks_insert_attrib(signal_xml, "value", value);                    }                    if (!zstr(duration)) {                        iks_insert_attrib(signal_xml, "duration", duration);                    }                    RAYO_SEND_REPLY(component, RAYO_COMPONENT(component)->client_jid, signal_event);                }            }        } else {            switch_log_printf(SWITCH_CHANNEL_UUID_LOG(RAYO_COMPONENT(component)->parent->id), SWITCH_LOG_DEBUG, "Skipping CPA event/n");        }        RAYO_UNLOCK(component);    }}
开发者ID:bodji,项目名称:freeswitch,代码行数:53,


示例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: vmivr_menu_authenticate

void vmivr_menu_authenticate(switch_core_session_t *session, vmivr_profile_t *profile) {	switch_channel_t *channel = switch_core_session_get_channel(session);	vmivr_menu_t menu = { "std_authenticate" };	int retry;	const char *auth_var = NULL;	/* Initialize Menu Configs */	menu_init(profile, &menu);	if (profile->id && (auth_var = switch_channel_get_variable(channel, "voicemail_authorized")) && switch_true(auth_var)) {		profile->authorized = SWITCH_TRUE;	}	for (retry = menu.ivr_maximum_attempts; switch_channel_ready(channel) && retry > 0 && profile->authorized == SWITCH_FALSE; retry--) {		const char *id = profile->id, *password = NULL;		char *cmd = NULL;		const char *password_mask = switch_event_get_header(menu.event_settings, "Password-Mask");		const char *user_mask = switch_event_get_header(menu.event_settings, "User-Mask");		if (!id) {			vmivr_menu_t sub_menu = { "std_authenticate_ask_user" };			/* Initialize Menu Configs */			menu_init(profile, &sub_menu);			switch_event_add_header(sub_menu.phrase_params, SWITCH_STACK_BOTTOM, "IVR-Retry-Left", "%d", retry);			id = vmivr_menu_get_input_set(session, profile, &sub_menu, user_mask);			menu_free(&sub_menu);		}		if (!password) {			vmivr_menu_t sub_menu = { "std_authenticate_ask_password" };			/* Initialize Menu Configs */			menu_init(profile, &sub_menu);			switch_event_add_header(sub_menu.phrase_params, SWITCH_STACK_BOTTOM, "IVR-Retry-Left", "%d", retry);			password = vmivr_menu_get_input_set(session, profile, &sub_menu, password_mask);			menu_free(&sub_menu);		}		cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, id, password);		if (vmivr_api_execute(session, profile->api_auth_login, cmd) == SWITCH_STATUS_SUCCESS) {			profile->id = id;			profile->authorized = SWITCH_TRUE;		} else {			ivre_playback_dtmf_buffered(session, switch_event_get_header(menu.event_phrases, "fail_auth"), NULL, NULL, NULL, 0);		}	}	menu_free(&menu);}
开发者ID:odmanV2,项目名称:freecenter,代码行数:48,


示例12: print_result

void print_result(char const *addr,				  char const *port,				  char const *tport,				  double weight,				  unsigned preference,				  switch_stream_handle_t *stream){	int xml = switch_true(switch_event_get_header(stream->param_event, "xml"));	if (!port || !port[0])		port = transport_is_secure(tport) ? "5061" : "5060";	if (xml) {		stream->write_function(stream, 							   " <route>/n"							   "  <preference>%u</preference>/n"							   "  <weight>%.3f</weight>/n"							   "  <transport>%s</transport>/n"							   "  <port>%s</port>/n"							   "  <address>%s</address>/n"							   " </route>/n",							   preference, weight, tport, port, addr);	} else {		stream->write_function(stream, "%10u/t%10.3f/t%10s/t%10s/t%10s/n", preference, weight, tport, port, addr);	}}
开发者ID:gujun,项目名称:sscore,代码行数:26,


示例13: append_event_message

void append_event_message(switch_core_session_t *session, vmivr_profile_t *profile, switch_event_t *phrase_params, switch_event_t *msg_list_event, size_t current_msg) {	char *varname;	char *apicmd;	char *total_msg = NULL;	if (!msg_list_event || !(total_msg = switch_event_get_header(msg_list_event, "VM-List-Count")) || current_msg > atoi(total_msg)) {		/* TODO Error MSG */		return;	}	varname = switch_mprintf("VM-List-Message-%" SWITCH_SIZE_T_FMT "-UUID", current_msg);	apicmd = switch_mprintf("json %s %s %s %s", profile->api_profile, profile->domain, profile->id, switch_event_get_header(msg_list_event, varname));	switch_safe_free(varname);	jsonapi2event(session, phrase_params, profile->api_msg_get, apicmd);	/* TODO Set these 2 header correctly */	switch_event_add_header(phrase_params, SWITCH_STACK_BOTTOM, "VM-Message-Type", "%s", "new");	switch_event_add_header(phrase_params, SWITCH_STACK_BOTTOM, "VM-Message-Number", "%"SWITCH_SIZE_T_FMT, current_msg);	switch_event_add_header_string(phrase_params, SWITCH_STACK_BOTTOM, "VM-Message-Private-Local-Copy", "False");	switch_safe_free(apicmd);}
开发者ID:PauloFer1,项目名称:FreeSWITCH,代码行数:26,


示例14: event_handler

static void event_handler(switch_event_t *event){    const char *sig = switch_event_get_header(event, "Trapped-Signal");    switch_hash_index_t *hi;    void *val;    cdr_fd_t *fd;    if (globals.shutdown) {        return;    }    if (sig && !strcmp(sig, "HUP")) {        for (hi = switch_hash_first(NULL, globals.fd_hash); hi; hi = switch_hash_next(hi)) {            switch_hash_this(hi, NULL, NULL, &val);            fd = (cdr_fd_t *) val;            switch_mutex_lock(fd->mutex);            do_rotate(fd);            switch_mutex_unlock(fd->mutex);        }        if (globals.db_online) {            PQfinish(globals.db_connection);            globals.db_online = 0;        }    }}
开发者ID:publicreading,项目名称:FreeSWITCH,代码行数:25,


示例15: conference_event_chat_message_broadcast

/* send a message to every member of the conference */void conference_event_chat_message_broadcast(conference_obj_t *conference, switch_event_t *event){	conference_member_t *member = NULL;	switch_event_t *processed;	switch_assert(conference != NULL);	switch_event_create(&processed, SWITCH_EVENT_CHANNEL_DATA);	switch_mutex_lock(conference->member_mutex);	for (member = conference->members; member; member = member->next) {		if (member->session && !conference_utils_member_test_flag(member, MFLAG_NOCHANNEL)) {			const char *presence_id = switch_channel_get_variable(member->channel, "presence_id");			const char *chat_proto = switch_channel_get_variable(member->channel, "chat_proto");			switch_event_t *reply = NULL;			if (presence_id && chat_proto) {				if (switch_event_get_header(processed, presence_id)) {					continue;				}				switch_event_dup(&reply, event);				switch_event_add_header_string(reply, SWITCH_STACK_BOTTOM, "to", presence_id);				switch_event_add_header_string(reply, SWITCH_STACK_BOTTOM, "conference_name", conference->name);				switch_event_add_header_string(reply, SWITCH_STACK_BOTTOM, "conference_domain", conference->domain);				switch_event_set_body(reply, switch_event_get_body(event));				switch_core_chat_deliver(chat_proto, &reply);				switch_event_add_header_string(processed, SWITCH_STACK_BOTTOM, presence_id, "true");			}		}	}	switch_event_destroy(&processed);	switch_mutex_unlock(conference->member_mutex);}
开发者ID:prashantchoudhary,项目名称:FreeswitchModified,代码行数:35,


示例16: event_handler

static void event_handler(switch_event_t *event){	if (process_event(event) != SWITCH_STATUS_SUCCESS) {		const char *peer_uuid = switch_event_get_header(event, "variable_signal_bond");		switch_core_session_t *peer_session = NULL;		switch_channel_t *peer_channel = NULL;		switch_event_t *peer_event = NULL;				if (!peer_uuid) {			return;		}		if (!(peer_session = switch_core_session_locate(peer_uuid))) {			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cant locate peer session for uuid %s/n", peer_uuid);			return;		}		peer_channel = switch_core_session_get_channel(peer_session);				if (switch_event_create(&peer_event, SWITCH_EVENT_CHANNEL_BRIDGE) != SWITCH_STATUS_SUCCESS) {			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cant create bridge event for peer channel %s/n", peer_uuid);			goto end;		}		switch_channel_event_set_data(peer_channel, peer_event);	end:		switch_core_session_rwunlock(peer_session);		if (peer_event) {			process_event(peer_event);			switch_event_destroy(&peer_event);		}	}}
开发者ID:Deepwalker,项目名称:FreeSWITCH,代码行数:35,


示例17: event_handler

static void event_handler(switch_event_t *event){	const char *sig = switch_event_get_header(event, "Trapped-Signal");	switch_hash_index_t *hi;	void *val;	const void *var;	logfile_profile_t *profile;	if (sig && !strcmp(sig, "HUP")) {		if (globals.rotate) {			for (hi = switch_core_hash_first(profile_hash); hi; hi = switch_core_hash_next(&hi)) {				switch_core_hash_this(hi, &var, NULL, &val);				profile = val;				mod_logfile_rotate(profile);			}		} else {			switch_mutex_lock(globals.mutex);			for (hi = switch_core_hash_first(profile_hash); hi; hi = switch_core_hash_next(&hi)) {				switch_core_hash_this(hi, &var, NULL, &val);				profile = val;				switch_file_close(profile->log_afd);				if (mod_logfile_openlogfile(profile, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Re-opening Log!/n");				}			}			switch_mutex_unlock(globals.mutex);		}	}}
开发者ID:odmanV2,项目名称:freecenter,代码行数:29,


示例18: mod_xml_radius_directory_search

static switch_xml_t mod_xml_radius_directory_search(const char *section, const char *tag_name, const char *key_name, const char *key_value, 													switch_event_t *params,	void *user_data){	char *event_buf = NULL;	switch_xml_t xml = NULL;	char *auth_method = switch_event_get_header(params,"sip_auth_method");		if ( GLOBAL_DEBUG ) {		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: starting authentication/n");		switch_event_serialize(params, &event_buf, SWITCH_TRUE);		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Event: %s /n", event_buf);		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Section: %s /nTag: %s/nKey_name: %s/nKey_value: %s/n", 						  section, tag_name, key_name, key_value);	}		if ( auth_method == NULL) {		return NULL;	}		if ( strncmp( "INVITE", auth_method, 6) == 0) {		xml = mod_xml_radius_auth_invite(params);	} else if ( strncmp( "REGISTER", auth_method, 8) == 0) {		xml = mod_xml_radius_auth_reg(params);	} else {		xml = NULL;	}	return xml;}
开发者ID:PauloFer1,项目名称:FreeSWITCH,代码行数:30,


示例19: event_handler

static void event_handler(switch_event_t *event){	const char *sig = switch_event_get_header(event, "Trapped-Signal");	if (sig && !strcmp(sig, "HUP")) {		do_rotate_all();	}}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:8,


示例20: SWITCH_DECLARE

SWITCH_DECLARE(int)Event::chat_send(const char *dest_proto){	if (zstr(dest_proto)) {		dest_proto = switch_event_get_header(event, "dest_proto");	}	return (int) switch_core_chat_send(dest_proto, event);}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:8,


示例21: 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,


示例22: vmivr_menu_record_greeting_with_slot

void vmivr_menu_record_greeting_with_slot(switch_core_session_t *session, vmivr_profile_t *profile) {	vmivr_menu_t menu = { "std_record_greeting_with_slot" };	const char *result;	int gnum = -1;	/* Initialize Menu Configs */	menu_init(profile, &menu);	result = vmivr_menu_get_input_set(session, profile, &menu, "X");	if (result)		gnum = atoi(result);	/* If user entered 0, we don't accept it */	if (gnum > 0) {		vmivr_menu_t sub_menu = { "std_record_greeting" };		char *tmp_filepath = NULL;		const char *record_format = NULL;		switch_status_t status;		/* Initialize Menu Configs */		menu_init(profile, &sub_menu);		record_format = switch_event_get_header(menu.event_settings, "Record-Format");		tmp_filepath = generate_random_file_name(session, "voicemail_ivr", record_format);		status =  vmivr_menu_record(session, profile, &sub_menu, tmp_filepath);		if (status == SWITCH_STATUS_SUCCESS) {			char *cmd = switch_core_session_sprintf(session, "%s %s %s %d %s", profile->api_profile, profile->domain, profile->id, gnum, tmp_filepath);			char *str_num = switch_core_session_sprintf(session, "%d", gnum);			vmivr_api_execute(session, profile->api_pref_greeting_set, cmd);			ivre_playback_dtmf_buffered(session, switch_event_get_header(menu.event_phrases, "selected_slot"), str_num, NULL, NULL, 0);		}		menu_free(&sub_menu);	}	menu_free(&menu);}
开发者ID:odmanV2,项目名称:freecenter,代码行数:45,


示例23: process_event

static switch_status_t process_event(switch_event_t *event){	switch_core_session_t *session = NULL;	switch_channel_t *channel;	char *username[3] = { 0 };	char *domain[3] = { 0 };	char key[512];	char *uuid = NULL, *my_uuid = NULL;	int i;	switch_thread_rwlock_rdlock(globals.spy_hash_lock);	if (!globals.spy_count) {		goto done;	}	username[0] = switch_event_get_header(event, "Caller-Username");	domain[0] = switch_event_get_header(event, "variable_domain_name");	domain[1] = switch_event_get_header(event, "variable_dialed_domain");	username[1] = switch_event_get_header(event, "variable_dialed_user");	username[2] = switch_event_get_header(event, "variable_user_name");	domain[2] = switch_event_get_header(event, "variable_domain_name");	for (i = 0; i < 3; i++) {		if (username[i] && domain[i]) {			switch_snprintf(key, sizeof(key), "%[email
C++ switch_get_state函数代码示例
C++ switch_event_fire函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。