<div><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">/*!<br>  <span style="color:rgb(0,76,20)">\brief</span> Fire an event filling in most of the arguements with obvious values<br>

  <span style="color:rgb(0,76,20)">\param</span> event the event to send (will be nulled on success)<br>  <span style="color:rgb(0,76,20)">\return</span> SWITCH_STATUS_SUCCESS if the operation was successful<br>  <span style="color:rgb(0,76,20)">\note</span> the body supplied by this function will supersede an existing body the event may have<br>

*/<br>#define switch_event_fire(event) switch_event_fire_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, event, NULL)<br>/*!<br>How would I use switch_event_fire_detailed with mod_event_socket, which I believe is necessary in order to send the user_data?</blockquote>

</div></div><div><br></div><div>switch_event.h:418:#define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, event, data)</div></div><div><br></div><div>So probably switch_event_fire_data(event_name, user_data)</div>

<div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><br><div class="gmail_quote">On 18 July 2013 03:09, Jon Lederman <span dir="ltr">&lt;<a href="mailto:jon@thesoniccloud.com" target="_blank">jon@thesoniccloud.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi,<div><br></div><div> <div><div>I&#39;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, &quot;Couldn&#39;t bind!\n&quot;);<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-&gt;event_user_data;<br>

 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, &quot;AudioWeaver Message Event Handler Reached!&quot;);<br> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, switch_event_get_body(event));<br>  std::string reply;<br>

  int ret = pvt-&gt;aw_talker-&gt;SendMessage(&quot;set_value,Sine1.freq,110.0&quot;, 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&#39;t seem to point to the private data.  Am I setting up my event handler correctly to get this data?<br><br>Thanks.<span class="HOEnZb"><font color="#888888"><br><br>-Jon</font></span></div>

</div></div></div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>