diff --git a/Makefile.am b/Makefile.am index 934fe4272c..0c55f61b6d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -168,6 +168,10 @@ if HAVE_FREETYPE CORE_CFLAGS += -DSWITCH_HAVE_FREETYPE $(LIBFREETYPE_CFLAGS) endif +if HAVE_GUMBO +CORE_CFLAGS += -DSWITCH_HAVE_GUMBO $(LIBGUMBO_CFLAGS) +endif + ## ## libfreeswitch ## @@ -230,9 +234,9 @@ CORE_LIBS+=libfreeswitch_libyuv.la endif lib_LTLIBRARIES = libfreeswitch.la -libfreeswitch_la_CFLAGS = $(CORE_CFLAGS) $(SQLITE_CFLAGS) $(FREETYPE_CFLAGS) $(CURL_CFLAGS) $(PCRE_CFLAGS) $(SPEEX_CFLAGS) $(LIBEDIT_CFLAGS) $(openssl_CFLAGS) $(AM_CFLAGS) +libfreeswitch_la_CFLAGS = $(CORE_CFLAGS) $(SQLITE_CFLAGS) $(GUMBO_CFLAGS) $(FREETYPE_CFLAGS) $(CURL_CFLAGS) $(PCRE_CFLAGS) $(SPEEX_CFLAGS) $(LIBEDIT_CFLAGS) $(openssl_CFLAGS) $(AM_CFLAGS) libfreeswitch_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_LDFLAGS) -no-undefined -libfreeswitch_la_LIBADD = $(CORE_LIBS) $(APR_LIBS) $(SQLITE_LIBS) $(FREETYPE_LIBS) $(CURL_LIBS) $(PCRE_LIBS) $(SPEEX_LIBS) $(LIBEDIT_LIBS) $(openssl_LIBS) $(PLATFORM_CORE_LIBS) +libfreeswitch_la_LIBADD = $(CORE_LIBS) $(APR_LIBS) $(SQLITE_LIBS) $(GUMBO_LIBS) $(FREETYPE_LIBS) $(CURL_LIBS) $(PCRE_LIBS) $(SPEEX_LIBS) $(LIBEDIT_LIBS) $(openssl_LIBS) $(PLATFORM_CORE_LIBS) libfreeswitch_la_DEPENDENCIES = $(BUILT_SOURCES) if HAVE_PNG diff --git a/configure.ac b/configure.ac index 539ab5d385..6dac862d72 100644 --- a/configure.ac +++ b/configure.ac @@ -1288,6 +1288,11 @@ PKG_CHECK_MODULES([LIBPNG], [libpng >= 1.6.16],[ PKG_CHECK_MODULES([FREETYPE], [freetype2 >= 2.4.9],[ AM_CONDITIONAL([HAVE_FREETYPE],[true])],[ AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_FREETYPE],[false])]) + +PKG_CHECK_MODULES([GUMBO], [gumbo >= 0.10.1],[ + AM_CONDITIONAL([HAVE_GUMBO],[true])],[ + AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_GUMBO],[false])]) + PKG_CHECK_MODULES([SQLITE], [sqlite3 >= 3.6.20]) PKG_CHECK_MODULES([CURL], [libcurl >= 7.19]) PKG_CHECK_MODULES([PCRE], [libpcre >= 7.8]) diff --git a/scripts/lua/tdd_echo.lua b/scripts/lua/tdd_echo.lua new file mode 100644 index 0000000000..a6c67d9612 --- /dev/null +++ b/scripts/lua/tdd_echo.lua @@ -0,0 +1,52 @@ + +local count = 0; +local tddstring = {}; + + +function my_cb(s, type, obj, arg) + if (arg) then + freeswitch.console_log("info", "\ntype: " .. type .. "\n" .. "arg: " .. arg .. "\n"); + else + freeswitch.console_log("info", "\ntype: " .. type .. "\n"); + end + + + tdddata = obj:getHeader("TDD-Data"); + count = 0; + table.insert(tddstring, tdddata); + + + freeswitch.console_log("info", obj:serialize("xml")); +end + +function all_done(s, how) + freeswitch.console_log("info", "done: " .. how .. "\n"); +end + +function tablelength(T) + local count = 0 + for _ in pairs(T) do count = count + 1 end + return count +end + + +blah = "args"; +session:setHangupHook("all_done"); +session:setInputCallback("my_cb", "blah"); +session:answer(); + +session:execute("playback", "silence_stream://2000"); +session:execute("spandsp_detect_tdd"); +session:execute("spandsp_send_tdd", "Welcome to FreeSWITCH"); + +while session:ready() do + session:streamFile("silence_stream://10000"); + if (count > 0) then + count = 0; + if (tablelength(tddstring) > 0) then + session:execute("spandsp_send_tdd", "You said: " .. table.concat(tddstring)); + tddstring = {}; + end + end + count = count + 1; +end diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index bf4dd351e1..d3b9de1e80 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -195,6 +195,7 @@ struct switch_core_session { switch_slin_data_t *sdata; switch_buffer_t *text_buffer; + switch_buffer_t *text_line_buffer; switch_mutex_t *text_mutex; }; diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index b1f4b2d219..f720bf2d98 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -93,6 +93,9 @@ SWITCH_DECLARE(int) switch_channel_test_ready(switch_channel_t *channel, switch_ #define switch_channel_media_ack(_channel) (!switch_channel_test_cap(_channel, CC_MEDIA_ACK) || switch_channel_test_flag(_channel, CF_MEDIA_ACK)) +#define switch_channel_text_only(_channel) (switch_channel_test_flag(_channel, CF_HAS_TEXT) && !switch_channel_test_flag(_channel, CF_AUDIO)) + + SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, switch_channel_t *other_channel, switch_channel_state_t want_state); SWITCH_DECLARE(void) switch_channel_wait_for_state_timeout(switch_channel_t *other_channel, switch_channel_state_t want_state, uint32_t timeout); SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel, diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h index 7fef07f4cd..9a9adb83a1 100644 --- a/src/include/switch_cpp.h +++ b/src/include/switch_cpp.h @@ -235,6 +235,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod SWITCH_DECLARE(int) insertFile(const char *file, const char *insert_file, int sample_point); SWITCH_DECLARE(int) answer(); + SWITCH_DECLARE(int) print(char *txt); SWITCH_DECLARE(int) preAnswer(); SWITCH_DECLARE(void) hangup(const char *cause = "normal_clearing"); SWITCH_DECLARE(void) hangupState(void); diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 98829e2461..b7d4b0dd88 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1535,7 +1535,15 @@ typedef enum { CF_TEXT_ECHO, CF_TEXT_ACTIVE, CF_TEXT_IDLE, + CF_TEXT_LINE_BASED, + CF_QUEUE_TEXT_EVENTS, CF_MSRP, + CF_MSRPS, + CF_WANT_MSRP, + CF_WANT_MSRPS, + CF_RTT, + CF_WANT_RTT, + CF_AUDIO, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ CF_FLAG_MAX @@ -1604,7 +1612,8 @@ typedef enum { SAF_ROUTING_EXEC = (1 << 1), SAF_MEDIA_TAP = (1 << 2), SAF_ZOMBIE_EXEC = (1 << 3), - SAF_NO_LOOPBACK = (1 << 4) + SAF_NO_LOOPBACK = (1 << 4), + SAF_SUPPORT_TEXT_ONLY = (1 << 5) } switch_application_flag_enum_t; typedef uint32_t switch_application_flag_t; diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 9c50701044..5b3285a43d 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -47,6 +47,25 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_URL_UNSAFE "\r\n #%&+:;<=>?@[\\]^`{|}\"" +static inline char *switch_get_hex_bytes(switch_byte_t *buf, switch_size_t datalen, char *new_buf, switch_size_t new_datalen) +{ + switch_byte_t *p, *e; + char *pp, *ee; + + e = buf + datalen; + ee = new_buf + new_datalen; + pp = new_buf; + + for (p = buf; p < e && pp < ee - 4; p++) { + snprintf(pp, 4, "%.2x ", (int)*p); + pp += 3; + } + *(pp-1) = '\0'; + + return new_buf; +} + + static inline uint32_t switch_round_to_step(uint32_t num, uint32_t step) { uint32_t r; @@ -1321,6 +1340,8 @@ typedef struct { **/ SWITCH_DECLARE(void) switch_getcputime(switch_cputime *t); +SWITCH_DECLARE(char *)switch_html_strip(const char *str); + SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 1be23ea88e..1a3e17a767 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1700,8 +1700,7 @@ switch_status_t conference_text_thread_callback(switch_core_session_t *session, inuse = switch_buffer_inuse(member->text_buffer); if (zstr(member->text_framedata) && inuse && (switch_channel_test_flag(channel, CF_TEXT_IDLE) || switch_test_flag(frame, SFF_TEXT_LINE_BREAK))) { - int bytes = 0, ok = 0; - char *p; + int bytes = 0;//, ok = 0; if (inuse + 1 > member->text_framesize) { void *tmp = malloc(inuse + 1024); @@ -1718,7 +1717,8 @@ switch_status_t conference_text_thread_callback(switch_core_session_t *session, bytes = switch_buffer_read(member->text_buffer, member->text_framedata, inuse); *(member->text_framedata + bytes) = '\0'; - + + /* for(p = member->text_framedata; p && *p; p++) { if (*p > 32 && *p < 127) { ok++; @@ -1728,7 +1728,7 @@ switch_status_t conference_text_thread_callback(switch_core_session_t *session, if (!ok) { member->text_framedata[0] = '\0'; } - + */ } switch_mutex_unlock(member->text_mutex); @@ -2326,7 +2326,7 @@ SWITCH_STANDARD_APP(conference_function) switch_core_session_set_video_read_callback(session, conference_video_thread_callback, (void *)&member); switch_core_session_set_text_read_callback(session, conference_text_thread_callback, (void *)&member); - if (switch_channel_test_flag(channel, CF_VIDEO_ONLY)) { + if (switch_channel_test_flag(channel, CF_VIDEO_ONLY) || !switch_channel_test_flag(channel, CF_AUDIO)) { while(conference_utils_member_test_flag((&member), MFLAG_RUNNING) && switch_channel_ready(channel)) { switch_yield(100000); } @@ -3603,7 +3603,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_conference_load) } SWITCH_ADD_API(api_interface, "conference", "Conference module commands", conference_api_main, p); - SWITCH_ADD_APP(app_interface, mod_conference_app_name, mod_conference_app_name, NULL, conference_function, NULL, SAF_NONE); + SWITCH_ADD_APP(app_interface, mod_conference_app_name, mod_conference_app_name, NULL, conference_function, NULL, SAF_SUPPORT_TEXT_ONLY); SWITCH_ADD_APP(app_interface, "conference_set_auto_outcall", "conference_set_auto_outcall", NULL, conference_auto_function, NULL, SAF_NONE); SWITCH_ADD_CHAT(chat_interface, CONF_CHAT_PROTO, chat_send); diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 28b1de428f..7ea0175b66 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -6301,7 +6301,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "stop_tone_detect", "stop detecting tones", "Stop detecting tones", stop_fax_detect_session_function, "", SAF_NONE); SWITCH_ADD_APP(app_interface, "fax_detect", "Detect faxes", "Detect fax send tone", fax_detect_session_function, "", SAF_MEDIA_TAP); SWITCH_ADD_APP(app_interface, "tone_detect", "Detect tones", "Detect tones", tone_detect_session_function, "", SAF_MEDIA_TAP); - SWITCH_ADD_APP(app_interface, "echo", "Echo", "Perform an echo test against the calling channel", echo_function, "", SAF_NONE); + SWITCH_ADD_APP(app_interface, "echo", "Echo", "Perform an echo test against the calling channel", echo_function, "", SAF_SUPPORT_TEXT_ONLY); SWITCH_ADD_APP(app_interface, "park", "Park", "Park", park_function, "", SAF_SUPPORT_NOMEDIA); 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, "[|]", SAF_NONE); @@ -6335,7 +6335,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "clear_speech_cache", "Clear Speech Handle Cache", "Clear Speech Handle Cache", clear_speech_cache_function, "", SAF_NONE); SWITCH_ADD_APP(app_interface, "bridge", "Bridge Audio", "Bridge the audio between two sessions", audio_bridge_function, "", - SAF_SUPPORT_NOMEDIA); + SAF_SUPPORT_NOMEDIA|SAF_SUPPORT_TEXT_ONLY); SWITCH_ADD_APP(app_interface, "system", "Execute a system command", "Execute a system command", system_session_function, "", SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC); SWITCH_ADD_APP(app_interface, "bgsystem", "Execute a system command in the background", "Execute a background system command", bgsystem_session_function, "", diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index 5ca1fcb87c..18c3977a8c 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -135,6 +135,12 @@ static void put_text_msg(void *user_data, const uint8_t *msg, int len) } switch_core_session_rwunlock(other_session); + + } else if (switch_channel_test_flag(channel, CF_QUEUE_TEXT_EVENTS)) { + + if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) { + switch_core_session_queue_event(pvt->session, &clone); + } } switch_event_fire(&event); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 63c92cc852..5874597976 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -924,6 +924,62 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) static switch_status_t sofia_read_text_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) { + switch_status_t status; + + if (switch_channel_test_flag(switch_core_session_get_channel(session), CF_MSRP)) { + switch_msrp_session_t *msrp_session = switch_core_media_get_msrp_session(session); + switch_frame_t *rframe = &msrp_session->frame; + msrp_msg_t *msrp_msg = switch_msrp_session_pop_msg(msrp_session); + + rframe->flags = 0; + +#if 0 + if (msrp_msg && msrp_msg->method == MSRP_METHOD_SEND) { /*echo back*/ + char *p; + p = msrp_msg->headers[MSRP_H_TO_PATH]; + msrp_msg->headers[MSRP_H_TO_PATH] = msrp_msg->headers[MSRP_H_FROM_PATH]; + msrp_msg->headers[MSRP_H_FROM_PATH] = p; + switch_msrp_send(msrp_session, msrp_msg); + } +#endif + + rframe->data = msrp_session->frame_data; + rframe->buflen = sizeof(msrp_session->frame_data); + + if (msrp_msg && msrp_msg->method == MSRP_METHOD_SEND && !switch_stristr("?OTRv3?", msrp_msg->payload) && + (switch_stristr("text/plain", msrp_msg->payload) || + switch_stristr("text/html", msrp_msg->payload))) { + rframe->datalen = msrp_msg->payload_bytes; + rframe->packetlen = msrp_msg->payload_bytes; + memcpy(rframe->data, msrp_msg->payload, msrp_msg->payload_bytes); + + rframe->m = 1; + + *frame = rframe; + + if (msrp_msg->headers[MSRP_H_CONTENT_TYPE] && !strcasecmp(msrp_msg->headers[MSRP_H_CONTENT_TYPE], "message/cpim")) { + char *stripped_text = switch_html_strip((char *)rframe->data); + memcpy(rframe->data, stripped_text, strlen(stripped_text)+1); + rframe->datalen = strlen(stripped_text)+1; + free(stripped_text); + } + + + switch_safe_free(msrp_msg); + msrp_msg = NULL; + status = SWITCH_STATUS_SUCCESS; + } else { + rframe->datalen = 2; + rframe->flags = SFF_CNG; + *frame = rframe; + status = SWITCH_STATUS_SUCCESS; + } + + return status; + } + + + return switch_core_media_read_frame(session, frame, flags, stream_id, SWITCH_MEDIA_TYPE_TEXT); } @@ -935,11 +991,10 @@ static switch_status_t sofia_write_text_frame(switch_core_session_t *session, sw if (frame && msrp_session) { switch_msrp_msg_t msrp_msg = { 0 }; - msrp_msg.headers[MSRP_H_CONTENT_TYPE] = "message/cpim"; - // msrp_msg.headers[MSRP_H_CONTENT_TYPE] = "text/plain"; + //msrp_msg.headers[MSRP_H_CONTENT_TYPE] = "message/cpim"; + msrp_msg.headers[MSRP_H_CONTENT_TYPE] = "text/plain"; msrp_msg.payload = frame->data; msrp_msg.payload_bytes = frame->datalen; - return switch_msrp_send(msrp_session, &msrp_msg); } diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index a7833b16c6..eaf48dd519 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -8098,9 +8098,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } else { uint8_t match = 0; - if (tech_pvt->mparams.num_codecs) { - match = sofia_media_negotiate_sdp(session, r_sdp, SDP_TYPE_RESPONSE); - } + + match = sofia_media_negotiate_sdp(session, r_sdp, SDP_TYPE_RESPONSE); + sofia_set_flag_locked(tech_pvt, TFLAG_ANS); @@ -8129,7 +8129,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, goto done; } } - + switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "NO CODECS"); switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); } diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java index e62fddf4fd..b104d7b706 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java @@ -126,6 +126,10 @@ public class CoreSession { return freeswitchJNI.CoreSession_answer(swigCPtr, this); } + public int print(String txt) { + return freeswitchJNI.CoreSession_print(swigCPtr, this, txt); + } + public int preAnswer() { return freeswitchJNI.CoreSession_preAnswer(swigCPtr, this); } diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java index 32d4748df5..d4a922db8f 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java @@ -113,6 +113,7 @@ public class freeswitchJNI { public final static native String CoreSession_voice_name_get(long jarg1, CoreSession jarg1_); public final static native int CoreSession_insertFile(long jarg1, CoreSession jarg1_, String jarg2, String jarg3, int jarg4); public final static native int CoreSession_answer(long jarg1, CoreSession jarg1_); + public final static native int CoreSession_print(long jarg1, CoreSession jarg1_, String jarg2); public final static native int CoreSession_preAnswer(long jarg1, CoreSession jarg1_); public final static native void CoreSession_hangup(long jarg1, CoreSession jarg1_, String jarg2); public final static native void CoreSession_hangupState(long jarg1, CoreSession jarg1_); diff --git a/src/mod/languages/mod_java/switch_swig_wrap.cpp b/src/mod/languages/mod_java/switch_swig_wrap.cpp index 697e535ac6..b0b65246a7 100644 --- a/src/mod/languages/mod_java/switch_swig_wrap.cpp +++ b/src/mod/languages/mod_java/switch_swig_wrap.cpp @@ -2166,6 +2166,28 @@ SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1answ } +SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1print(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jint jresult = 0 ; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(CoreSession **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (int)(arg1)->print(arg2); + jresult = (jint)result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1preAnswer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jint jresult = 0 ; CoreSession *arg1 = (CoreSession *) 0 ; diff --git a/src/mod/languages/mod_lua/freeswitch_lua.cpp b/src/mod/languages/mod_lua/freeswitch_lua.cpp index 0f2071aec0..e919665401 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.cpp +++ b/src/mod/languages/mod_lua/freeswitch_lua.cpp @@ -47,6 +47,8 @@ void Session::destroy(const char *err) switch_safe_free(cb_function); switch_safe_free(cb_arg); + unsetInputCallback(); + CoreSession::destroy(); @@ -240,6 +242,7 @@ void Session::unsetInputCallback(void) switch_safe_free(cb_arg); args.input_callback = NULL; ap = NULL; + switch_channel_clear_flag_recursive(channel, CF_QUEUE_TEXT_EVENTS); } void Session::setInputCallback(char *cbfunc, char *funcargs) @@ -262,6 +265,9 @@ void Session::setInputCallback(char *cbfunc, char *funcargs) args.input_callback = dtmf_callback; ap = &args; + + switch_channel_set_flag_recursive(channel, CF_QUEUE_TEXT_EVENTS); + } switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype) diff --git a/src/mod/languages/mod_lua/mod_lua.cpp b/src/mod/languages/mod_lua/mod_lua.cpp index 21855e3980..09bfac596d 100644 --- a/src/mod/languages/mod_lua/mod_lua.cpp +++ b/src/mod/languages/mod_lua/mod_lua.cpp @@ -688,7 +688,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load) SWITCH_ADD_API(api_interface, "luarun", "run a script", luarun_api_function, "