yet more rearrangment of events ;-)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@172 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2005-12-19 18:55:31 +00:00
1 parent 07920c0a94
commit 2a58e2038a
6 files changed
+236 -40

No files matched your search

+11 -6
View File
@@ -35,12 +35,11 @@ static const char modname[] = "mod_event_test";
static void event_handler (switch_event *event)
{
switch_console_printf(SWITCH_CHANNEL_CONSOLE,"\n*** EVENT ***\nEventName: %s\nSubclassOwner: %s\nSubclassName: %s\nEventData: %s\n\n",
switch_event_name(event->event),
event->subclass->owner,
event->subclass->name,
event->data);
char buf[1024];
switch_event_serialize(event, buf, sizeof(buf), NULL);
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "\nEVENT\n--------------------------------\n%s\n", buf);
}
static switch_loadable_module_interface event_test_module_interface = {
/*.module_name*/ modname,
@@ -76,10 +75,16 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(switch_loadable_module_inte
#ifdef TORTURE_ME
SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
{
int y = 0;
switch_event *event;
for(;;) {
int x;
for(x = 0; x < 100; x++) {
switch_event_fire_subclass(SWITCH_EVENT_CUSTOM, MY_EVENT_COOL, "hello world");
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_COOL) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, "event_info", "hello world %d", y++);
switch_event_fire(&event);
}
}
switch_yield(100000);
}
+8 -1
View File
@@ -266,8 +266,15 @@ static switch_status channel_on_transmit(switch_core_session *session)
while(switch_channel_get_state(channel) == CS_TRANSMIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
if (switch_time_now() - last >= waitsec) {
char buf[512];
switch_event *event;
snprintf(buf, sizeof(buf), "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id);
switch_event_fire_subclass(SWITCH_EVENT_CUSTOM, MY_EVENT_RINGING, buf);
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_RINGING) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, "event_info", buf);
switch_event_fire(&event);
}
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s\n", buf);
last = switch_time_now();
}