From: Brian West Date: Wed, 5 Nov 2014 15:44:24 +0000 (-0600) Subject: FS-6831 while you can already unset by calling set with var=, same with set in dialpl... X-Git-Tag: v1.4.14~2^2~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8478874ab9192d2ef6f192d24fb818f05202cf81;p=thirdparty%2Ffreeswitch.git FS-6831 while you can already unset by calling set with var=, same with set in dialplan this is a convience function similar to our unset in dialplan --- diff --git a/src/mod/applications/mod_sms/mod_sms.c b/src/mod/applications/mod_sms/mod_sms.c index cb1d3a49dc..2283e5d3a2 100644 --- a/src/mod/applications/mod_sms/mod_sms.c +++ b/src/mod/applications/mod_sms/mod_sms.c @@ -522,6 +522,25 @@ SWITCH_STANDARD_CHAT_APP(set_function) return SWITCH_STATUS_SUCCESS; } +SWITCH_STANDARD_CHAT_APP(unset_function) +{ + char *var; + + if (!data) return SWITCH_STATUS_SUCCESS; + + var = strdup(data); + + if (!var) return SWITCH_STATUS_SUCCESS; + + if (!zstr(var)) { + switch_event_del_header(message, var); + } + + free(var); + + return SWITCH_STATUS_SUCCESS; +} + SWITCH_STANDARD_CHAT_APP(fire_function) { switch_event_t *fireme; @@ -573,6 +592,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sms_load) SWITCH_ADD_CHAT_APP(chat_app_interface, "reply", "reply to a message", "reply to a message", reply_function, "", SCAF_NONE); SWITCH_ADD_CHAT_APP(chat_app_interface, "stop", "stop execution", "stop execution", stop_function, "", SCAF_NONE); SWITCH_ADD_CHAT_APP(chat_app_interface, "set", "set a variable", "set a variable", set_function, "", SCAF_NONE); + SWITCH_ADD_CHAT_APP(chat_app_interface, "unset", "unset a variable", "unset a variable", unset_function, "", SCAF_NONE); SWITCH_ADD_CHAT_APP(chat_app_interface, "send", "send the message as-is", "send the message as-is", send_function, "", SCAF_NONE); SWITCH_ADD_CHAT_APP(chat_app_interface, "fire", "fire the message", "fire the message", fire_function, "", SCAF_NONE); SWITCH_ADD_CHAT_APP(chat_app_interface, "system", "execute a system command", "execute a sytem command", system_function, "", SCAF_NONE);