<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Or even better, why not just call record_session in your dialplan?</div><br><div><div>On Sep 16, 2010, at 9:09 AM, Steven Ayre wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">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><br><div class="gmail_quote">On 16 September 2010 06:22, Farhan Husain <span dir="ltr">&lt;<a href="mailto:farhan.husain@csebuet.org">farhan.husain@csebuet.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex; position: static; z-index: auto; ">
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&nbsp;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>

</blockquote></div></blockquote></div><br></body></html>