Hello, I am trying to write a module which would record all the media sessions. What I did so far is as following: 1. Subscribed to channel events 2. On SWITCH_EVENT_CHANNEL_CREATE I install a callback function using the "switch_core_media_bug_add" function. 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: switch_bool_t my_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) 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? Thanks, Farhan
You don't need to reinvent the wheel. Check out these functions: 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) switch_ivr_record_session(switch_core_session_t *session, char *file, uint32_t limit, switch_file_handle_t *fh) 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. Using one of those will handle all the recording for you, so you just need to create an event handler that starts the recording. Alternatively, you could base the code in your module on those functions and record_callback. -Steve On 16 September 2010 06:22, Farhan Husain <farhan.husain@csebuet.org> wrote:
Hello,
I am trying to write a module which would record all the media sessions. What I did so far is as following:
1. Subscribed to channel events 2. On SWITCH_EVENT_CHANNEL_CREATE I install a callback function using the "switch_core_media_bug_add" function.
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:
switch_bool_t my_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
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?
Thanks, Farhan
_______________________________________________ FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
Or even better, why not just call record_session in your dialplan? On Sep 16, 2010, at 9:09 AM, Steven Ayre wrote:
You don't need to reinvent the wheel.
Check out these functions: 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) switch_ivr_record_session(switch_core_session_t *session, char *file, uint32_t limit, switch_file_handle_t *fh)
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.
Using one of those will handle all the recording for you, so you just need to create an event handler that starts the recording.
Alternatively, you could base the code in your module on those functions and record_callback.
On 16 September 2010 06:22, Farhan Husain <farhan.husain@csebuet.org> wrote: Hello,
I am trying to write a module which would record all the media sessions. What I did so far is as following:
1. Subscribed to channel events 2. On SWITCH_EVENT_CHANNEL_CREATE I install a callback function using the "switch_core_media_bug_add" function.
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:
switch_bool_t my_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
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?
participants (3)
-
Farhan Husain
-
Michael Jerris
-
Steven Ayre