From eb3e84369237326bde74ece766ede5bcf990f4af Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sat, 7 Dec 2013 01:57:59 +0800 Subject: [PATCH 01/23] Eliminate a warning from valgrind, that might potentially be reporting actual trouble. --- libs/spandsp/src/plc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/spandsp/src/plc.c b/libs/spandsp/src/plc.c index 7b45dad988..cb40ea88e0 100644 --- a/libs/spandsp/src/plc.c +++ b/libs/spandsp/src/plc.c @@ -84,7 +84,7 @@ static __inline__ void normalise_history(plc_state_t *s) if (s->buf_ptr == 0) return; memcpy(tmp, s->history, sizeof(int16_t)*s->buf_ptr); - memcpy(s->history, s->history + s->buf_ptr, sizeof(int16_t)*(PLC_HISTORY_LEN - s->buf_ptr)); + memmove(s->history, s->history + s->buf_ptr, sizeof(int16_t)*(PLC_HISTORY_LEN - s->buf_ptr)); memcpy(s->history + PLC_HISTORY_LEN - s->buf_ptr, tmp, sizeof(int16_t)*s->buf_ptr); s->buf_ptr = 0; } From ac2bf8a4058cb3df40e79f89276eab4847f59ae3 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sun, 8 Dec 2013 01:39:00 +0800 Subject: [PATCH 02/23] Fixed a file permission in the ESL library --- libs/esl/src/include/esl_json.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 libs/esl/src/include/esl_json.h diff --git a/libs/esl/src/include/esl_json.h b/libs/esl/src/include/esl_json.h old mode 100755 new mode 100644 From 074b70b7dbf0c5ddfe1c05cd07d4836c2e51fa3e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sun, 8 Dec 2013 07:09:40 +0500 Subject: [PATCH 03/23] comment --- support-d/.emacs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support-d/.emacs b/support-d/.emacs index 9b7b191e8b..d895761034 100644 --- a/support-d/.emacs +++ b/support-d/.emacs @@ -6,7 +6,7 @@ ;(setq cperl-hairy t) (global-unset-key "\C-h") (global-set-key "\C-h" 'delete-backward-char) -(load "/usr/share/emacs/site-lisp/rng-auto.el") +;(load "/usr/share/emacs/site-lisp/rng-auto.el") (require 'cc-mode) (defun my-build-tab-stop-list (width) From f148aa9c3b490372b78f786134de9913300556d2 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 8 Dec 2013 00:31:11 +0000 Subject: [PATCH 04/23] Improve upgrade path to freeswitch-all That is to say, declare all appropriate Provides/Conflicts/Replaces for freeswitch-all and freeswitch-all-dbg by enumerating the binary packages that we're going to produce during the build. Conflicts is more appropriate than Breaks here as both packages will continue to provide the same files on an ongoing basis and we would like to force the removal of the other package. --- debian/bootstrap.sh | 123 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 112 insertions(+), 11 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index edfe7f1077..3fc621aa4f 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -46,6 +46,33 @@ avoid_mods_squeeze=( formats/mod_vlc languages/mod_managed ) +manual_pkgs=( +freeswitch-all +freeswitch +libfreeswitch1 +freeswitch-meta-bare +freeswitch-meta-default +freeswitch-meta-vanilla +freeswitch-meta-sorbet +freeswitch-meta-all +freeswitch-meta-codecs +freeswitch-meta-conf +freeswitch-meta-lang +freeswitch-meta-mod-say +freeswitch-all-dbg +freeswitch-dbg +libfreeswitch1-dbg +libfreeswitch-dev +freeswitch-doc +freeswitch-init +freeswitch-sysvinit +freeswitch-systemd +freeswitch-lang +freeswitch-music +freeswitch-sounds +freeswitch-sounds-en +freeswitch-sounds-en-us +) err () { echo "$0 error: $1" >&2 @@ -61,6 +88,31 @@ xread () { return $ret } +intersperse () { + local sep="$1" + awk " + BEGIN { + first=1; + sep=\"${sep}\"; + }"' + /.*/ { + if (first == 0) { + printf "%s%s", sep, $0; + } else { + printf "%s", $0; + } + first=0; + } + END { printf "\n"; }' +} + +postfix () { + local px="$1" + awk " + BEGIN { px=\"${px}\"; }"' + /.*/ { printf "%s%s\n", $0, px; }' +} + avoid_mod_filter () { local x="avoid_mods_$codename[@]" local -a mods=("${avoid_mods[@]}" "${!x}") @@ -168,6 +220,60 @@ map_langs () { done } +map_pkgs () { + local fsx="$1" + for x in "${manual_pkgs[@]}"; do + $fsx $x + done + map_pkgs_confs () { $fsx "freeswitch-conf-${conf//_/-}"; } + map_confs map_pkgs_confs + map_pkgs_langs () { $fsx "freeswitch-lang-${lang//_/-}"; } + map_langs map_pkgs_langs + map_pkgs_mods () { + $fsx "freeswitch-mod-${module//_/-}" + $fsx "freeswitch-mod-${module//_/-}-dbg"; } + map_modules map_pkgs_mods +} + +list_pkgs () { + list_pkgs_thunk () { printf '%s\n' "$1"; } + map_pkgs list_pkgs_thunk +} + +list_freeswitch_all_pkgs () { + list_pkgs \ + | grep -v '^freeswitch-all$' \ + | grep -v -- '-dbg$' +} + +list_freeswitch_all_provides () { + list_freeswitch_all_pkgs \ + | intersperse ',\n ' +} + +list_freeswitch_all_replaces () { + list_freeswitch_all_pkgs \ + | postfix ' (<= ${binary:Version})' \ + | intersperse ',\n ' +} + +list_freeswitch_all_dbg_pkgs () { + list_pkgs \ + | grep -v '^freeswitch-all-dbg$' \ + | grep -- '-dbg$' +} + +list_freeswitch_all_dbg_provides () { + list_freeswitch_all_dbg_pkgs \ + | intersperse ',\n ' +} + +list_freeswitch_all_dbg_replaces () { + list_freeswitch_all_dbg_pkgs \ + | postfix ' (<= ${binary:Version})' \ + | intersperse ',\n ' +} + print_source_control () { cat <= 1.0.8), freeswitch-sounds-en-us-callie (>= 1.0.25) | freeswitch-sounds, @@ -647,6 +745,9 @@ Package: freeswitch-all-dbg Section: debug Priority: extra Architecture: any +Provides: $(list_freeswitch_all_dbg_provides) +Replaces: $(list_freeswitch_all_dbg_replaces) +Breaks: $(list_freeswitch_all_dbg_replaces) Depends: \${misc:Depends}, freeswitch (= \${binary:Version}) Description: debugging symbols for FreeSWITCH $(debian_wrap "${fs_description}") From 553bda996b1f19892cdfd9cfd20c00146e76b127 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sun, 8 Dec 2013 21:53:56 -0600 Subject: [PATCH 05/23] vs2010 reswig --- .../mod_managed/freeswitch_wrap.2010.cxx | 16 ++++++++++++---- .../languages/mod_managed/managed/swig.2010.cs | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 6b36513455..6a444f6ec1 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -12741,9 +12741,9 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_time_set_monotonic(int jarg1) { SWIGEXPORT void SWIGSTDCALL CSharp_switch_time_set_timerfd(int jarg1) { - switch_bool_t arg1 ; + int arg1 ; - arg1 = (switch_bool_t)jarg1; + arg1 = (int)jarg1; switch_time_set_timerfd(arg1); } @@ -14209,6 +14209,14 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ice_direction(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_debug_pool(void * jarg1) { + switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ; + + arg1 = (switch_stream_handle_t *)jarg1; + switch_core_session_debug_pool(arg1); +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_set(void * jarg1, char * jarg2) { switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; char *arg2 = (char *) 0 ; @@ -35686,7 +35694,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_MAX_CAND_get() { int jresult ; int result; - result = (int)(25); + result = (int)(50); jresult = result; return jresult; } @@ -35702,7 +35710,7 @@ SWIGEXPORT void SWIGSTDCALL CSharp_ice_t_cands_set(void * jarg1, void * jarg2) { icand_t (*inp)[2] = (icand_t (*)[2])(arg2); icand_t (*dest)[2] = (icand_t (*)[2])(arg1->cands); size_t ii = 0; - for (; ii < 25; ++ii) { + for (; ii < 50; ++ii) { icand_t *ip = inp[ii]; icand_t *dp = dest[ii]; size_t jj = 0; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 44cc42ee90..631a7fcf8f 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -2763,8 +2763,8 @@ public class freeswitch { freeswitchPINVOKE.switch_time_set_monotonic((int)enable); } - public static void switch_time_set_timerfd(switch_bool_t enable) { - freeswitchPINVOKE.switch_time_set_timerfd((int)enable); + public static void switch_time_set_timerfd(int enable) { + freeswitchPINVOKE.switch_time_set_timerfd(enable); } public static void switch_time_set_nanosleep(switch_bool_t enable) { @@ -3160,6 +3160,10 @@ public class freeswitch { return ret; } + public static void switch_core_session_debug_pool(switch_stream_handle stream) { + freeswitchPINVOKE.switch_core_session_debug_pool(switch_stream_handle.getCPtr(stream)); + } + public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload); return ret; @@ -10723,6 +10727,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ice_direction")] public static extern int switch_ice_direction(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_debug_pool")] + public static extern void switch_core_session_debug_pool(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_set")] public static extern void switch_loadable_module_interface_module_name_set(HandleRef jarg1, string jarg2); @@ -26726,6 +26733,7 @@ public enum switch_channel_flag_t { CF_VIDEO_ECHO, CF_SLA_INTERCEPT, CF_VIDEO_BREAK, + CF_MEDIA_PAUSE, CF_FLAG_MAX } @@ -35305,6 +35313,8 @@ public enum switch_rtp_flag_t { SWITCH_RTP_FLAG_KILL_JB, SWITCH_RTP_FLAG_VIDEO_BREAK, SWITCH_RTP_FLAG_PAUSE, + SWITCH_RTP_FLAG_FIR, + SWITCH_RTP_FLAG_PLI, SWITCH_RTP_FLAG_INVALID } From 9caae64f37bfdc8b17761926e8711e0f85963c35 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 9 Dec 2013 09:18:38 +0000 Subject: [PATCH 06/23] Correct shlibs of freeswitch-all wrt libfreeswitch1 The freeswitch-all package provides libfreeswitch1, so any shlibs-generated dependency should be for libfreeswitch1 rather than freeswitch-all. Because dh_shlibdeps / dpkg-shlibdeps searches for shlibs files in debian/*/DEBIAN/ it was sometimes using freeswitch-all rather than libfreeswitch1 to satisfy dependencies for freeswitch.so.1. FS-6029 --resolve --- debian/rules | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/rules b/debian/rules index 7d7d50fd71..0eb01ee422 100755 --- a/debian/rules +++ b/debian/rules @@ -106,6 +106,12 @@ override_dh_installinit: dh_installinit -pfreeswitch-sysvinit --name=freeswitch dh_installinit -pfreeswitch-all --name=freeswitch +override_dh_makeshlibs: + dh_makeshlibs + sed \ + -e '/^libfreeswitch 1/{s/freeswitch-all/libfreeswitch1/g}' \ + -i debian/freeswitch-all/DEBIAN/shlibs + debian-bootstrap: debian/.stamp-bootstrap debian/.stamp-bootstrap: (cd debian && ./bootstrap.sh) From 3f064220b99330a12839ac377b20c595143b04e7 Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Mon, 9 Dec 2013 08:54:54 -0600 Subject: [PATCH 07/23] FS-6024 --resolve --- src/mod/endpoints/mod_skinny/skinny_server.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 76486633ba..aaf7586daf 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -849,7 +849,25 @@ switch_status_t skinny_session_unhold_line(switch_core_session_t *session, liste send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, tech_pvt->call_id); send_set_speaker_mode(listener, SKINNY_SPEAKER_ON); send_select_soft_keys(listener, line_instance, tech_pvt->call_id, SKINNY_KEY_SET_RING_OUT, 0xffff); - skinny_session_start_media(session, listener, line_instance); + + send_stop_tone(listener, line_instance, tech_pvt->call_id); + send_open_receive_channel(listener, + tech_pvt->call_id, /* uint32_t conference_id, */ + tech_pvt->call_id, /* uint32_t pass_thru_party_id, */ + 20, /* uint32_t ms_per_packet, */ + SKINNY_CODEC_ULAW_64K, /* uint32_t payload_capacity, */ + 0, /* uint32_t echo_cancel_type, */ + 0, /* uint32_t g723_bitrate, */ + 0, /* uint32_t conference_id2, */ + 0 /* uint32_t reserved[10] */ + ); + + skinny_line_set_state(listener, line_instance, tech_pvt->call_id, SKINNY_CONNECTED); + send_select_soft_keys(listener, line_instance, tech_pvt->call_id, SKINNY_KEY_SET_CONNECTED, 0xffff); + + send_display_prompt_status_textid(listener, 0, SKINNY_TEXTID_CONNECTED, line_instance, tech_pvt->call_id); + skinny_session_send_call_info(session, listener, line_instance); + return SWITCH_STATUS_SUCCESS; } From 0174aba5aff5aa430700cc076edb8b196d4146a2 Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Mon, 9 Dec 2013 09:01:02 -0600 Subject: [PATCH 08/23] mod_skinny: move hardwired ptime to a define so it's in one place --- src/mod/endpoints/mod_skinny/skinny_protocol.h | 4 ++++ src/mod/endpoints/mod_skinny/skinny_server.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h index 8a5178302e..870b4c578a 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.h +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h @@ -39,6 +39,10 @@ /*****************************************************************************/ /* SKINNY TYPES */ /*****************************************************************************/ + +/* Hardcode ptime in one place until we make it dynamic */ +#define SKINNY_PTIME 20 + typedef enum { SKINNY_CODEC_NONE = 0, SKINNY_CODEC_NONSTANDARD = 1, diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index aaf7586daf..b9ec3de21b 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -788,7 +788,7 @@ switch_status_t skinny_session_start_media(switch_core_session_t *session, liste send_open_receive_channel(listener, tech_pvt->call_id, /* uint32_t conference_id, */ tech_pvt->call_id, /* uint32_t pass_thru_party_id, */ - 20, /* uint32_t ms_per_packet, */ + SKINNY_PTIME, /* uint32_t ms_per_packet, */ SKINNY_CODEC_ULAW_64K, /* uint32_t payload_capacity, */ 0, /* uint32_t echo_cancel_type, */ 0, /* uint32_t g723_bitrate, */ @@ -854,7 +854,7 @@ switch_status_t skinny_session_unhold_line(switch_core_session_t *session, liste send_open_receive_channel(listener, tech_pvt->call_id, /* uint32_t conference_id, */ tech_pvt->call_id, /* uint32_t pass_thru_party_id, */ - 20, /* uint32_t ms_per_packet, */ + SKINNY_PTIME, /* uint32_t ms_per_packet, */ SKINNY_CODEC_ULAW_64K, /* uint32_t payload_capacity, */ 0, /* uint32_t echo_cancel_type, */ 0, /* uint32_t g723_bitrate, */ @@ -1830,7 +1830,7 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste /* Codec */ tech_pvt->iananame = "PCMU"; /* TODO */ - tech_pvt->codec_ms = 20; /* TODO */ + tech_pvt->codec_ms = SKINNY_PTIME; /* TODO */ tech_pvt->rm_rate = 8000; /* TODO */ tech_pvt->rm_fmtp = NULL; /* TODO */ tech_pvt->agreed_pt = (switch_payload_t) 0; /* TODO */ @@ -1879,7 +1879,7 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste tech_pvt->party_id, /* uint32_t pass_thru_party_id, */ addr.s_addr, /* uint32_t remote_ip, */ tech_pvt->local_sdp_audio_port, /* uint32_t remote_port, */ - 20, /* uint32_t ms_per_packet, */ + SKINNY_PTIME, /* uint32_t ms_per_packet, */ SKINNY_CODEC_ULAW_64K, /* uint32_t payload_capacity, */ 184, /* uint32_t precedence, */ 0, /* uint32_t silence_suppression, */ From 9d70d99d892bb6b224c80337265fb875e14408f6 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Mon, 9 Dec 2013 11:09:50 -0500 Subject: [PATCH 09/23] mod_mongo: use C++ driver pooling, added support for socket timeout --- conf/vanilla/autoload_configs/mongo.conf.xml | 3 +- src/mod/applications/mod_mongo/Makefile | 7 +- .../conf/autoload_configs/mongo.conf.xml | 3 +- src/mod/applications/mod_mongo/mod_mongo.cpp | 158 +++++++------ src/mod/applications/mod_mongo/mod_mongo.h | 75 ------- src/mod/applications/mod_mongo/mongo_conn.cpp | 211 ------------------ 6 files changed, 103 insertions(+), 354 deletions(-) delete mode 100644 src/mod/applications/mod_mongo/mod_mongo.h delete mode 100644 src/mod/applications/mod_mongo/mongo_conn.cpp diff --git a/conf/vanilla/autoload_configs/mongo.conf.xml b/conf/vanilla/autoload_configs/mongo.conf.xml index 8423645e95..72fffafbb7 100644 --- a/conf/vanilla/autoload_configs/mongo.conf.xml +++ b/conf/vanilla/autoload_configs/mongo.conf.xml @@ -7,8 +7,9 @@ foo/server:port,server:port SET --> - + + - + + - - - - - - - diff --git a/conf/rayo/autoload_configs/hash.conf.xml b/conf/rayo/autoload_configs/hash.conf.xml deleted file mode 100644 index 95b7928775..0000000000 --- a/conf/rayo/autoload_configs/hash.conf.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/conf/rayo/autoload_configs/lua.conf.xml b/conf/rayo/autoload_configs/lua.conf.xml deleted file mode 100644 index 1eb594f0b5..0000000000 --- a/conf/rayo/autoload_configs/lua.conf.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/conf/rayo/autoload_configs/memcache.conf.xml b/conf/rayo/autoload_configs/memcache.conf.xml deleted file mode 100644 index dc0173f986..0000000000 --- a/conf/rayo/autoload_configs/memcache.conf.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/conf/rayo/autoload_configs/modules.conf.xml b/conf/rayo/autoload_configs/modules.conf.xml index 604bc4e12c..e0d81b34fa 100644 --- a/conf/rayo/autoload_configs/modules.conf.xml +++ b/conf/rayo/autoload_configs/modules.conf.xml @@ -18,8 +18,6 @@ - - @@ -33,6 +31,8 @@ + + @@ -45,9 +45,6 @@ - - - diff --git a/freeswitch.spec b/freeswitch.spec index d1ce880237..37f66cdf53 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -22,6 +22,7 @@ # Marc Olivier Chouinard # Raymond Chandler # Ken Rice +# Chris Rienzo # # Maintainer(s): Ken Rice # @@ -33,6 +34,8 @@ %define build_py26_esl 0 %define build_timerfd 0 %define build_mod_esl 0 +%define build_mod_rayo 1 +%define build_mod_ssml 1 %{?with_sang_tc:%define build_sng_tc 1 } %{?with_sang_isdn:%define build_sng_isdn 1 } @@ -977,6 +980,17 @@ Requires: %{name} = %{version}-%{release} %description event-json-cdr JSON CDR Logger for FreeSWITCH. +%if %{build_mod_rayo} +%package event-rayo +Summary: Rayo (XMPP 3PCC) server for the FreeSWITCH open source telephony platform +Group: System/Libraries +Requires: %{name} = %{version}-%{release} + +%description event-rayo +Rayo 3PCC for FreeSWITCH. http://rayo.org http://xmpp.org/extensions/xep-0327.html +Rayo is an XMPP protocol extension for third-party control of telephone calls. +%endif + %package event-snmp Summary: SNMP stats reporter for the FreeSWITCH open source telephony platform Group: System/Libraries @@ -1040,6 +1054,16 @@ Requires: %{name} = %{version}-%{release} Mod Shout is a FreeSWITCH module to allow you to stream audio from MP3s or a i shoutcast stream. +%if %{build_mod_ssml} +%package format-ssml +Summary: Adds Speech Synthesis Markup Language (SSML) parser format for the FreeSWITCH open source telephony platform +Group: System/Libraries +Requires: %{name} = %{version}-%{release} + +%description format-ssml +mod_ssml is a FreeSWITCH module that renders SSML into audio. This module requires a text-to-speech module for speech synthesis. +%endif + %package format-tone-stream Summary: Implements TGML Tone Generation for the FreeSWITCH open source telephony platform Group: System/Libraries @@ -1376,6 +1400,9 @@ EVENT_HANDLERS_MODULES="event_handlers/mod_cdr_csv event_handlers/mod_cdr_pg_csv event_handlers/mod_cdr_mongodb event_handlers/mod_erlang_event event_handlers/mod_event_multicast \ event_handlers/mod_event_socket event_handlers/mod_json_cdr \ event_handlers/mod_snmp" +%if %{build_mod_rayo} +EVENT_HANDLERS_MODULES+=" event_handlers/mod_rayo" +%endif #### BUILD ISSUES NET RESOLVED FOR RELEASE event_handlers/mod_event_zmq ###################################################################################################################### @@ -1385,6 +1412,9 @@ EVENT_HANDLERS_MODULES="event_handlers/mod_cdr_csv event_handlers/mod_cdr_pg_csv ###################################################################################################################### FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_portaudio_stream \ formats/mod_shell_stream formats/mod_shout formats/mod_sndfile formats/mod_tone_stream" +%if %{build_mod_ssml} +FORMATS_MODULES+=" formats/mod_ssml" +%endif ###################################################################################################################### # @@ -1704,8 +1734,7 @@ fi %{LIBDIR}/*.a %{LIBDIR}/*.la %{PKGCONFIGDIR}/* -%{MODINSTDIR}/*.a -%{MODINSTDIR}/*.la +%{MODINSTDIR}/*.*a %{INCLUDEDIR}/*.h @@ -1743,6 +1772,7 @@ fi %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/event_socket.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/fax.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/fifo.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/format_cdr.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/hash.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/httapi.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/http_cache.conf.xml @@ -2189,6 +2219,12 @@ fi %defattr(-, freeswitch, daemon) %{MODINSTDIR}/mod_json_cdr.so* +%if %{build_mod_rayo} +%files event-rayo +%defattr(-, freeswitch, daemon) +%{MODINSTDIR}/mod_rayo.so* +%endif + %files event-snmp %defattr(-, freeswitch, daemon) %{MODINSTDIR}/mod_snmp.so* @@ -2219,6 +2255,12 @@ fi %defattr(-, freeswitch, daemon) %{MODINSTDIR}/mod_shout.so* +%if %{build_mod_ssml} +%files format-ssml +%defattr(-, freeswitch, daemon) +%{MODINSTDIR}/mod_ssml.so* +%endif + %files format-tone-stream %defattr(-, freeswitch, daemon) %{MODINSTDIR}/mod_tone_stream.so* @@ -2385,6 +2427,9 @@ fi # ###################################################################################################################### %changelog +* Mon Dec 09 2013 - crienzo@grasshopper.com +- Add mod_ssml, mod_rayo +- Fix build on master * Thu Jun 28 2013 - krice@freeswitch.org - Add module for VP8 * Thu Jun 19 2013 - krice@freeswitch.org From d9a8dd0bb64a2859df9feb6abbff4d38610a8da2 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Mon, 9 Dec 2013 17:41:01 -0500 Subject: [PATCH 16/23] build: added freeswitch-config-rayo package and script to build it --- freeswitch-config-rayo.spec | 179 ++++++++++++++++++++++++++++++++++++ scripts/ci/config-rayo.sh | 26 ++++++ 2 files changed, 205 insertions(+) create mode 100644 freeswitch-config-rayo.spec create mode 100755 scripts/ci/config-rayo.sh diff --git a/freeswitch-config-rayo.spec b/freeswitch-config-rayo.spec new file mode 100644 index 0000000000..d5f951da50 --- /dev/null +++ b/freeswitch-config-rayo.spec @@ -0,0 +1,179 @@ +###################################################################################################################### +# +# freeswitch-config-rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application +# Copyright (C) 2013, Grasshopper +# +# 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-config-rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application +# +# The Initial Developer of the Original Code is Grasshopper +# Portions created by the Initial Developer are Copyright (C) +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Chris Rienzo +# +# freeswitch-rayo-config -- RPM packaging for Rayo Server configuration +# +###################################################################################################################### + +%define version %{VERSION_NUMBER} +%define release %{BUILD_NUMBER} + +%define fsname freeswitch + +%define PREFIX %{_prefix} +%define EXECPREFIX %{_exec_prefix} +%define BINDIR %{_bindir} +%define SBINDIR %{_sbindir} +%define LIBEXECDIR %{_libexecdir}/%fsname +%define SYSCONFDIR %{_sysconfdir}/%fsname +%define SHARESTATEDIR %{_sharedstatedir}/%fsname +%define LOCALSTATEDIR %{_localstatedir}/lib/%fsname +%define LIBDIR %{_libdir} +%define INCLUDEDIR %{_includedir} +%define _datarootdir %{_prefix}/share +%define DATAROOTDIR %{_datarootdir} +%define DATADIR %{_datadir} +%define INFODIR %{_infodir} +%define LOCALEDIR %{_datarootdir}/locale +%define MANDIR %{_mandir} +%define DOCDIR %{_defaultdocdir}/%fsname +%define HTMLDIR %{_defaultdocdir}/%fsname/html +%define DVIDIR %{_defaultdocdir}/%fsname/dvi +%define PDFDIR %{_defaultdocdir}/%fsname/pdf +%define PSDIR %{_defaultdocdir}/%fsname/ps +%define LOGFILEDIR /var/log/%fsname +%define MODINSTDIR %{_libdir}/%fsname/mod +%define RUNDIR %{_localstatedir}/run/%fsname +%define DBDIR %{LOCALSTATEDIR}/db +%define HTDOCSDIR %{_datarootdir}/%fsname/htdocs +%define SOUNDSDIR %{_datarootdir}/%fsname/sounds +%define GRAMMARDIR %{_datarootdir}/%fsname/grammar +%define SCRIPTDIR %{_datarootdir}/%fsname/scripts +%define RECORDINGSDIR %{LOCALSTATEDIR}/recordings +%define PKGCONFIGDIR %{_datarootdir}/%fsname/pkgconfig +%define HOMEDIR %{LOCALSTATEDIR} + +Name: freeswitch-config-rayo +Version: %{version} +Release: %{release}%{?dist} +License: MPL1.1 +Summary: Rayo configuration for the FreeSWITCH Open Source telephone platform. +Group: System/Libraries +Packager: Chris Rienzo +URL: http://www.freeswitch.org/ +Source0: freeswitch-%{version}.tar.bz2 +Requires: freeswitch = %{version} +Requires: freeswitch-application-conference +Requires: freeswitch-application-esf +Requires: freeswitch-application-expr +Requires: freeswitch-application-fsv +Requires: freeswitch-application-http-cache +Requires: freeswitch-asrtts-flite +Requires: freeswitch-asrtts-pocketsphinx +Requires: freeswitch-codec-celt +Requires: freeswitch-codec-h26x +Requires: freeswitch-codec-ilbc +Requires: freeswitch-codec-opus +Requires: freeswitch-codec-speex +Requires: freeswitch-codec-vp8 +Requires: freeswitch-event-rayo +Requires: freeswitch-format-local-stream +Requires: freeswitch-format-mod-shout +Requires: freeswitch-format-shell-stream +Requires: freeswitch-format-ssml +Requires: freeswitch-sounds-music-8000 +Requires: freeswitch-sounds-music-16000 +Requires: freeswitch-sounds-music-32000 +Requires: freeswitch-sounds-music-48000 +Requires: freeswitch-lang-en +Requires: freeswitch-sounds-en-us-callie-8000 +Requires: freeswitch-sounds-en-us-callie-16000 +Requires: freeswitch-sounds-en-us-callie-32000 +Requires: freeswitch-sounds-en-us-callie-48000 +BuildRequires: bash +BuildArch: noarch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +%description +FreeSWITCH rayo server implementation. + +%prep +%setup -b0 -q -n freeswitch-%{version} + +%build + +%install +%{__rm} -rf %{buildroot} +%{__install} -d -m 0750 %{buildroot}/%{SYSCONFDIR} +%{__install} -d -m 0750 %{buildroot}/%{SYSCONFDIR}/autoload_configs +%{__install} -d -m 0750 %{buildroot}/%{SYSCONFDIR}/dialplan +%{__install} -d -m 0750 %{buildroot}/%{SYSCONFDIR}/sip_profiles +%{__install} -d -m 0750 %{buildroot}/%{SYSCONFDIR}/directory +%{__cp} -prv ./conf/rayo/*.{xml,types,pem} %{buildroot}/%{SYSCONFDIR}/ +%{__cp} -prv ./conf/rayo/{autoload_configs,dialplan} %{buildroot}/%{SYSCONFDIR}/ +%{__cp} -prv ./conf/rayo/sip_profiles/external.xml %{buildroot}/%{SYSCONFDIR}/sip_profiles +%{__cp} -prv ./conf/rayo/sip_profiles/external %{buildroot}/%{SYSCONFDIR}/sip_profiles +%{__cp} -prv ./conf/rayo/directory %{buildroot}/%{SYSCONFDIR}/ + +%postun + +%clean +%{__rm} -rf %{buildroot} + +%files +%defattr(-,freeswitch,daemon) +%dir %attr(0750, freeswitch, daemon) %{SYSCONFDIR} +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/cacert.pem +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/*.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/mime.types +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/acl.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/cdr_csv.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/conference.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/console.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/event_socket.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/http_cache.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/local_stream.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/logfile.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/modules.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/pocketsphinx.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/post_load_modules.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/presence_map.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/rayo.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/shout.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/sofia.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/spandsp.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/ssml.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/switch.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/timezones.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/dialplan/public.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/directory/default.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/directory/default/*.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/sip_profiles/*.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/sip_profiles/external/*.xml + +### END OF config-rayo + +###################################################################################################################### +# +# Changelog +# +###################################################################################################################### +%changelog +* Mon Jun 03 2013 - crienzo@grasshopper.com +- Added users and internal profile for softphone testing +* Wed May 08 2013 - crienzo@grasshopper.com +- Initial revision + diff --git a/scripts/ci/config-rayo.sh b/scripts/ci/config-rayo.sh new file mode 100755 index 0000000000..c346f5e0ed --- /dev/null +++ b/scripts/ci/config-rayo.sh @@ -0,0 +1,26 @@ +#!/bin/sh +##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- + +src_repo="$(pwd)" + +if [ ! -d .git ]; then + echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2 + exit 1; +fi + +rpmbuild --define "VERSION_NUMBER $1" \ + --define "BUILD_NUMBER $2" \ + --define "_topdir %(pwd)/rpmbuild" \ + --define "_rpmdir %{_topdir}" \ + --define "_srcrpmdir %{_topdir}" \ + -ba freeswitch-config-rayo.spec + +mkdir $src_repo/RPMS +mv $src_repo/rpmbuild/*/*.rpm $src_repo/RPMS/. + +cat 1>&2 < Date: Tue, 10 Dec 2013 03:42:12 +0500 Subject: [PATCH 17/23] FS-6033 --resolve --- src/switch_ivr_play_say.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 97f553d733..47451c3ca6 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -389,31 +389,26 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se const char *prefix, *var; + if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_FALSE; + } + prefix = switch_channel_get_variable(channel, "sound_prefix"); if (!prefix) { prefix = SWITCH_GLOBAL_dirs.sounds_dir; } + if (!switch_channel_media_ready(channel)) { + return SWITCH_STATUS_FALSE; + } + switch_core_session_get_read_impl(session, &read_impl); if (!(divisor = read_impl.actual_samples_per_second / 8000)) { divisor = 1; } - - if (!switch_channel_ready(channel)) { - return SWITCH_STATUS_FALSE; - } - - if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) { - return SWITCH_STATUS_FALSE; - } - - if (!switch_channel_media_ready(channel)) { - return SWITCH_STATUS_FALSE; - } - arg_recursion_check_start(args); if (!fh) { From a5647414e463926e2b6a69827ee7c5d13880b2db Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 7 Dec 2013 21:14:26 +0000 Subject: [PATCH 18/23] Deal correctly with spaces in SWITCH_VERSION_REVISION_HUMAN This affects the set_fs_ver bash function and the ./build/set-fs-version.sh script. Previously we were failing to quote the value of SWITCH_VERSION_REVISION_HUMAN when inserting it into configure.in. When it contains spaces, which it often does, this results in a malformed line in the generated configure script, which results in the define in src/include/switch_version.h.in being left unset. --- scripts/ci/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/common.sh b/scripts/ci/common.sh index a1e97c6064..adb8d56d80 100755 --- a/scripts/ci/common.sh +++ b/scripts/ci/common.sh @@ -108,7 +108,7 @@ set_fs_ver () { if [ -n "$rev" ]; then [ -n "$hrev" ] || hrev="$rev" sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \ - -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, \[\).*\(\])\)|\1$hrev\2|" \ + -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, \[\).*\(\])\)|\1'$hrev'\2|" \ -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \ -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION_HUMAN\)|\1|" \ configure.in > configure.in.$$ From 8099af65647d01dc5e2d65a50626a4299fc7d70c Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 10 Dec 2013 03:53:17 +0000 Subject: [PATCH 19/23] Cleanup whitespace in debian/ --- debian/AUTHORS | 1 - debian/bootstrap.sh | 2 +- debian/control-modules | 1 - debian/copyright | 4 ++-- debian/freeswitch-systemd.freeswitch.service | 1 - debian/rules | 1 - debian/util.sh | 1 - 7 files changed, 3 insertions(+), 8 deletions(-) diff --git a/debian/AUTHORS b/debian/AUTHORS index 2145c58864..838dabde3c 100644 --- a/debian/AUTHORS +++ b/debian/AUTHORS @@ -23,4 +23,3 @@ Thanks-to: Steven Ayre Thanks-to: William King # for moral support and small tweaks - diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 3fc621aa4f..8f12a9fc3f 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -1018,7 +1018,7 @@ print_edit_warning () { } gencontrol_per_mod () { - print_mod_control "$module_name" "$description" "$long_description" >> control + print_mod_control "$module_name" "$description" "$long_description" >> control } gencontrol_per_cat () { diff --git a/debian/control-modules b/debian/control-modules index cd7acb2c73..4ece17626a 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -700,4 +700,3 @@ Description: mod_xml_rpc Module: xml_int/mod_xml_scgi Description: mod_xml_scgi Adds mod_xml_scgi. - diff --git a/debian/copyright b/debian/copyright index d7ea35053f..278992caa0 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1427,7 +1427,7 @@ Files: libs/js/nsprpub/pr/tests/tmocon.c libs/js/nsprpub/pr/src/md/unix/os_ReliantUNIX.s libs/js/nsprpub/pr/src/md/unix/os_Darwin_ppc.s libs/js/nsprpub/pr/src/md/unix/os_SunOS_ultrasparc.s - libs/js/nsprpub/pr/src/md/unix/os_Linux_ia64.s + libs/js/nsprpub/pr/src/md/unix/os_Linux_ia64.s libs/js/nsprpub/pr/tests/testfile.c libs/js/nsprpub/pr/src/md/unix/os_Darwin_x86.s libs/js/nsprpub/pr/src/md/unix/os_AIX.s @@ -1958,7 +1958,7 @@ License: LGPL Files: libs/libwebsockets/win32port/zlib/* Copyright: 1995-2010 Jean-loup Gailly - 1995-2010 Mark Adler + 1995-2010 Mark Adler 1995-2010 Jean-loup Gailly and Mark Adler 1995-2010 Jean-loup Gailly and Mark Adler "; License: zlib/libpng diff --git a/debian/freeswitch-systemd.freeswitch.service b/debian/freeswitch-systemd.freeswitch.service index 1e7d2fcad1..3a734e3b37 100644 --- a/debian/freeswitch-systemd.freeswitch.service +++ b/debian/freeswitch-systemd.freeswitch.service @@ -32,4 +32,3 @@ UMask=0007 [Install] WantedBy=multi-user.target - diff --git a/debian/rules b/debian/rules index 0eb01ee422..e2586a455c 100755 --- a/debian/rules +++ b/debian/rules @@ -133,4 +133,3 @@ binary-quicktest: echo "applications/mod_commands" > debian/modules.conf (cd debian && ./bootstrap.sh) dh binary - diff --git a/debian/util.sh b/debian/util.sh index 66231c3d82..94ef0e0791 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -455,4 +455,3 @@ case "$cmd" in create-orig) create_orig "$@" ;; *) usage ;; esac - From 58d0d3d4a8730281e8cc6aae70c61e5f7e91b3da Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 10 Dec 2013 18:19:36 +0000 Subject: [PATCH 20/23] Cleanup whitespace --- docs/SubmittingPatches | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches index e839ff128d..3ac732d349 100644 --- a/docs/SubmittingPatches +++ b/docs/SubmittingPatches @@ -108,10 +108,9 @@ submitted to JIRA. You can also reach us on freenode.net at: > #freeswitch-dev - + Finally, feel free to join us in our weekly conference call. Many of the core developers are often on the call and you'll have an opportunity at the beginning or end of the call to ask your questions: > http://wiki.freeswitch.org/wiki/Weekly_Conference_Call - From d2f8cf40bc33edc00a5f77f13283fc9233e032e5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 10 Dec 2013 23:48:09 +0500 Subject: [PATCH 21/23] FS-6006 --- src/switch_core_state_machine.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index 6de6b9798e..0005905deb 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -467,7 +467,8 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) switch_channel_set_running_state(session->channel, state); switch_channel_clear_flag(session->channel, CF_TRANSFER); switch_channel_clear_flag(session->channel, CF_REDIRECT); - + switch_ivr_parse_all_messages(session); + if (session->endpoint_interface->io_routines->state_run) { rstatus = session->endpoint_interface->io_routines->state_run(session); } From ef730b75aa40d99d0ef1b9465fd2cdef605d64cb Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Dec 2013 00:04:26 +0500 Subject: [PATCH 22/23] FS-5987 pushing the patch now since no matter what its better than before --- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 +- src/mod/endpoints/mod_sofia/sofia.c | 60 ++++++++---- src/mod/endpoints/mod_sofia/sofia_presence.c | 37 +++++--- src/mod/endpoints/mod_sofia/sofia_reg.c | 99 ++++++++++++-------- 4 files changed, 128 insertions(+), 70 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 952fce2f9f..f80539684a 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -164,7 +164,6 @@ typedef struct sofia_dispatch_event_s { struct sofia_private { char uuid[SWITCH_UUID_FORMATTED_LENGTH + 1]; - sofia_gateway_t *gateway; char gateway_name[256]; char auth_gateway_name[256]; char *call_id; @@ -422,6 +421,7 @@ typedef enum { struct sofia_gateway_subscription { sofia_gateway_t *gateway; + sofia_private_t *sofia_private; nua_handle_t *nh; char *expires_str; char *event; /* eg, 'message-summary' to subscribe to MWI events */ diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index f9fc330c71..ad581d877e 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -337,6 +337,7 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, switch_event_t *s_event = NULL; sofia_gateway_subscription_t *gw_sub_ptr; int sub_state; + sofia_gateway_t *gateway = NULL; tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END()); @@ -445,19 +446,25 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, } } - if (!sofia_private || !sofia_private->gateway) { + if (!sofia_private || zstr(sofia_private->gateway_name)) { if (profile->debug) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Gateway information missing Subscription Event: %s\n", sip->sip_event->o_type); } goto error; } + + + if (!(gateway = sofia_reg_find_gateway(sofia_private->gateway_name))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateway information missing\n"); + goto error; + } /* find the corresponding gateway subscription (if any) */ - if (!(gw_sub_ptr = sofia_find_gateway_subscription(sofia_private->gateway, sip->sip_event->o_type))) { + if (!(gw_sub_ptr = sofia_find_gateway_subscription(gateway, sip->sip_event->o_type))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Could not find gateway subscription. Gateway: %s. Subscription Event: %s\n", - sofia_private->gateway->name, sip->sip_event->o_type); + gateway->name, sip->sip_event->o_type); goto error; } @@ -466,17 +473,28 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, goto error; } + if (sip->sip_subscription_state && sip->sip_subscription_state->ss_expires) { + int delta = atoi(sip->sip_subscription_state->ss_expires); + + delta /= 2; + + if (delta < 1) { + delta = 1; + } + gw_sub_ptr->expires = switch_epoch_time_now(NULL) + delta; + } + /* dispatch freeswitch event */ if (switch_event_create(&s_event, SWITCH_EVENT_NOTIFY_IN) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event", sip->sip_event->o_type); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "pl_data", sip->sip_payload ? sip->sip_payload->pl_data : ""); if ( sip->sip_content_type != NULL ) switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "sip_content_type", sip->sip_content_type->c_type); - switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "port", "%d", sofia_private->gateway->profile->sip_port); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "port", "%d", gateway->profile->sip_port); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "module_name", "mod_sofia"); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_name", sofia_private->gateway->profile->name); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_uri", sofia_private->gateway->profile->url); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "gateway_name", sofia_private->gateway->name); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_name", gateway->profile->name); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_uri", gateway->profile->url); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "gateway_name", gateway->name); if ( sip->sip_call_info != NULL ) { sip_call_info_t *call_info = sip->sip_call_info; int cur_len = 0; @@ -565,12 +583,16 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, end: - if (sub_state == nua_substate_terminated && sofia_private && sofia_private != &mod_sofia_globals.destroy_private && + if (!gateway && sub_state == nua_substate_terminated && sofia_private && sofia_private != &mod_sofia_globals.destroy_private && sofia_private != &mod_sofia_globals.keep_private) { sofia_private->destroy_nh = 1; sofia_private->destroy_me = 1; } + if (gateway) { + sofia_reg_release_gateway(gateway); + } + } void sofia_handle_sip_i_bye(switch_core_session_t *session, int status, @@ -1049,9 +1071,9 @@ static void our_sofia_event_callback(nua_event_t event, if (sofia_private && sofia_private != &mod_sofia_globals.destroy_private && sofia_private != &mod_sofia_globals.keep_private) { - if ((gateway = sofia_private->gateway)) { - /* Released in sofia_reg_release_gateway() */ - if (sofia_reg_gateway_rdlock(gateway) != SWITCH_STATUS_SUCCESS) { + + if (!zstr(sofia_private->gateway_name)) { + if (!(gateway = sofia_reg_find_gateway(sofia_private->gateway_name))) { return; } } else if (!zstr(sofia_private->uuid)) { @@ -1499,9 +1521,16 @@ static void our_sofia_event_callback(nua_event_t event, case nua_r_authenticate: if (status >= 500) { - if (sofia_private && sofia_private->gateway) { - nua_handle_destroy(sofia_private->gateway->nh); - sofia_private->gateway->nh = NULL; + if (sofia_private && !zstr(sofia_private->gateway_name)) { + sofia_gateway_t *gateway = NULL; + + if ((gateway = sofia_reg_find_gateway(sofia_private->gateway_name))) { + nua_handle_bind(gateway->nh, NULL); + gateway->sofia_private = NULL; + nua_handle_destroy(gateway->nh); + gateway->nh = NULL; + sofia_reg_release_gateway(gateway); + } } else { nua_handle_destroy(nh); } @@ -2325,10 +2354,9 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread if (++gateway_loops >= GATEWAY_SECONDS) { sofia_reg_check_gateway(profile, switch_epoch_time_now(NULL)); + sofia_sub_check_gateway(profile, switch_epoch_time_now(NULL)); gateway_loops = 0; } - - sofia_sub_check_gateway(profile, time(NULL)); } switch_yield(1000000); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 747f4491e5..dd0fe1ac95 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -4285,6 +4285,7 @@ void sofia_presence_handle_sip_r_subscribe(int status, { sip_event_t const *o = NULL; sofia_gateway_subscription_t *gw_sub_ptr; + sofia_gateway_t *gateway = NULL; if (!sip) { return; @@ -4297,18 +4298,25 @@ void sofia_presence_handle_sip_r_subscribe(int status, return; } - if (!sofia_private || !sofia_private->gateway) { + if (!sofia_private || zstr(sofia_private->gateway_name)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateway information missing\n"); return; } - /* Find the subscription if one exists */ - if (!(gw_sub_ptr = sofia_find_gateway_subscription(sofia_private->gateway, o->o_type))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not find gateway subscription. Gateway: %s. Subscription Event: %s\n", - sofia_private->gateway->name, o->o_type); + + if (!(gateway = sofia_reg_find_gateway(sofia_private->gateway_name))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateway information missing\n"); return; } + + /* Find the subscription if one exists */ + if (!(gw_sub_ptr = sofia_find_gateway_subscription(gateway, o->o_type))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not find gateway subscription. Gateway: %s. Subscription Event: %s\n", + gateway->name, o->o_type); + goto end; + } + /* Update the subscription status for the subscription */ switch (status) { case 200: @@ -4326,19 +4334,22 @@ void sofia_presence_handle_sip_r_subscribe(int status, default: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "status (%d) != 200, updated state to SUB_STATE_FAILED.\n", status); gw_sub_ptr->state = SUB_STATE_FAILED; + gw_sub_ptr->expires = switch_epoch_time_now(NULL); + gw_sub_ptr->retry = switch_epoch_time_now(NULL); - if (sofia_private) { - if (gw_sub_ptr->nh) { - nua_handle_bind(gw_sub_ptr->nh, NULL); - nua_handle_destroy(gw_sub_ptr->nh); - gw_sub_ptr->nh = NULL; - } - } else { + if (!sofia_private) { nua_handle_destroy(nh); } - + break; } + + end: + + if (gateway) { + sofia_reg_release_gateway(gateway); + } + } diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 821a086880..fe4f0c57b9 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -47,7 +47,7 @@ static void sofia_reg_new_handle(sofia_gateway_t *gateway_ptr, int attach) nua_handle_bind(gateway_ptr->nh, NULL); nua_handle_destroy(gateway_ptr->nh); gateway_ptr->nh = NULL; - sofia_private_free(gateway_ptr->sofia_private); + gateway_ptr->sofia_private = NULL; } gateway_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL, @@ -56,23 +56,24 @@ static void sofia_reg_new_handle(sofia_gateway_t *gateway_ptr, int attach) NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()); if (attach) { if (!gateway_ptr->sofia_private) { - gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private)); + gateway_ptr->sofia_private = su_alloc(gateway_ptr->nh->nh_home, sizeof(*gateway_ptr->sofia_private)); switch_assert(gateway_ptr->sofia_private); } memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private)); - gateway_ptr->sofia_private->gateway = gateway_ptr; + switch_set_string(gateway_ptr->sofia_private->gateway_name, gateway_ptr->name); nua_handle_bind(gateway_ptr->nh, gateway_ptr->sofia_private); } } -static void sofia_reg_new_sub_handle(sofia_gateway_subscription_t *gw_sub_ptr, int attach) +static void sofia_reg_new_sub_handle(sofia_gateway_subscription_t *gw_sub_ptr) { sofia_gateway_t *gateway_ptr = gw_sub_ptr->gateway; char *user_via = NULL; char *register_host = sofia_glue_get_register_host(gateway_ptr->register_proxy); int ss_state = nua_callstate_authenticating; + /* check for NAT and place a Via header if necessary (hostname or non-local IP) */ if (register_host && sofia_glue_check_nat(gateway_ptr->profile, register_host)) { user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport); @@ -82,7 +83,7 @@ static void sofia_reg_new_sub_handle(sofia_gateway_subscription_t *gw_sub_ptr, i nua_handle_bind(gw_sub_ptr->nh, NULL); nua_handle_destroy(gw_sub_ptr->nh); gw_sub_ptr->nh = NULL; - sofia_private_free(gateway_ptr->sofia_private); + gw_sub_ptr->sofia_private = NULL; } gw_sub_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL, @@ -90,16 +91,14 @@ static void sofia_reg_new_sub_handle(sofia_gateway_subscription_t *gw_sub_ptr, i TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_TO_STR(gateway_ptr->register_to), NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()); - if (attach) { - if (!gateway_ptr->sofia_private) { - gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private)); - switch_assert(gateway_ptr->sofia_private); - } - memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private)); - - gateway_ptr->sofia_private->gateway = gateway_ptr; - nua_handle_bind(gw_sub_ptr->nh, gateway_ptr->sofia_private); + if (!gw_sub_ptr->sofia_private) { + gw_sub_ptr->sofia_private = su_alloc(gw_sub_ptr->nh->nh_home, sizeof(*gw_sub_ptr->sofia_private)); + switch_assert(gw_sub_ptr->sofia_private); } + memset(gw_sub_ptr->sofia_private, 0, sizeof(*gw_sub_ptr->sofia_private)); + + switch_set_string(gw_sub_ptr->sofia_private->gateway_name, gateway_ptr->name); + nua_handle_bind(gw_sub_ptr->nh, gw_sub_ptr->sofia_private); switch_safe_free(register_host); switch_safe_free(user_via); @@ -109,6 +108,8 @@ static void sofia_reg_kill_sub(sofia_gateway_subscription_t *gw_sub_ptr) { sofia_gateway_t *gateway_ptr = gw_sub_ptr->gateway; + gw_sub_ptr->sofia_private = NULL; + if (gw_sub_ptr->nh) { nua_handle_bind(gw_sub_ptr->nh, NULL); } @@ -141,6 +142,7 @@ static void sofia_reg_kill_reg(sofia_gateway_t *gateway_ptr) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Destroying registration handle for %s\n", gateway_ptr->name); } + gateway_ptr->sofia_private = NULL; nua_handle_bind(gateway_ptr->nh, NULL); nua_handle_destroy(gateway_ptr->nh); gateway_ptr->nh = NULL; @@ -175,20 +177,18 @@ void sofia_reg_unregister(sofia_profile_t *profile) nua_handle_bind(gateway_ptr->nh, NULL); } - if (gateway_ptr->sofia_private) { - sofia_private_free(gateway_ptr->sofia_private); - } - if (gateway_ptr->state == REG_STATE_REGED) { sofia_reg_kill_reg(gateway_ptr); } for (gw_sub_ptr = gateway_ptr->subscriptions; gw_sub_ptr; gw_sub_ptr = gw_sub_ptr->next) { + if (gw_sub_ptr->state == SUB_STATE_SUBED) { sofia_reg_kill_sub(gw_sub_ptr); } } + gateway_ptr->subscriptions = NULL; } switch_mutex_unlock(mod_sofia_globals.hash_mutex); } @@ -229,7 +229,7 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now) break; case SUB_STATE_UNSUBED: - sofia_reg_new_sub_handle(gw_sub_ptr, 1); + sofia_reg_new_sub_handle(gw_sub_ptr); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "subscribing to [%s] on gateway [%s]\n", gw_sub_ptr->event, gateway_ptr->name); @@ -2184,17 +2184,27 @@ void sofia_reg_handle_sip_r_register(int status, sofia_dispatch_event_t *de, tagi_t tags[]) { + sofia_gateway_t *gateway = NULL; + + if (sofia_private && !zstr(sofia_private->gateway_name)) { + gateway = sofia_reg_find_gateway(sofia_private->gateway_name); + } + + if (status >= 500) { - if (sofia_private && sofia_private->gateway) { - nua_handle_destroy(sofia_private->gateway->nh); - sofia_private->gateway->nh = NULL; + if (sofia_private && gateway) { + nua_handle_bind(gateway->nh, NULL); + gateway->sofia_private = NULL; + nua_handle_destroy(gateway->nh); + gateway->nh = NULL; + } else { nua_handle_destroy(nh); } } - if (sofia_private && sofia_private->gateway) { - reg_state_t ostate = sofia_private->gateway->state; + if (sofia_private && gateway) { + reg_state_t ostate = gateway->state; switch (status) { case 200: if (sip && sip->sip_contact) { @@ -2206,7 +2216,7 @@ void sofia_reg_handle_sip_r_register(int status, for (; contact; contact = contact->m_next) { if ((full = sip_header_as_string(nh->nh_home, (void *) contact))) { - if (switch_stristr(sofia_private->gateway->register_contact, full)) { + if (switch_stristr(gateway->register_contact, full)) { break; } @@ -2223,37 +2233,42 @@ void sofia_reg_handle_sip_r_register(int status, new_expires = contact->m_expires; expi = (uint32_t) atoi(new_expires); - if (expi > 0 && expi != sofia_private->gateway->freq) { - //sofia_private->gateway->freq = expi; - //sofia_private->gateway->expires_str = switch_core_sprintf(sofia_private->gateway->pool, "%d", expi); + if (expi > 0 && expi != gateway->freq) { + //gateway->freq = expi; + //gateway->expires_str = switch_core_sprintf(gateway->pool, "%d", expi); if (expi > 60) { - sofia_private->gateway->expires = switch_epoch_time_now(NULL) + (expi - 15); + gateway->expires = switch_epoch_time_now(NULL) + (expi - 15); } else { - sofia_private->gateway->expires = switch_epoch_time_now(NULL) + (expi - 2); + gateway->expires = switch_epoch_time_now(NULL) + (expi - 2); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Changing expire time to %d by request of proxy %s\n", expi, sofia_private->gateway->register_proxy); + "Changing expire time to %d by request of proxy %s\n", expi, gateway->register_proxy); } } } - sofia_private->gateway->state = REG_STATE_REGISTER; + gateway->state = REG_STATE_REGISTER; break; case 100: break; default: - sofia_private->gateway->state = REG_STATE_FAILED; - sofia_private->gateway->failure_status = status; + gateway->state = REG_STATE_FAILED; + gateway->failure_status = status; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Registration Failed with status %s [%d]. failure #%d\n", - sofia_private->gateway->name, switch_str_nil(phrase), status, ++sofia_private->gateway->failures); + gateway->name, switch_str_nil(phrase), status, ++gateway->failures); break; } - if (ostate != sofia_private->gateway->state) { - sofia_reg_fire_custom_gateway_state_event(sofia_private->gateway, status, phrase); + if (ostate != gateway->state) { + sofia_reg_fire_custom_gateway_state_event(gateway, status, phrase); } } + + if (gateway) { + sofia_reg_release_gateway(gateway); + } + } void sofia_reg_handle_sip_r_challenge(int status, @@ -2282,8 +2297,12 @@ void sofia_reg_handle_sip_r_challenge(int status, sip_auth_password = switch_channel_get_variable(channel, "sip_auth_password"); } - if (sofia_private && *sofia_private->auth_gateway_name) { - gw_name = sofia_private->auth_gateway_name; + if (sofia_private) { + if (*sofia_private->auth_gateway_name) { + gw_name = sofia_private->auth_gateway_name; + } else if (*sofia_private->gateway_name) { + gw_name = sofia_private->gateway_name; + } } if (session) { @@ -2407,7 +2426,7 @@ void sofia_reg_handle_sip_r_challenge(int status, tl_gets(tags, NUTAG_CALLSTATE_REF(ss_state), SIPTAG_WWW_AUTHENTICATE_REF(authenticate), TAG_END()); nua_authenticate(nh, - TAG_IF(sofia_private && sofia_private->gateway, SIPTAG_EXPIRES_STR(gateway ? gateway->expires_str : "3600")), + TAG_IF(gateway, SIPTAG_EXPIRES_STR(gateway ? gateway->expires_str : "3600")), NUTAG_AUTH(authentication), TAG_END()); goto end; From 9ec1e86574bc2fe49ea19aca120b3c74270baa18 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Tue, 10 Dec 2013 14:16:08 -0500 Subject: [PATCH 23/23] rpmbuild: update version of flite, lame, and opus --- freeswitch.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/freeswitch.spec b/freeswitch.spec index 37f66cdf53..b59bc0f4ed 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -115,8 +115,8 @@ Vendor: http://www.freeswitch.org/ ###################################################################################################################### Source0: http://files.freeswitch.org/%{name}-%{version}.tar.bz2 Source1: http://files.freeswitch.org/downloads/libs/celt-0.10.0.tar.gz -Source2: http://files.freeswitch.org/downloads/libs/flite-1.5.1-current.tar.bz2 -Source3: http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz +Source2: http://files.freeswitch.org/downloads/libs/flite-1.5.4-current.tar.bz2 +Source3: http://files.freeswitch.org/downloads/libs/lame-3.98.4.tar.gz Source4: http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz Source5: http://files.freeswitch.org/downloads/libs/mpg123-1.13.2.tar.gz #Source6: http://files.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz @@ -126,7 +126,7 @@ Source8: http://files.freeswitch.org/downloads/libs/sphinxbase-0.7.tar.gz Source9: http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz Source10: http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz Source11: http://files.freeswitch.org/downloads/libs/json-c-0.9.tar.gz -Source12: http://files.freeswitch.org/downloads/libs/opus-0.9.0.tar.gz +Source12: http://files.freeswitch.org/downloads/libs/opus-1.0.3.tar.gz Prefix: %{prefix}