You don't need to reinvent the wheel.<br><br>Check out these functions:<br>switch_ivr_record_file(switch_core_session_t *session, switch_file_handle_t *fh, const char *file, switch_input_args_t *args, uint32_t limit)<br>
switch_ivr_record_session(switch_core_session_t *session, char *file, uint32_t limit, switch_file_handle_t *fh)<br><br>I don't think they're in the documentation. For an example of using them, the record and record_session apps in mod_dptools.c use them.<br>
<br>Using one of those will handle all the recording for you, so you just need to create an event handler that starts the recording.<br><br>Alternatively, you could base the code in your module on those functions and record_callback.<br>
<br>-Steve<br><br><br><br><div class="gmail_quote">On 16 September 2010 06:22, Farhan Husain <span dir="ltr"><<a href="mailto:farhan.husain@csebuet.org">farhan.husain@csebuet.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hello,<div><br></div><div>I am trying to write a module which would record all the media sessions. What I did so far is as following:</div><div><br></div><div>1. Subscribed to channel events</div><div>2. On SWITCH_EVENT_CHANNEL_CREATE I install a callback function using the "switch_core_media_bug_add" function.</div>
<div><br></div><div>At this point, my callback method is being called. I can see my debug printout when I leave a voicemail for an offline user. I want to write the media data to a file. The callback method signature is like this:</div>
<div><br></div><div>switch_bool_t my_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)</div><div><br></div><div>However, I tried to find what "switch_media_bug_t" and "switch_abc_type_t" are in the API reference doc and found their definition. But it seems hard to understand what the fields mean, specially for the first struct. Can anyone help me by describing these two data types?</div>
<div><br></div><div>Thanks,</div><div>Farhan</div>
<br>_______________________________________________<br>
FreeSWITCH-dev mailing list<br>
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>