[Freeswitch-svn] [commit] r4124 - in freeswitch/trunk/src: . include mod/applications/mod_dptools
Freeswitch SVN
anthm at freeswitch.org
Mon Feb 5 14:35:32 EST 2007
Author: anthm
Date: Mon Feb 5 14:35:31 2007
New Revision: 4124
Modified:
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/switch_channel.c
Log:
get rid of _ char in special vars and add an unset dialplan app for clarity sake
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Mon Feb 5 14:35:31 2007
@@ -76,21 +76,21 @@
#define SWITCH_GRAMMAR_DIR SWITCH_PREFIX_DIR SWITCH_PATH_SEPARATOR "grammar"
#endif
-#define SWITCH_R_SDP_VARIABLE "_switch_r_sdp_"
-#define SWITCH_L_SDP_VARIABLE "_switch_l_sdp_"
-#define SWITCH_B_SDP_VARIABLE "_switch_m_sdp_"
-#define SWITCH_BRIDGE_VARIABLE "_bridge_to_"
-#define SWITCH_SIGNAL_BRIDGE_VARIABLE "_signal_bridge_to_"
-#define SWITCH_ORIGINATOR_VARIABLE "_originator_"
-#define SWITCH_ORIGINATOR_CODEC_VARIABLE "_originator_codec_"
-#define SWITCH_LOCAL_MEDIA_IP_VARIABLE "_local_media_ip_"
-#define SWITCH_LOCAL_MEDIA_PORT_VARIABLE "_local_media_port_"
-#define SWITCH_REMOTE_MEDIA_IP_VARIABLE "_remote_media_ip_"
-#define SWITCH_REMOTE_MEDIA_PORT_VARIABLE "_remote_media_port_"
+#define SWITCH_R_SDP_VARIABLE "switch_r_sdp"
+#define SWITCH_L_SDP_VARIABLE "switch_l_sdp"
+#define SWITCH_B_SDP_VARIABLE "switch_m_sdp"
+#define SWITCH_BRIDGE_VARIABLE "bridge_to"
+#define SWITCH_SIGNAL_BRIDGE_VARIABLE "signal_bridge_to"
+#define SWITCH_ORIGINATOR_VARIABLE "originator"
+#define SWITCH_ORIGINATOR_CODEC_VARIABLE "originator_codec"
+#define SWITCH_LOCAL_MEDIA_IP_VARIABLE "local_media_ip"
+#define SWITCH_LOCAL_MEDIA_PORT_VARIABLE "local_media_port"
+#define SWITCH_REMOTE_MEDIA_IP_VARIABLE "remote_media_ip"
+#define SWITCH_REMOTE_MEDIA_PORT_VARIABLE "remote_media_port"
#define SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE "hangup_after_bridge"
-#define SWITCH_SPEECH_KEY "_speech_"
-#define SWITCH_UUID_BRIDGE "_uuid_bridge_"
+#define SWITCH_SPEECH_KEY "speech"
+#define SWITCH_UUID_BRIDGE "uuid_bridge"
#define SWITCH_BITS_PER_BYTE 8
typedef uint8_t switch_byte_t;
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 Mon Feb 5 14:35:31 2007
@@ -176,7 +176,6 @@
}
-
static void set_function(switch_core_session_t *session, char *data)
{
switch_channel_t *channel;
@@ -193,9 +192,9 @@
if (val) {
*val++ = '\0';
- if (!strcmp(val, "_UNDEF_")) {
- val = NULL;
- }
+ if (switch_strlen_zero(val)) {
+ val = NULL;
+ }
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", var, val ? val : "UNDEF");
@@ -203,6 +202,22 @@
}
}
+
+static void unset_function(switch_core_session_t *session, char *data)
+{
+ switch_channel_t *channel;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ if (switch_strlen_zero(data)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No variable name specified.\n");
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "UNSET [%s]\n", (char *) data);
+ switch_channel_set_variable(channel, (char *) data, NULL);
+ }
+}
+
static void log_function(switch_core_session_t *session, char *data)
{
switch_channel_t *channel;
@@ -524,13 +539,22 @@
/*.next */ &detect_speech_application_interface
};
+static const switch_application_interface_t unset_application_interface = {
+ /*.interface_name */ "unset",
+ /*.application_function */ unset_function,
+ /* long_desc */ "Unset a channel varaible for the channel calling the application.",
+ /* short_desc */ "Unset a channel varaible",
+ /* syntax */ "<varname>",
+ /*.next */ &ringback_application_interface
+};
+
static const switch_application_interface_t set_application_interface = {
/*.interface_name */ "set",
/*.application_function */ set_function,
/* long_desc */ "Set a channel varaible for the channel calling the application.",
/* short_desc */ "Set a channel varaible",
- /* syntax */ "<varname>=[<value>|_UNDEF_]",
- /*.next */ &ringback_application_interface
+ /* syntax */ "<varname>=<value>",
+ /*.next */ &unset_application_interface
};
static const switch_application_interface_t info_application_interface = {
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Mon Feb 5 14:35:31 2007
@@ -363,7 +363,7 @@
if (varname) {
switch_core_hash_delete(channel->variables, varname);
- if (value) {
+ if (!switch_strlen_zero(value)) {
switch_core_hash_insert_dup(channel->variables, varname, switch_core_session_strdup(channel->session, value));
} else {
switch_core_hash_delete(channel->variables, varname);
More information about the Freeswitch-svn
mailing list