[Freeswitch-svn] [commit] r1677 - in freeswitch/branches/athompson/trunk: . src/mod/applications/mod_sleep
Freeswitch SVN
athompson at freeswitch.org
Mon Jun 26 00:01:15 EDT 2006
Author: athompson
Date: Mon Jun 26 00:01:15 2006
New Revision: 1677
Added:
freeswitch/branches/athompson/trunk/src/mod/applications/mod_sleep/
freeswitch/branches/athompson/trunk/src/mod/applications/mod_sleep/mod_sleep.c
Modified:
freeswitch/branches/athompson/trunk/modules.conf.in
Log:
Add a sleep application for putting a delay in the dialplan.
Modified: freeswitch/branches/athompson/trunk/modules.conf.in
==============================================================================
--- freeswitch/branches/athompson/trunk/modules.conf.in (original)
+++ freeswitch/branches/athompson/trunk/modules.conf.in Mon Jun 26 00:01:15 2006
@@ -5,6 +5,7 @@
applications/mod_echo
applications/mod_ivrtest
applications/mod_playback
+applications/mod_sleep
applications/mod_skel
#applications/mod_rss
#asr_tts/mod_cepstral
Added: freeswitch/branches/athompson/trunk/src/mod/applications/mod_sleep/mod_sleep.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/athompson/trunk/src/mod/applications/mod_sleep/mod_sleep.c Mon Jun 26 00:01:15 2006
@@ -0,0 +1,71 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct at yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct at yahoo.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Anthony Minessale II <anthmct at yahoo.com>
+ * Andrew Thompson <athompson at collectiveholdings.com>
+ *
+ * mod_sleep.c -- Sleep Module
+ *
+ */
+#include <switch.h>
+
+static const char modname[] = "mod_sleep";
+
+static void sleep_function(switch_core_session_t *session, char *data)
+{
+ char *delay = NULL;
+
+ delay = switch_core_session_strdup(session, data);
+ /* 1000000 seems to be equiv to 1 second */
+ switch_sleep(atof(delay) * 1000000);
+}
+
+static const switch_application_interface_t sleep_application_interface = {
+ /*.interface_name */ "sleep",
+ /*.application_function */ sleep_function,
+ NULL,NULL,NULL,NULL
+};
+
+static switch_loadable_module_interface_t sleep_module_interface = {
+ /*.module_name */ modname,
+ /*.endpoint_interface */ NULL,
+ /*.timer_interface */ NULL,
+ /*.dialplan_interface */ NULL,
+ /*.codec_interface */ NULL,
+ /*.application_interface */ &sleep_application_interface,
+ /*.api_interface */ NULL,
+ /*.file_interface */ NULL,
+ /*.speech_interface */ NULL,
+ /*.directory_interface */ NULL
+};
+
+SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
+{
+ /* connect my internal structure to the blank pointer passed to me */
+ *module_interface = &sleep_module_interface;
+
+ /* indicate that the module should continue to be loaded */
+ return SWITCH_STATUS_SUCCESS;
+}
More information about the Freeswitch-svn
mailing list