<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div> <div><div>I'm trying to set up an event handler that will send some user data to a callback function. I am using:<br><br><br> pvt = (switch_audio_weaver_t*) switch_core_session_alloc(session, sizeof(*pvt));<br><br> if (switch_event_bind(modname, SWITCH_EVENT_CUSTOM, AUDIOWEAVER_SEND_MESSAGE, audioweaver_message_event_handler, pvt) != SWITCH_STATUS_SUCCESS) {<br> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");<br> /* indicate that the module should continue to be loaded */<br> return SWITCH_STATUS_FALSE;<br>}<br><br>This works fine and my event handler is called. But, I am unclear how to get the event_user_data. My event handler is:<br><br>static void audioweaver_message_event_handler(switch_event_t *event)<br>{<br> switch_audio_weaver_t *pvt = (switch_audio_weaver_t *) event->event_user_data;<br> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AudioWeaver Message Event Handler Reached!");<br> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, switch_event_get_body(event));<br> std::string reply;<br> int ret = pvt->aw_talker->SendMessage("set_value,Sine1.freq,110.0", reply);<div><br></div><div><div>I am using mod_event_socket, which uses switch_event_fire. I note in switch_event.h, the following:</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0); ">/*!</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0); "> <span style="color: rgb(0, 76, 20); ">\brief</span> Fire an event filling in most of the arguements with obvious values</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0); "> <span style="color: rgb(0, 76, 20); ">\param</span> event the event to send (will be nulled on success)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0); "> <span style="color: rgb(0, 76, 20); ">\return</span> SWITCH_STATUS_SUCCESS if the operation was successful</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0); "> <span style="color: rgb(0, 76, 20); ">\note</span> the body supplied by this function will supersede an existing body the event may have</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0); ">*/</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(120, 73, 42); ">#define switch_event_fire(event) switch_event_fire_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, event, NULL)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(0, 132, 0); ">/*!</div></div><div><br></div><div>How would I use switch_event_fire_detailed with mod_event_socket, which I believe is necessary in order to send the user_data?</div>}<br><br>However, the pointer doesn't seem to point to the private data. Am I setting up my event handler correctly to get this data?<br><br>Thanks.<br><br>-Jon</div></div></div></div></body></html>