[Freeswitch-trunk] [commit] r6771 - in freeswitch/trunk/src: . include mod/applications/mod_commands mod/applications/mod_dptools
Freeswitch SVN
anthm at freeswitch.org
Thu Dec 13 17:17:20 EST 2007
Author: anthm
Date: Thu Dec 13 17:17:20 2007
New Revision: 6771
Modified:
freeswitch/trunk/src/include/switch_ivr.h
freeswitch/trunk/src/include/switch_module_interfaces.h
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_core_state_machine.c
freeswitch/trunk/src/switch_ivr.c
Log:
add park_state
Modified: freeswitch/trunk/src/include/switch_ivr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_ivr.h (original)
+++ freeswitch/trunk/src/include/switch_ivr.h Thu Dec 13 17:17:20 2007
@@ -719,6 +719,7 @@
switch_input_args_t *args);
SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint32_t delay_ms);
SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session, const char *uuid);
+SWITCH_DECLARE(void) switch_ivr_park_session(switch_core_session_t *session);
/** @} */
Modified: freeswitch/trunk/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/trunk/src/include/switch_module_interfaces.h (original)
+++ freeswitch/trunk/src/include/switch_module_interfaces.h Thu Dec 13 17:17:20 2007
@@ -53,6 +53,7 @@
SWITCH_SHN_ON_HANGUP,
SWITCH_SHN_ON_LOOPBACK,
SWITCH_SHN_ON_TRANSMIT,
+ SWITCH_SHN_ON_PARK,
SWITCH_SHN_ON_HOLD,
SWITCH_SHN_ON_HIBERNATE,
SWITCH_SHN_ON_RESET
@@ -71,6 +72,8 @@
switch_state_handler_t on_loopback;
/*! executed when the state changes to transmit */
switch_state_handler_t on_transmit;
+ /*! executed when the state changes to park */
+ switch_state_handler_t on_park;
/*! executed when the state changes to hold */
switch_state_handler_t on_hold;
/*! executed when the state changes to hibernate */
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Thu Dec 13 17:17:20 2007
@@ -560,6 +560,7 @@
CS_TRANSMIT - Channel is in a passive transmit state
CS_EXECUTE - Channel is executing it's dialplan
CS_LOOPBACK - Channel is in loopback
+CS_PARK - Channel is parked
CS_HOLD - Channel is on hold
CS_HIBERNATE - Channel is in a sleep state
CS_RESET - Channel is in a reset state
@@ -574,6 +575,7 @@
CS_TRANSMIT,
CS_EXECUTE,
CS_LOOPBACK,
+ CS_PARK,
CS_HOLD,
CS_HIBERNATE,
CS_RESET,
Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Thu Dec 13 17:17:20 2007
@@ -685,6 +685,29 @@
return SWITCH_STATUS_SUCCESS;
}
+
+#define PARK_SYNTAX "<uuid>"
+SWITCH_STANDARD_API(park_function)
+{
+ switch_core_session_t *ksession = NULL;
+
+ if (session) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (!cmd) {
+ stream->write_function(stream, "-USAGE: %s\n", PARK_SYNTAX);
+ } else if ((ksession = switch_core_session_locate(cmd))) {
+ switch_ivr_park_session(ksession);
+ switch_core_session_rwunlock(ksession);
+ stream->write_function(stream, "+OK\n");
+ } else {
+ stream->write_function(stream, "-ERR No Such Channel!\n");
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
#define TRANSFER_SYNTAX "<uuid> [-bleg|-both] <dest-exten> [<dialplan>] [<context>]"
SWITCH_STANDARD_API(transfer_function)
{
@@ -1994,11 +2017,14 @@
SWITCH_ADD_API(commands_api_interface, "originate", "Originate a Call", originate_function, ORIGINATE_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "tone_detect", "Start Tone Detection on a channel", tone_detect_session_function, TONE_DETECT_SYNTAX);
- SWITCH_ADD_API(commands_api_interface, "killchan", "Kill Channel", kill_function, KILL_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "killchan", "Kill Channel (depricated)", kill_function, KILL_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "uuid_kill", "Kill Channel", kill_function, KILL_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "uuid_park", "Park Channel", park_function, PARK_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "reloadxml", "Reload XML", reload_function, "");
SWITCH_ADD_API(commands_api_interface, "unload", "Unload Module", unload_function, LOAD_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "load", "Load Module", load_function, LOAD_SYNTAX);
- SWITCH_ADD_API(commands_api_interface, "transfer", "Transfer Module", transfer_function, TRANSFER_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "transfer", "Transfer (depricated)", transfer_function, TRANSFER_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "uuid_transfer", "Transfer a session", transfer_function, TRANSFER_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "pause", "Pause", pause_function, PAUSE_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "break", "Break", break_function, BREAK_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "show", "Show", show_function, SHOW_SYNTAX);
@@ -2008,11 +2034,17 @@
SWITCH_ADD_API(commands_api_interface, "uuid_getvar", "uuid_getvar", uuid_getvar_function, GETVAR_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "global_setvar", "global_setvar", global_setvar_function, GLOBAL_SETVAR_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "global_getvar", "global_getvar", global_getvar_function, GLOBAL_GETVAR_SYNTAX);
- SWITCH_ADD_API(commands_api_interface, "session_displace", "session displace", session_displace_function, "<uuid> [start|stop] <path> [<limit>] [mux]");
- SWITCH_ADD_API(commands_api_interface, "session_record", "session record", session_record_function, SESS_REC_SYNTAX);
- SWITCH_ADD_API(commands_api_interface, "broadcast", "broadcast", uuid_broadcast_function, BROADCAST_SYNTAX);
- SWITCH_ADD_API(commands_api_interface, "hold", "hold", uuid_hold_function, HOLD_SYNTAX);
- SWITCH_ADD_API(commands_api_interface, "media", "media", uuid_media_function, MEDIA_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "session_displace", "session displace (depricated)",
+ session_displace_function, "<uuid> [start|stop] <path> [<limit>] [mux]");
+ SWITCH_ADD_API(commands_api_interface, "uuid_displace", "session displace", session_displace_function, "<uuid> [start|stop] <path> [<limit>] [mux]");
+ SWITCH_ADD_API(commands_api_interface, "session_record", "session record (depricated)", session_record_function, SESS_REC_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "uuid_record", "session record", session_record_function, SESS_REC_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "broadcast", "broadcast (depricated)", uuid_broadcast_function, BROADCAST_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "uuid_broadcast", "broadcast", uuid_broadcast_function, BROADCAST_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "hold", "hold (depricated)", uuid_hold_function, HOLD_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "uuid_hold", "hold", uuid_hold_function, HOLD_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "media", "media (depricated)", uuid_media_function, MEDIA_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "uuid media", "media", uuid_media_function, MEDIA_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "fsctl", "control messages", ctl_function, CTL_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "help", "Show help for all the api commands", help_function, "");
SWITCH_ADD_API(commands_api_interface, "version", "Show version of the switch", version_function, "");
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Thu Dec 13 17:17:20 2007
@@ -1027,6 +1027,12 @@
}
+SWITCH_STANDARD_APP(park_state_function)
+{
+ switch_ivr_park_session(session);
+
+}
+
/********************************************************************************/
/* Playback/Record Functions */
/********************************************************************************/
@@ -1637,7 +1643,8 @@
SWITCH_ADD_APP(app_interface, "fax_detect", "Detect faxes", "Detect fax send tone", fax_detect_session_function, "", SAF_NONE);
SWITCH_ADD_APP(app_interface, "tone_detect", "Detect tones", "Detect tones", tone_detect_session_function, "", SAF_NONE);
SWITCH_ADD_APP(app_interface, "echo", "Echo", "Perform an echo test against the calling channel", echo_function, "", SAF_NONE);
- SWITCH_ADD_APP(app_interface, "park", NULL, NULL, park_function, NULL, SAF_NONE);
+ SWITCH_ADD_APP(app_interface, "park", "Park", "Park", park_function, "", SAF_NONE);
+ SWITCH_ADD_APP(app_interface, "park_state", "Park State", "Park State", park_state_function, "", SAF_NONE);
SWITCH_ADD_APP(app_interface, "gentones", "Generate Tones", "Generate tones to the channel", gentones_function, "<tgml_script>[|<loops>]", SAF_NONE);
SWITCH_ADD_APP(app_interface, "playback", "Playback File", "Playback a file to the channel", playback_function, "<path>", SAF_NONE);
SWITCH_ADD_APP(app_interface, "stop_record_session", "Stop Record Session", STOP_SESS_REC_DESC, stop_record_session_function, "<path>", SAF_NONE);
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Thu Dec 13 17:17:20 2007
@@ -553,6 +553,7 @@
"CS_TRANSMIT",
"CS_EXECUTE",
"CS_LOOPBACK",
+ "CS_PARK",
"CS_HOLD",
"CS_HIBERNATE",
"CS_RESET",
@@ -666,6 +667,7 @@
case CS_TRANSMIT:
case CS_RING:
case CS_EXECUTE:
+ case CS_PARK:
case CS_HOLD:
case CS_HIBERNATE:
case CS_RESET:
@@ -680,6 +682,7 @@
case CS_TRANSMIT:
case CS_RING:
case CS_EXECUTE:
+ case CS_PARK:
case CS_HOLD:
case CS_HIBERNATE:
case CS_RESET:
@@ -694,6 +697,7 @@
case CS_LOOPBACK:
case CS_RING:
case CS_EXECUTE:
+ case CS_PARK:
case CS_HOLD:
case CS_HIBERNATE:
case CS_RESET:
@@ -703,6 +707,21 @@
}
break;
+ case CS_PARK:
+ switch (state) {
+ case CS_LOOPBACK:
+ case CS_RING:
+ case CS_EXECUTE:
+ case CS_TRANSMIT:
+ case CS_HIBERNATE:
+ case CS_RESET:
+ case CS_HOLD:
+ ok++;
+ default:
+ break;
+ }
+ break;
+
case CS_HOLD:
switch (state) {
case CS_LOOPBACK:
@@ -711,6 +730,7 @@
case CS_TRANSMIT:
case CS_HIBERNATE:
case CS_RESET:
+ case CS_PARK:
ok++;
default:
break;
@@ -723,6 +743,7 @@
case CS_RING:
case CS_EXECUTE:
case CS_TRANSMIT:
+ case CS_PARK:
case CS_HOLD:
case CS_RESET:
ok++;
@@ -737,6 +758,7 @@
case CS_LOOPBACK:
case CS_EXECUTE:
case CS_TRANSMIT:
+ case CS_PARK:
case CS_HOLD:
case CS_HIBERNATE:
case CS_RESET:
@@ -751,6 +773,7 @@
case CS_LOOPBACK:
case CS_TRANSMIT:
case CS_RING:
+ case CS_PARK:
case CS_HOLD:
case CS_HIBERNATE:
case CS_RESET:
Modified: freeswitch/trunk/src/switch_core_state_machine.c
==============================================================================
--- freeswitch/trunk/src/switch_core_state_machine.c (original)
+++ freeswitch/trunk/src/switch_core_state_machine.c Thu Dec 13 17:17:20 2007
@@ -205,6 +205,15 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard TRANSMIT\n");
}
+static void switch_core_standard_on_park(switch_core_session_t *session)
+{
+ switch_assert(session != NULL);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard PARK\n");
+ switch_channel_clear_flag(session->channel, CF_TRANSFER);
+ switch_core_session_reset(session);
+ switch_ivr_park(session, NULL);
+}
+
static void switch_core_standard_on_hold(switch_core_session_t *session)
{
switch_assert(session != NULL);
@@ -419,6 +428,9 @@
case CS_TRANSMIT: /* send/recieve data to/from another channel */
STATE_MACRO(transmit, "TRANSMIT");
break;
+ case CS_PARK: /* wait in limbo */
+ STATE_MACRO(park, "PARK");
+ break;
case CS_HOLD: /* wait in limbo */
STATE_MACRO(hold, "HOLD");
break;
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Thu Dec 13 17:17:20 2007
@@ -1494,6 +1494,13 @@
return SWITCH_STATUS_FALSE;
}
+SWITCH_DECLARE(void) switch_ivr_park_session(switch_core_session_t *session)
+{
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ switch_channel_set_state_flag(channel, CF_TRANSFER);
+ switch_channel_set_state(channel, CS_PARK);
+}
+
SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint32_t delay_ms)
{
stfu_instance_t *jb;
More information about the Freeswitch-trunk
mailing list