From d06ac756ebb9b5837ca71fa68749e9880a541ef1 Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 10 Sep 2014 14:49:56 -0500 Subject: [PATCH 01/57] clarify tls ciphers and update num to allow for ipv6 and tls options --- conf/vanilla/autoload_configs/enum.conf.xml | 6 +++--- conf/vanilla/vars.xml | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/conf/vanilla/autoload_configs/enum.conf.xml b/conf/vanilla/autoload_configs/enum.conf.xml index b9813efa27..a8f6f52f85 100644 --- a/conf/vanilla/autoload_configs/enum.conf.xml +++ b/conf/vanilla/autoload_configs/enum.conf.xml @@ -14,8 +14,8 @@ - - - + + + diff --git a/conf/vanilla/vars.xml b/conf/vanilla/vars.xml index 28a6dc96fb..ff40fc7cfc 100644 --- a/conf/vanilla/vars.xml +++ b/conf/vanilla/vars.xml @@ -61,7 +61,7 @@ - + From 575adecf75516ab5abbfb6b5934a54b4b835bdd0 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 10 Sep 2014 14:57:57 -0500 Subject: [PATCH 02/57] Revert "FS-6566" This reverts commit 99d0f134e7cd1345641022c0e5b406e8dfa5caa8. --- src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index ff6b6431d1..f89a9a0644 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -37,7 +37,7 @@ #include #include -#include +#include SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_pg_csv_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cdr_pg_csv_shutdown); From e2b1ee26ae50d0e9fba8a19be1514f57a59c12e9 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Wed, 10 Sep 2014 15:04:31 -0500 Subject: [PATCH 03/57] fix libpq location detection --- src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am b/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am index bcbfada1cf..d612dd5869 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am +++ b/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am @@ -3,6 +3,6 @@ MODNAME=mod_cdr_pg_csv mod_LTLIBRARIES = mod_cdr_pg_csv.la mod_cdr_pg_csv_la_SOURCES = mod_cdr_pg_csv.c -mod_cdr_pg_csv_la_CFLAGS = $(AM_CFLAGS) $(SWITCH_AM_CXXFLAGS) +mod_cdr_pg_csv_la_CFLAGS = $(AM_CFLAGS) $(SWITCH_AM_CXXFLAGS) $(POSTGRESQL_CFLAGS) mod_cdr_pg_csv_la_LIBADD = $(switch_builddir)/libfreeswitch.la -mod_cdr_pg_csv_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lpq $(SWITCH_AM_LDFLAGS) +mod_cdr_pg_csv_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(SWITCH_AM_LDFLAGS) $(POSTGRESQL_LIBDIR) -lpq From d1e00c2db9478adbcdbf899afc8ccfae6bf57c3e Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Wed, 10 Sep 2014 15:55:29 -0500 Subject: [PATCH 04/57] updates to the spec file for better dep tracking and addition file in configs --- freeswitch.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/freeswitch.spec b/freeswitch.spec index 91b551247d..a14b643625 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -179,6 +179,9 @@ BuildRequires: e2fsprogs-devel BuildRequires: libtheora-devel BuildRequires: libxml2-devel BuildRequires: bison +BuildRequires: net-snmp-devel +BuildRequires: libmemcached-devel +BuildRequires: portaudio-devel %if %{build_py26_esl} BuildRequires: python26-devel Requires: python26 @@ -1815,6 +1818,7 @@ fi %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/tts_commandline.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/unicall.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/unimrcp.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/verto.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/voicemail.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/voicemail_ivr.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/xml_cdr.conf.xml From 30283b7f6bb92f25cbde18760473f441a025263e Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Wed, 10 Sep 2014 16:27:16 -0500 Subject: [PATCH 05/57] Revert "fix libpq location detection" This reverts commit e2b1ee26ae50d0e9fba8a19be1514f57a59c12e9. --- src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am b/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am index d612dd5869..bcbfada1cf 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am +++ b/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am @@ -3,6 +3,6 @@ MODNAME=mod_cdr_pg_csv mod_LTLIBRARIES = mod_cdr_pg_csv.la mod_cdr_pg_csv_la_SOURCES = mod_cdr_pg_csv.c -mod_cdr_pg_csv_la_CFLAGS = $(AM_CFLAGS) $(SWITCH_AM_CXXFLAGS) $(POSTGRESQL_CFLAGS) +mod_cdr_pg_csv_la_CFLAGS = $(AM_CFLAGS) $(SWITCH_AM_CXXFLAGS) mod_cdr_pg_csv_la_LIBADD = $(switch_builddir)/libfreeswitch.la -mod_cdr_pg_csv_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(SWITCH_AM_LDFLAGS) $(POSTGRESQL_LIBDIR) -lpq +mod_cdr_pg_csv_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lpq $(SWITCH_AM_LDFLAGS) From ce5d21106e58abf42fd1a6ac38f454e371217c30 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 11 Sep 2014 03:29:07 +0500 Subject: [PATCH 06/57] FS-6761 #resolve --- src/mod/applications/mod_httapi/mod_httapi.c | 2 +- src/mod/xml_int/mod_xml_curl/mod_xml_curl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index f3b1a5997c..fede125ffb 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -1603,10 +1603,10 @@ static switch_status_t httapi_sync(client_t *client) switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) client); switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEHEADER, (void *) client); switch_curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, ua); + switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1); if (client->profile->timeout) { switch_curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, client->profile->timeout); - switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1); } if (client->profile->ssl_cert_file) { diff --git a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c index 112b370af0..af0a87dd96 100644 --- a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c +++ b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c @@ -237,10 +237,10 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, file_callback); switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &config_data); switch_curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-xml/1.0"); + switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1); if (binding->timeout) { switch_curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, binding->timeout); - switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1); } if (binding->disable100continue) { From bb84b0534c0805f82d6a35b9fca9f33c29287e82 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 10 Sep 2014 22:03:29 +0000 Subject: [PATCH 07/57] Check for libpq in core before building mod_cdr_pg_csv --- configure.ac | 3 +++ src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/configure.ac b/configure.ac index e8f9efade0..dbb5a925f2 100644 --- a/configure.ac +++ b/configure.ac @@ -601,6 +601,7 @@ if test x"$enable_core_pgsql_support" = x"yes" ; then AC_MSG_RESULT([$POSTGRESQL_LIBDIR]) AC_DEFINE([SWITCH_HAVE_PGSQL], [1], [Define to 1 if PostgreSQL libraries are available]) + AM_CONDITIONAL([HAVE_PGSQL],[true]) AC_DEFINE_UNQUOTED([POSTGRESQL_VERSION], "${POSTGRESQL_VERSION}", [Specifies the version of PostgreSQL we are linking against]) AC_DEFINE_UNQUOTED([POSTGRESQL_MAJOR_VERSION], ${POSTGRESQL_MAJOR_VERSION}, [Specifies the version of PostgreSQL we are linking against]) AC_DEFINE_UNQUOTED([POSTGRESQL_MINOR_VERSION], ${POSTGRESQL_MINOR_VERSION}, [Specifies the version of PostgreSQL we are linking against]) @@ -612,6 +613,8 @@ if test x"$enable_core_pgsql_support" = x"yes" ; then SWITCH_AM_LDFLAGS="$POSTGRESQL_LDFLAGS $SWITCH_AM_LDFLAGS" LIBS="$save_LIBS" +else + AM_CONDITIONAL([HAVE_PGSQL],[false]) fi AC_ARG_ENABLE(deprecated-core-db-events, diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am b/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am index bcbfada1cf..7c37b89630 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am +++ b/src/mod/event_handlers/mod_cdr_pg_csv/Makefile.am @@ -1,8 +1,17 @@ include $(top_srcdir)/build/modmake.rulesam MODNAME=mod_cdr_pg_csv +if HAVE_PGSQL + mod_LTLIBRARIES = mod_cdr_pg_csv.la mod_cdr_pg_csv_la_SOURCES = mod_cdr_pg_csv.c mod_cdr_pg_csv_la_CFLAGS = $(AM_CFLAGS) $(SWITCH_AM_CXXFLAGS) mod_cdr_pg_csv_la_LIBADD = $(switch_builddir)/libfreeswitch.la mod_cdr_pg_csv_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lpq $(SWITCH_AM_LDFLAGS) + +else +install: error +all: error +error: + $(error You must configure --enable-core-pgsql-support to build this module) +endif From 6953881a711882bf087305a4a2d8e6802266c47c Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 10 Sep 2014 17:40:44 -0500 Subject: [PATCH 08/57] fix valet parking sample --- conf/vanilla/dialplan/default.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/vanilla/dialplan/default.xml b/conf/vanilla/dialplan/default.xml index 8971939ec2..1695159b36 100644 --- a/conf/vanilla/dialplan/default.xml +++ b/conf/vanilla/dialplan/default.xml @@ -508,7 +508,7 @@ After call is retrieved, park extension is free for another call. --> - + From fbcee7c707462aa0dbab066c9e0dcf08a065b6c1 Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 10 Sep 2014 20:00:29 -0500 Subject: [PATCH 09/57] Fix Spec file to build again --- freeswitch.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/freeswitch.spec b/freeswitch.spec index a14b643625..23bf56faae 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -121,13 +121,13 @@ 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 -Source6: http://files.freeswitch.org/downloads/libs/pocketsphinx-0.7.tar.gz +Source6: http://files.freeswitch.org/downloads/libs/pocketsphinx-0.8.tar.gz Source7: http://files.freeswitch.org/downloads/libs/soundtouch-1.7.1.tar.gz -Source8: http://files.freeswitch.org/downloads/libs/sphinxbase-0.7.tar.gz +Source8: http://files.freeswitch.org/downloads/libs/sphinxbase-0.8.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-1.1.tar.gz +Source12: http://files.freeswitch.org/downloads/libs/opus-1.1-p2.tar.gz Source13: http://files.freeswitch.org/downloads/libs/v8-3.24.14.tar.bz2 Prefix: %{prefix} @@ -146,6 +146,7 @@ BuildRequires: lzo-devel %endif BuildRequires: autoconf BuildRequires: automake +BuildRequires: bzip2 BuildRequires: curl-devel BuildRequires: gcc-c++ BuildRequires: gnutls-devel @@ -155,6 +156,7 @@ BuildRequires: openssl-devel >= 1.0.1e BuildRequires: pcre-devel BuildRequires: speex-devel BuildRequires: sqlite-devel +BuildRequires: ldns-devel BuildRequires: libedit-devel BuildRequires: perl %if 0%{?fedora_version} >= 8 || 0%{?rhel} >= 6 @@ -1521,6 +1523,7 @@ fi --with-dbdir=%{DBDIR} \ --with-htdocsdir=%{HTDOCSDIR} \ --with-soundsdir=%{SOUNDSDIR} \ +--enable-core-pgsql-support \ --enable-core-odbc-support \ --enable-core-libedit-support \ --with-grammardir=%{GRAMMARDIR} \ From d49cd267c0d4dc31886563c05451f55c7aaf0aba Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 11 Sep 2014 10:24:40 -0500 Subject: [PATCH 10/57] fix fedora rpm build --- freeswitch.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freeswitch.spec b/freeswitch.spec index 23bf56faae..03aef0e4b6 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -159,7 +159,7 @@ BuildRequires: sqlite-devel BuildRequires: ldns-devel BuildRequires: libedit-devel BuildRequires: perl -%if 0%{?fedora_version} >= 8 || 0%{?rhel} >= 6 +%if 0%{?fedora} >= 8 || 0%{?rhel} >= 6 BuildRequires: perl-ExtUtils-Embed %endif BuildRequires: pkgconfig From 43b759348955de7bb54dbe1c879c02407d957f77 Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 11 Sep 2014 10:28:45 -0500 Subject: [PATCH 11/57] fix opensuse rpm build --- freeswitch.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/freeswitch.spec b/freeswitch.spec index 23bf56faae..63269d2922 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -168,7 +168,11 @@ BuildRequires: termcap %endif BuildRequires: unixODBC-devel BuildRequires: gdbm-devel +%if 0%{?suse_version} > 100 +BuildRequires: db-devel +%else BuildRequires: db4-devel +%endif BuildRequires: python-devel BuildRequires: libogg-devel BuildRequires: libvorbis-devel From 622e0e1a6f9819f00163ebdf4c71ba0862f375b6 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 11 Sep 2014 17:42:07 +0000 Subject: [PATCH 12/57] Check for null hash on increment of mod_hash limit When we specifically release all limits on a channel we destroy the hash table stored in the "limit_hash" private channel data but we don't destroy the private data as it will be reclaimed as part of the session. If limit increment is called after the limit release we can reuse that channel private, but we need to check whether the hash table is null first. Fortunately this makes the code look better anyway. FS-6775 #resolve FS-6783 #resolve --- src/mod/applications/mod_hash/mod_hash.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index fdc12bee2b..2ab9e0ae7d 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -150,21 +150,15 @@ SWITCH_LIMIT_INCR(limit_incr_hash) switch_core_hash_insert(globals.limit_hash, hashkey, item); } - /* Did we already run on this channel before? */ - if ((pvt = switch_channel_get_private(channel, "limit_hash"))) { - /* Yes, but check if we did that realm+resource - If we didnt, allow incrementing the counter. - If we did, dont touch it but do the validation anyways - */ - increment = !switch_core_hash_find(pvt->hash, hashkey); - } else { - /* This is the first limit check on this channel, create a hashtable, set our private data */ + if (!(pvt = switch_channel_get_private(channel, "limit_hash"))) { pvt = (limit_hash_private_t *) switch_core_session_alloc(session, sizeof(limit_hash_private_t)); memset(pvt, 0, sizeof(limit_hash_private_t)); - switch_core_hash_init(&pvt->hash); switch_channel_set_private(channel, "limit_hash", pvt); } - + if (!(pvt->hash)) { + switch_core_hash_init(&pvt->hash); + } + increment = !switch_core_hash_find(pvt->hash, hashkey); remote_usage = get_remote_usage(hashkey); if (interval > 0) { From 20af2159d10da64690b1a21421c2d19a14b8e77a Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Thu, 11 Sep 2014 21:53:39 +0400 Subject: [PATCH 13/57] Fix verto and rtc RPMs Fix dates in RPM changelog that cause complaints on newer RPM build software --- freeswitch.spec | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/freeswitch.spec b/freeswitch.spec index d0d9205337..0f8145efa5 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -867,6 +867,22 @@ Requires: %{name} = %{version}-%{release} %description endpoint-skinny SCCP/Skinny support for FreeSWITCH open source telephony platform. +%package endpoint-verto +Summary: Verto endpoint support for FreeSWITCH open source telephony platform +Group: System/Libraries +Requires: %{name} = %{version}-%{release} + +%description endpoint-verto +Verto protocol support for FreeSWITCH open source telephony platform. + +%package endpoint-rtc +Summary: Verto endpoint support for FreeSWITCH open source telephony platform +Group: System/Libraries +Requires: %{name} = %{version}-%{release} + +%description endpoint-rtc +Verto protocol support for FreeSWITCH open source telephony platform. + %package freetdm Summary: Provides a unified interface to hardware TDM cards and ss7 stacks for FreeSWITCH Group: System/Libraries @@ -1405,7 +1421,7 @@ DIRECTORIES_MODULES="" ###################################################################################################################### ENDPOINTS_MODULES="endpoints/mod_dingaling ../../libs/freetdm/mod_freetdm \ endpoints/mod_loopback endpoints/mod_portaudio endpoints/mod_rtmp \ - endpoints/mod_skinny endpoints/mod_skypopen endpoints/mod_sofia" + endpoints/mod_skinny endpoints/mod_verto endpoints/mod_rtc endpoints/mod_skypopen endpoints/mod_sofia" ## DISABLED MODULES DUE TO BUILD ISSUES endpoints/mod_gsmopen endpoints/mod_h323 endpoints/mod_khomp @@ -2102,6 +2118,12 @@ fi %files endpoint-skinny %{MODINSTDIR}/mod_skinny.so* +%files endpoint-verto +%{MODINSTDIR}/mod_verto.so* + +%files endpoint-rtc +%{MODINSTDIR}/mod_rtc.so* + %files endpoint-skypopen %{MODINSTDIR}/mod_skypopen.so* @@ -2349,7 +2371,9 @@ fi # ###################################################################################################################### %changelog -* Fri Jun 02 2014 - krice@freeswitch.org +* Thu Sep 11 2014 - krice@freeswitch.org +- add and fix mod_verto and mod_rtc +* Mon Jun 02 2014 - krice@freeswitch.org - remove mod_spidermoney as its been deprecated * Fri Feb 21 2014 - crienzo@grasshopper.com - change file owner to root @@ -2362,11 +2386,11 @@ fi * Mon Dec 09 2013 - crienzo@grasshopper.com - Add mod_ssml, mod_rayo - Fix build on master -* Thu Jun 28 2013 - krice@freeswitch.org +* Fri Jun 28 2013 - krice@freeswitch.org - Add module for VP8 -* Thu Jun 19 2013 - krice@freeswitch.org +* Wed Jun 19 2013 - krice@freeswitch.org - tweak files included for vanilla configs -* Thu Sep 19 2012 - krice@freeswitch.org +* Wed Sep 19 2012 - krice@freeswitch.org - Add support for Spanish and Portugese say language modules * Thu Jan 26 2012 - krice@freeswitch.org - complete rework of spec file @@ -2448,10 +2472,10 @@ fi - added directory files to russian language * Sat Nov 21 2009 - michal.bielicki@seventhsignal.de - added patch by Igor Neves : Added some checkup in %post and %postun to prevent upgrades from removing freeswitch user -* Thu Nov 18 2009 - michal.bielicki@seventhsignal.de +* Wed Nov 18 2009 - michal.bielicki@seventhsignal.de - added new config files for diretory and distributor - removed sangoma boost from openzap for builds that do not inherit wanpipe while building. -* Tue Jul 24 2009 - mike@jerris.com +* Fri Jul 24 2009 - mike@jerris.com - removed mod_http - removed ozmod_wanpipe * Tue Jun 23 2009 - raulfragoso@gmail.com @@ -2459,7 +2483,7 @@ fi - Included new config and mod files to catch up with latest SVN - Included new sound files for base256 and zrtp - mod_unimrcp must be built after mod_sofia -* Mon Feb 17 2009 - michal.bielicki@halokwadrat.de +* Tue Feb 17 2009 - michal.bielicki@halokwadrat.de - added mod_python - added mod_fax - added mod_amrwb.so @@ -2496,7 +2520,7 @@ fi - abstraction of mkdir, mv, rm, install etc into macros * Fri Jan 18 2008 - michal.bielicki@voiceworks.pl - fixes, fixes and more fixes in preparation for rc1 -* Thu Dec 5 2007 - michal.bielicki@voiceworks.pl +* Wed Dec 5 2007 - michal.bielicki@voiceworks.pl - put in detail configfiles in to split of spidermonkey configs - created link from /opt/freesxwitch/conf to /etc%{prefix} * Thu Nov 29 2007 - michal.bielicki@voiceworks.pl From 034bd1bf6902ad4d12e94eec133e343078047777 Mon Sep 17 00:00:00 2001 From: SwK Date: Thu, 11 Sep 2014 14:55:18 -0400 Subject: [PATCH 14/57] add stuff into tree for generating the YUM repo pointer RPM --- yum/GPL | 347 ++++++++++++++++++++++++++++++++++++ yum/RPM-GPG-KEY-FREESWITCH | 25 +++ yum/freeswitch-release.spec | 58 ++++++ yum/freeswitch-testing.repo | 26 +++ yum/freeswitch.repo | 26 +++ yum/rpmbuilder.sh | 28 +++ 6 files changed, 510 insertions(+) create mode 100644 yum/GPL create mode 100644 yum/RPM-GPG-KEY-FREESWITCH create mode 100644 yum/freeswitch-release.spec create mode 100644 yum/freeswitch-testing.repo create mode 100644 yum/freeswitch.repo create mode 100755 yum/rpmbuilder.sh diff --git a/yum/GPL b/yum/GPL new file mode 100644 index 0000000000..fd8bee7b02 --- /dev/null +++ b/yum/GPL @@ -0,0 +1,347 @@ +***************************************************************************** +The following copyright applies to the Red Hat Linux compilation and any +portions of Red Hat Linux it does not conflict with. Whenever this +policy does conflict with the copyright of any individual portion of Red Hat +Linux, it does not apply. + +***************************************************************************** + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/yum/RPM-GPG-KEY-FREESWITCH b/yum/RPM-GPG-KEY-FREESWITCH new file mode 100644 index 0000000000..5d0ee845c4 --- /dev/null +++ b/yum/RPM-GPG-KEY-FREESWITCH @@ -0,0 +1,25 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.10 (GNU/Linux) + +mQGiBE8jEfIRBAC+Cca0fPQxhyhn0NMsPaMQJgTvqhWb5/f4Mel++kosmUQQ4fJq +4U9NFvpfNyLp5MoHpnlDfAb+e57B2sr47NOJLTh83yQIAnvU+8O0Q4kvMaiiesX5 +CisApLBs6Vx28y7VWmLsY3vWu8mC7M+PORKfpBV8DWy/7569wQPx2SCsIwCgzv2T +8YsnYsSVRrrmh46J1o4/ngsD/13ETX4ws/wNN+82RdqUxu7fjc0fNbUAb6XYddAb +1hrw5npQulgUNWkpnVmIDRHDXLNMeT8nZDkxsA8AsT+u7ACfPFa2o3R8w9zOPSO+ +oSO0+Puhop2+z1gm6lmfMKq9HpeXG3yt/8zsEVUmOYT9m+vYEVghfpXtACVYheDq +LzUuA/9E9HBiNPVhJ/mEpOk9bZ1gpwr3mjlpUbvX5aGwTJJ+YoTfZOCL7go3uQHn +/sT35WoJ23wJCRlW0SYTFJqCoris9AhI+qw7xRTw9wb+txSI96uhafUUMCn6GLkN ++yAixqDwNHKkdax3GSGJtLB0t67QoBDIpcGog7ZfRMvWP3QLNLQ4RnJlZVNXSVRD +SCBQYWNrYWdlIFNpZ25pbmcgS2V5IDxwYWNrYWdlc0BmcmVlc3dpdGNoLm9yZz6I +YgQTEQIAIgUCTyMR8gIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQ127c +dyXgEM879ACffY0HFi+mACtfFYmX/Uk/qGELSP4An1B8D5L4dLFFr1zV9YawQUbz +O9/MuQENBE8jEfIQBAC7vnn855YDuz1gTsUMYDxfIRH5KPmDDEAf1WXoD3QG4qOQ +xVW5nhp/bolh2CacAxdOjZePdhGkkdNOBpcu9NlTNRru0myGN8etbnzP3O5dq0io +VMf23C5u9KPbxwRWS+WFtC4CRFn6DafDI1qa3Gv3CkiBWtKR0Wid2SQLzl3mVwAF +EQP9HlwGjhBfFA26LlSMPhSo0Ll+sdcOJupJ21zmGeg7c0GpBnzDzyyJg04gbahs +xWtW3Y/+B4LGM97o6lnu0OQI7MX5gY1G4Jgu6pgYv8tQd5XyU/CAJUA5VWTxUMIi +JP6qlzm1bz4AAPmGw4mkS1u4N+vai21Zl4iyFIQFeiuU/K2ISQQYEQIACQUCTyMR +8gIbDAAKCRDXbtx3JeAQzxReAJ4if8mss7CU2PBB7ycyqmQ94pfa5gCaArUwapxO +y3VNFe8aDajIULY7X3A= +=McFP +-----END PGP PUBLIC KEY BLOCK----- diff --git a/yum/freeswitch-release.spec b/yum/freeswitch-release.spec new file mode 100644 index 0000000000..5ff6f95dae --- /dev/null +++ b/yum/freeswitch-release.spec @@ -0,0 +1,58 @@ +Name: freeswitch-release +Version: 1 +Release: 0 +Summary: FreeSwitch Packages for Enterprise Linux repository configuration + +Group: System Environment/Base +License: GPL +URL: http://www.freeswitch.org + +Source0: http://files.freeswitch.org/yum/RPM-GPG-KEY-FREESWITCH +Source1: GPL +Source2: freeswitch.repo +Source3: freeswitch-testing.repo + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildArch: noarch +Requires: redhat-release >= %{version} + +%description +This package contains the FreeSwitch Yum repository +GPG key as well as configuration for yum. + +%prep +%setup -q -c -T +install -pm 644 %{SOURCE0} . +install -pm 644 %{SOURCE1} . + +%build + + +%install +rm -rf $RPM_BUILD_ROOT + +#GPG Key +install -Dpm 644 %{SOURCE0} \ + $RPM_BUILD_ROOT%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-FREESWITCH + +# yum +install -dm 755 $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d +install -pm 644 %{SOURCE2} %{SOURCE3} \ + $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%doc GPL +%config(noreplace) /etc/yum.repos.d/* +/etc/pki/rpm-gpg/* + + +%changelog +* Sat Jan 27 2012 Ken Rice - 5-0 +- Replace GPG key with correct key, and update primary URLs +* Sat Dec 21 2011 Ken Rice - 5-0 +- Initial Version - Thanks to the EPEL Guys I had something to Rip Off. Hense this package is GPL diff --git a/yum/freeswitch-testing.repo b/yum/freeswitch-testing.repo new file mode 100644 index 0000000000..4205c302da --- /dev/null +++ b/yum/freeswitch-testing.repo @@ -0,0 +1,26 @@ +[freeswitch-testing] +name=FreeSwitch Packages for Enterprise Linux $releasever - Testing - $basearch +baseurl=http://files.freeswitch.org/yum/testing/$releasever/$basearch +#mirrorlist=http://mirrors.freeswitch.org/mirrorlist?repo=testing-freeswitch$releasever&arch=$basearch +#failovermethod=priority +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-FREESWITCH + +[freeswitch-testing-debuginfo] +name=FreeSwitch Packages for Enterprise Linux $releasever - Testing - $basearch - Debug +baseurl=http://files.freeswitch.org/yum/testing/$releasever/$basearch/debug +#mirrorlist=http://mirrors.freeswitch.org/mirrorlist?repo=testing-debug-freeswitch$releasever&arch=$basearch +#failovermethod=priority +enabled=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-FREESWITCH +gpgcheck=1 + +[freeswitch-testing-source] +name=FreeSwitch Packages for Enterprise Linux $releasever - Testing - $basearch - Source +baseurl=http://files.freeswitch.org/yum/testing/$releasever/SRPMS +#mirrorlist=http://mirrors.freeswitch.org/mirrorlist?repo=testing-source-freeswitch$releasever&arch=$basearch +failovermethod=priority +enabled=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-FREESWITCH +gpgcheck=1 diff --git a/yum/freeswitch.repo b/yum/freeswitch.repo new file mode 100644 index 0000000000..f9722e2c82 --- /dev/null +++ b/yum/freeswitch.repo @@ -0,0 +1,26 @@ +[freeswitch] +name=FreeSWITCH Packages for Enterprise Linux $releasever - $basearch +baseurl=http://files.freeswitch.org/yum/$releasever/$basearch +#mirrorlist=http://mirrors.freeswitch.org/mirrorlist?repo=freeswitch-5&arch=$basearch +#failovermethod=priority +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-FREESWITCH + +[freeswitch-debuginfo] +name=FreeSWITCH Packages for Enterprise Linux $releasever - $basearch - Debug +baseurl=http://files.freeswitch.org/yum/$releasever/$basearch/debug +#mirrorlist=http://mirrors.freeswitch.org/mirrorlist?repo=freeswitch-debug-5&arch=$basearch +#failovermethod=priority +enabled=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-FREESWITCH +gpgcheck=1 + +[freeswitch-source] +name=FreeSWITCH Packages for Enterprise Linux $releasever - $basearch - Source +baseurl=http://files.freeswitch.org/yum/$releasever/SRPMS +#mirrorlist=http://mirrors.freeswitch.org/mirrorlist?repo=freeswitch-source-5&arch=$basearch +#failovermethod=priority +enabled=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-FREESWITCH +gpgcheck=1 diff --git a/yum/rpmbuilder.sh b/yum/rpmbuilder.sh new file mode 100755 index 0000000000..050dc0fbd1 --- /dev/null +++ b/yum/rpmbuilder.sh @@ -0,0 +1,28 @@ +dst_parent="/tmp/" +dst_dir="/tmp/$dst_name" +#!/bin/sh +##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- + +sdir="." +[ -n "${0%/*}" ] && sdir="${0%/*}" + +dst_name="freeswitch-release" + +(mkdir -p temp && cd temp && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SPECS) + +cp -a * temp/SOURCES/ || true + +rpmbuild --define "_topdir %(pwd)/temp" \ + --define "_rpmdir %{_topdir}" \ + --define "_srcrpmdir %{_topdir}" \ + -ba freeswitch-release.spec + +mkdir ./RPMS +mv ./temp/*/*.rpm ./RPMS/. + +cat 1>&2 < Date: Thu, 11 Sep 2014 14:18:37 -0500 Subject: [PATCH 15/57] FS-5142 don't multipart/mixed if body has content-type present --- src/switch_utils.c | 51 ++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/src/switch_utils.c b/src/switch_utils.c index 399442be71..f57ea00c4e 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -808,11 +808,18 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, goto end; } } - switch_snprintf(buf, B64BUFFLEN, "MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"%s\"\n", bound); - if (!write_buf(fd, buf)) { - rval = SWITCH_FALSE; - err = "write error."; - goto end; + + if (!file && (!body || !switch_stristr("content-type", body))) { + bound = NULL; + } + + if (bound) { + switch_snprintf(buf, B64BUFFLEN, "MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"%s\"\n", bound); + if (!write_buf(fd, buf)) { + rval = SWITCH_FALSE; + err = "write error."; + goto end; + } } if (headers && !write_buf(fd, headers)) { @@ -827,15 +834,17 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, goto end; } - if (body && switch_stristr("content-type", body)) { - switch_snprintf(buf, B64BUFFLEN, "--%s\n", bound); - } else { - switch_snprintf(buf, B64BUFFLEN, "--%s\nContent-Type: text/plain\n\n", bound); - } - if (!write_buf(fd, buf)) { - rval = SWITCH_FALSE; - err = "write error."; - goto end; + if (bound) { + if (body && switch_stristr("content-type", body)) { + switch_snprintf(buf, B64BUFFLEN, "--%s\n", bound); + } else { + switch_snprintf(buf, B64BUFFLEN, "--%s\nContent-Type: text/plain\n\n", bound); + } + if (!write_buf(fd, buf)) { + rval = SWITCH_FALSE; + err = "write error."; + goto end; + } } if (body) { @@ -846,7 +855,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, } } - if (file) { + if (file && bound) { const char *stipped_file = switch_cut_path(file); const char *new_type; char *ext; @@ -904,12 +913,14 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, } - switch_snprintf(buf, B64BUFFLEN, "\n\n--%s--\n.\n", bound); + if (bound) { + switch_snprintf(buf, B64BUFFLEN, "\n\n--%s--\n.\n", bound); - if (!write_buf(fd, buf)) { - rval = SWITCH_FALSE; - err = "write error."; - goto end; + if (!write_buf(fd, buf)) { + rval = SWITCH_FALSE; + err = "write error."; + goto end; + } } } From 124e3339fc6142af47985c4417a71e04f2ef50e4 Mon Sep 17 00:00:00 2001 From: SwK Date: Thu, 11 Sep 2014 15:20:03 -0400 Subject: [PATCH 16/57] ignore packaging artifacts when building repo pointer RPM --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 2923d395f4..2bdfb15d5a 100644 --- a/.gitignore +++ b/.gitignore @@ -227,3 +227,5 @@ libs/libsndfile/src/Symbols.gnu-binutils libs/libsndfile/src/Symbols.static libs/libsndfile/src/version-metadata.rc libs/libsndfile/tests/pedantic-header-test.sh +yum/RPMS +yum/temp From 7144b252545f334fdb91cd49d728cfb32c9b8d2b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 12 Sep 2014 00:37:15 +0500 Subject: [PATCH 17/57] obey sip_copy_custom_headers on bye --- src/mod/endpoints/mod_sofia/sofia.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index c2fd9adb2f..6cf16e5912 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -938,7 +938,12 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status, switch_core_session_get_partner(session, &nsession); if (nsession) { - switch_ivr_transfer_variable(session, nsession, SOFIA_SIP_BYE_HEADER_PREFIX_T); + const char *vval; + switch_channel_t *nchannel = switch_core_session_get_channel(nsession); + + if (!(vval = switch_channel_get_variable(nchannel, "sip_copy_custom_headers")) || switch_true(vval)) { + switch_ivr_transfer_variable(session, nsession, SOFIA_SIP_BYE_HEADER_PREFIX_T); + } switch_core_session_rwunlock(nsession); } } From 5bd35471f78a2ee1307fec234eee1776e0fa4d46 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 11 Sep 2014 19:44:36 +0000 Subject: [PATCH 18/57] Add var to suppress `Privacy: none` header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently the MetaSwitch guys incorrectly interpret `Privacy: none` as `Privacy: id`. ref: RFC 3325 Reported-by: Stéphane Alnet FS-6817 #resolve --- src/mod/endpoints/mod_sofia/sofia_glue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index fe522fdd4f..99caba5c2e 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1075,7 +1075,9 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) { tech_pvt->privacy = "id"; } else { - tech_pvt->privacy = "none"; + if (!(val = switch_channel_get_variable(channel, "sip_cid_suppress_privacy_none")) || !switch_true(val)) { + tech_pvt->privacy = "none"; + } } break; From 6791c4aa692d683ac02a87e459424eed5035269d Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Fri, 12 Sep 2014 00:04:11 +0400 Subject: [PATCH 19/57] automate this a little more --- scripts/ci/sounds-en-us-callie.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/ci/sounds-en-us-callie.sh b/scripts/ci/sounds-en-us-callie.sh index 32fbc0a400..3df278c621 100755 --- a/scripts/ci/sounds-en-us-callie.sh +++ b/scripts/ci/sounds-en-us-callie.sh @@ -10,11 +10,22 @@ check_input_ver_build $@ eval $(parse_version "$1") build="$2" -cd rpmbuild/SOURCES +basedir=$(pwd); -wget http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-$ver.tar.gz +if [ ! -d "$basedir/../freeswitch-sounds" ]; then + cd $basedir/.. + git clone https://stash.freeswitch.org/scm/fs/freeswitch-sounds.git +else + cd $basedir/../freeswitch-sounds + git pull +fi -cd ../.. +cd $basedir/../freeswitch-sounds/sounds/trunk +perl dist.pl + +cp * freeswitch-sounds-*48000*.tar.gz $basedir/rpmbuild/SOURCES + +cd $basedir rpmbuild --define "VERSION_NUMBER $ver" \ --define "BUILD_NUMBER 1" \ From fc1b0c80b77ea9be01c4bbd346a0ac4951e9aebf Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Fri, 12 Sep 2014 01:29:07 +0400 Subject: [PATCH 20/57] clean these up and stream line the process --- freeswitch-sounds-en-us-callie.spec | 31 ++++++++--------------------- scripts/ci/sounds-en-us-callie.sh | 9 +++++++-- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/freeswitch-sounds-en-us-callie.spec b/freeswitch-sounds-en-us-callie.spec index 68c79e42b6..025eda0d53 100644 --- a/freeswitch-sounds-en-us-callie.spec +++ b/freeswitch-sounds-en-us-callie.spec @@ -73,6 +73,9 @@ Group: Applications/Communications Packager: Patrick Laimbock URL: http://www.freeswitch.org Source0:http://files.freeswitch.org/%{name}-48000-%{version}.tar.gz +Source1:http://files.freeswitch.org/%{name}-32000-%{version}.tar.gz +Source2:http://files.freeswitch.org/%{name}-16000-%{version}.tar.gz +Source3:http://files.freeswitch.org/%{name}-8000-%{version}.tar.gz BuildArch: noarch BuildRequires: sox Requires: freeswitch @@ -139,25 +142,11 @@ FreeSWITCH Callie prompts package that pulls in the 8KHz, 16KHz, ############################################################################## %prep -%setup -b0 -q -n en -mkdir -p ./usr/callie -# create buildsounds-callie.sh script in working dir -echo '#!/bin/bash - -sounds_location=$1 -for rate in 32000 16000 8000 -do - for i in ascii base256 conference currency digits directory ivr misc phonetic-ascii time voicemail zrtp - do - mkdir -p $sounds_location/$i/$rate - for f in `find $sounds_location/$i/48000 -name \*.wav` - do - echo "generating" $sounds_location/$i/$rate/`basename $f` - sox $f -r $rate $sounds_location/$i/$rate/`basename $f` - done - done -done' > ./us/callie/buildsounds-callie.sh -%{__chmod} 0750 ./us/callie/buildsounds-callie.sh +%setup -n en +%setup -T -D -b 0 -n en +%setup -T -D -b 1 -n en +%setup -T -D -b 2 -n en +%setup -T -D -b 3 -n en ############################################################################## # Build @@ -180,7 +169,6 @@ pushd us/callie # first install the 48KHz sounds %{__cp} -prv ./* %{buildroot}%{SOUNDSDIR}/en/us/callie # now resample the 48KHz ones to 8KHz, 16KHz and 32KHz -./buildsounds-callie.sh %{buildroot}%{SOUNDSDIR}/en/us/callie popd ############################################################################## @@ -196,8 +184,6 @@ popd %post # generate the 8KHz, 16KHz and 32KHz prompts from the 48KHz ones -cd %{SOUNDSDIR}/en/us/callie -./buildsounds-callie.sh %{SOUNDSDIR}/en/us/callie ############################################################################## # Postun @@ -214,7 +200,6 @@ cd %{SOUNDSDIR}/en/us/callie %files %defattr(-,root,root) -%attr(0750,freeswitch,daemon) %{SOUNDSDIR}/en/us/callie/buildsounds-callie.sh %files -n freeswitch-sounds-en-us-callie-8000 %defattr(-,root,root,-) diff --git a/scripts/ci/sounds-en-us-callie.sh b/scripts/ci/sounds-en-us-callie.sh index 3df278c621..255d511516 100755 --- a/scripts/ci/sounds-en-us-callie.sh +++ b/scripts/ci/sounds-en-us-callie.sh @@ -12,6 +12,8 @@ build="$2" basedir=$(pwd); +(mkdir -p rpmbuild && cd rpmbuild && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SPECS) + if [ ! -d "$basedir/../freeswitch-sounds" ]; then cd $basedir/.. git clone https://stash.freeswitch.org/scm/fs/freeswitch-sounds.git @@ -21,9 +23,12 @@ else fi cd $basedir/../freeswitch-sounds/sounds/trunk -perl dist.pl +# perl dist.pl -cp * freeswitch-sounds-*48000*.tar.gz $basedir/rpmbuild/SOURCES +mv freeswitch-sounds-*48000*.tar.gz $basedir/rpmbuild/SOURCES +mv freeswitch-sounds-*32000*.tar.gz $basedir/rpmbuild/SOURCES +mv freeswitch-sounds-*16000*.tar.gz $basedir/rpmbuild/SOURCES +mv freeswitch-sounds-*8000*.tar.gz $basedir/rpmbuild/SOURCES cd $basedir From 7ac6c64c208920505edfd955a7428a38dd362af3 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Fri, 12 Sep 2014 02:21:26 +0400 Subject: [PATCH 21/57] get music ready for 1.0.50 --- freeswitch-sounds-music.spec | 2 +- scripts/ci/sounds-music.sh | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/freeswitch-sounds-music.spec b/freeswitch-sounds-music.spec index 520a7dddfe..7e06e63883 100644 --- a/freeswitch-sounds-music.spec +++ b/freeswitch-sounds-music.spec @@ -35,7 +35,7 @@ Summary: FreeSWITCH Music on Hold soundfiles Name: freeswitch-sounds-music -Version: 1.0.8 +Version: 1.0.50 Release: 2%{?dist} License: MPL Group: Productivity/Telephony/Servers diff --git a/scripts/ci/sounds-music.sh b/scripts/ci/sounds-music.sh index 70e61eabec..1550182aeb 100755 --- a/scripts/ci/sounds-music.sh +++ b/scripts/ci/sounds-music.sh @@ -8,16 +8,25 @@ if [ ! -d .git ]; then exit 1; fi -ver="1.0.8" +ver="1.0.50" -cd rpmbuild/SOURCES +basedir=$(pwd); -wget http://files.freeswitch.org/freeswitch-sounds-music-8000-$ver.tar.gz -wget http://files.freeswitch.org/freeswitch-sounds-music-16000-$ver.tar.gz -wget http://files.freeswitch.org/freeswitch-sounds-music-32000-$ver.tar.gz -wget http://files.freeswitch.org/freeswitch-sounds-music-48000-$ver.tar.gz +(mkdir -p rpmbuild && cd rpmbuild && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SPECS) -cd ../.. +if [ ! -d "$basedir/../freeswitch-sounds" ]; then + cd $basedir/.. + git clone https://stash.freeswitch.org/scm/fs/freeswitch-sounds.git +else + cd $basedir/../freeswitch-sounds + git pull +fi + +cd $basedir/../freeswitch-sounds/sounds/trunk + +mv freeswitch-sounds-music-*.tar.gz $basedir/rpmbuild/SOURCES + +cd $basedir rpmbuild --define "VERSION_NUMBER $ver" \ --define "BUILD_NUMBER 1" \ From 6b86e62a656451253457a989a995e9882faa36ca Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Fri, 12 Sep 2014 02:21:47 +0400 Subject: [PATCH 22/57] small tweaks --- scripts/ci/sounds-en-us-callie.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/ci/sounds-en-us-callie.sh b/scripts/ci/sounds-en-us-callie.sh index 255d511516..9b6e898fa4 100755 --- a/scripts/ci/sounds-en-us-callie.sh +++ b/scripts/ci/sounds-en-us-callie.sh @@ -25,10 +25,7 @@ fi cd $basedir/../freeswitch-sounds/sounds/trunk # perl dist.pl -mv freeswitch-sounds-*48000*.tar.gz $basedir/rpmbuild/SOURCES -mv freeswitch-sounds-*32000*.tar.gz $basedir/rpmbuild/SOURCES -mv freeswitch-sounds-*16000*.tar.gz $basedir/rpmbuild/SOURCES -mv freeswitch-sounds-*8000*.tar.gz $basedir/rpmbuild/SOURCES +mv freeswitch-sounds-en-us-callie-*.tar.gz $basedir/rpmbuild/SOURCES cd $basedir From d0e203a6cd9baa041fd6b5b5fdcdd8dd21304781 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Fri, 12 Sep 2014 02:33:01 +0400 Subject: [PATCH 23/57] fully regenerate these things when ran --- scripts/ci/sounds-en-us-callie.sh | 3 ++- scripts/ci/sounds-music.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/ci/sounds-en-us-callie.sh b/scripts/ci/sounds-en-us-callie.sh index 9b6e898fa4..44ded75091 100755 --- a/scripts/ci/sounds-en-us-callie.sh +++ b/scripts/ci/sounds-en-us-callie.sh @@ -19,11 +19,12 @@ if [ ! -d "$basedir/../freeswitch-sounds" ]; then git clone https://stash.freeswitch.org/scm/fs/freeswitch-sounds.git else cd $basedir/../freeswitch-sounds + git clean -fdx git pull fi cd $basedir/../freeswitch-sounds/sounds/trunk -# perl dist.pl +./dist.pl en/us/callie mv freeswitch-sounds-en-us-callie-*.tar.gz $basedir/rpmbuild/SOURCES diff --git a/scripts/ci/sounds-music.sh b/scripts/ci/sounds-music.sh index 1550182aeb..4fb3e88915 100755 --- a/scripts/ci/sounds-music.sh +++ b/scripts/ci/sounds-music.sh @@ -23,7 +23,7 @@ else fi cd $basedir/../freeswitch-sounds/sounds/trunk - +./dist.pl music mv freeswitch-sounds-music-*.tar.gz $basedir/rpmbuild/SOURCES cd $basedir From 96bd8ebd28366bb9a5245ed3af8a33dc6cca7f77 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Thu, 11 Sep 2014 17:45:17 -0500 Subject: [PATCH 24/57] bump music and en/us/callie sounds files revs --- build/moh_version.txt | 2 +- build/sounds_version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/moh_version.txt b/build/moh_version.txt index 337a6a8f18..3e9c4a61ca 100644 --- a/build/moh_version.txt +++ b/build/moh_version.txt @@ -1 +1 @@ -1.0.8 \ No newline at end of file +1.0.50 diff --git a/build/sounds_version.txt b/build/sounds_version.txt index 68ecec5864..bfd46eaa24 100644 --- a/build/sounds_version.txt +++ b/build/sounds_version.txt @@ -1,4 +1,4 @@ -en-us-callie 1.0.25 +en-us-callie 1.0.50 ru-RU-elena 1.0.13 fr-ca-june 1.0.18 From efe0ebd3184c8d87df7537b5f06813cd51b26b33 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 12 Sep 2014 18:49:58 +0500 Subject: [PATCH 25/57] FS-6818 #resolve --- src/mod/endpoints/mod_verto/mod_verto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index f15f291ad9..5586e55d1e 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3764,7 +3764,7 @@ static int profile_one_loop(verto_profile_t *profile) } if (pfds[x].revents & SWITCH_POLL_READ) { - if (pfds[x].sock == profile->mcast_sub.sock) { + if (profile->mcast_ip && pfds[x].sock == profile->mcast_sub.sock) { handle_mcast_sub(profile); } else { start_jsock(profile, pfds[x].sock); From ef9553abaf69e16544c3adda6352d5062e433bc1 Mon Sep 17 00:00:00 2001 From: Brian West Date: Fri, 12 Sep 2014 08:59:11 -0500 Subject: [PATCH 26/57] fix a few things --- yum/freeswitch-release.spec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yum/freeswitch-release.spec b/yum/freeswitch-release.spec index 5ff6f95dae..b1c995163b 100644 --- a/yum/freeswitch-release.spec +++ b/yum/freeswitch-release.spec @@ -1,7 +1,7 @@ Name: freeswitch-release Version: 1 Release: 0 -Summary: FreeSwitch Packages for Enterprise Linux repository configuration +Summary: FreeSWITCH Packages for Enterprise Linux repository configuration Group: System Environment/Base License: GPL @@ -18,7 +18,7 @@ BuildArch: noarch Requires: redhat-release >= %{version} %description -This package contains the FreeSwitch Yum repository +This package contains the FreeSWITCH Yum repository GPG key as well as configuration for yum. %prep @@ -52,7 +52,7 @@ rm -rf $RPM_BUILD_ROOT %changelog -* Sat Jan 27 2012 Ken Rice - 5-0 +* Fri Jan 27 2012 Ken Rice - 5-0 - Replace GPG key with correct key, and update primary URLs -* Sat Dec 21 2011 Ken Rice - 5-0 +* Wed Dec 21 2011 Ken Rice - 5-0 - Initial Version - Thanks to the EPEL Guys I had something to Rip Off. Hense this package is GPL From 688f2252b05f9de4553103220c6c619b4c3cb82e Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Fri, 12 Sep 2014 19:36:48 +0400 Subject: [PATCH 27/57] update ru/RU sounds for 1.0.50 --- freeswitch-sounds-ru-RU-elena.spec | 44 ++++++++++-------------------- scripts/ci/sounds-ru-ru-elena.sh | 24 ++++++++++------ 2 files changed, 30 insertions(+), 38 deletions(-) diff --git a/freeswitch-sounds-ru-RU-elena.spec b/freeswitch-sounds-ru-RU-elena.spec index 99e913b4d3..6563547f4e 100644 --- a/freeswitch-sounds-ru-RU-elena.spec +++ b/freeswitch-sounds-ru-RU-elena.spec @@ -14,14 +14,14 @@ # Determine distribution ############################################################################## -%define is_rhel5 %(test -f /etc/redhat-release && egrep -q 'release 5' /etc/redhat-release && echo 1 || echo 0) +#%define is_rhel5 %(test -f /etc/redhat-release && egrep -q 'release 5' /etc/redhat-release && echo 1 || echo 0) ############################################################################## # Set variables ############################################################################## -%define version %{VERSION_NUMBER} -%define release %{BUILD_NUMBER} +%define version 1.0.50 +%define release 1 %define fsname freeswitch # you could add a version number to be more strict @@ -76,7 +76,10 @@ Group: Applications/Communications Packager: Michal Bielicki URL: http://www.freeswitch.org Source0:http://files.freeswitch.org/%{name}-48000-%{version}.tar.gz -BuildArch: noarch +Source1:http://files.freeswitch.org/%{name}-32000-%{version}.tar.gz +Source2:http://files.freeswitch.org/%{name}-16000-%{version}.tar.gz +Source3:http://files.freeswitch.org/%{name}-8000-%{version}.tar.gz +BuildA4ch: noarch BuildRequires: sox Requires: freeswitch Requires: freeswitch-sounds-ru-RU-elena-48000 @@ -140,25 +143,11 @@ FreeSWITCH Elena prompts package that pulls in the 8KHz, 16KHz, 32KHz and 48KHz ############################################################################## %prep -%setup -b0 -q -n ru -mkdir -p ./RU/elena -# create buildsounds-elena.sh script in working dir -echo '#!/bin/bash - -sounds_location=$1 -for rate in 32000 16000 8000 -do - for i in ascii base256 conference currency digits directory ivr misc phonetic-ascii time voicemail zrtp users - do - mkdir -p $sounds_location/$i/$rate - for f in `find $sounds_location/$i/48000 -name \*.wav` - do - echo "generating" $sounds_location/$i/$rate/`basename $f` - sox $f -r $rate $sounds_location/$i/$rate/`basename $f` - done - done -done' > ./RU/elena/buildsounds-elena.sh -%{__chmod} 0750 ./RU/elena/buildsounds-elena.sh +%setup -n ru +%setup -T -D -b 0 -n ru +%setup -T -D -b 1 -n ru +%setup -T -D -b 2 -n ru +%setup -T -D -b 3 -n ru ############################################################################## # Build @@ -196,18 +185,12 @@ popd ############################################################################## %post -# generate the 8KHz, 16KHz and 32KHz prompts from the 48KHz ones -cd %{SOUNDSDIR}/ru/RU/elena -./buildsounds-elena.sh %{SOUNDSDIR}/ru/RU/elena ############################################################################## # Postun ############################################################################## %postun -# you could check if there are sound files in 8000/ or -# 16000/ or 32000/ and remove them *only* if the files -# do not belong to an rpm ############################################################################## # Files @@ -215,7 +198,6 @@ cd %{SOUNDSDIR}/ru/RU/elena %files %defattr(-,root,root) -%attr(0750,freeswitch,daemon) %{SOUNDSDIR}/ru/RU/elena/buildsounds-elena.sh %files -n freeswitch-sounds-ru-RU-elena-8000 %defattr(-,root,root,-) @@ -340,6 +322,8 @@ cd %{SOUNDSDIR}/ru/RU/elena ############################################################################## %changelog +* Fri Sep 12 2014 Ken Rice - 1.0.50-1 +- created out of the spec file for elena * Mon Mar 06 2012 Ken Rice - 1.0.13-2 - created out of the spec file for elena * Mon Jul 11 2011 Michal Bielicki - 1.0.13-1 diff --git a/scripts/ci/sounds-ru-ru-elena.sh b/scripts/ci/sounds-ru-ru-elena.sh index 33a4f9d004..ed59dd24fb 100755 --- a/scripts/ci/sounds-ru-ru-elena.sh +++ b/scripts/ci/sounds-ru-ru-elena.sh @@ -1,22 +1,30 @@ #!/bin/sh ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- -src_repo="$(pwd)" +basedir=$(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 -ver="1.0.13" +(mkdir -p rpmbuild && cd rpmbuild && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SPECS) -build="2" +if [ ! -d "$basedir/../freeswitch-sounds" ]; then + cd $basedir/.. + git clone https://stash.freeswitch.org/scm/fs/freeswitch-sounds.git +else + cd $basedir/../freeswitch-sounds + git clean -fdx + git pull +fi -cd rpmbuild/SOURCES +cd $basedir/../freeswitch-sounds/sounds/trunk +./dist.pl ru/RU/elena -wget http://files.freeswitch.org/freeswitch-sounds-ru-RU-elena-48000-$ver.tar.gz +mv freeswitch-sounds-ru-RU-elena-*.tar.gz $basedir/rpmbuild/SOURCES -cd ../.. +cd $basedir rpmbuild --define "VERSION_NUMBER $ver" \ --define "BUILD_NUMBER $build" \ @@ -25,8 +33,8 @@ rpmbuild --define "VERSION_NUMBER $ver" \ --define "_srcrpmdir %{_topdir}" \ -ba freeswitch-sounds-ru-RU-elena.spec -mkdir $src_repo/RPMS -mv $src_repo/rpmbuild/*/*.rpm $src_repo/RPMS/. +mkdir $basedir/RPMS +mv $basedir/rpmbuild/*/*.rpm $basedir/RPMS/. cat 1>&2 < Date: Fri, 12 Sep 2014 19:44:25 +0400 Subject: [PATCH 28/57] typo correction --- freeswitch-sounds-ru-RU-elena.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freeswitch-sounds-ru-RU-elena.spec b/freeswitch-sounds-ru-RU-elena.spec index 6563547f4e..6de99af686 100644 --- a/freeswitch-sounds-ru-RU-elena.spec +++ b/freeswitch-sounds-ru-RU-elena.spec @@ -79,7 +79,7 @@ Source0:http://files.freeswitch.org/%{name}-48000-%{version}.tar.gz Source1:http://files.freeswitch.org/%{name}-32000-%{version}.tar.gz Source2:http://files.freeswitch.org/%{name}-16000-%{version}.tar.gz Source3:http://files.freeswitch.org/%{name}-8000-%{version}.tar.gz -BuildA4ch: noarch +BuildArch: noarch BuildRequires: sox Requires: freeswitch Requires: freeswitch-sounds-ru-RU-elena-48000 From 0aececa578158c8d366648bf3b35883d0cc79fd1 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Fri, 12 Sep 2014 19:54:14 +0400 Subject: [PATCH 29/57] last little tweaks on Elena Sounds --- freeswitch-sounds-ru-RU-elena.spec | 2 -- scripts/ci/sounds-ru-ru-elena.sh | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/freeswitch-sounds-ru-RU-elena.spec b/freeswitch-sounds-ru-RU-elena.spec index 6de99af686..d3dffe197c 100644 --- a/freeswitch-sounds-ru-RU-elena.spec +++ b/freeswitch-sounds-ru-RU-elena.spec @@ -169,8 +169,6 @@ FreeSWITCH Elena prompts package that pulls in the 8KHz, 16KHz, 32KHz and 48KHz pushd RU/elena # first install the 48KHz sounds %{__cp} -prv ./* %{buildroot}%{SOUNDSDIR}/ru/RU/elena -# now resample the 48KHz ones to 8KHz, 16KHz and 32KHz -./buildsounds-elena.sh %{buildroot}%{SOUNDSDIR}/ru/RU/elena popd ############################################################################## diff --git a/scripts/ci/sounds-ru-ru-elena.sh b/scripts/ci/sounds-ru-ru-elena.sh index ed59dd24fb..80682985f9 100755 --- a/scripts/ci/sounds-ru-ru-elena.sh +++ b/scripts/ci/sounds-ru-ru-elena.sh @@ -26,9 +26,7 @@ mv freeswitch-sounds-ru-RU-elena-*.tar.gz $basedir/rpmbuild/SOURCES cd $basedir -rpmbuild --define "VERSION_NUMBER $ver" \ - --define "BUILD_NUMBER $build" \ - --define "_topdir %(pwd)/rpmbuild" \ +rpmbuild --define "_topdir %(pwd)/rpmbuild" \ --define "_rpmdir %{_topdir}" \ --define "_srcrpmdir %{_topdir}" \ -ba freeswitch-sounds-ru-RU-elena.spec From 0b7863a9b7e786d35ddf5babc51ba19f1dfa7a1a Mon Sep 17 00:00:00 2001 From: jchavanton Date: Mon, 21 Jul 2014 05:40:59 -0400 Subject: [PATCH 30/57] [FS-6623] implement RTCP report generation --- src/include/switch_types.h | 26 ++- src/switch_rtp.c | 444 +++++++++++++++++++++++++++++-------- 2 files changed, 373 insertions(+), 97 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index b29a6176fd..07576099e3 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -627,11 +627,27 @@ typedef struct { double mos; } switch_rtp_numbers_t; - typedef struct { - uint32_t packet_count; - uint32_t octet_count; + uint32_t packet_count; /* sent packet count */ + uint32_t octet_count; uint32_t peer_ssrc; + uint32_t last_rpt_ts; /* RTP timestamp at which the last report was generated and sent */ + uint32_t ssrc; /* identifier of the source */ + uint32_t csrc; /* contributing source 0-15 32bit each */ + uint32_t last_pkt_tsdiff; /* Jitter calculation, timestamp difference between the two last received packet */ + double inter_jitter; /* Jitter calculation, Interarrival jitter */ + uint32_t last_rpt_ext_seq; /* Packet loss calculation, extended sequence number at the begining of this RTCP report interval */ + uint16_t last_rpt_cycle; /* Packet loss calculation, sequence number cycle at the begining of the current RTCP report interval */ + uint16_t period_pkt_count; /* Packet loss calculation, packet count received during this RTCP report interval */ + uint16_t pkt_count; /* Packet loss calculation, packet count received during this session */ + uint32_t rtcp_rtp_count; /* RTCP report generated count */ + uint32_t high_ext_seq_recv; /* Packet loss calculation, highest extended sequence number received and processed for stats */ + uint16_t cycle; /* Packet loss calculation, sequence number cycle of the current RTCP report interval */ + uint32_t bad_seq; /* Bad SEQ found, used to detect reset on the other side */ + uint16_t base_seq; /* Packet loss calculation, first sequence number received */ + uint32_t cum_lost; /* Packet loss calculation, cumulative number of packet lost */ + uint32_t last_recv_lsr_local; /* RTT calculation, When receiving an SR we save our local timestamp in fraction of 65536 seconds */ + uint32_t last_recv_lsr_peer; /* RTT calculation, When receiving an SR we extract the middle 32bits of the remote NTP timestamp to include it in the next SR LSR */ } switch_rtcp_numbers_t; typedef struct { @@ -884,7 +900,7 @@ typedef struct { #endif #if SWITCH_BYTE_ORDER == __BIG_ENDIAN -typedef struct { +typedef struct switch_rtcp_hdr_s { unsigned version:2; /* protocol version */ unsigned p:1; /* padding flag */ unsigned count:5; /* number of reception report blocks */ @@ -894,7 +910,7 @@ typedef struct { #else /* BIG_ENDIAN */ -typedef struct { +typedef struct switch_rtcp_hdr_s { unsigned count:5; /* number of reception report blocks */ unsigned p:1; /* padding flag */ unsigned version:2; /* protocol version */ diff --git a/src/switch_rtp.c b/src/switch_rtp.c index eb9e7de49c..bc3dbfd4f3 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -34,6 +34,8 @@ //#define RTP_DEBUG_WRITE_DELTA //#define DEBUG_MISSED_SEQ //#define DEBUG_EXTRA +#define DEBUG_RTCP + #include #ifndef _MSC_VER #include @@ -68,6 +70,7 @@ #define RTP_MAGIC_NUMBER 42 #define WARN_SRTP_ERRS 10 #define MAX_SRTP_ERRS 100 +#define NTP_TIME_OFFSET 2208988800UL #define DTMF_SANITY (rtp_session->one_second * 30) @@ -353,6 +356,7 @@ struct switch_rtp { uint32_t samples_per_interval; uint32_t samples_per_second; uint32_t conf_samples_per_interval; + uint16_t rtcp_send_rate; uint32_t rsamples_per_interval; uint32_t ms_per_packet; uint32_t one_second; @@ -473,14 +477,36 @@ struct switch_rtcp_s_desc_trunk { char text[1]; }; -/* This is limited to a single block with force description. Not to be used as reference of the rtcp packet*/ -struct switch_rtcp_senderinfo { - struct switch_rtcp_sr_head sr_head; - struct switch_rtcp_report_block sr_block; - struct switch_rtcp_s_desc_head sr_desc_head; - struct switch_rtcp_s_desc_trunk sr_desc_ssrc; +struct switch_rtcp_sender_info { + unsigned ntp_msw:32; + unsigned ntp_lsw:32; + unsigned ts:32; + unsigned pc:32; + unsigned oc:32; }; +struct switch_rtcp_sender_report { + unsigned ssrc:32; + struct switch_rtcp_sender_info sender_info; + struct switch_rtcp_report_block report_block; + struct switch_rtcp_s_desc_head sr_desc_head; + struct switch_rtcp_s_desc_trunk sr_desc_ssrc; +}; + +struct switch_rtcp_receiver_report { + unsigned ssrc:32; + struct switch_rtcp_report_block report_block; + struct switch_rtcp_s_desc_head sr_desc_head; + struct switch_rtcp_s_desc_trunk sr_desc_ssrc; +}; +/* This is limited to a single block with force description. Not to be used as reference of the rtcp packet*/ +//struct switch_rtcp_senderinfo { +// struct switch_rtcp_sr_head sr_head; +// struct switch_rtcp_report_block sr_block; +// struct switch_rtcp_s_desc_head sr_desc_head; +// struct switch_rtcp_s_desc_trunk sr_desc_ssrc; +//}; + typedef enum { RESULT_CONTINUE, RESULT_GOTO_END, @@ -1816,6 +1842,198 @@ static void check_jitter(switch_rtp_t *rtp_session) } } +static void rtcp_generate_sender_info(switch_rtp_t *rtp_session, struct switch_rtcp_sender_info *sr){ +#ifdef DEBUG_RTCP + switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); +#endif + switch_time_t now; + uint32_t sec, ntp_sec, ntp_usec; + switch_time_exp_t now_hr; + now = switch_time_now(); + sec = now/1000000; /* convert to seconds */ + ntp_sec = sec+NTP_TIME_OFFSET; /* convert to NTP seconds */ + sr->ntp_msw = htonl(ntp_sec); /* store result in "most significant word" */ + ntp_usec = now - (sec*1000000); /* remove seconds to keep only the microseconds */ + sr->ntp_lsw = htonl(ntp_usec*(double)(((uint64_t)1)<<32)*1.0e-6); /* convert microseconds to fraction of 32bits and store result in "least significatn word" */ + + sr->ts = htonl(rtp_session->last_write_ts); + sr->pc = htonl(rtp_session->stats.outbound.packet_count); + sr->oc = htonl((rtp_session->stats.outbound.raw_bytes - rtp_session->stats.outbound.packet_count * sizeof(srtp_hdr_t))); + +#ifdef DEBUG_RTCP + switch_time_exp_gmt(&now_hr,now); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"Sending an RTCP packet[%04d-%02d-%02d %02d:%02d:%02d.%d] lsr[%u] msw[%u] lsw[%u] fs_ssrc[%u]\n", + 1900 + now_hr.tm_year, now_hr.tm_mday, now_hr.tm_mon, now_hr.tm_hour, now_hr.tm_min, now_hr.tm_sec, now_hr.tm_usec, + (ntohl(sr->ntp_lsw)&0xffff0000)>>16 | (ntohl(sr->ntp_msw)&0x0000ffff)<<16, + ntohl(sr->ntp_msw),ntohl(sr->ntp_lsw), rtp_session->ssrc + ); +#endif +} + + +static void rtcp_generate_report_block(switch_rtp_t *rtp_session, struct switch_rtcp_report_block *rtcp_report_block){ +#ifdef DEBUG_RTCP + switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); +#endif + switch_rtcp_numbers_t * stats=&rtp_session->stats.rtcp; + switch_time_t now; + uint32_t expected_pkt, dlsr; + int32_t pkt_lost; + uint32_t ntp_sec, ntp_usec, lsr_now, sec; + now = switch_time_now(); + sec = now/1000000; /* convert to seconds */ + ntp_sec = sec+NTP_TIME_OFFSET; /* convert to NTP seconds */ + ntp_usec = now - (sec*1000000); /* remove seconds to keep only the microseconds */ + + /* Packet loss */ + if(stats->rtcp_rtp_count == 0){ + expected_pkt = stats->high_ext_seq_recv - stats->base_seq + 1; + } + else{ + expected_pkt = stats->high_ext_seq_recv - stats->last_rpt_ext_seq; + } + + pkt_lost = expected_pkt - stats->period_pkt_count; + stats->cum_lost=stats->cum_lost+pkt_lost; + if(expected_pkt > 0 && pkt_lost > 0) + rtcp_report_block->fraction = (uint8_t) (pkt_lost * 256 / expected_pkt); + else + rtcp_report_block->fraction = 0; + +#if SWITCH_BYTE_ORDER != __BIG_ENDIAN + /* Reversing byte order for 24bits */ + rtcp_report_block->lost = (((stats->cum_lost&0x0000FF)<<16) | ((stats->cum_lost&0x00FF00)) | ((stats->cum_lost&0xFF0000)>>16)); +#endif + +#ifdef DEBUG_RTCP + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_generate_sr: stats_ssrc[%d] received[%d] expected[%d] cum[%d]lost[%d|%d/256]pkt last_seq[%d]cyc[%d] last_rpt_seq[%d]cyc[%d] ssrc[%d]\n", + ntohl((uint32_t)rtp_session->recv_msg.header.ssrc), stats->period_pkt_count, expected_pkt, + stats->cum_lost, pkt_lost, rtcp_report_block->fraction, stats->high_ext_seq_recv&0x0000ffff, + stats->cycle, stats->last_rpt_ext_seq&0x0000ffff, stats->last_rpt_cycle, rtp_session->stats.rtcp.peer_ssrc + ); +#endif + rtcp_report_block->highest_sequence_number_received = stats->high_ext_seq_recv; + + /* Jitter */ + rtcp_report_block->jitter = htonl((uint32_t)stats->inter_jitter); + + /* Delay since Last Sender Report (DLSR) : 32bits, 1/65536 seconds */ + lsr_now = (uint32_t)(ntp_usec*0.065536) | (ntp_sec&0x0000ffff)<<16; /* 0.065536 is used for convertion from useconds to fraction of 65536 (x65536/1000000) */ + + if(stats->last_recv_lsr_local){ + dlsr = lsr_now - stats->last_recv_lsr_local; + } + else{ + dlsr = 0; + } + rtcp_report_block->lsr = stats->last_recv_lsr_peer; + rtcp_report_block->dlsr = htonl(dlsr); + rtcp_report_block->ssrc = htonl(rtp_session->stats.rtcp.peer_ssrc); + stats->rtcp_rtp_count++; +} + +static void rtcp_stats_init(switch_rtp_t *rtp_session) +{ + switch_rtcp_numbers_t * stats=&rtp_session->stats.rtcp; + srtp_hdr_t * hdr = &rtp_session->recv_msg.header; + switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); + stats->ssrc=ntohl(hdr->ssrc); + stats->last_rpt_ts=rtp_session->timer.samplecount; + stats->last_rpt_ext_seq=0; + stats->last_rpt_cycle=0; + stats->last_pkt_tsdiff=0; + stats->inter_jitter=0; + stats->cycle=0; + stats->high_ext_seq_recv=ntohs((uint16_t)hdr->seq); + stats->base_seq=ntohs((uint16_t)hdr->seq); + stats->bad_seq = (1<<16) + 1; /* Make sure we wont missmatch 2 consecutive packets, so seq == bad_seq is false */ + stats->cum_lost=0; + stats->period_pkt_count=0; + stats->pkt_count=0; + stats->rtcp_rtp_count=0; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats_init: ssrc[%d] base_seq[%d]", stats->ssrc, stats->base_seq); + if(!rtp_session->rtcp_sock_output) + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats_init: no rtcp socket"); + if(!rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats_init: rtcp disabled"); + if(rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]) + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats_init: rtcp passthru"); +} + +static int rtcp_stats(switch_rtp_t *rtp_session) +{ + switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); + srtp_hdr_t * hdr = &rtp_session->recv_msg.header; + switch_rtcp_numbers_t * stats=&rtp_session->stats.rtcp; + uint32_t packet_spacing_diff, pkt_tsdiff, pkt_extended_seq; + uint16_t pkt_seq, seq_diff, max_seq; + const int MAX_DROPOUT = 3000; + const int MAX_MISORDER = 100; + const int RTP_SEQ_MOD = (1<<16); + + if(!rtp_session->rtcp_sock_output || !rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] || rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU] || !rtp_session->rtcp_interval) + return 0; // do not process RTCP in current state + + pkt_seq = (uint16_t) ntohs((uint16_t) rtp_session->recv_msg.header.seq); + + /* Detect sequence number cycle change */ + max_seq = stats->high_ext_seq_recv&0x0000ffff; + seq_diff = pkt_seq - max_seq; + + if(seq_diff < MAX_DROPOUT){ /* in order, with permissible gap */ + if(pkt_seq < max_seq){ + stats->cycle++; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats:[cycle change] pkt_seq[%d]cycle[%d] max_seq[%d] stats_ssrc[%d] local_ts[%u]\n", + pkt_seq, stats->cycle, max_seq, stats->ssrc, rtp_session->timer.samplecount); + } + pkt_extended_seq = stats->cycle << 16 | pkt_seq; /* getting the extended packet extended sequence ID */ + if(pkt_extended_seq > stats->high_ext_seq_recv) + stats->high_ext_seq_recv = pkt_extended_seq; + } + else if(seq_diff <= (RTP_SEQ_MOD - MAX_MISORDER)){ /* the sequence number made a very large jump */ + if(pkt_seq == stats->bad_seq){ + rtcp_stats_init(rtp_session); + } + else{ + stats->bad_seq = (pkt_seq + 1) & (RTP_SEQ_MOD-1); + } + return 0; /* no stats, packet is out of sync and will be accounted as lost */ + } + else { + /* duplicate or reordered packet */ + } + + /* Verify that we are on the same stream source (we do not support multiple sources) */ + if(ntohl(hdr->ssrc) != stats->ssrc || !stats->last_rpt_ts){ + rtcp_stats_init(rtp_session); + } + + stats->period_pkt_count++; + stats->pkt_count++; +#ifdef DEBUG_RTCP + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "rtcp_stats: period_pkt_count[%d]last_seq[%d]cycle[%d]stats_ssrc[%d]local_ts[%u]\n", + stats->period_pkt_count, pkt_seq, stats->cycle, stats->ssrc, rtp_session->timer.samplecount); +#endif + /* Interarrival jitter calculation */ + pkt_tsdiff = rtp_session->timer.samplecount - ntohl(hdr->ts) ; /* relative transit times for this packet */ + if(stats->pkt_count < 2){ /* Can not compute Jitter with only one packet */ + stats->last_pkt_tsdiff = pkt_tsdiff; + } + else{ + packet_spacing_diff = pkt_tsdiff - stats->last_pkt_tsdiff; /* Jitter : difference of relative transit times for the two packets */ + stats->last_pkt_tsdiff = pkt_tsdiff; + /* Interarrival jitter estimation, "J(i) = J(i-1) + ( |D(i-1,i)| - J(i-1) )/16" */ + stats->inter_jitter = (stats->inter_jitter + (((double)abs(packet_spacing_diff) - stats->inter_jitter) /16.)); + } + +#ifdef DEBUG_RTCP + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "rtcp_stats: pkt_ts[%d]local_ts[%d]diff[%d]pkt_spacing[%d]inter_jitter[%f]seq[%d]stats_ssrc[%d]", + ntohl(hdr->ts), rtp_session->timer.samplecount, pkt_tsdiff, packet_spacing_diff, stats->inter_jitter, ntohs(hdr->seq), stats->ssrc); +#endif + return 1; +} + + static int check_rtcp_and_ice(switch_rtp_t *rtp_session) { int ret = 0; @@ -1865,58 +2083,59 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) rtcp_ok = 0; } - if (rtp_session->rtcp_sock_output && rtcp_ok && rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] && !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]) { - struct switch_rtcp_senderinfo *sr = (struct switch_rtcp_senderinfo*) rtp_session->rtcp_send_msg.body; - //rtp_msg_t *send_msg = &rtp_session->send_msg; - switch_size_t rtcp_bytes; - switch_byte_t *ptr = (switch_byte_t *)rtp_session->rtcp_send_msg.body; - switch_time_t when = 0; + if (rtp_session->rtcp_sock_output && rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] && + !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU] && + (rtp_session->timer.samplecount - rtp_session->stats.rtcp.last_rpt_ts >= rtp_session->samples_per_second * rtp_session->rtcp_send_rate) ) { + + switch_rtcp_numbers_t * stats=&rtp_session->stats.rtcp; + struct switch_rtcp_receiver_report *rr; + struct switch_rtcp_sender_report *sr; + struct switch_rtcp_report_block *rtcp_report_block; + + switch_size_t rtcp_bytes = sizeof(struct switch_rtcp_hdr_s)+sizeof(uint32_t); /* add size of the packet header and the ssrc */ rtp_session->rtcp_send_msg.header.version = 2; rtp_session->rtcp_send_msg.header.p = 0; rtp_session->rtcp_send_msg.header.count = 1; - sr->sr_head.ssrc = htonl(rtp_session->ssrc); - - if (!rtp_session->stats.inbound.period_packet_count) { - rtp_session->rtcp_send_msg.header.type = 201; - rtcp_bytes = sizeof(switch_rtcp_hdr_t) + 4; - ptr += 4; - } else { - switch_time_t when; - rtp_session->rtcp_send_msg.header.type = 200; - - if (rtp_session->send_time) { - when = rtp_session->send_time; - } else { - when = switch_micro_time_now(); - } - - sr->sr_head.ntp_msw = htonl((u_long)(when / 1000000 + 2208988800UL)); - /* - sr->ntp_lsw = htonl((u_long)(when % 1000000 * ((UINT_MAX * 1.0)/ 1000000.0))); - */ - sr->sr_head.ntp_lsw = htonl((u_long)(rtp_session->send_time % 1000000 * 4294.967296)); - sr->sr_head.ts = htonl(rtp_session->last_write_ts); - sr->sr_head.pc = htonl(rtp_session->stats.outbound.packet_count); - sr->sr_head.oc = htonl((rtp_session->stats.outbound.raw_bytes - rtp_session->stats.outbound.packet_count * sizeof(srtp_hdr_t))); - + if (!rtp_session->stats.outbound.packet_count) { + rtp_session->rtcp_send_msg.header.type = 201; /* Receiver report */ + rr=(struct switch_rtcp_receiver_report*) rtp_session->rtcp_send_msg.body; + rr->ssrc = htonl(rtp_session->ssrc); + rtcp_report_block = &rr->report_block; + rtcp_bytes+=sizeof(struct switch_rtcp_report_block); } + else { + struct switch_rtcp_sender_info *rtcp_sender_info; + rtp_session->rtcp_send_msg.header.type = 200; /* Sender report */ + sr=(struct switch_rtcp_sender_report*) rtp_session->rtcp_send_msg.body; + sr->ssrc = htonl(rtp_session->ssrc); + rtcp_sender_info = &sr->sender_info; + rtcp_generate_sender_info(rtp_session, rtcp_sender_info); + rtcp_report_block = &sr->report_block; + rtcp_bytes+=sizeof(struct switch_rtcp_sender_info) + sizeof(struct switch_rtcp_report_block); + } + rtcp_generate_report_block(rtp_session, rtcp_report_block); - /* TBD need to put more accurate stats here. */ + rtp_session->rtcp_send_msg.header.length = htons((uint16_t)(rtcp_bytes / 4) - 1); - sr->sr_block.ssrc = htonl(rtp_session->stats.rtcp.peer_ssrc); - sr->sr_block.fraction = 0; - sr->sr_block.lost = htonl(rtp_session->stats.inbound.skip_packet_count); - sr->sr_block.highest_sequence_number_received = htonl(rtp_session->recv_msg.header.seq); - sr->sr_block.jitter = htonl(0); - sr->sr_block.lsr = htonl(0); - sr->sr_block.dlsr = htonl(0); + /* Prepare next report */ + stats->last_rpt_cycle=stats->cycle; + stats->last_rpt_ext_seq=stats->high_ext_seq_recv; + stats->last_rpt_ts=rtp_session->timer.samplecount; + stats->period_pkt_count=0; - sr->sr_desc_head.v = 0x02; - sr->sr_desc_head.padding = 0; - sr->sr_desc_head.sc = 1; - sr->sr_desc_head.pt = 202; + rtp_session->rtcp_send_msg.header.length = htons((u_short)(rtcp_bytes / 4) - 1); + +/* ToBeDone : there was some issue with this report block so I commented the following lines of code to fix it please see + * RFC3550 section 6.5 SDES: Source Description RTCP Packet + * I guess it could be made optionnal, I do not see much value in incresing the size of the RTCP report */ +/* + rtcp_header->v = 0x02; + rtcp_header->padding = 0; + rtcp_header->sc = 1; + rtcp_header->pt = 202; + rtcp_header->length = htons(5); sr->sr_desc_ssrc.ssrc = htonl(rtp_session->ssrc); sr->sr_desc_ssrc.cname = 0x1; @@ -1927,8 +2146,8 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting RTCP src-1 to %s\n", str_cname); sr->sr_desc_ssrc.length = (unsigned int)strlen(str_cname); memcpy ((char*)sr->sr_desc_ssrc.text, str_cname, strlen(str_cname)); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting RTCP src-1 LENGTH to %d (%d, %s)\n", - sr->sr_desc_ssrc.length, sr->sr_desc_head.length, str_cname); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting RTCP src-1 LENGTH to %d (%d, %s)\n", + sr->sr_desc_ssrc.length, sr->header.length, str_cname); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting msw = %d, lsw = %d \n", sr->sr_head.ntp_msw, sr->sr_head.ntp_lsw); @@ -1944,7 +2163,9 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) rtcp_bytes = sr_length + sr_desc_length; } - +*/ + + #ifdef ENABLE_SRTP if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND]) { @@ -3734,6 +3955,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_sessi switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "RTCP send rate is: %d and packet rate is: %d Remote Port: %d\n", send_rate, rtp_session->ms_per_packet, rtp_session->remote_rtcp_port); rtp_session->rtcp_interval = send_rate; + rtp_session->rtcp_send_rate = send_rate/1000; rtp_session->next_rtcp_send = switch_time_now() + (rtp_session->rtcp_interval * 1000); } @@ -4773,6 +4995,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t } rtp_session->stats.inbound.packet_count++; + rtcp_stats(rtp_session); if (!rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && !rtp_session->flags[SWITCH_RTP_FLAG_UDPTL]) { @@ -4942,39 +5165,75 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t static switch_status_t process_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t *bytes) { switch_status_t status = SWITCH_STATUS_FALSE; + switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Received an RTCP packet of length %" SWITCH_SIZE_T_FMT " bytes\n", *bytes); + if (rtp_session->rtcp_recv_msg.header.version == 2) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"RTCP packet type is %d\n", rtp_session->rtcp_recv_msg.header.type); + + if (rtp_session->rtcp_recv_msg.header.type == 200 || rtp_session->rtcp_recv_msg.header.type == 201) { + struct switch_rtcp_report_block *report_block; + switch_time_t now; + switch_time_exp_t now_hr; + uint32_t sec, ntp_sec, ntp_usec, lsr_now; + uint32_t lsr; + uint32_t packet_ssrc; + now = switch_time_now(); /* number of microseconds since 00:00:00 january 1, 1970 UTC */ + sec = now/1000000; /* converted to second (NTP most significant bits) */ + ntp_sec = sec+NTP_TIME_OFFSET; /* 32bits most significant */ + ntp_usec = now - (sec*1000000); /* micro seconds */ + lsr_now = (uint32_t)(ntp_usec*0.065536) | (ntp_sec&0x0000ffff)<<16; // 0.065536 is used for convertion from useconds + + if (rtp_session->rtcp_recv_msg.header.type == 200){ /* Sender report */ + struct switch_rtcp_sender_report* sr = (struct switch_rtcp_sender_report*)rtp_session->rtcp_recv_msg.body; + report_block = &sr->report_block; + rtp_session->stats.rtcp.packet_count += ntohl(sr->sender_info.pc); + rtp_session->stats.rtcp.octet_count += ntohl(sr->sender_info.oc); + packet_ssrc = sr->ssrc; + /* Extracting LSR from NTP timestamp and save it */ + lsr = (ntohl(sr->sender_info.ntp_lsw)&0xffff0000)>>16 | (ntohl(sr->sender_info.ntp_msw)&0x0000ffff)<<16; /* The middle 32 bits out of 64 in the NTP timestamp */ + rtp_session->stats.rtcp.last_recv_lsr_peer = htonl(lsr); /* Save it include it in the next SR */ + rtp_session->stats.rtcp.last_recv_lsr_local = lsr_now; /* Save it to calculate DLSR when generating next SR */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Received a SR with %d report blocks, " \ + "length in words = %d, " \ + "SSRC = 0x%X, " \ + "NTP MSW = %u, " \ + "NTP LSW = %u, " \ + "RTP timestamp = %u, " \ + "Sender Packet Count = %u, " \ + "Sender Octet Count = %u\n", + rtp_session->rtcp_recv_msg.header.count, + ntohs((uint16_t)rtp_session->rtcp_recv_msg.header.length), + ntohl(sr->ssrc), + ntohl(sr->sender_info.ntp_msw), + ntohl(sr->sender_info.ntp_lsw), + ntohl(sr->sender_info.ts), + ntohl(sr->sender_info.pc), + ntohl(sr->sender_info.oc)); + } + else{ /* Receiver report */ + struct switch_rtcp_receiver_report* rr = (struct switch_rtcp_receiver_report*)rtp_session->rtcp_recv_msg.body; + report_block = &rr->report_block; + packet_ssrc = rr->ssrc; + } + + /* Currently in passthru mode RTT will not be accurate, some work as to be done (something like mapping the NTP timestamp with a local one) to have RTT from both legs */ + if(report_block->lsr && !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]){ + switch_time_exp_gmt(&now_hr,now); + /* Calculating RTT = A - DLSR - LSR */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, + "Receiving an RTCP packet[%04d-%02d-%02d %02d:%02d:%02d.%d] SSRC[%u]" + "RTT[%f] A[%u] - DLSR[%u] - LSR[%u]\n", + 1900 + now_hr.tm_year, now_hr.tm_mday, now_hr.tm_mon, now_hr.tm_hour, now_hr.tm_min, now_hr.tm_sec, now_hr.tm_usec, + ntohl(packet_ssrc), (double)(lsr_now - ntohl(report_block->dlsr) - ntohl(report_block->lsr))/65536, + lsr_now, ntohl(report_block->dlsr), ntohl(report_block->lsr)); + } - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10,"Received an RTCP packet of length %" SWITCH_SIZE_T_FMT " bytes\n", *bytes); - if (rtp_session->rtcp_recv_msg_p->header.version == 2) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10,"RTCP packet type is %d\n", rtp_session->rtcp_recv_msg_p->header.type); - if (rtp_session->rtcp_recv_msg_p->header.type == 200) { - struct switch_rtcp_senderinfo* sr = (struct switch_rtcp_senderinfo*)rtp_session->rtcp_recv_msg_p->body; - rtp_session->rtcp_fresh_frame = 1; - - rtp_session->stats.rtcp.packet_count += ntohl(sr->sr_head.pc); - rtp_session->stats.rtcp.octet_count += ntohl(sr->sr_head.oc); - rtp_session->stats.rtcp.peer_ssrc = ntohl(sr->sr_head.ssrc); - - /* sender report */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10,"Received a SR with %d report blocks, " \ - "length in words = %d, " \ - "SSRC = 0x%X, " \ - "NTP MSW = %u, " \ - "NTP LSW = %u, " \ - "RTP timestamp = %u, " \ - "Sender Packet Count = %u, " \ - "Sender Octet Count = %u\n", - rtp_session->rtcp_recv_msg_p->header.count, - ntohs((uint16_t)rtp_session->rtcp_recv_msg_p->header.length), - ntohl(sr->sr_head.ssrc), - ntohl(sr->sr_head.ntp_msw), - ntohl(sr->sr_head.ntp_lsw), - ntohl(sr->sr_head.ts), - ntohl(sr->sr_head.pc), - ntohl(sr->sr_head.oc)); + rtp_session->stats.rtcp.peer_ssrc = ntohl(packet_ssrc); + status = SWITCH_STATUS_SUCCESS; } - } else { + } + else { if (rtp_session->rtcp_recv_msg_p->header.version != 2) { if (rtp_session->rtcp_recv_msg_p->header.version == 0) { if (rtp_session->ice.ice_user) { @@ -4982,8 +5241,8 @@ static switch_status_t process_rtcp_packet(switch_rtp_t *rtp_session, switch_siz } } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), - SWITCH_LOG_DEBUG, "Received an unsupported RTCP packet version %d\nn", rtp_session->rtcp_recv_msg_p->header.version); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), + SWITCH_LOG_NOTICE, "Received an unsupported RTCP packet version %d\nn", rtp_session->rtcp_recv_msg_p->header.version); } } @@ -5958,19 +6217,20 @@ SWITCH_DECLARE(switch_status_t) switch_rtcp_zerocopy_read_frame(switch_rtp_t *rt /* A fresh frame has been found! */ if (rtp_session->rtcp_fresh_frame) { - struct switch_rtcp_senderinfo* sr = (struct switch_rtcp_senderinfo*)rtp_session->rtcp_recv_msg_p->body; + // struct switch_rtcp_senderinfo* sr = (struct switch_rtcp_senderinfo*)rtp_session->rtcp_recv_msg_p->body; + struct switch_rtcp_sender_report* sr = (struct switch_rtcp_sender_report*)rtp_session->rtcp_recv_msg.body; int i = 0; /* turn the flag off! */ rtp_session->rtcp_fresh_frame = 0; - frame->ssrc = ntohl(sr->sr_head.ssrc); - frame->packet_type = (uint16_t)rtp_session->rtcp_recv_msg_p->header.type; - frame->ntp_msw = ntohl(sr->sr_head.ntp_msw); - frame->ntp_lsw = ntohl(sr->sr_head.ntp_lsw); - frame->timestamp = ntohl(sr->sr_head.ts); - frame->packet_count = ntohl(sr->sr_head.pc); - frame->octect_count = ntohl(sr->sr_head.oc); + frame->ssrc = ntohl(sr->ssrc); + frame->packet_type = (uint16_t)rtp_session->rtcp_recv_msg.header.type; + frame->ntp_msw = ntohl(sr->sender_info.ntp_msw); + frame->ntp_lsw = ntohl(sr->sender_info.ntp_lsw); + frame->timestamp = ntohl(sr->sender_info.ts); + frame->packet_count = ntohl(sr->sender_info.pc); + frame->octect_count = ntohl(sr->sender_info.oc); for (i = 0; i < (int)rtp_session->rtcp_recv_msg_p->header.count && i < MAX_REPORT_BLOCKS ; i++) { struct switch_rtcp_report_block* report = (struct switch_rtcp_report_block*) (rtp_session->rtcp_recv_msg_p->body + (sizeof(struct switch_rtcp_sr_head) + (i * sizeof(struct switch_rtcp_report_block)))); From ea973b0b4cde8ecf562252d6d22faad583e30846 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 5 Sep 2014 13:51:50 +0000 Subject: [PATCH 31/57] logging correction --- src/switch_rtp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index bc3dbfd4f3..03b8ddbd2f 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1862,10 +1862,10 @@ static void rtcp_generate_sender_info(switch_rtp_t *rtp_session, struct switch_r #ifdef DEBUG_RTCP switch_time_exp_gmt(&now_hr,now); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"Sending an RTCP packet[%04d-%02d-%02d %02d:%02d:%02d.%d] lsr[%u] msw[%u] lsw[%u] fs_ssrc[%u]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"Sending an RTCP packet[%04d-%02d-%02d %02d:%02d:%02d.%d] lsr[%u] msw[%u] lsw[%u] stats_ssrc[%u]\n", 1900 + now_hr.tm_year, now_hr.tm_mday, now_hr.tm_mon, now_hr.tm_hour, now_hr.tm_min, now_hr.tm_sec, now_hr.tm_usec, (ntohl(sr->ntp_lsw)&0xffff0000)>>16 | (ntohl(sr->ntp_msw)&0x0000ffff)<<16, - ntohl(sr->ntp_msw),ntohl(sr->ntp_lsw), rtp_session->ssrc + ntohl(sr->ntp_msw),ntohl(sr->ntp_lsw), rtp_session->stats.rtcp.ssrc ); #endif } @@ -1906,8 +1906,8 @@ static void rtcp_generate_report_block(switch_rtp_t *rtp_session, struct switch_ #endif #ifdef DEBUG_RTCP - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_generate_sr: stats_ssrc[%d] received[%d] expected[%d] cum[%d]lost[%d|%d/256]pkt last_seq[%d]cyc[%d] last_rpt_seq[%d]cyc[%d] ssrc[%d]\n", - ntohl((uint32_t)rtp_session->recv_msg.header.ssrc), stats->period_pkt_count, expected_pkt, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_generate_sr: stats_ssrc[%u] received[%d] expected[%d] cum[%d]lost[%d|%d/256]pkt last_seq[%d]cyc[%d] last_rpt_seq[%d]cyc[%d] ssrc[%d]\n", + ntohl(rtp_session->recv_msg.header.ssrc), stats->period_pkt_count, expected_pkt, stats->cum_lost, pkt_lost, rtcp_report_block->fraction, stats->high_ext_seq_recv&0x0000ffff, stats->cycle, stats->last_rpt_ext_seq&0x0000ffff, stats->last_rpt_cycle, rtp_session->stats.rtcp.peer_ssrc ); @@ -1983,7 +1983,7 @@ static int rtcp_stats(switch_rtp_t *rtp_session) if(seq_diff < MAX_DROPOUT){ /* in order, with permissible gap */ if(pkt_seq < max_seq){ stats->cycle++; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats:[cycle change] pkt_seq[%d]cycle[%d] max_seq[%d] stats_ssrc[%d] local_ts[%u]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats:[cycle change] pkt_seq[%d]cycle[%d] max_seq[%d] stats_ssrc[%u] local_ts[%u]\n", pkt_seq, stats->cycle, max_seq, stats->ssrc, rtp_session->timer.samplecount); } pkt_extended_seq = stats->cycle << 16 | pkt_seq; /* getting the extended packet extended sequence ID */ @@ -2011,7 +2011,7 @@ static int rtcp_stats(switch_rtp_t *rtp_session) stats->period_pkt_count++; stats->pkt_count++; #ifdef DEBUG_RTCP - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "rtcp_stats: period_pkt_count[%d]last_seq[%d]cycle[%d]stats_ssrc[%d]local_ts[%u]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "rtcp_stats: period_pkt_count[%d]last_seq[%d]cycle[%d]stats_ssrc[%u]local_ts[%u]\n", stats->period_pkt_count, pkt_seq, stats->cycle, stats->ssrc, rtp_session->timer.samplecount); #endif /* Interarrival jitter calculation */ From 50c62cdfd7a9ddee22e9e779c0a8c4dfba23f717 Mon Sep 17 00:00:00 2001 From: jchavanton Date: Mon, 8 Sep 2014 15:29:06 +0200 Subject: [PATCH 32/57] missing host to network conversion highest_sequence_number_received --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 03b8ddbd2f..370c951913 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1912,7 +1912,7 @@ static void rtcp_generate_report_block(switch_rtp_t *rtp_session, struct switch_ stats->cycle, stats->last_rpt_ext_seq&0x0000ffff, stats->last_rpt_cycle, rtp_session->stats.rtcp.peer_ssrc ); #endif - rtcp_report_block->highest_sequence_number_received = stats->high_ext_seq_recv; + rtcp_report_block->highest_sequence_number_received = htonl(stats->high_ext_seq_recv); /* Jitter */ rtcp_report_block->jitter = htonl((uint32_t)stats->inter_jitter); From 764faad671902d734bb18ca9f87798f0670396eb Mon Sep 17 00:00:00 2001 From: jchavanton Date: Wed, 10 Sep 2014 12:36:38 +0200 Subject: [PATCH 33/57] logging adjustment --- src/switch_rtp.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 370c951913..153d9239a5 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -34,7 +34,7 @@ //#define RTP_DEBUG_WRITE_DELTA //#define DEBUG_MISSED_SEQ //#define DEBUG_EXTRA -#define DEBUG_RTCP +//#define DEBUG_RTCP #include #ifndef _MSC_VER @@ -1843,9 +1843,7 @@ static void check_jitter(switch_rtp_t *rtp_session) } static void rtcp_generate_sender_info(switch_rtp_t *rtp_session, struct switch_rtcp_sender_info *sr){ -#ifdef DEBUG_RTCP switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); -#endif switch_time_t now; uint32_t sec, ntp_sec, ntp_usec; switch_time_exp_t now_hr; @@ -1860,14 +1858,12 @@ static void rtcp_generate_sender_info(switch_rtp_t *rtp_session, struct switch_r sr->pc = htonl(rtp_session->stats.outbound.packet_count); sr->oc = htonl((rtp_session->stats.outbound.raw_bytes - rtp_session->stats.outbound.packet_count * sizeof(srtp_hdr_t))); -#ifdef DEBUG_RTCP switch_time_exp_gmt(&now_hr,now); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"Sending an RTCP packet[%04d-%02d-%02d %02d:%02d:%02d.%d] lsr[%u] msw[%u] lsw[%u] stats_ssrc[%u]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Sending an RTCP packet[%04d-%02d-%02d %02d:%02d:%02d.%d] lsr[%u] msw[%u] lsw[%u] stats_ssrc[%u]\n", 1900 + now_hr.tm_year, now_hr.tm_mday, now_hr.tm_mon, now_hr.tm_hour, now_hr.tm_min, now_hr.tm_sec, now_hr.tm_usec, (ntohl(sr->ntp_lsw)&0xffff0000)>>16 | (ntohl(sr->ntp_msw)&0x0000ffff)<<16, ntohl(sr->ntp_msw),ntohl(sr->ntp_lsw), rtp_session->stats.rtcp.ssrc ); -#endif } From 0e89bbd0333c027273e4165af850bc304861dbdc Mon Sep 17 00:00:00 2001 From: jchavanton Date: Wed, 10 Sep 2014 14:53:43 +0200 Subject: [PATCH 34/57] more formatting and logging tuning --- src/switch_rtp.c | 141 ++++++++++++++++++++++------------------------- 1 file changed, 65 insertions(+), 76 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 153d9239a5..23cebb0e1b 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -499,13 +499,6 @@ struct switch_rtcp_receiver_report { struct switch_rtcp_s_desc_head sr_desc_head; struct switch_rtcp_s_desc_trunk sr_desc_ssrc; }; -/* This is limited to a single block with force description. Not to be used as reference of the rtcp packet*/ -//struct switch_rtcp_senderinfo { -// struct switch_rtcp_sr_head sr_head; -// struct switch_rtcp_report_block sr_block; -// struct switch_rtcp_s_desc_head sr_desc_head; -// struct switch_rtcp_s_desc_trunk sr_desc_ssrc; -//}; typedef enum { RESULT_CONTINUE, @@ -1882,20 +1875,19 @@ static void rtcp_generate_report_block(switch_rtp_t *rtp_session, struct switch_ ntp_usec = now - (sec*1000000); /* remove seconds to keep only the microseconds */ /* Packet loss */ - if(stats->rtcp_rtp_count == 0){ + if (stats->rtcp_rtp_count == 0) { expected_pkt = stats->high_ext_seq_recv - stats->base_seq + 1; - } - else{ + } else { expected_pkt = stats->high_ext_seq_recv - stats->last_rpt_ext_seq; } pkt_lost = expected_pkt - stats->period_pkt_count; stats->cum_lost=stats->cum_lost+pkt_lost; - if(expected_pkt > 0 && pkt_lost > 0) + if (expected_pkt > 0 && pkt_lost > 0) { rtcp_report_block->fraction = (uint8_t) (pkt_lost * 256 / expected_pkt); - else + } else { rtcp_report_block->fraction = 0; - + } #if SWITCH_BYTE_ORDER != __BIG_ENDIAN /* Reversing byte order for 24bits */ rtcp_report_block->lost = (((stats->cum_lost&0x0000FF)<<16) | ((stats->cum_lost&0x00FF00)) | ((stats->cum_lost&0xFF0000)>>16)); @@ -1916,10 +1908,9 @@ static void rtcp_generate_report_block(switch_rtp_t *rtp_session, struct switch_ /* Delay since Last Sender Report (DLSR) : 32bits, 1/65536 seconds */ lsr_now = (uint32_t)(ntp_usec*0.065536) | (ntp_sec&0x0000ffff)<<16; /* 0.065536 is used for convertion from useconds to fraction of 65536 (x65536/1000000) */ - if(stats->last_recv_lsr_local){ + if (stats->last_recv_lsr_local) { dlsr = lsr_now - stats->last_recv_lsr_local; - } - else{ + } else { dlsr = 0; } rtcp_report_block->lsr = stats->last_recv_lsr_peer; @@ -1930,37 +1921,41 @@ static void rtcp_generate_report_block(switch_rtp_t *rtp_session, struct switch_ static void rtcp_stats_init(switch_rtp_t *rtp_session) { - switch_rtcp_numbers_t * stats=&rtp_session->stats.rtcp; + switch_rtcp_numbers_t * stats = &rtp_session->stats.rtcp; srtp_hdr_t * hdr = &rtp_session->recv_msg.header; switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); - stats->ssrc=ntohl(hdr->ssrc); - stats->last_rpt_ts=rtp_session->timer.samplecount; - stats->last_rpt_ext_seq=0; - stats->last_rpt_cycle=0; - stats->last_pkt_tsdiff=0; - stats->inter_jitter=0; - stats->cycle=0; - stats->high_ext_seq_recv=ntohs((uint16_t)hdr->seq); - stats->base_seq=ntohs((uint16_t)hdr->seq); + stats->ssrc = ntohl(hdr->ssrc); + stats->last_rpt_ts = rtp_session->timer.samplecount; + stats->last_rpt_ext_seq = 0; + stats->last_rpt_cycle = 0; + stats->last_pkt_tsdiff = 0; + stats->inter_jitter = 0; + stats->cycle = 0; + stats->high_ext_seq_recv = ntohs((uint16_t)hdr->seq); + stats->base_seq = ntohs((uint16_t)hdr->seq); stats->bad_seq = (1<<16) + 1; /* Make sure we wont missmatch 2 consecutive packets, so seq == bad_seq is false */ - stats->cum_lost=0; - stats->period_pkt_count=0; - stats->pkt_count=0; - stats->rtcp_rtp_count=0; + stats->cum_lost = 0; + stats->period_pkt_count = 0; + stats->pkt_count = 0; + stats->rtcp_rtp_count = 0; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats_init: ssrc[%d] base_seq[%d]", stats->ssrc, stats->base_seq); - if(!rtp_session->rtcp_sock_output) - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats_init: no rtcp socket"); - if(!rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) + + if (!rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats_init: rtcp disabled"); - if(rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]) + } + if (!rtp_session->rtcp_sock_output) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats_init: no rtcp socket"); + } + if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats_init: rtcp passthru"); + } } static int rtcp_stats(switch_rtp_t *rtp_session) { switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); srtp_hdr_t * hdr = &rtp_session->recv_msg.header; - switch_rtcp_numbers_t * stats=&rtp_session->stats.rtcp; + switch_rtcp_numbers_t * stats = &rtp_session->stats.rtcp; uint32_t packet_spacing_diff, pkt_tsdiff, pkt_extended_seq; uint16_t pkt_seq, seq_diff, max_seq; const int MAX_DROPOUT = 3000; @@ -1968,7 +1963,7 @@ static int rtcp_stats(switch_rtp_t *rtp_session) const int RTP_SEQ_MOD = (1<<16); if(!rtp_session->rtcp_sock_output || !rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] || rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU] || !rtp_session->rtcp_interval) - return 0; // do not process RTCP in current state + return 0; /* do not process RTCP in current state */ pkt_seq = (uint16_t) ntohs((uint16_t) rtp_session->recv_msg.header.seq); @@ -1976,31 +1971,30 @@ static int rtcp_stats(switch_rtp_t *rtp_session) max_seq = stats->high_ext_seq_recv&0x0000ffff; seq_diff = pkt_seq - max_seq; - if(seq_diff < MAX_DROPOUT){ /* in order, with permissible gap */ - if(pkt_seq < max_seq){ + if (seq_diff < MAX_DROPOUT) { /* in order, with permissible gap */ + if (pkt_seq < max_seq) { stats->cycle++; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats:[cycle change] pkt_seq[%d]cycle[%d] max_seq[%d] stats_ssrc[%u] local_ts[%u]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats:[cycle change] pkt_seq[%d]cycle[%d] max_seq[%d] stats_ssrc[%u] local_ts[%u]\n", pkt_seq, stats->cycle, max_seq, stats->ssrc, rtp_session->timer.samplecount); } pkt_extended_seq = stats->cycle << 16 | pkt_seq; /* getting the extended packet extended sequence ID */ - if(pkt_extended_seq > stats->high_ext_seq_recv) + if (pkt_extended_seq > stats->high_ext_seq_recv) { stats->high_ext_seq_recv = pkt_extended_seq; - } - else if(seq_diff <= (RTP_SEQ_MOD - MAX_MISORDER)){ /* the sequence number made a very large jump */ - if(pkt_seq == stats->bad_seq){ - rtcp_stats_init(rtp_session); } - else{ + } + else if (seq_diff <= (RTP_SEQ_MOD - MAX_MISORDER)) { /* the sequence number made a very large jump */ + if (pkt_seq == stats->bad_seq) { + rtcp_stats_init(rtp_session); + } else { stats->bad_seq = (pkt_seq + 1) & (RTP_SEQ_MOD-1); } return 0; /* no stats, packet is out of sync and will be accounted as lost */ - } - else { + } else { /* duplicate or reordered packet */ } /* Verify that we are on the same stream source (we do not support multiple sources) */ - if(ntohl(hdr->ssrc) != stats->ssrc || !stats->last_rpt_ts){ + if (ntohl(hdr->ssrc) != stats->ssrc || !stats->last_rpt_ts) { rtcp_stats_init(rtp_session); } @@ -2012,10 +2006,9 @@ static int rtcp_stats(switch_rtp_t *rtp_session) #endif /* Interarrival jitter calculation */ pkt_tsdiff = rtp_session->timer.samplecount - ntohl(hdr->ts) ; /* relative transit times for this packet */ - if(stats->pkt_count < 2){ /* Can not compute Jitter with only one packet */ + if (stats->pkt_count < 2) { /* Can not compute Jitter with only one packet */ stats->last_pkt_tsdiff = pkt_tsdiff; - } - else{ + } else { packet_spacing_diff = pkt_tsdiff - stats->last_pkt_tsdiff; /* Jitter : difference of relative transit times for the two packets */ stats->last_pkt_tsdiff = pkt_tsdiff; /* Interarrival jitter estimation, "J(i) = J(i-1) + ( |D(i-1,i)| - J(i-1) )/16" */ @@ -2079,11 +2072,11 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) rtcp_ok = 0; } - if (rtp_session->rtcp_sock_output && rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] && - !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU] && + if (rtp_session->rtcp_sock_output && rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] && + !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU] && (rtp_session->timer.samplecount - rtp_session->stats.rtcp.last_rpt_ts >= rtp_session->samples_per_second * rtp_session->rtcp_send_rate) ) { - switch_rtcp_numbers_t * stats=&rtp_session->stats.rtcp; + switch_rtcp_numbers_t * stats = &rtp_session->stats.rtcp; struct switch_rtcp_receiver_report *rr; struct switch_rtcp_sender_report *sr; struct switch_rtcp_report_block *rtcp_report_block; @@ -2099,33 +2092,34 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) rr=(struct switch_rtcp_receiver_report*) rtp_session->rtcp_send_msg.body; rr->ssrc = htonl(rtp_session->ssrc); rtcp_report_block = &rr->report_block; - rtcp_bytes+=sizeof(struct switch_rtcp_report_block); - } - else { + rtcp_bytes += sizeof(struct switch_rtcp_report_block); + } else { struct switch_rtcp_sender_info *rtcp_sender_info; rtp_session->rtcp_send_msg.header.type = 200; /* Sender report */ - sr=(struct switch_rtcp_sender_report*) rtp_session->rtcp_send_msg.body; + sr = (struct switch_rtcp_sender_report*) rtp_session->rtcp_send_msg.body; sr->ssrc = htonl(rtp_session->ssrc); rtcp_sender_info = &sr->sender_info; rtcp_generate_sender_info(rtp_session, rtcp_sender_info); rtcp_report_block = &sr->report_block; - rtcp_bytes+=sizeof(struct switch_rtcp_sender_info) + sizeof(struct switch_rtcp_report_block); + rtcp_bytes += sizeof(struct switch_rtcp_sender_info) + sizeof(struct switch_rtcp_report_block); } rtcp_generate_report_block(rtp_session, rtcp_report_block); rtp_session->rtcp_send_msg.header.length = htons((uint16_t)(rtcp_bytes / 4) - 1); /* Prepare next report */ - stats->last_rpt_cycle=stats->cycle; - stats->last_rpt_ext_seq=stats->high_ext_seq_recv; - stats->last_rpt_ts=rtp_session->timer.samplecount; - stats->period_pkt_count=0; + stats->last_rpt_cycle = stats->cycle; + stats->last_rpt_ext_seq = stats->high_ext_seq_recv; + stats->last_rpt_ts = rtp_session->timer.samplecount; + stats->period_pkt_count = 0; rtp_session->rtcp_send_msg.header.length = htons((u_short)(rtcp_bytes / 4) - 1); /* ToBeDone : there was some issue with this report block so I commented the following lines of code to fix it please see * RFC3550 section 6.5 SDES: Source Description RTCP Packet - * I guess it could be made optionnal, I do not see much value in incresing the size of the RTCP report */ + * I guess it could be made optionnal, I do not see much value in incresing the size of the RTCP report + **/ + /* rtcp_header->v = 0x02; rtcp_header->padding = 0; @@ -2134,7 +2128,7 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) rtcp_header->length = htons(5); sr->sr_desc_ssrc.ssrc = htonl(rtp_session->ssrc); - sr->sr_desc_ssrc.cname = 0x1; + sr->sr_desc_ssrc.cname = 0x1; { char bufa[30]; const char* str_cname = switch_get_addr(bufa, sizeof(bufa), rtp_session->rtcp_local_addr); @@ -2161,8 +2155,6 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) } */ - - #ifdef ENABLE_SRTP if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND]) { int sbytes = (int) rtcp_bytes; @@ -5164,7 +5156,7 @@ static switch_status_t process_rtcp_packet(switch_rtp_t *rtp_session, switch_siz switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Received an RTCP packet of length %" SWITCH_SIZE_T_FMT " bytes\n", *bytes); if (rtp_session->rtcp_recv_msg.header.version == 2) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"RTCP packet type is %d\n", rtp_session->rtcp_recv_msg.header.type); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"RTCP packet type is %d\n", rtp_session->rtcp_recv_msg.header.type); if (rtp_session->rtcp_recv_msg.header.type == 200 || rtp_session->rtcp_recv_msg.header.type == 201) { struct switch_rtcp_report_block *report_block; @@ -5179,7 +5171,7 @@ static switch_status_t process_rtcp_packet(switch_rtp_t *rtp_session, switch_siz ntp_usec = now - (sec*1000000); /* micro seconds */ lsr_now = (uint32_t)(ntp_usec*0.065536) | (ntp_sec&0x0000ffff)<<16; // 0.065536 is used for convertion from useconds - if (rtp_session->rtcp_recv_msg.header.type == 200){ /* Sender report */ + if (rtp_session->rtcp_recv_msg.header.type == 200) { /* Sender report */ struct switch_rtcp_sender_report* sr = (struct switch_rtcp_sender_report*)rtp_session->rtcp_recv_msg.body; report_block = &sr->report_block; rtp_session->stats.rtcp.packet_count += ntohl(sr->sender_info.pc); @@ -5205,15 +5197,14 @@ static switch_status_t process_rtcp_packet(switch_rtp_t *rtp_session, switch_siz ntohl(sr->sender_info.ts), ntohl(sr->sender_info.pc), ntohl(sr->sender_info.oc)); - } - else{ /* Receiver report */ + } else { /* Receiver report */ struct switch_rtcp_receiver_report* rr = (struct switch_rtcp_receiver_report*)rtp_session->rtcp_recv_msg.body; report_block = &rr->report_block; packet_ssrc = rr->ssrc; } /* Currently in passthru mode RTT will not be accurate, some work as to be done (something like mapping the NTP timestamp with a local one) to have RTT from both legs */ - if(report_block->lsr && !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]){ + if (report_block->lsr && !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]) { switch_time_exp_gmt(&now_hr,now); /* Calculating RTT = A - DLSR - LSR */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, @@ -5228,8 +5219,7 @@ static switch_status_t process_rtcp_packet(switch_rtp_t *rtp_session, switch_siz rtp_session->stats.rtcp.peer_ssrc = ntohl(packet_ssrc); status = SWITCH_STATUS_SUCCESS; } - } - else { + } else { if (rtp_session->rtcp_recv_msg_p->header.version != 2) { if (rtp_session->rtcp_recv_msg_p->header.version == 0) { if (rtp_session->ice.ice_user) { @@ -5238,7 +5228,7 @@ static switch_status_t process_rtcp_packet(switch_rtp_t *rtp_session, switch_siz } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), - SWITCH_LOG_NOTICE, "Received an unsupported RTCP packet version %d\nn", rtp_session->rtcp_recv_msg_p->header.version); + SWITCH_LOG_DEBUG, "Received an unsupported RTCP packet version %d\nn", rtp_session->rtcp_recv_msg_p->header.version); } } @@ -6213,7 +6203,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtcp_zerocopy_read_frame(switch_rtp_t *rt /* A fresh frame has been found! */ if (rtp_session->rtcp_fresh_frame) { - // struct switch_rtcp_senderinfo* sr = (struct switch_rtcp_senderinfo*)rtp_session->rtcp_recv_msg_p->body; struct switch_rtcp_sender_report* sr = (struct switch_rtcp_sender_report*)rtp_session->rtcp_recv_msg.body; int i = 0; From 6df5288f5ac7ac9c48d7f7cc730c26dae3215495 Mon Sep 17 00:00:00 2001 From: jchavanton Date: Fri, 12 Sep 2014 08:52:02 +0200 Subject: [PATCH 35/57] removing commented work in progress on SDES and logging tunning on rtcp_init --- src/switch_rtp.c | 129 +++++++++-------------------------------------- 1 file changed, 23 insertions(+), 106 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 23cebb0e1b..8e3ee117b6 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -430,74 +430,32 @@ struct switch_rtcp_report_block { uint32_t dlsr; /* The delay, expressed in units of 1/65536 seconds, between receiving the last SR packet from source SSRC_n and sending this reception report block */ }; -/* This was previously used, but a similar struct switch_rtcp_report_block existed and I merged them both. It also fixed the problem of lost being an integer and not a unsigned. -struct switch_rtcp_source { - unsigned ssrc1:32; - unsigned fraction_lost:8; - unsigned cumulative_lost:24; - unsigned hi_seq_recieved:32; - unsigned interarrival_jitter:32; - unsigned lsr:32; - unsigned lsr_delay:32; -}; -*/ - struct switch_rtcp_sr_head { - unsigned ssrc:32; - unsigned ntp_msw:32; - unsigned ntp_lsw:32; - unsigned ts:32; - unsigned pc:32; - unsigned oc:32; -}; - -#if SWITCH_BYTE_ORDER == __BIG_ENDIAN -struct switch_rtcp_s_desc_head { - unsigned v:2; - unsigned padding:1; - unsigned sc:5; - unsigned pt:8; - unsigned length:16; -}; - -#else /* BIG_ENDIAN */ -struct switch_rtcp_s_desc_head { - unsigned sc:5; - unsigned padding:1; - unsigned v:2; - unsigned pt:8; - unsigned length:16; -}; -#endif - -struct switch_rtcp_s_desc_trunk { - unsigned ssrc:32; - unsigned cname:8; - unsigned length:8; - char text[1]; + uint32_t ssrc; + uint32_t ntp_msw; + uint32_t ntp_lsw; + uint32_t ts; + uint32_t pc; + uint32_t oc; }; struct switch_rtcp_sender_info { - unsigned ntp_msw:32; - unsigned ntp_lsw:32; - unsigned ts:32; - unsigned pc:32; - unsigned oc:32; + uint32_t ntp_msw; + uint32_t ntp_lsw; + uint32_t ts; + uint32_t pc; + uint32_t oc; }; struct switch_rtcp_sender_report { - unsigned ssrc:32; - struct switch_rtcp_sender_info sender_info; - struct switch_rtcp_report_block report_block; - struct switch_rtcp_s_desc_head sr_desc_head; - struct switch_rtcp_s_desc_trunk sr_desc_ssrc; + uint32_t ssrc; + struct switch_rtcp_sender_info sender_info; + struct switch_rtcp_report_block report_block; }; struct switch_rtcp_receiver_report { - unsigned ssrc:32; - struct switch_rtcp_report_block report_block; - struct switch_rtcp_s_desc_head sr_desc_head; - struct switch_rtcp_s_desc_trunk sr_desc_ssrc; + uint32_t ssrc; + struct switch_rtcp_report_block report_block; }; typedef enum { @@ -1938,16 +1896,15 @@ static void rtcp_stats_init(switch_rtp_t *rtp_session) stats->period_pkt_count = 0; stats->pkt_count = 0; stats->rtcp_rtp_count = 0; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats_init: ssrc[%d] base_seq[%d]", stats->ssrc, stats->base_seq); if (!rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats_init: rtcp disabled"); - } - if (!rtp_session->rtcp_sock_output) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats_init: no rtcp socket"); - } - if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats_init: rtcp passthru"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: rtcp disabled"); + } else if (!rtp_session->rtcp_sock_output) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "rtcp_stats_init: no rtcp socket"); + } else if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: rtcp passthru"); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: ssrc[%d] base_seq[%d]", stats->ssrc, stats->base_seq); } } @@ -2112,48 +2069,8 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) stats->last_rpt_ext_seq = stats->high_ext_seq_recv; stats->last_rpt_ts = rtp_session->timer.samplecount; stats->period_pkt_count = 0; - rtp_session->rtcp_send_msg.header.length = htons((u_short)(rtcp_bytes / 4) - 1); -/* ToBeDone : there was some issue with this report block so I commented the following lines of code to fix it please see - * RFC3550 section 6.5 SDES: Source Description RTCP Packet - * I guess it could be made optionnal, I do not see much value in incresing the size of the RTCP report - **/ - -/* - rtcp_header->v = 0x02; - rtcp_header->padding = 0; - rtcp_header->sc = 1; - rtcp_header->pt = 202; - rtcp_header->length = htons(5); - - sr->sr_desc_ssrc.ssrc = htonl(rtp_session->ssrc); - sr->sr_desc_ssrc.cname = 0x1; - { - char bufa[30]; - const char* str_cname = switch_get_addr(bufa, sizeof(bufa), rtp_session->rtcp_local_addr); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting RTCP src-1 to %s\n", str_cname); - sr->sr_desc_ssrc.length = (unsigned int)strlen(str_cname); - memcpy ((char*)sr->sr_desc_ssrc.text, str_cname, strlen(str_cname)); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting RTCP src-1 LENGTH to %d (%d, %s)\n", - sr->sr_desc_ssrc.length, sr->header.length, str_cname); - } - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting msw = %d, lsw = %d \n", sr->sr_head.ntp_msw, sr->sr_head.ntp_lsw); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "now = %"SWITCH_TIME_T_FMT", now lo = %d, now hi = %d\n", - when, (int32_t)(when&0xFFFFFFFF), (int32_t)((when>>32&0xFFFFFFFF))); - - { - size_t sr_length = sizeof(switch_rtcp_hdr_t) + sizeof(struct switch_rtcp_sr_head) + (1 * sizeof(struct switch_rtcp_report_block)); - size_t sr_desc_length = sizeof(struct switch_rtcp_s_desc_head) + sizeof(struct switch_rtcp_s_desc_trunk) + sr->sr_desc_ssrc.length; - - rtp_session->rtcp_send_msg.header.length = htons((u_short)(sr_length / 4) - 1); - sr->sr_desc_head.length = htons((u_short)(sr_desc_length / 4) - 1); - - rtcp_bytes = sr_length + sr_desc_length; - } -*/ #ifdef ENABLE_SRTP if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND]) { From 6c52217920148f633b3d03ef5428dfa5938e4fd3 Mon Sep 17 00:00:00 2001 From: Brian West Date: Fri, 12 Sep 2014 11:58:51 -0500 Subject: [PATCH 36/57] depend on fs before install --- build/Makefile.centos6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Makefile.centos6 b/build/Makefile.centos6 index 463e31c8c7..625970bb0b 100644 --- a/build/Makefile.centos6 +++ b/build/Makefile.centos6 @@ -24,7 +24,7 @@ freeswitch.git/bootstrap.sh: has-git rpmforge: (which rpm && rpm -i http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm) || true -install: +install: freeswitch cd freeswitch.git && make install cd-sounds-install cd-moh-install has-git: From 3e8e2ce151d5d1e33eed3f9ff633ff8ade9d0b97 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 12 Sep 2014 17:06:58 +0000 Subject: [PATCH 37/57] Revert commits pushed too early Revert "depend on fs before install" This reverts commit 6c52217920148f633b3d03ef5428dfa5938e4fd3. Revert "removing commented work in progress on SDES and logging tunning on" This reverts commit 6df5288f5ac7ac9c48d7f7cc730c26dae3215495. Revert "more formatting and logging tuning" This reverts commit 0e89bbd0333c027273e4165af850bc304861dbdc. Revert "logging adjustment" This reverts commit 764faad671902d734bb18ca9f87798f0670396eb. Revert "missing host to network conversion highest_sequence_number_received" This reverts commit 50c62cdfd7a9ddee22e9e779c0a8c4dfba23f717. Revert "logging correction" This reverts commit ea973b0b4cde8ecf562252d6d22faad583e30846. Revert "[FS-6623] implement RTCP report generation" This reverts commit 0b7863a9b7e786d35ddf5babc51ba19f1dfa7a1a. --- build/Makefile.centos6 | 2 +- src/include/switch_types.h | 26 +- src/switch_rtp.c | 472 ++++++++++++------------------------- 3 files changed, 161 insertions(+), 339 deletions(-) diff --git a/build/Makefile.centos6 b/build/Makefile.centos6 index 625970bb0b..463e31c8c7 100644 --- a/build/Makefile.centos6 +++ b/build/Makefile.centos6 @@ -24,7 +24,7 @@ freeswitch.git/bootstrap.sh: has-git rpmforge: (which rpm && rpm -i http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm) || true -install: freeswitch +install: cd freeswitch.git && make install cd-sounds-install cd-moh-install has-git: diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 07576099e3..b29a6176fd 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -627,27 +627,11 @@ typedef struct { double mos; } switch_rtp_numbers_t; + typedef struct { - uint32_t packet_count; /* sent packet count */ - uint32_t octet_count; + uint32_t packet_count; + uint32_t octet_count; uint32_t peer_ssrc; - uint32_t last_rpt_ts; /* RTP timestamp at which the last report was generated and sent */ - uint32_t ssrc; /* identifier of the source */ - uint32_t csrc; /* contributing source 0-15 32bit each */ - uint32_t last_pkt_tsdiff; /* Jitter calculation, timestamp difference between the two last received packet */ - double inter_jitter; /* Jitter calculation, Interarrival jitter */ - uint32_t last_rpt_ext_seq; /* Packet loss calculation, extended sequence number at the begining of this RTCP report interval */ - uint16_t last_rpt_cycle; /* Packet loss calculation, sequence number cycle at the begining of the current RTCP report interval */ - uint16_t period_pkt_count; /* Packet loss calculation, packet count received during this RTCP report interval */ - uint16_t pkt_count; /* Packet loss calculation, packet count received during this session */ - uint32_t rtcp_rtp_count; /* RTCP report generated count */ - uint32_t high_ext_seq_recv; /* Packet loss calculation, highest extended sequence number received and processed for stats */ - uint16_t cycle; /* Packet loss calculation, sequence number cycle of the current RTCP report interval */ - uint32_t bad_seq; /* Bad SEQ found, used to detect reset on the other side */ - uint16_t base_seq; /* Packet loss calculation, first sequence number received */ - uint32_t cum_lost; /* Packet loss calculation, cumulative number of packet lost */ - uint32_t last_recv_lsr_local; /* RTT calculation, When receiving an SR we save our local timestamp in fraction of 65536 seconds */ - uint32_t last_recv_lsr_peer; /* RTT calculation, When receiving an SR we extract the middle 32bits of the remote NTP timestamp to include it in the next SR LSR */ } switch_rtcp_numbers_t; typedef struct { @@ -900,7 +884,7 @@ typedef struct { #endif #if SWITCH_BYTE_ORDER == __BIG_ENDIAN -typedef struct switch_rtcp_hdr_s { +typedef struct { unsigned version:2; /* protocol version */ unsigned p:1; /* padding flag */ unsigned count:5; /* number of reception report blocks */ @@ -910,7 +894,7 @@ typedef struct switch_rtcp_hdr_s { #else /* BIG_ENDIAN */ -typedef struct switch_rtcp_hdr_s { +typedef struct { unsigned count:5; /* number of reception report blocks */ unsigned p:1; /* padding flag */ unsigned version:2; /* protocol version */ diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 8e3ee117b6..eb9e7de49c 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -34,8 +34,6 @@ //#define RTP_DEBUG_WRITE_DELTA //#define DEBUG_MISSED_SEQ //#define DEBUG_EXTRA -//#define DEBUG_RTCP - #include #ifndef _MSC_VER #include @@ -70,7 +68,6 @@ #define RTP_MAGIC_NUMBER 42 #define WARN_SRTP_ERRS 10 #define MAX_SRTP_ERRS 100 -#define NTP_TIME_OFFSET 2208988800UL #define DTMF_SANITY (rtp_session->one_second * 30) @@ -356,7 +353,6 @@ struct switch_rtp { uint32_t samples_per_interval; uint32_t samples_per_second; uint32_t conf_samples_per_interval; - uint16_t rtcp_send_rate; uint32_t rsamples_per_interval; uint32_t ms_per_packet; uint32_t one_second; @@ -430,32 +426,59 @@ struct switch_rtcp_report_block { uint32_t dlsr; /* The delay, expressed in units of 1/65536 seconds, between receiving the last SR packet from source SSRC_n and sending this reception report block */ }; +/* This was previously used, but a similar struct switch_rtcp_report_block existed and I merged them both. It also fixed the problem of lost being an integer and not a unsigned. +struct switch_rtcp_source { + unsigned ssrc1:32; + unsigned fraction_lost:8; + unsigned cumulative_lost:24; + unsigned hi_seq_recieved:32; + unsigned interarrival_jitter:32; + unsigned lsr:32; + unsigned lsr_delay:32; +}; +*/ + struct switch_rtcp_sr_head { - uint32_t ssrc; - uint32_t ntp_msw; - uint32_t ntp_lsw; - uint32_t ts; - uint32_t pc; - uint32_t oc; + unsigned ssrc:32; + unsigned ntp_msw:32; + unsigned ntp_lsw:32; + unsigned ts:32; + unsigned pc:32; + unsigned oc:32; }; -struct switch_rtcp_sender_info { - uint32_t ntp_msw; - uint32_t ntp_lsw; - uint32_t ts; - uint32_t pc; - uint32_t oc; +#if SWITCH_BYTE_ORDER == __BIG_ENDIAN +struct switch_rtcp_s_desc_head { + unsigned v:2; + unsigned padding:1; + unsigned sc:5; + unsigned pt:8; + unsigned length:16; }; -struct switch_rtcp_sender_report { - uint32_t ssrc; - struct switch_rtcp_sender_info sender_info; - struct switch_rtcp_report_block report_block; +#else /* BIG_ENDIAN */ +struct switch_rtcp_s_desc_head { + unsigned sc:5; + unsigned padding:1; + unsigned v:2; + unsigned pt:8; + unsigned length:16; +}; +#endif + +struct switch_rtcp_s_desc_trunk { + unsigned ssrc:32; + unsigned cname:8; + unsigned length:8; + char text[1]; }; -struct switch_rtcp_receiver_report { - uint32_t ssrc; - struct switch_rtcp_report_block report_block; +/* This is limited to a single block with force description. Not to be used as reference of the rtcp packet*/ +struct switch_rtcp_senderinfo { + struct switch_rtcp_sr_head sr_head; + struct switch_rtcp_report_block sr_block; + struct switch_rtcp_s_desc_head sr_desc_head; + struct switch_rtcp_s_desc_trunk sr_desc_ssrc; }; typedef enum { @@ -1793,193 +1816,6 @@ static void check_jitter(switch_rtp_t *rtp_session) } } -static void rtcp_generate_sender_info(switch_rtp_t *rtp_session, struct switch_rtcp_sender_info *sr){ - switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); - switch_time_t now; - uint32_t sec, ntp_sec, ntp_usec; - switch_time_exp_t now_hr; - now = switch_time_now(); - sec = now/1000000; /* convert to seconds */ - ntp_sec = sec+NTP_TIME_OFFSET; /* convert to NTP seconds */ - sr->ntp_msw = htonl(ntp_sec); /* store result in "most significant word" */ - ntp_usec = now - (sec*1000000); /* remove seconds to keep only the microseconds */ - sr->ntp_lsw = htonl(ntp_usec*(double)(((uint64_t)1)<<32)*1.0e-6); /* convert microseconds to fraction of 32bits and store result in "least significatn word" */ - - sr->ts = htonl(rtp_session->last_write_ts); - sr->pc = htonl(rtp_session->stats.outbound.packet_count); - sr->oc = htonl((rtp_session->stats.outbound.raw_bytes - rtp_session->stats.outbound.packet_count * sizeof(srtp_hdr_t))); - - switch_time_exp_gmt(&now_hr,now); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Sending an RTCP packet[%04d-%02d-%02d %02d:%02d:%02d.%d] lsr[%u] msw[%u] lsw[%u] stats_ssrc[%u]\n", - 1900 + now_hr.tm_year, now_hr.tm_mday, now_hr.tm_mon, now_hr.tm_hour, now_hr.tm_min, now_hr.tm_sec, now_hr.tm_usec, - (ntohl(sr->ntp_lsw)&0xffff0000)>>16 | (ntohl(sr->ntp_msw)&0x0000ffff)<<16, - ntohl(sr->ntp_msw),ntohl(sr->ntp_lsw), rtp_session->stats.rtcp.ssrc - ); -} - - -static void rtcp_generate_report_block(switch_rtp_t *rtp_session, struct switch_rtcp_report_block *rtcp_report_block){ -#ifdef DEBUG_RTCP - switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); -#endif - switch_rtcp_numbers_t * stats=&rtp_session->stats.rtcp; - switch_time_t now; - uint32_t expected_pkt, dlsr; - int32_t pkt_lost; - uint32_t ntp_sec, ntp_usec, lsr_now, sec; - now = switch_time_now(); - sec = now/1000000; /* convert to seconds */ - ntp_sec = sec+NTP_TIME_OFFSET; /* convert to NTP seconds */ - ntp_usec = now - (sec*1000000); /* remove seconds to keep only the microseconds */ - - /* Packet loss */ - if (stats->rtcp_rtp_count == 0) { - expected_pkt = stats->high_ext_seq_recv - stats->base_seq + 1; - } else { - expected_pkt = stats->high_ext_seq_recv - stats->last_rpt_ext_seq; - } - - pkt_lost = expected_pkt - stats->period_pkt_count; - stats->cum_lost=stats->cum_lost+pkt_lost; - if (expected_pkt > 0 && pkt_lost > 0) { - rtcp_report_block->fraction = (uint8_t) (pkt_lost * 256 / expected_pkt); - } else { - rtcp_report_block->fraction = 0; - } -#if SWITCH_BYTE_ORDER != __BIG_ENDIAN - /* Reversing byte order for 24bits */ - rtcp_report_block->lost = (((stats->cum_lost&0x0000FF)<<16) | ((stats->cum_lost&0x00FF00)) | ((stats->cum_lost&0xFF0000)>>16)); -#endif - -#ifdef DEBUG_RTCP - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_generate_sr: stats_ssrc[%u] received[%d] expected[%d] cum[%d]lost[%d|%d/256]pkt last_seq[%d]cyc[%d] last_rpt_seq[%d]cyc[%d] ssrc[%d]\n", - ntohl(rtp_session->recv_msg.header.ssrc), stats->period_pkt_count, expected_pkt, - stats->cum_lost, pkt_lost, rtcp_report_block->fraction, stats->high_ext_seq_recv&0x0000ffff, - stats->cycle, stats->last_rpt_ext_seq&0x0000ffff, stats->last_rpt_cycle, rtp_session->stats.rtcp.peer_ssrc - ); -#endif - rtcp_report_block->highest_sequence_number_received = htonl(stats->high_ext_seq_recv); - - /* Jitter */ - rtcp_report_block->jitter = htonl((uint32_t)stats->inter_jitter); - - /* Delay since Last Sender Report (DLSR) : 32bits, 1/65536 seconds */ - lsr_now = (uint32_t)(ntp_usec*0.065536) | (ntp_sec&0x0000ffff)<<16; /* 0.065536 is used for convertion from useconds to fraction of 65536 (x65536/1000000) */ - - if (stats->last_recv_lsr_local) { - dlsr = lsr_now - stats->last_recv_lsr_local; - } else { - dlsr = 0; - } - rtcp_report_block->lsr = stats->last_recv_lsr_peer; - rtcp_report_block->dlsr = htonl(dlsr); - rtcp_report_block->ssrc = htonl(rtp_session->stats.rtcp.peer_ssrc); - stats->rtcp_rtp_count++; -} - -static void rtcp_stats_init(switch_rtp_t *rtp_session) -{ - switch_rtcp_numbers_t * stats = &rtp_session->stats.rtcp; - srtp_hdr_t * hdr = &rtp_session->recv_msg.header; - switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); - stats->ssrc = ntohl(hdr->ssrc); - stats->last_rpt_ts = rtp_session->timer.samplecount; - stats->last_rpt_ext_seq = 0; - stats->last_rpt_cycle = 0; - stats->last_pkt_tsdiff = 0; - stats->inter_jitter = 0; - stats->cycle = 0; - stats->high_ext_seq_recv = ntohs((uint16_t)hdr->seq); - stats->base_seq = ntohs((uint16_t)hdr->seq); - stats->bad_seq = (1<<16) + 1; /* Make sure we wont missmatch 2 consecutive packets, so seq == bad_seq is false */ - stats->cum_lost = 0; - stats->period_pkt_count = 0; - stats->pkt_count = 0; - stats->rtcp_rtp_count = 0; - - if (!rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: rtcp disabled"); - } else if (!rtp_session->rtcp_sock_output) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "rtcp_stats_init: no rtcp socket"); - } else if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: rtcp passthru"); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: ssrc[%d] base_seq[%d]", stats->ssrc, stats->base_seq); - } -} - -static int rtcp_stats(switch_rtp_t *rtp_session) -{ - switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); - srtp_hdr_t * hdr = &rtp_session->recv_msg.header; - switch_rtcp_numbers_t * stats = &rtp_session->stats.rtcp; - uint32_t packet_spacing_diff, pkt_tsdiff, pkt_extended_seq; - uint16_t pkt_seq, seq_diff, max_seq; - const int MAX_DROPOUT = 3000; - const int MAX_MISORDER = 100; - const int RTP_SEQ_MOD = (1<<16); - - if(!rtp_session->rtcp_sock_output || !rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] || rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU] || !rtp_session->rtcp_interval) - return 0; /* do not process RTCP in current state */ - - pkt_seq = (uint16_t) ntohs((uint16_t) rtp_session->recv_msg.header.seq); - - /* Detect sequence number cycle change */ - max_seq = stats->high_ext_seq_recv&0x0000ffff; - seq_diff = pkt_seq - max_seq; - - if (seq_diff < MAX_DROPOUT) { /* in order, with permissible gap */ - if (pkt_seq < max_seq) { - stats->cycle++; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats:[cycle change] pkt_seq[%d]cycle[%d] max_seq[%d] stats_ssrc[%u] local_ts[%u]\n", - pkt_seq, stats->cycle, max_seq, stats->ssrc, rtp_session->timer.samplecount); - } - pkt_extended_seq = stats->cycle << 16 | pkt_seq; /* getting the extended packet extended sequence ID */ - if (pkt_extended_seq > stats->high_ext_seq_recv) { - stats->high_ext_seq_recv = pkt_extended_seq; - } - } - else if (seq_diff <= (RTP_SEQ_MOD - MAX_MISORDER)) { /* the sequence number made a very large jump */ - if (pkt_seq == stats->bad_seq) { - rtcp_stats_init(rtp_session); - } else { - stats->bad_seq = (pkt_seq + 1) & (RTP_SEQ_MOD-1); - } - return 0; /* no stats, packet is out of sync and will be accounted as lost */ - } else { - /* duplicate or reordered packet */ - } - - /* Verify that we are on the same stream source (we do not support multiple sources) */ - if (ntohl(hdr->ssrc) != stats->ssrc || !stats->last_rpt_ts) { - rtcp_stats_init(rtp_session); - } - - stats->period_pkt_count++; - stats->pkt_count++; -#ifdef DEBUG_RTCP - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "rtcp_stats: period_pkt_count[%d]last_seq[%d]cycle[%d]stats_ssrc[%u]local_ts[%u]\n", - stats->period_pkt_count, pkt_seq, stats->cycle, stats->ssrc, rtp_session->timer.samplecount); -#endif - /* Interarrival jitter calculation */ - pkt_tsdiff = rtp_session->timer.samplecount - ntohl(hdr->ts) ; /* relative transit times for this packet */ - if (stats->pkt_count < 2) { /* Can not compute Jitter with only one packet */ - stats->last_pkt_tsdiff = pkt_tsdiff; - } else { - packet_spacing_diff = pkt_tsdiff - stats->last_pkt_tsdiff; /* Jitter : difference of relative transit times for the two packets */ - stats->last_pkt_tsdiff = pkt_tsdiff; - /* Interarrival jitter estimation, "J(i) = J(i-1) + ( |D(i-1,i)| - J(i-1) )/16" */ - stats->inter_jitter = (stats->inter_jitter + (((double)abs(packet_spacing_diff) - stats->inter_jitter) /16.)); - } - -#ifdef DEBUG_RTCP - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "rtcp_stats: pkt_ts[%d]local_ts[%d]diff[%d]pkt_spacing[%d]inter_jitter[%f]seq[%d]stats_ssrc[%d]", - ntohl(hdr->ts), rtp_session->timer.samplecount, pkt_tsdiff, packet_spacing_diff, stats->inter_jitter, ntohs(hdr->seq), stats->ssrc); -#endif - return 1; -} - - static int check_rtcp_and_ice(switch_rtp_t *rtp_session) { int ret = 0; @@ -2029,48 +1865,86 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) rtcp_ok = 0; } - if (rtp_session->rtcp_sock_output && rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] && - !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU] && - (rtp_session->timer.samplecount - rtp_session->stats.rtcp.last_rpt_ts >= rtp_session->samples_per_second * rtp_session->rtcp_send_rate) ) { - - switch_rtcp_numbers_t * stats = &rtp_session->stats.rtcp; - struct switch_rtcp_receiver_report *rr; - struct switch_rtcp_sender_report *sr; - struct switch_rtcp_report_block *rtcp_report_block; - - switch_size_t rtcp_bytes = sizeof(struct switch_rtcp_hdr_s)+sizeof(uint32_t); /* add size of the packet header and the ssrc */ + if (rtp_session->rtcp_sock_output && rtcp_ok && rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] && !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]) { + struct switch_rtcp_senderinfo *sr = (struct switch_rtcp_senderinfo*) rtp_session->rtcp_send_msg.body; + //rtp_msg_t *send_msg = &rtp_session->send_msg; + switch_size_t rtcp_bytes; + switch_byte_t *ptr = (switch_byte_t *)rtp_session->rtcp_send_msg.body; + switch_time_t when = 0; rtp_session->rtcp_send_msg.header.version = 2; rtp_session->rtcp_send_msg.header.p = 0; rtp_session->rtcp_send_msg.header.count = 1; - if (!rtp_session->stats.outbound.packet_count) { - rtp_session->rtcp_send_msg.header.type = 201; /* Receiver report */ - rr=(struct switch_rtcp_receiver_report*) rtp_session->rtcp_send_msg.body; - rr->ssrc = htonl(rtp_session->ssrc); - rtcp_report_block = &rr->report_block; - rtcp_bytes += sizeof(struct switch_rtcp_report_block); + sr->sr_head.ssrc = htonl(rtp_session->ssrc); + + if (!rtp_session->stats.inbound.period_packet_count) { + rtp_session->rtcp_send_msg.header.type = 201; + rtcp_bytes = sizeof(switch_rtcp_hdr_t) + 4; + ptr += 4; } else { - struct switch_rtcp_sender_info *rtcp_sender_info; - rtp_session->rtcp_send_msg.header.type = 200; /* Sender report */ - sr = (struct switch_rtcp_sender_report*) rtp_session->rtcp_send_msg.body; - sr->ssrc = htonl(rtp_session->ssrc); - rtcp_sender_info = &sr->sender_info; - rtcp_generate_sender_info(rtp_session, rtcp_sender_info); - rtcp_report_block = &sr->report_block; - rtcp_bytes += sizeof(struct switch_rtcp_sender_info) + sizeof(struct switch_rtcp_report_block); + switch_time_t when; + rtp_session->rtcp_send_msg.header.type = 200; + + if (rtp_session->send_time) { + when = rtp_session->send_time; + } else { + when = switch_micro_time_now(); + } + + sr->sr_head.ntp_msw = htonl((u_long)(when / 1000000 + 2208988800UL)); + /* + sr->ntp_lsw = htonl((u_long)(when % 1000000 * ((UINT_MAX * 1.0)/ 1000000.0))); + */ + sr->sr_head.ntp_lsw = htonl((u_long)(rtp_session->send_time % 1000000 * 4294.967296)); + sr->sr_head.ts = htonl(rtp_session->last_write_ts); + sr->sr_head.pc = htonl(rtp_session->stats.outbound.packet_count); + sr->sr_head.oc = htonl((rtp_session->stats.outbound.raw_bytes - rtp_session->stats.outbound.packet_count * sizeof(srtp_hdr_t))); + } - rtcp_generate_report_block(rtp_session, rtcp_report_block); - rtp_session->rtcp_send_msg.header.length = htons((uint16_t)(rtcp_bytes / 4) - 1); + /* TBD need to put more accurate stats here. */ - /* Prepare next report */ - stats->last_rpt_cycle = stats->cycle; - stats->last_rpt_ext_seq = stats->high_ext_seq_recv; - stats->last_rpt_ts = rtp_session->timer.samplecount; - stats->period_pkt_count = 0; - rtp_session->rtcp_send_msg.header.length = htons((u_short)(rtcp_bytes / 4) - 1); + sr->sr_block.ssrc = htonl(rtp_session->stats.rtcp.peer_ssrc); + sr->sr_block.fraction = 0; + sr->sr_block.lost = htonl(rtp_session->stats.inbound.skip_packet_count); + sr->sr_block.highest_sequence_number_received = htonl(rtp_session->recv_msg.header.seq); + sr->sr_block.jitter = htonl(0); + sr->sr_block.lsr = htonl(0); + sr->sr_block.dlsr = htonl(0); + sr->sr_desc_head.v = 0x02; + sr->sr_desc_head.padding = 0; + sr->sr_desc_head.sc = 1; + sr->sr_desc_head.pt = 202; + + sr->sr_desc_ssrc.ssrc = htonl(rtp_session->ssrc); + sr->sr_desc_ssrc.cname = 0x1; + { + char bufa[30]; + const char* str_cname = switch_get_addr(bufa, sizeof(bufa), rtp_session->rtcp_local_addr); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting RTCP src-1 to %s\n", str_cname); + sr->sr_desc_ssrc.length = (unsigned int)strlen(str_cname); + memcpy ((char*)sr->sr_desc_ssrc.text, str_cname, strlen(str_cname)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting RTCP src-1 LENGTH to %d (%d, %s)\n", + sr->sr_desc_ssrc.length, sr->sr_desc_head.length, str_cname); + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting msw = %d, lsw = %d \n", sr->sr_head.ntp_msw, sr->sr_head.ntp_lsw); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "now = %"SWITCH_TIME_T_FMT", now lo = %d, now hi = %d\n", + when, (int32_t)(when&0xFFFFFFFF), (int32_t)((when>>32&0xFFFFFFFF))); + + { + size_t sr_length = sizeof(switch_rtcp_hdr_t) + sizeof(struct switch_rtcp_sr_head) + (1 * sizeof(struct switch_rtcp_report_block)); + size_t sr_desc_length = sizeof(struct switch_rtcp_s_desc_head) + sizeof(struct switch_rtcp_s_desc_trunk) + sr->sr_desc_ssrc.length; + + rtp_session->rtcp_send_msg.header.length = htons((u_short)(sr_length / 4) - 1); + sr->sr_desc_head.length = htons((u_short)(sr_desc_length / 4) - 1); + + rtcp_bytes = sr_length + sr_desc_length; + } + #ifdef ENABLE_SRTP if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND]) { @@ -3860,7 +3734,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_sessi switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "RTCP send rate is: %d and packet rate is: %d Remote Port: %d\n", send_rate, rtp_session->ms_per_packet, rtp_session->remote_rtcp_port); rtp_session->rtcp_interval = send_rate; - rtp_session->rtcp_send_rate = send_rate/1000; rtp_session->next_rtcp_send = switch_time_now() + (rtp_session->rtcp_interval * 1000); } @@ -4900,7 +4773,6 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t } rtp_session->stats.inbound.packet_count++; - rtcp_stats(rtp_session); if (!rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && !rtp_session->flags[SWITCH_RTP_FLAG_UDPTL]) { @@ -5070,71 +4942,37 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t static switch_status_t process_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t *bytes) { switch_status_t status = SWITCH_STATUS_FALSE; - switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Received an RTCP packet of length %" SWITCH_SIZE_T_FMT " bytes\n", *bytes); - if (rtp_session->rtcp_recv_msg.header.version == 2) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"RTCP packet type is %d\n", rtp_session->rtcp_recv_msg.header.type); - - if (rtp_session->rtcp_recv_msg.header.type == 200 || rtp_session->rtcp_recv_msg.header.type == 201) { - struct switch_rtcp_report_block *report_block; - switch_time_t now; - switch_time_exp_t now_hr; - uint32_t sec, ntp_sec, ntp_usec, lsr_now; - uint32_t lsr; - uint32_t packet_ssrc; - now = switch_time_now(); /* number of microseconds since 00:00:00 january 1, 1970 UTC */ - sec = now/1000000; /* converted to second (NTP most significant bits) */ - ntp_sec = sec+NTP_TIME_OFFSET; /* 32bits most significant */ - ntp_usec = now - (sec*1000000); /* micro seconds */ - lsr_now = (uint32_t)(ntp_usec*0.065536) | (ntp_sec&0x0000ffff)<<16; // 0.065536 is used for convertion from useconds - - if (rtp_session->rtcp_recv_msg.header.type == 200) { /* Sender report */ - struct switch_rtcp_sender_report* sr = (struct switch_rtcp_sender_report*)rtp_session->rtcp_recv_msg.body; - report_block = &sr->report_block; - rtp_session->stats.rtcp.packet_count += ntohl(sr->sender_info.pc); - rtp_session->stats.rtcp.octet_count += ntohl(sr->sender_info.oc); - packet_ssrc = sr->ssrc; - /* Extracting LSR from NTP timestamp and save it */ - lsr = (ntohl(sr->sender_info.ntp_lsw)&0xffff0000)>>16 | (ntohl(sr->sender_info.ntp_msw)&0x0000ffff)<<16; /* The middle 32 bits out of 64 in the NTP timestamp */ - rtp_session->stats.rtcp.last_recv_lsr_peer = htonl(lsr); /* Save it include it in the next SR */ - rtp_session->stats.rtcp.last_recv_lsr_local = lsr_now; /* Save it to calculate DLSR when generating next SR */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Received a SR with %d report blocks, " \ - "length in words = %d, " \ - "SSRC = 0x%X, " \ - "NTP MSW = %u, " \ - "NTP LSW = %u, " \ - "RTP timestamp = %u, " \ - "Sender Packet Count = %u, " \ - "Sender Octet Count = %u\n", - rtp_session->rtcp_recv_msg.header.count, - ntohs((uint16_t)rtp_session->rtcp_recv_msg.header.length), - ntohl(sr->ssrc), - ntohl(sr->sender_info.ntp_msw), - ntohl(sr->sender_info.ntp_lsw), - ntohl(sr->sender_info.ts), - ntohl(sr->sender_info.pc), - ntohl(sr->sender_info.oc)); - } else { /* Receiver report */ - struct switch_rtcp_receiver_report* rr = (struct switch_rtcp_receiver_report*)rtp_session->rtcp_recv_msg.body; - report_block = &rr->report_block; - packet_ssrc = rr->ssrc; - } - - /* Currently in passthru mode RTT will not be accurate, some work as to be done (something like mapping the NTP timestamp with a local one) to have RTT from both legs */ - if (report_block->lsr && !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]) { - switch_time_exp_gmt(&now_hr,now); - /* Calculating RTT = A - DLSR - LSR */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, - "Receiving an RTCP packet[%04d-%02d-%02d %02d:%02d:%02d.%d] SSRC[%u]" - "RTT[%f] A[%u] - DLSR[%u] - LSR[%u]\n", - 1900 + now_hr.tm_year, now_hr.tm_mday, now_hr.tm_mon, now_hr.tm_hour, now_hr.tm_min, now_hr.tm_sec, now_hr.tm_usec, - ntohl(packet_ssrc), (double)(lsr_now - ntohl(report_block->dlsr) - ntohl(report_block->lsr))/65536, - lsr_now, ntohl(report_block->dlsr), ntohl(report_block->lsr)); - } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10,"Received an RTCP packet of length %" SWITCH_SIZE_T_FMT " bytes\n", *bytes); + if (rtp_session->rtcp_recv_msg_p->header.version == 2) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10,"RTCP packet type is %d\n", rtp_session->rtcp_recv_msg_p->header.type); + if (rtp_session->rtcp_recv_msg_p->header.type == 200) { + struct switch_rtcp_senderinfo* sr = (struct switch_rtcp_senderinfo*)rtp_session->rtcp_recv_msg_p->body; + rtp_session->rtcp_fresh_frame = 1; - rtp_session->stats.rtcp.peer_ssrc = ntohl(packet_ssrc); - status = SWITCH_STATUS_SUCCESS; + + rtp_session->stats.rtcp.packet_count += ntohl(sr->sr_head.pc); + rtp_session->stats.rtcp.octet_count += ntohl(sr->sr_head.oc); + rtp_session->stats.rtcp.peer_ssrc = ntohl(sr->sr_head.ssrc); + + /* sender report */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10,"Received a SR with %d report blocks, " \ + "length in words = %d, " \ + "SSRC = 0x%X, " \ + "NTP MSW = %u, " \ + "NTP LSW = %u, " \ + "RTP timestamp = %u, " \ + "Sender Packet Count = %u, " \ + "Sender Octet Count = %u\n", + rtp_session->rtcp_recv_msg_p->header.count, + ntohs((uint16_t)rtp_session->rtcp_recv_msg_p->header.length), + ntohl(sr->sr_head.ssrc), + ntohl(sr->sr_head.ntp_msw), + ntohl(sr->sr_head.ntp_lsw), + ntohl(sr->sr_head.ts), + ntohl(sr->sr_head.pc), + ntohl(sr->sr_head.oc)); } } else { if (rtp_session->rtcp_recv_msg_p->header.version != 2) { @@ -5144,8 +4982,8 @@ static switch_status_t process_rtcp_packet(switch_rtp_t *rtp_session, switch_siz } } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), - SWITCH_LOG_DEBUG, "Received an unsupported RTCP packet version %d\nn", rtp_session->rtcp_recv_msg_p->header.version); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), + SWITCH_LOG_DEBUG, "Received an unsupported RTCP packet version %d\nn", rtp_session->rtcp_recv_msg_p->header.version); } } @@ -6120,19 +5958,19 @@ SWITCH_DECLARE(switch_status_t) switch_rtcp_zerocopy_read_frame(switch_rtp_t *rt /* A fresh frame has been found! */ if (rtp_session->rtcp_fresh_frame) { - struct switch_rtcp_sender_report* sr = (struct switch_rtcp_sender_report*)rtp_session->rtcp_recv_msg.body; + struct switch_rtcp_senderinfo* sr = (struct switch_rtcp_senderinfo*)rtp_session->rtcp_recv_msg_p->body; int i = 0; /* turn the flag off! */ rtp_session->rtcp_fresh_frame = 0; - frame->ssrc = ntohl(sr->ssrc); - frame->packet_type = (uint16_t)rtp_session->rtcp_recv_msg.header.type; - frame->ntp_msw = ntohl(sr->sender_info.ntp_msw); - frame->ntp_lsw = ntohl(sr->sender_info.ntp_lsw); - frame->timestamp = ntohl(sr->sender_info.ts); - frame->packet_count = ntohl(sr->sender_info.pc); - frame->octect_count = ntohl(sr->sender_info.oc); + frame->ssrc = ntohl(sr->sr_head.ssrc); + frame->packet_type = (uint16_t)rtp_session->rtcp_recv_msg_p->header.type; + frame->ntp_msw = ntohl(sr->sr_head.ntp_msw); + frame->ntp_lsw = ntohl(sr->sr_head.ntp_lsw); + frame->timestamp = ntohl(sr->sr_head.ts); + frame->packet_count = ntohl(sr->sr_head.pc); + frame->octect_count = ntohl(sr->sr_head.oc); for (i = 0; i < (int)rtp_session->rtcp_recv_msg_p->header.count && i < MAX_REPORT_BLOCKS ; i++) { struct switch_rtcp_report_block* report = (struct switch_rtcp_report_block*) (rtp_session->rtcp_recv_msg_p->body + (sizeof(struct switch_rtcp_sr_head) + (i * sizeof(struct switch_rtcp_report_block)))); From 3afc086413308a5085b72dc07b974b5d1e3218eb Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Fri, 12 Sep 2014 20:35:18 +0400 Subject: [PATCH 38/57] June French RPMs --- build/sounds_version.txt | 2 +- freeswitch-sounds-fr-ca-june.spec | 318 ++++++++++++++++++++++++++++++ scripts/ci/sounds-fr-ca-june.sh | 40 ++++ 3 files changed, 359 insertions(+), 1 deletion(-) create mode 100644 freeswitch-sounds-fr-ca-june.spec create mode 100755 scripts/ci/sounds-fr-ca-june.sh diff --git a/build/sounds_version.txt b/build/sounds_version.txt index bfd46eaa24..add0373413 100644 --- a/build/sounds_version.txt +++ b/build/sounds_version.txt @@ -1,4 +1,4 @@ en-us-callie 1.0.50 -ru-RU-elena 1.0.13 +ru-RU-elena 1.0.50 fr-ca-june 1.0.18 diff --git a/freeswitch-sounds-fr-ca-june.spec b/freeswitch-sounds-fr-ca-june.spec new file mode 100644 index 0000000000..ada43dcd70 --- /dev/null +++ b/freeswitch-sounds-fr-ca-june.spec @@ -0,0 +1,318 @@ +############################################################################## +# Copyright and license +############################################################################## +# +# Spec file for package freeswitch-sounds-fr-ca-june (version 1.0.50-1) +# +# Based on parts by Copyright (c) 2009 Patrick Laimbock +# Copyright (c) 2014 FreeSWITCH.org +# This file and all modifications and additions to the pristine +# package are under the same license as the package itself. +# + +############################################################################## +# Set variables +############################################################################## + +%define version 1.0.50 +%define release 1 + +%define fsname freeswitch +# you could add a version number to be more strict + +%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} + + + + + +############################################################################## +# General +############################################################################## + +Summary: FreeSWITCH fr-CA June prompts +Name: freeswitch-sounds-fr-ca-june +Version: %{version} +Release: %{release}%{?dist} +License: MPL +Group: Applications/Communications +Packager: Ken Rice +URL: http://www.freeswitch.org +Source0:http://files.freeswitch.org/%{name}-48000-%{version}.tar.gz +Source1:http://files.freeswitch.org/%{name}-32000-%{version}.tar.gz +Source2:http://files.freeswitch.org/%{name}-16000-%{version}.tar.gz +Source3:http://files.freeswitch.org/%{name}-8000-%{version}.tar.gz +BuildArch: noarch +BuildRequires: sox +Requires: freeswitch +Requires: freeswitch-sounds-fr-ca-june-48000 +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +%description +FreeSWITCH 48kHz fr CA June prompts plus, during the installation, +it will also install locally generated 8KHz, 16KHz and 32KHz prompts + +%package -n freeswitch-sounds-fr-ca-june-8000 +Summary: FreeSWITCH 8kHz fr CA June prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-fr-ca-june-8000 +FreeSWITCH 8kHz fr CA June prompts + +%package -n freeswitch-sounds-fr-ca-june-16000 +Summary: FreeSWITCH 16kHz fr CA June prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-fr-ca-june-16000 +FreeSWITCH 16kHz fr CA June prompts + +%package -n freeswitch-sounds-fr-ca-june-32000 +Summary: FreeSWITCH 32kHz fr CA June prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-fr-ca-june-32000 +FreeSWITCH 32kHz fr CA June prompts + +%package -n freeswitch-sounds-fr-ca-june-48000 +Summary: FreeSWITCH 48kHz fr CA June prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-fr-ca-june-48000 +FreeSWITCH 48kHz fr CA June prompts + +%package -n freeswitch-sounds-fr-ca-june-all +Summary: FreeSWITCH fr CA June prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} +Requires: freeswitch-sounds-fr-ca-june-8000 = %{version} +Requires: freeswitch-sounds-fr-ca-june-16000 = %{version} +Requires: freeswitch-sounds-fr-ca-june-32000 = %{version} +Requires: freeswitch-sounds-fr-ca-june-48000 = %{version} + +%description -n freeswitch-sounds-fr-ca-june-all +FreeSWITCH Elena prompts package that pulls in the 8KHz, 16KHz, 32KHz and 48KHz RPMs + +############################################################################## +# Prep +############################################################################## + +%prep +%setup -n ru +%setup -T -D -b 0 -n ru +%setup -T -D -b 1 -n ru +%setup -T -D -b 2 -n ru +%setup -T -D -b 3 -n ru + +############################################################################## +# Build +############################################################################## + +%build +# nothing to do here + +############################################################################## +# Install +############################################################################## + +%install +[ "%{buildroot}" != '/' ] && rm -rf %{buildroot} + +# create the sounds directories +%{__install} -d -m 0750 %{buildroot}%{SOUNDSDIR}/fr/ca/june + +pushd RU/elena +# first install the 48KHz sounds +%{__cp} -prv ./* %{buildroot}%{SOUNDSDIR}/fr/ca/june +popd + +############################################################################## +# Clean +############################################################################## + +%clean +[ "%{buildroot}" != '/' ] && rm -rf %{buildroot} + +############################################################################## +# Post +############################################################################## + +%post + +############################################################################## +# Postun +############################################################################## + +%postun + +############################################################################## +# Files +############################################################################## + +%files +%defattr(-,root,root) + +%files -n freeswitch-sounds-fr-ca-june-8000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/ascii/8000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/base256/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/conference/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/currency/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/digits/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/directory/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/ivr/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/misc/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/time/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/voicemail/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/zrtp/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/users/8000 +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ascii/8000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/base256/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/conference/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/currency/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/digits/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/directory/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ivr/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/misc/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/time/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/voicemail/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/zrtp/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/users/8000/*.wav + +%files -n freeswitch-sounds-fr-ca-june-16000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/ascii/16000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/base256/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/conference/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/currency/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/digits/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/directory/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/ivr/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/misc/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/time/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/voicemail/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/zrtp/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/users/16000 +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ascii/16000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/base256/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/conference/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/currency/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/digits/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/directory/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ivr/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/misc/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/time/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/voicemail/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/zrtp/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/users/16000/*.wav + +%files -n freeswitch-sounds-fr-ca-june-32000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/ascii/32000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/base256/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/conference/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/currency/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/digits/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/directory/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/ivr/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/misc/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/time/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/voicemail/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/zrtp/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/users/32000 +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ascii/32000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/base256/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/conference/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/currency/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/digits/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/directory/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ivr/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/misc/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/time/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/voicemail/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/zrtp/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/users/32000/*.wav + +%files -n freeswitch-sounds-fr-ca-june-48000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/ascii/48000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/base256/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/conference/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/currency/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/digits/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/directory/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/ivr/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/misc/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/time/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/voicemail/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/zrtp/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/users/48000 +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ascii/48000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/base256/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/conference/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/currency/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/digits/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/directory/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ivr/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/misc/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/time/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/voicemail/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/zrtp/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/users/48000/*.wav + +%files -n freeswitch-sounds-fr-ca-june-all + +############################################################################## +# Changelog +############################################################################## + +%changelog +* Fri Sep 12 2014 Ken Rice - 1.0.50-1 +- created out of the spec file for june diff --git a/scripts/ci/sounds-fr-ca-june.sh b/scripts/ci/sounds-fr-ca-june.sh new file mode 100755 index 0000000000..8ca1f9d6e6 --- /dev/null +++ b/scripts/ci/sounds-fr-ca-june.sh @@ -0,0 +1,40 @@ +#!/bin/sh +##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- + +sdir="." +[ -n "${0%/*}" ] && sdir="${0%/*}" +. $sdir/common.sh + +basedir=$(pwd); + +(mkdir -p rpmbuild && cd rpmbuild && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SPECS) + +if [ ! -d "$basedir/../freeswitch-sounds" ]; then + cd $basedir/.. + git clone https://stash.freeswitch.org/scm/fs/freeswitch-sounds.git +else + cd $basedir/../freeswitch-sounds + git clean -fdx + git pull +fi + +cd $basedir/../freeswitch-sounds/sounds/trunk +./dist.pl fr/ca/june + +mv freeswitch-sounds-fr-ca-june-*.tar.* $basedir/rpmbuild/SOURCES + +cd $basedir + +rpmbuild --define "_topdir %(pwd)/rpmbuild" \ + --define "_rpmdir %{_topdir}" \ + --define "_srcrpmdir %{_topdir}" \ + -ba freeswitch-sounds-fr-ca-june.spec + +mkdir $src_repo/RPMS +mv $src_repo/rpmbuild/*/*.rpm $src_repo/RPMS/. + +cat 1>&2 < Date: Fri, 12 Sep 2014 20:57:22 +0400 Subject: [PATCH 39/57] make the spec file match the files that are there --- freeswitch-sounds-fr-ca-june.spec | 52 ++++++++++++++++++------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/freeswitch-sounds-fr-ca-june.spec b/freeswitch-sounds-fr-ca-june.spec index ada43dcd70..6547c2d37a 100644 --- a/freeswitch-sounds-fr-ca-june.spec +++ b/freeswitch-sounds-fr-ca-june.spec @@ -137,11 +137,11 @@ FreeSWITCH Elena prompts package that pulls in the 8KHz, 16KHz, 32KHz and 48KHz ############################################################################## %prep -%setup -n ru -%setup -T -D -b 0 -n ru -%setup -T -D -b 1 -n ru -%setup -T -D -b 2 -n ru -%setup -T -D -b 3 -n ru +%setup -n fr +%setup -T -D -b 0 -n fr +%setup -T -D -b 1 -n fr +%setup -T -D -b 2 -n fr +%setup -T -D -b 3 -n fr ############################################################################## # Build @@ -160,7 +160,7 @@ FreeSWITCH Elena prompts package that pulls in the 8KHz, 16KHz, 32KHz and 48KHz # create the sounds directories %{__install} -d -m 0750 %{buildroot}%{SOUNDSDIR}/fr/ca/june -pushd RU/elena +pushd ca/june # first install the 48KHz sounds %{__cp} -prv ./* %{buildroot}%{SOUNDSDIR}/fr/ca/june popd @@ -199,26 +199,28 @@ popd %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/currency/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/digits/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/directory/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/extra-attempt-record/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/ivr/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/misc/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/time/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/voicemail/8000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/zrtp/8000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/users/8000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/zrtp/8000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/users/8000 %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ascii/8000/*.wav #%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/base256/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/conference/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/currency/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/digits/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/directory/8000/*.wav +%attr(0750,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/extra-attempt-record/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ivr/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/misc/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/time/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/voicemail/8000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/zrtp/8000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/users/8000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/zrtp/8000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/users/8000/*.wav %files -n freeswitch-sounds-fr-ca-june-16000 %defattr(-,root,root,-) @@ -228,26 +230,28 @@ popd %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/currency/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/digits/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/directory/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/extra-attempt-record/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/ivr/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/misc/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/time/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/voicemail/16000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/zrtp/16000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/users/16000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/zrtp/16000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/users/16000 %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ascii/16000/*.wav #%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/base256/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/conference/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/currency/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/digits/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/directory/16000/*.wav +%attr(0750,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/extra-attempt-record/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ivr/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/misc/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/time/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/voicemail/16000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/zrtp/16000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/users/16000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/zrtp/16000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/users/16000/*.wav %files -n freeswitch-sounds-fr-ca-june-32000 %defattr(-,root,root,-) @@ -257,26 +261,28 @@ popd %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/currency/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/digits/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/directory/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/extra-attempt-record/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/ivr/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/misc/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/time/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/voicemail/32000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/zrtp/32000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/users/32000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/zrtp/32000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/users/32000 %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ascii/32000/*.wav #%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/base256/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/conference/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/currency/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/digits/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/directory/32000/*.wav +%attr(0750,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/extra-attempt-record/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ivr/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/misc/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/time/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/voicemail/32000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/zrtp/32000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/users/32000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/zrtp/32000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/users/32000/*.wav %files -n freeswitch-sounds-fr-ca-june-48000 %defattr(-,root,root,-) @@ -286,26 +292,28 @@ popd %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/currency/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/digits/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/directory/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/extra-attempt-record/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/ivr/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/misc/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/time/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/voicemail/48000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/zrtp/48000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/users/48000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/zrtp/48000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/fr/ca/june/users/48000 %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ascii/48000/*.wav #%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/base256/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/conference/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/currency/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/digits/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/directory/48000/*.wav +%attr(0750,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/extra-attempt-record/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/ivr/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/misc/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/phonetic-ascii/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/time/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/voicemail/48000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/zrtp/48000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/users/48000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/zrtp/48000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/fr/ca/june/users/48000/*.wav %files -n freeswitch-sounds-fr-ca-june-all From e440eb6dc8374f734d72f4e8f45fdea09ba07de5 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Fri, 12 Sep 2014 21:14:43 +0400 Subject: [PATCH 40/57] include the hash files so we can copy them up all at once --- scripts/ci/sounds-ru-ru-elena.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/sounds-ru-ru-elena.sh b/scripts/ci/sounds-ru-ru-elena.sh index 80682985f9..223d37f523 100755 --- a/scripts/ci/sounds-ru-ru-elena.sh +++ b/scripts/ci/sounds-ru-ru-elena.sh @@ -22,7 +22,7 @@ fi cd $basedir/../freeswitch-sounds/sounds/trunk ./dist.pl ru/RU/elena -mv freeswitch-sounds-ru-RU-elena-*.tar.gz $basedir/rpmbuild/SOURCES +mv freeswitch-sounds-ru-RU-elena-*.tar.* $basedir/rpmbuild/SOURCES cd $basedir From 19e0de9049539cdfd2dc2ba78c45ef96f0facbbc Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 12 Sep 2014 17:42:05 +0000 Subject: [PATCH 41/57] Document how to setup git correctly --- docs/SubmittingPatches | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches index 16be7a2479..a7d2347aeb 100644 --- a/docs/SubmittingPatches +++ b/docs/SubmittingPatches @@ -7,6 +7,13 @@ Download the Source Code git clone https://stash.freeswitch.org/scm/fs/freeswitch.git cd freeswitch +Ensure Git is Setup +------------------- + + # tell git your full name and email address; make sure to use your + # real name and not a username + ./scripts/setup-git.sh + Create Your Patch ----------------- @@ -24,6 +31,9 @@ Create Your Patch # logically separate change #while true; do emacs .; git commit -va; done + # review changes; ensure your author name is correct + git log -p + # create patch files git format-patch origin/master..HEAD From 4016b93d4a444ffc77587a5889ad675cccb6f30a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 12 Sep 2014 17:43:39 +0000 Subject: [PATCH 42/57] Indicate we want a full name for git --- scripts/setup-git.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup-git.sh b/scripts/setup-git.sh index df3cd73b6c..369c118560 100755 --- a/scripts/setup-git.sh +++ b/scripts/setup-git.sh @@ -16,7 +16,7 @@ if ! git config user.name >/dev/null 2>&1; then name=$(git config user.name) [ -z "$name" ] \ && [ -n "$NAME" ] && name="$NAME" || name="" - echo -n "What is your name? [$name]: " + echo -n "What is your full real name? [$name]: " read name_ [ -n "$name_" ] && name="$name_" [ -z "$name" ] && err "Your name is required." From bbcd4a86d1b17ff4635e6881a083cfee4581db31 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Sat, 13 Sep 2014 01:42:44 +0400 Subject: [PATCH 43/57] prep for streamlining this process --- freeswitch-sounds-en-ca-june.spec | 326 ++++++++++++++++++++++++++++ freeswitch-sounds-en-us-callie.spec | 4 +- freeswitch-sounds-sv-se-jakob.spec | 4 +- scripts/ci/mk-sounds-rpms.sh | 50 +++++ 4 files changed, 380 insertions(+), 4 deletions(-) create mode 100644 freeswitch-sounds-en-ca-june.spec create mode 100755 scripts/ci/mk-sounds-rpms.sh diff --git a/freeswitch-sounds-en-ca-june.spec b/freeswitch-sounds-en-ca-june.spec new file mode 100644 index 0000000000..69998fffb0 --- /dev/null +++ b/freeswitch-sounds-en-ca-june.spec @@ -0,0 +1,326 @@ +############################################################################## +# Copyright and license +############################################################################## +# +# Spec file for package freeswitch-sounds-en-ca-june (version 1.0.50-1) +# +# Based on parts by Copyright (c) 2009 Patrick Laimbock +# Copyright (c) 2014 FreeSWITCH.org +# This file and all modifications and additions to the pristine +# package are under the same license as the package itself. +# + +############################################################################## +# Set variables +############################################################################## + +%define version 1.0.50 +%define release 1 + +%define fsname freeswitch +# you could add a version number to be more strict + +%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} + + + + + +############################################################################## +# General +############################################################################## + +Summary: FreeSWITCH fr-CA June prompts +Name: freeswitch-sounds-en-ca-june +Version: %{version} +Release: %{release}%{?dist} +License: MPL +Group: Applications/Communications +Packager: Ken Rice +URL: http://www.freeswitch.org +Source0:http://files.freeswitch.org/%{name}-48000-%{version}.tar.gz +Source1:http://files.freeswitch.org/%{name}-32000-%{version}.tar.gz +Source2:http://files.freeswitch.org/%{name}-16000-%{version}.tar.gz +Source3:http://files.freeswitch.org/%{name}-8000-%{version}.tar.gz +BuildArch: noarch +BuildRequires: sox +Requires: freeswitch +Requires: freeswitch-sounds-en-ca-june-48000 +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +%description +FreeSWITCH 48kHz fr CA June prompts plus, during the installation, +it will also install locally generated 8KHz, 16KHz and 32KHz prompts + +%package -n freeswitch-sounds-en-ca-june-8000 +Summary: FreeSWITCH 8kHz fr CA June prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-en-ca-june-8000 +FreeSWITCH 8kHz fr CA June prompts + +%package -n freeswitch-sounds-en-ca-june-16000 +Summary: FreeSWITCH 16kHz fr CA June prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-en-ca-june-16000 +FreeSWITCH 16kHz fr CA June prompts + +%package -n freeswitch-sounds-en-ca-june-32000 +Summary: FreeSWITCH 32kHz fr CA June prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-en-ca-june-32000 +FreeSWITCH 32kHz fr CA June prompts + +%package -n freeswitch-sounds-en-ca-june-48000 +Summary: FreeSWITCH 48kHz fr CA June prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-en-ca-june-48000 +FreeSWITCH 48kHz fr CA June prompts + +%package -n freeswitch-sounds-en-ca-june-all +Summary: FreeSWITCH fr CA June prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} +Requires: freeswitch-sounds-en-ca-june-8000 = %{version} +Requires: freeswitch-sounds-en-ca-june-16000 = %{version} +Requires: freeswitch-sounds-en-ca-june-32000 = %{version} +Requires: freeswitch-sounds-en-ca-june-48000 = %{version} + +%description -n freeswitch-sounds-en-ca-june-all +FreeSWITCH Elena prompts package that pulls in the 8KHz, 16KHz, 32KHz and 48KHz RPMs + +############################################################################## +# Prep +############################################################################## + +%prep +%setup -n fr +%setup -T -D -b 0 -n fr +%setup -T -D -b 1 -n fr +%setup -T -D -b 2 -n fr +%setup -T -D -b 3 -n fr + +############################################################################## +# Build +############################################################################## + +%build +# nothing to do here + +############################################################################## +# Install +############################################################################## + +%install +[ "%{buildroot}" != '/' ] && rm -rf %{buildroot} + +# create the sounds directories +%{__install} -d -m 0750 %{buildroot}%{SOUNDSDIR}/en/ca/june + +pushd ca/june +# first install the 48KHz sounds +%{__cp} -prv ./* %{buildroot}%{SOUNDSDIR}/en/ca/june +popd + +############################################################################## +# Clean +############################################################################## + +%clean +[ "%{buildroot}" != '/' ] && rm -rf %{buildroot} + +############################################################################## +# Post +############################################################################## + +%post + +############################################################################## +# Postun +############################################################################## + +%postun + +############################################################################## +# Files +############################################################################## + +%files +%defattr(-,root,root) + +%files -n freeswitch-sounds-en-ca-june-8000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/ascii/8000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/base256/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/conference/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/currency/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/digits/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/directory/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/extra-attempt-record/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/ivr/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/misc/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/phonetic-ascii/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/time/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/voicemail/8000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/zrtp/8000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/users/8000 +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/ascii/8000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/base256/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/conference/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/currency/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/digits/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/directory/8000/*.wav +%attr(0750,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/extra-attempt-record/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/ivr/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/misc/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/phonetic-ascii/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/time/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/voicemail/8000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/zrtp/8000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/users/8000/*.wav + +%files -n freeswitch-sounds-en-ca-june-16000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/ascii/16000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/base256/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/conference/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/currency/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/digits/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/directory/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/extra-attempt-record/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/ivr/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/misc/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/phonetic-ascii/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/time/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/voicemail/16000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/zrtp/16000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/users/16000 +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/ascii/16000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/base256/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/conference/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/currency/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/digits/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/directory/16000/*.wav +%attr(0750,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/extra-attempt-record/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/ivr/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/misc/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/phonetic-ascii/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/time/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/voicemail/16000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/zrtp/16000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/users/16000/*.wav + +%files -n freeswitch-sounds-en-ca-june-32000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/ascii/32000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/base256/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/conference/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/currency/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/digits/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/directory/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/extra-attempt-record/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/ivr/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/misc/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/phonetic-ascii/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/time/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/voicemail/32000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/zrtp/32000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/users/32000 +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/ascii/32000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/base256/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/conference/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/currency/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/digits/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/directory/32000/*.wav +%attr(0750,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/extra-attempt-record/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/ivr/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/misc/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/phonetic-ascii/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/time/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/voicemail/32000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/zrtp/32000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/users/32000/*.wav + +%files -n freeswitch-sounds-en-ca-june-48000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/ascii/48000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/base256/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/conference/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/currency/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/digits/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/directory/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/extra-attempt-record/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/ivr/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/misc/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/phonetic-ascii/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/time/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/voicemail/48000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/zrtp/48000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/users/48000 +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/ascii/48000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/base256/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/conference/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/currency/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/digits/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/directory/48000/*.wav +%attr(0750,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/extra-attempt-record/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/ivr/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/misc/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/phonetic-ascii/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/time/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/voicemail/48000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/zrtp/48000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/users/48000/*.wav + +%files -n freeswitch-sounds-en-ca-june-all + +############################################################################## +# Changelog +############################################################################## + +%changelog +* Fri Sep 12 2014 Ken Rice - 1.0.50-1 +- created out of the spec file for june diff --git a/freeswitch-sounds-en-us-callie.spec b/freeswitch-sounds-en-us-callie.spec index 025eda0d53..9f81994a2c 100644 --- a/freeswitch-sounds-en-us-callie.spec +++ b/freeswitch-sounds-en-us-callie.spec @@ -20,8 +20,8 @@ # Set variables ############################################################################## -%define version %{VERSION_NUMBER} -%define release %{BUILD_NUMBER} +%define version 1.0.50 +%define release 1 %define fsname freeswitch # you could add a version number to be more strict diff --git a/freeswitch-sounds-sv-se-jakob.spec b/freeswitch-sounds-sv-se-jakob.spec index 06f91becb7..023d13ca56 100644 --- a/freeswitch-sounds-sv-se-jakob.spec +++ b/freeswitch-sounds-sv-se-jakob.spec @@ -21,8 +21,8 @@ # Set variables ############################################################################## -%define version %{VERSION_NUMBER} -%define release %{BUILD_NUMBER} +%define version 1.0.50 +%define release 1 %define fsname freeswitch # you could add a version number to be more strict diff --git a/scripts/ci/mk-sounds-rpms.sh b/scripts/ci/mk-sounds-rpms.sh new file mode 100755 index 0000000000..607a58cf84 --- /dev/null +++ b/scripts/ci/mk-sounds-rpms.sh @@ -0,0 +1,50 @@ +#!/bin/sh +##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- + +declare -a specfiles=('freeswitch-sounds-en-ca-june.spec' 'freeswitch-sounds-fr-ca-june.spec' 'freeswitch-sounds-ru-RU-elena.spec' 'freeswitch-sounds-en-us-callie.spec' 'freeswitch-sounds-sv-se-jakob.spec') + +sdir="." +[ -n "${0%/*}" ] && sdir="${0%/*}" +. $sdir/common.sh + +check_pwd + +basedir=$(pwd); + +(mkdir -p rpmbuild && cd rpmbuild && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SPECS) + +if [ ! -d "$basedir/../freeswitch-sounds" ]; then + cd $basedir/.. + git clone https://stash.freeswitch.org/scm/fs/freeswitch-sounds.git +else + cd $basedir/../freeswitch-sounds + git clean -fdx + git pull +fi + +for i in "${specfiles[@]}" +do + +cd $basedir/../freeswitch-sounds/sounds/trunk + +./dist.pl `echo $i|sed -e 's/freeswitch-sounds-//g' -e 's/\.spec//g' -e 's/-/\//g'` + +mv `echo $i|sed -e's/\.spec//g'`*.tar.* $basedir/rpmbuild/SOURCES + +cd $basedir + +rpmbuild --define "_topdir %(pwd)/rpmbuild" \ + --define "_rpmdir %{_topdir}" \ + --define "_srcrpmdir %{_topdir}" \ + -ba $i + +done + +mkdir $src_repo/RPMS +mv $src_repo/rpmbuild/*/*.rpm $src_repo/RPMS/. + +cat 1>&2 < Date: Sun, 14 Sep 2014 13:06:31 +0200 Subject: [PATCH 44/57] FS-6821 mod_gsmopen: fix interface name in log Fix interface name for logs emitted from mod_gsmopen.cpp during startup --- src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index a92303351a..37e160c674 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -1486,8 +1486,6 @@ static switch_status_t load_config(int reload_type) memset(&newconf, '\0', sizeof(newconf)); globals.GSMOPEN_INTERFACES[interface_id] = newconf; - tech_pvt = &globals.GSMOPEN_INTERFACES[interface_id]; - switch_mutex_init(&globals.GSMOPEN_INTERFACES[interface_id].controldev_lock, SWITCH_MUTEX_NESTED, gsmopen_module_pool); switch_mutex_init(&globals.GSMOPEN_INTERFACES[interface_id].controldev_audio_lock, SWITCH_MUTEX_NESTED, gsmopen_module_pool); @@ -1596,9 +1594,11 @@ static switch_status_t load_config(int reload_type) for (i = 0; i < GSMOPEN_MAX_INTERFACES; i++) { - switch_threadattr_t *gsmopen_api_thread_attr = NULL; - int res = 0; - int interface_id = i; + switch_threadattr_t *gsmopen_api_thread_attr = NULL; + int res = 0; + int interface_id = i; + + tech_pvt = &globals.GSMOPEN_INTERFACES[interface_id]; if (strlen(globals.GSMOPEN_INTERFACES[i].name) && !globals.GSMOPEN_INTERFACES[i].active) { From b738775876a945ff7b77f992d18e9ae486f630ac Mon Sep 17 00:00:00 2001 From: jchavanton Date: Mon, 21 Jul 2014 05:40:59 -0400 Subject: [PATCH 45/57] [FS-6623] implement RTCP report generation --- src/include/switch_types.h | 26 +- src/switch_rtp.c | 472 +++++++++++++++++++++++++------------ 2 files changed, 338 insertions(+), 160 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index b29a6176fd..07576099e3 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -627,11 +627,27 @@ typedef struct { double mos; } switch_rtp_numbers_t; - typedef struct { - uint32_t packet_count; - uint32_t octet_count; + uint32_t packet_count; /* sent packet count */ + uint32_t octet_count; uint32_t peer_ssrc; + uint32_t last_rpt_ts; /* RTP timestamp at which the last report was generated and sent */ + uint32_t ssrc; /* identifier of the source */ + uint32_t csrc; /* contributing source 0-15 32bit each */ + uint32_t last_pkt_tsdiff; /* Jitter calculation, timestamp difference between the two last received packet */ + double inter_jitter; /* Jitter calculation, Interarrival jitter */ + uint32_t last_rpt_ext_seq; /* Packet loss calculation, extended sequence number at the begining of this RTCP report interval */ + uint16_t last_rpt_cycle; /* Packet loss calculation, sequence number cycle at the begining of the current RTCP report interval */ + uint16_t period_pkt_count; /* Packet loss calculation, packet count received during this RTCP report interval */ + uint16_t pkt_count; /* Packet loss calculation, packet count received during this session */ + uint32_t rtcp_rtp_count; /* RTCP report generated count */ + uint32_t high_ext_seq_recv; /* Packet loss calculation, highest extended sequence number received and processed for stats */ + uint16_t cycle; /* Packet loss calculation, sequence number cycle of the current RTCP report interval */ + uint32_t bad_seq; /* Bad SEQ found, used to detect reset on the other side */ + uint16_t base_seq; /* Packet loss calculation, first sequence number received */ + uint32_t cum_lost; /* Packet loss calculation, cumulative number of packet lost */ + uint32_t last_recv_lsr_local; /* RTT calculation, When receiving an SR we save our local timestamp in fraction of 65536 seconds */ + uint32_t last_recv_lsr_peer; /* RTT calculation, When receiving an SR we extract the middle 32bits of the remote NTP timestamp to include it in the next SR LSR */ } switch_rtcp_numbers_t; typedef struct { @@ -884,7 +900,7 @@ typedef struct { #endif #if SWITCH_BYTE_ORDER == __BIG_ENDIAN -typedef struct { +typedef struct switch_rtcp_hdr_s { unsigned version:2; /* protocol version */ unsigned p:1; /* padding flag */ unsigned count:5; /* number of reception report blocks */ @@ -894,7 +910,7 @@ typedef struct { #else /* BIG_ENDIAN */ -typedef struct { +typedef struct switch_rtcp_hdr_s { unsigned count:5; /* number of reception report blocks */ unsigned p:1; /* padding flag */ unsigned version:2; /* protocol version */ diff --git a/src/switch_rtp.c b/src/switch_rtp.c index eb9e7de49c..8e3ee117b6 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -34,6 +34,8 @@ //#define RTP_DEBUG_WRITE_DELTA //#define DEBUG_MISSED_SEQ //#define DEBUG_EXTRA +//#define DEBUG_RTCP + #include #ifndef _MSC_VER #include @@ -68,6 +70,7 @@ #define RTP_MAGIC_NUMBER 42 #define WARN_SRTP_ERRS 10 #define MAX_SRTP_ERRS 100 +#define NTP_TIME_OFFSET 2208988800UL #define DTMF_SANITY (rtp_session->one_second * 30) @@ -353,6 +356,7 @@ struct switch_rtp { uint32_t samples_per_interval; uint32_t samples_per_second; uint32_t conf_samples_per_interval; + uint16_t rtcp_send_rate; uint32_t rsamples_per_interval; uint32_t ms_per_packet; uint32_t one_second; @@ -426,59 +430,32 @@ struct switch_rtcp_report_block { uint32_t dlsr; /* The delay, expressed in units of 1/65536 seconds, between receiving the last SR packet from source SSRC_n and sending this reception report block */ }; -/* This was previously used, but a similar struct switch_rtcp_report_block existed and I merged them both. It also fixed the problem of lost being an integer and not a unsigned. -struct switch_rtcp_source { - unsigned ssrc1:32; - unsigned fraction_lost:8; - unsigned cumulative_lost:24; - unsigned hi_seq_recieved:32; - unsigned interarrival_jitter:32; - unsigned lsr:32; - unsigned lsr_delay:32; -}; -*/ - struct switch_rtcp_sr_head { - unsigned ssrc:32; - unsigned ntp_msw:32; - unsigned ntp_lsw:32; - unsigned ts:32; - unsigned pc:32; - unsigned oc:32; + uint32_t ssrc; + uint32_t ntp_msw; + uint32_t ntp_lsw; + uint32_t ts; + uint32_t pc; + uint32_t oc; }; -#if SWITCH_BYTE_ORDER == __BIG_ENDIAN -struct switch_rtcp_s_desc_head { - unsigned v:2; - unsigned padding:1; - unsigned sc:5; - unsigned pt:8; - unsigned length:16; +struct switch_rtcp_sender_info { + uint32_t ntp_msw; + uint32_t ntp_lsw; + uint32_t ts; + uint32_t pc; + uint32_t oc; }; -#else /* BIG_ENDIAN */ -struct switch_rtcp_s_desc_head { - unsigned sc:5; - unsigned padding:1; - unsigned v:2; - unsigned pt:8; - unsigned length:16; -}; -#endif - -struct switch_rtcp_s_desc_trunk { - unsigned ssrc:32; - unsigned cname:8; - unsigned length:8; - char text[1]; +struct switch_rtcp_sender_report { + uint32_t ssrc; + struct switch_rtcp_sender_info sender_info; + struct switch_rtcp_report_block report_block; }; -/* This is limited to a single block with force description. Not to be used as reference of the rtcp packet*/ -struct switch_rtcp_senderinfo { - struct switch_rtcp_sr_head sr_head; - struct switch_rtcp_report_block sr_block; - struct switch_rtcp_s_desc_head sr_desc_head; - struct switch_rtcp_s_desc_trunk sr_desc_ssrc; +struct switch_rtcp_receiver_report { + uint32_t ssrc; + struct switch_rtcp_report_block report_block; }; typedef enum { @@ -1816,6 +1793,193 @@ static void check_jitter(switch_rtp_t *rtp_session) } } +static void rtcp_generate_sender_info(switch_rtp_t *rtp_session, struct switch_rtcp_sender_info *sr){ + switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); + switch_time_t now; + uint32_t sec, ntp_sec, ntp_usec; + switch_time_exp_t now_hr; + now = switch_time_now(); + sec = now/1000000; /* convert to seconds */ + ntp_sec = sec+NTP_TIME_OFFSET; /* convert to NTP seconds */ + sr->ntp_msw = htonl(ntp_sec); /* store result in "most significant word" */ + ntp_usec = now - (sec*1000000); /* remove seconds to keep only the microseconds */ + sr->ntp_lsw = htonl(ntp_usec*(double)(((uint64_t)1)<<32)*1.0e-6); /* convert microseconds to fraction of 32bits and store result in "least significatn word" */ + + sr->ts = htonl(rtp_session->last_write_ts); + sr->pc = htonl(rtp_session->stats.outbound.packet_count); + sr->oc = htonl((rtp_session->stats.outbound.raw_bytes - rtp_session->stats.outbound.packet_count * sizeof(srtp_hdr_t))); + + switch_time_exp_gmt(&now_hr,now); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Sending an RTCP packet[%04d-%02d-%02d %02d:%02d:%02d.%d] lsr[%u] msw[%u] lsw[%u] stats_ssrc[%u]\n", + 1900 + now_hr.tm_year, now_hr.tm_mday, now_hr.tm_mon, now_hr.tm_hour, now_hr.tm_min, now_hr.tm_sec, now_hr.tm_usec, + (ntohl(sr->ntp_lsw)&0xffff0000)>>16 | (ntohl(sr->ntp_msw)&0x0000ffff)<<16, + ntohl(sr->ntp_msw),ntohl(sr->ntp_lsw), rtp_session->stats.rtcp.ssrc + ); +} + + +static void rtcp_generate_report_block(switch_rtp_t *rtp_session, struct switch_rtcp_report_block *rtcp_report_block){ +#ifdef DEBUG_RTCP + switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); +#endif + switch_rtcp_numbers_t * stats=&rtp_session->stats.rtcp; + switch_time_t now; + uint32_t expected_pkt, dlsr; + int32_t pkt_lost; + uint32_t ntp_sec, ntp_usec, lsr_now, sec; + now = switch_time_now(); + sec = now/1000000; /* convert to seconds */ + ntp_sec = sec+NTP_TIME_OFFSET; /* convert to NTP seconds */ + ntp_usec = now - (sec*1000000); /* remove seconds to keep only the microseconds */ + + /* Packet loss */ + if (stats->rtcp_rtp_count == 0) { + expected_pkt = stats->high_ext_seq_recv - stats->base_seq + 1; + } else { + expected_pkt = stats->high_ext_seq_recv - stats->last_rpt_ext_seq; + } + + pkt_lost = expected_pkt - stats->period_pkt_count; + stats->cum_lost=stats->cum_lost+pkt_lost; + if (expected_pkt > 0 && pkt_lost > 0) { + rtcp_report_block->fraction = (uint8_t) (pkt_lost * 256 / expected_pkt); + } else { + rtcp_report_block->fraction = 0; + } +#if SWITCH_BYTE_ORDER != __BIG_ENDIAN + /* Reversing byte order for 24bits */ + rtcp_report_block->lost = (((stats->cum_lost&0x0000FF)<<16) | ((stats->cum_lost&0x00FF00)) | ((stats->cum_lost&0xFF0000)>>16)); +#endif + +#ifdef DEBUG_RTCP + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_generate_sr: stats_ssrc[%u] received[%d] expected[%d] cum[%d]lost[%d|%d/256]pkt last_seq[%d]cyc[%d] last_rpt_seq[%d]cyc[%d] ssrc[%d]\n", + ntohl(rtp_session->recv_msg.header.ssrc), stats->period_pkt_count, expected_pkt, + stats->cum_lost, pkt_lost, rtcp_report_block->fraction, stats->high_ext_seq_recv&0x0000ffff, + stats->cycle, stats->last_rpt_ext_seq&0x0000ffff, stats->last_rpt_cycle, rtp_session->stats.rtcp.peer_ssrc + ); +#endif + rtcp_report_block->highest_sequence_number_received = htonl(stats->high_ext_seq_recv); + + /* Jitter */ + rtcp_report_block->jitter = htonl((uint32_t)stats->inter_jitter); + + /* Delay since Last Sender Report (DLSR) : 32bits, 1/65536 seconds */ + lsr_now = (uint32_t)(ntp_usec*0.065536) | (ntp_sec&0x0000ffff)<<16; /* 0.065536 is used for convertion from useconds to fraction of 65536 (x65536/1000000) */ + + if (stats->last_recv_lsr_local) { + dlsr = lsr_now - stats->last_recv_lsr_local; + } else { + dlsr = 0; + } + rtcp_report_block->lsr = stats->last_recv_lsr_peer; + rtcp_report_block->dlsr = htonl(dlsr); + rtcp_report_block->ssrc = htonl(rtp_session->stats.rtcp.peer_ssrc); + stats->rtcp_rtp_count++; +} + +static void rtcp_stats_init(switch_rtp_t *rtp_session) +{ + switch_rtcp_numbers_t * stats = &rtp_session->stats.rtcp; + srtp_hdr_t * hdr = &rtp_session->recv_msg.header; + switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); + stats->ssrc = ntohl(hdr->ssrc); + stats->last_rpt_ts = rtp_session->timer.samplecount; + stats->last_rpt_ext_seq = 0; + stats->last_rpt_cycle = 0; + stats->last_pkt_tsdiff = 0; + stats->inter_jitter = 0; + stats->cycle = 0; + stats->high_ext_seq_recv = ntohs((uint16_t)hdr->seq); + stats->base_seq = ntohs((uint16_t)hdr->seq); + stats->bad_seq = (1<<16) + 1; /* Make sure we wont missmatch 2 consecutive packets, so seq == bad_seq is false */ + stats->cum_lost = 0; + stats->period_pkt_count = 0; + stats->pkt_count = 0; + stats->rtcp_rtp_count = 0; + + if (!rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: rtcp disabled"); + } else if (!rtp_session->rtcp_sock_output) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "rtcp_stats_init: no rtcp socket"); + } else if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: rtcp passthru"); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: ssrc[%d] base_seq[%d]", stats->ssrc, stats->base_seq); + } +} + +static int rtcp_stats(switch_rtp_t *rtp_session) +{ + switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); + srtp_hdr_t * hdr = &rtp_session->recv_msg.header; + switch_rtcp_numbers_t * stats = &rtp_session->stats.rtcp; + uint32_t packet_spacing_diff, pkt_tsdiff, pkt_extended_seq; + uint16_t pkt_seq, seq_diff, max_seq; + const int MAX_DROPOUT = 3000; + const int MAX_MISORDER = 100; + const int RTP_SEQ_MOD = (1<<16); + + if(!rtp_session->rtcp_sock_output || !rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] || rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU] || !rtp_session->rtcp_interval) + return 0; /* do not process RTCP in current state */ + + pkt_seq = (uint16_t) ntohs((uint16_t) rtp_session->recv_msg.header.seq); + + /* Detect sequence number cycle change */ + max_seq = stats->high_ext_seq_recv&0x0000ffff; + seq_diff = pkt_seq - max_seq; + + if (seq_diff < MAX_DROPOUT) { /* in order, with permissible gap */ + if (pkt_seq < max_seq) { + stats->cycle++; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "rtcp_stats:[cycle change] pkt_seq[%d]cycle[%d] max_seq[%d] stats_ssrc[%u] local_ts[%u]\n", + pkt_seq, stats->cycle, max_seq, stats->ssrc, rtp_session->timer.samplecount); + } + pkt_extended_seq = stats->cycle << 16 | pkt_seq; /* getting the extended packet extended sequence ID */ + if (pkt_extended_seq > stats->high_ext_seq_recv) { + stats->high_ext_seq_recv = pkt_extended_seq; + } + } + else if (seq_diff <= (RTP_SEQ_MOD - MAX_MISORDER)) { /* the sequence number made a very large jump */ + if (pkt_seq == stats->bad_seq) { + rtcp_stats_init(rtp_session); + } else { + stats->bad_seq = (pkt_seq + 1) & (RTP_SEQ_MOD-1); + } + return 0; /* no stats, packet is out of sync and will be accounted as lost */ + } else { + /* duplicate or reordered packet */ + } + + /* Verify that we are on the same stream source (we do not support multiple sources) */ + if (ntohl(hdr->ssrc) != stats->ssrc || !stats->last_rpt_ts) { + rtcp_stats_init(rtp_session); + } + + stats->period_pkt_count++; + stats->pkt_count++; +#ifdef DEBUG_RTCP + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "rtcp_stats: period_pkt_count[%d]last_seq[%d]cycle[%d]stats_ssrc[%u]local_ts[%u]\n", + stats->period_pkt_count, pkt_seq, stats->cycle, stats->ssrc, rtp_session->timer.samplecount); +#endif + /* Interarrival jitter calculation */ + pkt_tsdiff = rtp_session->timer.samplecount - ntohl(hdr->ts) ; /* relative transit times for this packet */ + if (stats->pkt_count < 2) { /* Can not compute Jitter with only one packet */ + stats->last_pkt_tsdiff = pkt_tsdiff; + } else { + packet_spacing_diff = pkt_tsdiff - stats->last_pkt_tsdiff; /* Jitter : difference of relative transit times for the two packets */ + stats->last_pkt_tsdiff = pkt_tsdiff; + /* Interarrival jitter estimation, "J(i) = J(i-1) + ( |D(i-1,i)| - J(i-1) )/16" */ + stats->inter_jitter = (stats->inter_jitter + (((double)abs(packet_spacing_diff) - stats->inter_jitter) /16.)); + } + +#ifdef DEBUG_RTCP + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "rtcp_stats: pkt_ts[%d]local_ts[%d]diff[%d]pkt_spacing[%d]inter_jitter[%f]seq[%d]stats_ssrc[%d]", + ntohl(hdr->ts), rtp_session->timer.samplecount, pkt_tsdiff, packet_spacing_diff, stats->inter_jitter, ntohs(hdr->seq), stats->ssrc); +#endif + return 1; +} + + static int check_rtcp_and_ice(switch_rtp_t *rtp_session) { int ret = 0; @@ -1865,86 +2029,48 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) rtcp_ok = 0; } - if (rtp_session->rtcp_sock_output && rtcp_ok && rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] && !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]) { - struct switch_rtcp_senderinfo *sr = (struct switch_rtcp_senderinfo*) rtp_session->rtcp_send_msg.body; - //rtp_msg_t *send_msg = &rtp_session->send_msg; - switch_size_t rtcp_bytes; - switch_byte_t *ptr = (switch_byte_t *)rtp_session->rtcp_send_msg.body; - switch_time_t when = 0; + if (rtp_session->rtcp_sock_output && rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] && + !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU] && + (rtp_session->timer.samplecount - rtp_session->stats.rtcp.last_rpt_ts >= rtp_session->samples_per_second * rtp_session->rtcp_send_rate) ) { + + switch_rtcp_numbers_t * stats = &rtp_session->stats.rtcp; + struct switch_rtcp_receiver_report *rr; + struct switch_rtcp_sender_report *sr; + struct switch_rtcp_report_block *rtcp_report_block; + + switch_size_t rtcp_bytes = sizeof(struct switch_rtcp_hdr_s)+sizeof(uint32_t); /* add size of the packet header and the ssrc */ rtp_session->rtcp_send_msg.header.version = 2; rtp_session->rtcp_send_msg.header.p = 0; rtp_session->rtcp_send_msg.header.count = 1; - sr->sr_head.ssrc = htonl(rtp_session->ssrc); - - if (!rtp_session->stats.inbound.period_packet_count) { - rtp_session->rtcp_send_msg.header.type = 201; - rtcp_bytes = sizeof(switch_rtcp_hdr_t) + 4; - ptr += 4; + if (!rtp_session->stats.outbound.packet_count) { + rtp_session->rtcp_send_msg.header.type = 201; /* Receiver report */ + rr=(struct switch_rtcp_receiver_report*) rtp_session->rtcp_send_msg.body; + rr->ssrc = htonl(rtp_session->ssrc); + rtcp_report_block = &rr->report_block; + rtcp_bytes += sizeof(struct switch_rtcp_report_block); } else { - switch_time_t when; - rtp_session->rtcp_send_msg.header.type = 200; - - if (rtp_session->send_time) { - when = rtp_session->send_time; - } else { - when = switch_micro_time_now(); - } - - sr->sr_head.ntp_msw = htonl((u_long)(when / 1000000 + 2208988800UL)); - /* - sr->ntp_lsw = htonl((u_long)(when % 1000000 * ((UINT_MAX * 1.0)/ 1000000.0))); - */ - sr->sr_head.ntp_lsw = htonl((u_long)(rtp_session->send_time % 1000000 * 4294.967296)); - sr->sr_head.ts = htonl(rtp_session->last_write_ts); - sr->sr_head.pc = htonl(rtp_session->stats.outbound.packet_count); - sr->sr_head.oc = htonl((rtp_session->stats.outbound.raw_bytes - rtp_session->stats.outbound.packet_count * sizeof(srtp_hdr_t))); - + struct switch_rtcp_sender_info *rtcp_sender_info; + rtp_session->rtcp_send_msg.header.type = 200; /* Sender report */ + sr = (struct switch_rtcp_sender_report*) rtp_session->rtcp_send_msg.body; + sr->ssrc = htonl(rtp_session->ssrc); + rtcp_sender_info = &sr->sender_info; + rtcp_generate_sender_info(rtp_session, rtcp_sender_info); + rtcp_report_block = &sr->report_block; + rtcp_bytes += sizeof(struct switch_rtcp_sender_info) + sizeof(struct switch_rtcp_report_block); } + rtcp_generate_report_block(rtp_session, rtcp_report_block); - /* TBD need to put more accurate stats here. */ + rtp_session->rtcp_send_msg.header.length = htons((uint16_t)(rtcp_bytes / 4) - 1); - sr->sr_block.ssrc = htonl(rtp_session->stats.rtcp.peer_ssrc); - sr->sr_block.fraction = 0; - sr->sr_block.lost = htonl(rtp_session->stats.inbound.skip_packet_count); - sr->sr_block.highest_sequence_number_received = htonl(rtp_session->recv_msg.header.seq); - sr->sr_block.jitter = htonl(0); - sr->sr_block.lsr = htonl(0); - sr->sr_block.dlsr = htonl(0); + /* Prepare next report */ + stats->last_rpt_cycle = stats->cycle; + stats->last_rpt_ext_seq = stats->high_ext_seq_recv; + stats->last_rpt_ts = rtp_session->timer.samplecount; + stats->period_pkt_count = 0; + rtp_session->rtcp_send_msg.header.length = htons((u_short)(rtcp_bytes / 4) - 1); - sr->sr_desc_head.v = 0x02; - sr->sr_desc_head.padding = 0; - sr->sr_desc_head.sc = 1; - sr->sr_desc_head.pt = 202; - - sr->sr_desc_ssrc.ssrc = htonl(rtp_session->ssrc); - sr->sr_desc_ssrc.cname = 0x1; - { - char bufa[30]; - const char* str_cname = switch_get_addr(bufa, sizeof(bufa), rtp_session->rtcp_local_addr); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting RTCP src-1 to %s\n", str_cname); - sr->sr_desc_ssrc.length = (unsigned int)strlen(str_cname); - memcpy ((char*)sr->sr_desc_ssrc.text, str_cname, strlen(str_cname)); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting RTCP src-1 LENGTH to %d (%d, %s)\n", - sr->sr_desc_ssrc.length, sr->sr_desc_head.length, str_cname); - } - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting msw = %d, lsw = %d \n", sr->sr_head.ntp_msw, sr->sr_head.ntp_lsw); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "now = %"SWITCH_TIME_T_FMT", now lo = %d, now hi = %d\n", - when, (int32_t)(when&0xFFFFFFFF), (int32_t)((when>>32&0xFFFFFFFF))); - - { - size_t sr_length = sizeof(switch_rtcp_hdr_t) + sizeof(struct switch_rtcp_sr_head) + (1 * sizeof(struct switch_rtcp_report_block)); - size_t sr_desc_length = sizeof(struct switch_rtcp_s_desc_head) + sizeof(struct switch_rtcp_s_desc_trunk) + sr->sr_desc_ssrc.length; - - rtp_session->rtcp_send_msg.header.length = htons((u_short)(sr_length / 4) - 1); - sr->sr_desc_head.length = htons((u_short)(sr_desc_length / 4) - 1); - - rtcp_bytes = sr_length + sr_desc_length; - } - #ifdef ENABLE_SRTP if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND]) { @@ -3734,6 +3860,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_sessi switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "RTCP send rate is: %d and packet rate is: %d Remote Port: %d\n", send_rate, rtp_session->ms_per_packet, rtp_session->remote_rtcp_port); rtp_session->rtcp_interval = send_rate; + rtp_session->rtcp_send_rate = send_rate/1000; rtp_session->next_rtcp_send = switch_time_now() + (rtp_session->rtcp_interval * 1000); } @@ -4773,6 +4900,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t } rtp_session->stats.inbound.packet_count++; + rtcp_stats(rtp_session); if (!rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && !rtp_session->flags[SWITCH_RTP_FLAG_UDPTL]) { @@ -4942,37 +5070,71 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t static switch_status_t process_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t *bytes) { switch_status_t status = SWITCH_STATUS_FALSE; + switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Received an RTCP packet of length %" SWITCH_SIZE_T_FMT " bytes\n", *bytes); + if (rtp_session->rtcp_recv_msg.header.version == 2) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"RTCP packet type is %d\n", rtp_session->rtcp_recv_msg.header.type); + + if (rtp_session->rtcp_recv_msg.header.type == 200 || rtp_session->rtcp_recv_msg.header.type == 201) { + struct switch_rtcp_report_block *report_block; + switch_time_t now; + switch_time_exp_t now_hr; + uint32_t sec, ntp_sec, ntp_usec, lsr_now; + uint32_t lsr; + uint32_t packet_ssrc; + now = switch_time_now(); /* number of microseconds since 00:00:00 january 1, 1970 UTC */ + sec = now/1000000; /* converted to second (NTP most significant bits) */ + ntp_sec = sec+NTP_TIME_OFFSET; /* 32bits most significant */ + ntp_usec = now - (sec*1000000); /* micro seconds */ + lsr_now = (uint32_t)(ntp_usec*0.065536) | (ntp_sec&0x0000ffff)<<16; // 0.065536 is used for convertion from useconds + + if (rtp_session->rtcp_recv_msg.header.type == 200) { /* Sender report */ + struct switch_rtcp_sender_report* sr = (struct switch_rtcp_sender_report*)rtp_session->rtcp_recv_msg.body; + report_block = &sr->report_block; + rtp_session->stats.rtcp.packet_count += ntohl(sr->sender_info.pc); + rtp_session->stats.rtcp.octet_count += ntohl(sr->sender_info.oc); + packet_ssrc = sr->ssrc; + /* Extracting LSR from NTP timestamp and save it */ + lsr = (ntohl(sr->sender_info.ntp_lsw)&0xffff0000)>>16 | (ntohl(sr->sender_info.ntp_msw)&0x0000ffff)<<16; /* The middle 32 bits out of 64 in the NTP timestamp */ + rtp_session->stats.rtcp.last_recv_lsr_peer = htonl(lsr); /* Save it include it in the next SR */ + rtp_session->stats.rtcp.last_recv_lsr_local = lsr_now; /* Save it to calculate DLSR when generating next SR */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Received a SR with %d report blocks, " \ + "length in words = %d, " \ + "SSRC = 0x%X, " \ + "NTP MSW = %u, " \ + "NTP LSW = %u, " \ + "RTP timestamp = %u, " \ + "Sender Packet Count = %u, " \ + "Sender Octet Count = %u\n", + rtp_session->rtcp_recv_msg.header.count, + ntohs((uint16_t)rtp_session->rtcp_recv_msg.header.length), + ntohl(sr->ssrc), + ntohl(sr->sender_info.ntp_msw), + ntohl(sr->sender_info.ntp_lsw), + ntohl(sr->sender_info.ts), + ntohl(sr->sender_info.pc), + ntohl(sr->sender_info.oc)); + } else { /* Receiver report */ + struct switch_rtcp_receiver_report* rr = (struct switch_rtcp_receiver_report*)rtp_session->rtcp_recv_msg.body; + report_block = &rr->report_block; + packet_ssrc = rr->ssrc; + } + + /* Currently in passthru mode RTT will not be accurate, some work as to be done (something like mapping the NTP timestamp with a local one) to have RTT from both legs */ + if (report_block->lsr && !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]) { + switch_time_exp_gmt(&now_hr,now); + /* Calculating RTT = A - DLSR - LSR */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, + "Receiving an RTCP packet[%04d-%02d-%02d %02d:%02d:%02d.%d] SSRC[%u]" + "RTT[%f] A[%u] - DLSR[%u] - LSR[%u]\n", + 1900 + now_hr.tm_year, now_hr.tm_mday, now_hr.tm_mon, now_hr.tm_hour, now_hr.tm_min, now_hr.tm_sec, now_hr.tm_usec, + ntohl(packet_ssrc), (double)(lsr_now - ntohl(report_block->dlsr) - ntohl(report_block->lsr))/65536, + lsr_now, ntohl(report_block->dlsr), ntohl(report_block->lsr)); + } - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10,"Received an RTCP packet of length %" SWITCH_SIZE_T_FMT " bytes\n", *bytes); - if (rtp_session->rtcp_recv_msg_p->header.version == 2) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10,"RTCP packet type is %d\n", rtp_session->rtcp_recv_msg_p->header.type); - if (rtp_session->rtcp_recv_msg_p->header.type == 200) { - struct switch_rtcp_senderinfo* sr = (struct switch_rtcp_senderinfo*)rtp_session->rtcp_recv_msg_p->body; - rtp_session->rtcp_fresh_frame = 1; - - rtp_session->stats.rtcp.packet_count += ntohl(sr->sr_head.pc); - rtp_session->stats.rtcp.octet_count += ntohl(sr->sr_head.oc); - rtp_session->stats.rtcp.peer_ssrc = ntohl(sr->sr_head.ssrc); - - /* sender report */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10,"Received a SR with %d report blocks, " \ - "length in words = %d, " \ - "SSRC = 0x%X, " \ - "NTP MSW = %u, " \ - "NTP LSW = %u, " \ - "RTP timestamp = %u, " \ - "Sender Packet Count = %u, " \ - "Sender Octet Count = %u\n", - rtp_session->rtcp_recv_msg_p->header.count, - ntohs((uint16_t)rtp_session->rtcp_recv_msg_p->header.length), - ntohl(sr->sr_head.ssrc), - ntohl(sr->sr_head.ntp_msw), - ntohl(sr->sr_head.ntp_lsw), - ntohl(sr->sr_head.ts), - ntohl(sr->sr_head.pc), - ntohl(sr->sr_head.oc)); + rtp_session->stats.rtcp.peer_ssrc = ntohl(packet_ssrc); + status = SWITCH_STATUS_SUCCESS; } } else { if (rtp_session->rtcp_recv_msg_p->header.version != 2) { @@ -4982,8 +5144,8 @@ static switch_status_t process_rtcp_packet(switch_rtp_t *rtp_session, switch_siz } } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), - SWITCH_LOG_DEBUG, "Received an unsupported RTCP packet version %d\nn", rtp_session->rtcp_recv_msg_p->header.version); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), + SWITCH_LOG_DEBUG, "Received an unsupported RTCP packet version %d\nn", rtp_session->rtcp_recv_msg_p->header.version); } } @@ -5958,19 +6120,19 @@ SWITCH_DECLARE(switch_status_t) switch_rtcp_zerocopy_read_frame(switch_rtp_t *rt /* A fresh frame has been found! */ if (rtp_session->rtcp_fresh_frame) { - struct switch_rtcp_senderinfo* sr = (struct switch_rtcp_senderinfo*)rtp_session->rtcp_recv_msg_p->body; + struct switch_rtcp_sender_report* sr = (struct switch_rtcp_sender_report*)rtp_session->rtcp_recv_msg.body; int i = 0; /* turn the flag off! */ rtp_session->rtcp_fresh_frame = 0; - frame->ssrc = ntohl(sr->sr_head.ssrc); - frame->packet_type = (uint16_t)rtp_session->rtcp_recv_msg_p->header.type; - frame->ntp_msw = ntohl(sr->sr_head.ntp_msw); - frame->ntp_lsw = ntohl(sr->sr_head.ntp_lsw); - frame->timestamp = ntohl(sr->sr_head.ts); - frame->packet_count = ntohl(sr->sr_head.pc); - frame->octect_count = ntohl(sr->sr_head.oc); + frame->ssrc = ntohl(sr->ssrc); + frame->packet_type = (uint16_t)rtp_session->rtcp_recv_msg.header.type; + frame->ntp_msw = ntohl(sr->sender_info.ntp_msw); + frame->ntp_lsw = ntohl(sr->sender_info.ntp_lsw); + frame->timestamp = ntohl(sr->sender_info.ts); + frame->packet_count = ntohl(sr->sender_info.pc); + frame->octect_count = ntohl(sr->sender_info.oc); for (i = 0; i < (int)rtp_session->rtcp_recv_msg_p->header.count && i < MAX_REPORT_BLOCKS ; i++) { struct switch_rtcp_report_block* report = (struct switch_rtcp_report_block*) (rtp_session->rtcp_recv_msg_p->body + (sizeof(struct switch_rtcp_sr_head) + (i * sizeof(struct switch_rtcp_report_block)))); From f924684eff25109306be645c43d85e2a55930e54 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 13 Sep 2014 01:41:49 +0500 Subject: [PATCH 46/57] FS-6623 #resolve fix init and logging for rtcp --- src/include/switch_types.h | 1 + src/switch_rtp.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 07576099e3..145d743274 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -648,6 +648,7 @@ typedef struct { uint32_t cum_lost; /* Packet loss calculation, cumulative number of packet lost */ uint32_t last_recv_lsr_local; /* RTT calculation, When receiving an SR we save our local timestamp in fraction of 65536 seconds */ uint32_t last_recv_lsr_peer; /* RTT calculation, When receiving an SR we extract the middle 32bits of the remote NTP timestamp to include it in the next SR LSR */ + uint32_t init; } switch_rtcp_numbers_t; typedef struct { diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 8e3ee117b6..475f804675 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1418,6 +1418,10 @@ static void send_fir(switch_rtp_t *rtp_session) rtp_session->remote_ssrc = rtp_session->stats.rtcp.peer_ssrc; } + if (rtp_session->remote_ssrc == 0) { + rtp_session->remote_ssrc = ntohl(rtp_session->recv_msg.header.ssrc); + } + if (rtp_session->remote_ssrc == 0) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "Peer ssrc not known yet for FIR\n"); return; @@ -1884,6 +1888,7 @@ static void rtcp_stats_init(switch_rtp_t *rtp_session) switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); stats->ssrc = ntohl(hdr->ssrc); stats->last_rpt_ts = rtp_session->timer.samplecount; + stats->init = 1; stats->last_rpt_ext_seq = 0; stats->last_rpt_cycle = 0; stats->last_pkt_tsdiff = 0; @@ -1898,13 +1903,13 @@ static void rtcp_stats_init(switch_rtp_t *rtp_session) stats->rtcp_rtp_count = 0; if (!rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: rtcp disabled"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: rtcp disabled\n"); } else if (!rtp_session->rtcp_sock_output) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "rtcp_stats_init: no rtcp socket"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "rtcp_stats_init: no rtcp socket\n"); } else if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: rtcp passthru"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: rtcp passthru\n"); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: ssrc[%d] base_seq[%d]", stats->ssrc, stats->base_seq); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: ssrc[%d] base_seq[%d]\n", stats->ssrc, stats->base_seq); } } @@ -1951,7 +1956,7 @@ static int rtcp_stats(switch_rtp_t *rtp_session) } /* Verify that we are on the same stream source (we do not support multiple sources) */ - if (ntohl(hdr->ssrc) != stats->ssrc || !stats->last_rpt_ts) { + if (ntohl(hdr->ssrc) != stats->ssrc || !stats->init) { rtcp_stats_init(rtp_session); } From 4be18d2c7bcc2eefe0d3ed8ab48fc35c999474a3 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Mon, 15 Sep 2014 20:01:32 +0400 Subject: [PATCH 47/57] make these work with the rest of the RPM packaging system --- freeswitch-sounds-en-ca-june.spec | 18 +-- freeswitch-sounds-sv-se-jakob.spec | 188 ++++++++++------------------- 2 files changed, 67 insertions(+), 139 deletions(-) diff --git a/freeswitch-sounds-en-ca-june.spec b/freeswitch-sounds-en-ca-june.spec index 69998fffb0..be7a76cb1e 100644 --- a/freeswitch-sounds-en-ca-june.spec +++ b/freeswitch-sounds-en-ca-june.spec @@ -137,11 +137,11 @@ FreeSWITCH Elena prompts package that pulls in the 8KHz, 16KHz, 32KHz and 48KHz ############################################################################## %prep -%setup -n fr -%setup -T -D -b 0 -n fr -%setup -T -D -b 1 -n fr -%setup -T -D -b 2 -n fr -%setup -T -D -b 3 -n fr +%setup -n en +%setup -T -D -b 0 -n en +%setup -T -D -b 1 -n en +%setup -T -D -b 2 -n en +%setup -T -D -b 3 -n en ############################################################################## # Build @@ -199,7 +199,6 @@ popd %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/currency/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/digits/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/directory/8000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/extra-attempt-record/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/ivr/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/misc/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/phonetic-ascii/8000 @@ -213,7 +212,6 @@ popd %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/currency/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/digits/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/directory/8000/*.wav -%attr(0750,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/extra-attempt-record/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/ivr/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/misc/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/phonetic-ascii/8000/*.wav @@ -230,7 +228,6 @@ popd %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/currency/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/digits/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/directory/16000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/extra-attempt-record/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/ivr/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/misc/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/phonetic-ascii/16000 @@ -244,7 +241,6 @@ popd %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/currency/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/digits/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/directory/16000/*.wav -%attr(0750,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/extra-attempt-record/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/ivr/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/misc/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/phonetic-ascii/16000/*.wav @@ -261,7 +257,6 @@ popd %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/currency/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/digits/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/directory/32000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/extra-attempt-record/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/ivr/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/misc/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/phonetic-ascii/32000 @@ -275,7 +270,6 @@ popd %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/currency/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/digits/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/directory/32000/*.wav -%attr(0750,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/extra-attempt-record/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/ivr/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/misc/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/phonetic-ascii/32000/*.wav @@ -292,7 +286,6 @@ popd %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/currency/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/digits/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/directory/48000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/extra-attempt-record/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/ivr/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/misc/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/en/ca/june/phonetic-ascii/48000 @@ -306,7 +299,6 @@ popd %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/currency/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/digits/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/directory/48000/*.wav -%attr(0750,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/extra-attempt-record/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/ivr/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/misc/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/en/ca/june/phonetic-ascii/48000/*.wav diff --git a/freeswitch-sounds-sv-se-jakob.spec b/freeswitch-sounds-sv-se-jakob.spec index 023d13ca56..16c4b45635 100644 --- a/freeswitch-sounds-sv-se-jakob.spec +++ b/freeswitch-sounds-sv-se-jakob.spec @@ -5,18 +5,12 @@ # Spec file for package freeswitch-sounds-sv-se-jakob (version 1.0.18-1) # # Copyright (c) 2009 Patrick Laimbock -# Some fixes and additions (c) 2011 Michal Bielicki # Copied and modified for mod_say_sv (c) 2013 Jakob Sundberg +# Additional changes (c) 2014 Ken Rice # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # -############################################################################## -# Determine distribution -############################################################################## - -# %define is_rhel5 %(test -f /etc/redhat-release && egrep -q 'release 5' /etc/redhat-release && echo 1 || echo 0) - ############################################################################## # Set variables ############################################################################## @@ -71,9 +65,12 @@ Version: %{version} Release: %{release}%{?dist} License: MPL Group: Applications/Communications -Packager: Patrick Laimbock +Packager: Ken Rice URL: http://www.freeswitch.org -Source0:http://files.freeswitch.org/%{name}-48000-%{version}.tar.bz2 +Source0:http://files.freeswitch.org/%{name}-48000-%{version}.tar.gz +Source1:http://files.freeswitch.org/%{name}-32000-%{version}.tar.gz +Source2:http://files.freeswitch.org/%{name}-16000-%{version}.tar.gz +Source3:http://files.freeswitch.org/%{name}-8000-%{version}.tar.gz BuildArch: noarch BuildRequires: sox Requires: freeswitch @@ -140,25 +137,11 @@ FreeSWITCH jakob prompts package that pulls in the 8KHz, 16KHz, ############################################################################## %prep -%setup -b0 -q -n en -mkdir -p ./usr/jakob -# create buildsounds-jakob.sh script in working dir -echo '#!/bin/bash - -sounds_location=$1 -for rate in 32000 16000 8000 -do - for i in ascii base256 conference currency digits directory ivr misc phonetic-ascii time voicemail zrtp - do - mkdir -p $sounds_location/$i/$rate - for f in `find $sounds_location/$i/48000 -name \*.wav` - do - echo "generating" $sounds_location/$i/$rate/`basename $f` - sox $f -r $rate $sounds_location/$i/$rate/`basename $f` - done - done -done' > ./sv/jakob/buildsounds-jakob.sh -%{__chmod} 0750 ./sv/jakob/buildsounds-jakob.sh +%setup -n sv +%setup -T -D -b 0 -n sv +%setup -T -D -b 1 -n sv +%setup -T -D -b 2 -n sv +%setup -T -D -b 3 -n sv ############################################################################## # Build @@ -177,11 +160,9 @@ done' > ./sv/jakob/buildsounds-jakob.sh # create the sounds directories %{__install} -d -m 0750 %{buildroot}%{SOUNDSDIR}/sv/se/jakob -pushd sv/jakob +pushd se/jakob # first install the 48KHz sounds %{__cp} -prv ./* %{buildroot}%{SOUNDSDIR}/sv/se/jakob -# now resample the 48KHz ones to 8KHz, 16KHz and 32KHz -./buildsounds-jakob.sh %{buildroot}%{SOUNDSDIR}/sv/se/jakob popd ############################################################################## @@ -196,9 +177,6 @@ popd ############################################################################## %post -# generate the 8KHz, 16KHz and 32KHz prompts from the 48KHz ones -cd %{SOUNDSDIR}/sv/se/jakob -./buildsounds-jakob.sh %{SOUNDSDIR}/sv/se/jakob ############################################################################## # Postun @@ -215,115 +193,114 @@ cd %{SOUNDSDIR}/sv/se/jakob %files %defattr(-,root,root) -%attr(0750,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/buildsounds-jakob.sh %files -n freeswitch-sounds-sv-se-jakob-8000 %defattr(-,root,root,-) %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/ascii/8000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/base256/8000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/conference/8000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/base256/8000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/conference/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/currency/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/digits/8000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/directory/8000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/ivr/8000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/misc/8000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/directory/8000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/ivr/8000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/misc/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/phonetic-ascii/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/time/8000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/voicemail/8000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/zrtp/8000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/zrtp/8000 %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/ascii/8000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/base256/8000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/conference/8000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/base256/8000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/conference/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/currency/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/digits/8000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/directory/8000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/ivr/8000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/misc/8000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/directory/8000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/ivr/8000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/misc/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/phonetic-ascii/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/time/8000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/voicemail/8000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/zrtp/8000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/zrtp/8000/*.wav %files -n freeswitch-sounds-sv-se-jakob-16000 %defattr(-,root,root,-) %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/ascii/16000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/base256/16000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/conference/16000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/base256/16000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/conference/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/currency/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/digits/16000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/directory/16000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/ivr/16000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/misc/16000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/directory/16000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/ivr/16000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/misc/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/phonetic-ascii/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/time/16000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/voicemail/16000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/zrtp/16000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/zrtp/16000 %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/ascii/16000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/base256/16000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/conference/16000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/base256/16000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/conference/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/currency/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/digits/16000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/directory/16000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/ivr/16000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/misc/16000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/directory/16000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/ivr/16000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/misc/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/phonetic-ascii/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/time/16000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/voicemail/16000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/zrtp/16000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/zrtp/16000/*.wav %files -n freeswitch-sounds-sv-se-jakob-32000 %defattr(-,root,root,-) %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/ascii/32000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/base256/32000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/conference/32000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/base256/32000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/conference/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/currency/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/digits/32000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/directory/32000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/ivr/32000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/misc/32000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/directory/32000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/ivr/32000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/misc/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/phonetic-ascii/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/time/32000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/voicemail/32000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/zrtp/32000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/zrtp/32000 %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/ascii/32000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/base256/32000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/conference/32000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/base256/32000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/conference/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/currency/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/digits/32000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/directory/32000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/ivr/32000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/misc/32000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/directory/32000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/ivr/32000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/misc/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/phonetic-ascii/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/time/32000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/voicemail/32000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/zrtp/32000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/zrtp/32000/*.wav %files -n freeswitch-sounds-sv-se-jakob-48000 %defattr(-,root,root,-) %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/ascii/48000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/base256/48000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/conference/48000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/base256/48000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/conference/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/currency/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/digits/48000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/directory/48000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/ivr/48000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/misc/48000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/directory/48000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/ivr/48000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/misc/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/phonetic-ascii/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/time/48000 %attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/voicemail/48000 -%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/zrtp/48000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/sv/se/jakob/zrtp/48000 %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/ascii/48000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/base256/48000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/conference/48000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/base256/48000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/conference/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/currency/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/digits/48000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/directory/48000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/ivr/48000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/misc/48000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/directory/48000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/ivr/48000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/misc/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/phonetic-ascii/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/time/48000/*.wav %attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/voicemail/48000/*.wav -%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/zrtp/48000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/sv/se/jakob/zrtp/48000/*.wav %files -n freeswitch-sounds-sv-se-jakob-all @@ -332,46 +309,5 @@ cd %{SOUNDSDIR}/sv/se/jakob ############################################################################## %changelog -* Sun Mar 05 2012 Ken Rice - 1.0.18-1 -- update to FHS Layout for FreeSWITCH -- bump up version -* Sun May 22 2011 Michal Bielicki - 1.0.16-1 -- bump up version -* Tue Jan 18 2011 Michal Bielicki - 1.0.14-1 -- bump up version -- include script into freeswitch core -- include specfile into freeswitch core -- runtime does not require sox, only building - -* Thu Dec 17 2009 Patrick Laimbock - 1.0.12-8 -- update perms and user/group to sync with the old situation - -* Wed Dec 16 2009 Patrick Laimbock - 1.0.12-7 -- make main package require freeswitch-sounds-sv-se-jakob-48000 and -- generate the 8KHz, 16KHz and 32KHz sounds from there -- add license to spec file - -* Wed Dec 16 2009 Patrick Laimbock - 1.0.12-5 -- put 48KHz in a separate package and let the main package Require 48KHz -- and then use the script to generate the 8KHz, 16KHz and 32KHz sounds - -* Wed Dec 16 2009 Patrick Laimbock - 1.0.12-4 -- add freeswitch-sounds-sv-se-jakob-all package that pulls in the 8KHz, -- 16KHz, 32KHz and 48KHz RPM packages - -* Tue Dec 15 2009 Patrick Laimbock - 1.0.12-3 -- override subpackage name with -n so it no longer builds an empty main RPM -- rework spec file -- add sox as a requirement -- run buildsounds-jakob.sh in post to generate 8KHz, 16KHz and 32KHz prompts - -* Tue Dec 15 2009 Patrick Laimbock - 1.0.12-2 -- can't override Name in subpackage so put all versions in RPM subpackages -- with an empty main RPM package - -* Tue Dec 15 2009 Patrick Laimbock - 1.0.12-1 -- create spec file with the following requirement: -- source only contains the 48KHz sound prompts -- during build the 48KHz sound prompts are resampled to 8KHz, 16KHz and 32KHz -- the 8KHz, 16KHz, 32KHz and 48KHz sound prompts are packaged separately - +* Mon Sep 15 2014 Ken Rice - 1.0.50-1 +- new spec file for jakob From b420a304b81028d7d7d0958add241f5c5e43a583 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Mon, 15 Sep 2014 21:45:32 +0400 Subject: [PATCH 48/57] pt-BR-karina spec file initial import --- freeswitch-sounds-pt-BR-karina.spec | 318 ++++++++++++++++++++++++++++ 1 file changed, 318 insertions(+) create mode 100644 freeswitch-sounds-pt-BR-karina.spec diff --git a/freeswitch-sounds-pt-BR-karina.spec b/freeswitch-sounds-pt-BR-karina.spec new file mode 100644 index 0000000000..81c85625b2 --- /dev/null +++ b/freeswitch-sounds-pt-BR-karina.spec @@ -0,0 +1,318 @@ +############################################################################## +# Copyright and license +############################################################################## +# +# Spec file for package freeswitch-sounds-pt-BR-karina (version 1.0.50-1) +# +# Based on parts by Copyright (c) 2009 Patrick Laimbock +# Copyright (c) 2014 FreeSWITCH.org +# This file and all modifications and additions to the pristine +# package are under the same license as the package itself. +# + +############################################################################## +# Set variables +############################################################################## + +%define version 1.0.50 +%define release 1 + +%define fsname freeswitch +# you could add a version number to be more strict + +%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} + + + + + +############################################################################## +# General +############################################################################## + +Summary: FreeSWITCH pt-BR Karina prompts +Name: freeswitch-sounds-pt-BR-karina +Version: %{version} +Release: %{release}%{?dist} +License: MPL +Group: Applications/Communications +Packager: Ken Rice +URL: http://www.freeswitch.org +Source0:http://files.freeswitch.org/%{name}-48000-%{version}.tar.gz +Source1:http://files.freeswitch.org/%{name}-32000-%{version}.tar.gz +Source2:http://files.freeswitch.org/%{name}-16000-%{version}.tar.gz +Source3:http://files.freeswitch.org/%{name}-8000-%{version}.tar.gz +BuildArch: noarch +BuildRequires: sox +Requires: freeswitch +Requires: freeswitch-sounds-pt-BR-karina-48000 +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +%description +FreeSWITCH 48kHz fr BR Karina prompts plus, during the installation, +it will also install locally generated 8KHz, 16KHz and 32KHz prompts + +%package -n freeswitch-sounds-pt-BR-karina-8000 +Summary: FreeSWITCH 8kHz fr BR Karina prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-pt-BR-karina-8000 +FreeSWITCH 8kHz fr BR Karina prompts + +%package -n freeswitch-sounds-pt-BR-karina-16000 +Summary: FreeSWITCH 16kHz fr BR Karina prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-pt-BR-karina-16000 +FreeSWITCH 16kHz fr BR Karina prompts + +%package -n freeswitch-sounds-pt-BR-karina-32000 +Summary: FreeSWITCH 32kHz fr BR Karina prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-pt-BR-karina-32000 +FreeSWITCH 32kHz fr BR Karina prompts + +%package -n freeswitch-sounds-pt-BR-karina-48000 +Summary: FreeSWITCH 48kHz fr BR Karina prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-pt-BR-karina-48000 +FreeSWITCH 48kHz fr BR Karina prompts + +%package -n freeswitch-sounds-pt-BR-karina-all +Summary: FreeSWITCH fr BR Karina prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} +Requires: freeswitch-sounds-pt-BR-karina-8000 = %{version} +Requires: freeswitch-sounds-pt-BR-karina-16000 = %{version} +Requires: freeswitch-sounds-pt-BR-karina-32000 = %{version} +Requires: freeswitch-sounds-pt-BR-karina-48000 = %{version} + +%description -n freeswitch-sounds-pt-BR-karina-all +FreeSWITCH Elena prompts package that pulls in the 8KHz, 16KHz, 32KHz and 48KHz RPMs + +############################################################################## +# Prep +############################################################################## + +%prep +%setup -n pt +%setup -T -D -b 0 -n pt +%setup -T -D -b 1 -n pt +%setup -T -D -b 2 -n pt +%setup -T -D -b 3 -n pt + +############################################################################## +# Build +############################################################################## + +%build +# nothing to do here + +############################################################################## +# Install +############################################################################## + +%install +[ "%{buildroot}" != '/' ] && rm -rf %{buildroot} + +# create the sounds directories +%{__install} -d -m 0750 %{buildroot}%{SOUNDSDIR}/pt/BR/karina + +pushd BR/karina +# first install the 48KHz sounds +%{__cp} -prv ./* %{buildroot}%{SOUNDSDIR}/pt/BR/karina +popd + +############################################################################## +# Clean +############################################################################## + +%clean +[ "%{buildroot}" != '/' ] && rm -rf %{buildroot} + +############################################################################## +# Post +############################################################################## + +%post + +############################################################################## +# Postun +############################################################################## + +%postun + +############################################################################## +# Files +############################################################################## + +%files +%defattr(-,root,root) + +%files -n freeswitch-sounds-pt-BR-karina-8000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/ascii/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/base256/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/conference/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/currency/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/digits/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/directory/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/ivr/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/misc/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/phonetic-ascii/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/time/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/voicemail/8000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/zrtp/8000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/users/8000 +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/ascii/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/base256/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/conference/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/currency/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/digits/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/directory/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/ivr/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/misc/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/phonetic-ascii/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/time/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/voicemail/8000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/zrtp/8000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/users/8000/*.wav + +%files -n freeswitch-sounds-pt-BR-karina-16000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/ascii/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/base256/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/conference/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/currency/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/digits/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/directory/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/ivr/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/misc/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/phonetic-ascii/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/time/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/voicemail/16000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/zrtp/16000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/users/16000 +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/ascii/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/base256/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/conference/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/currency/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/digits/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/directory/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/ivr/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/misc/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/phonetic-ascii/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/time/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/voicemail/16000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/zrtp/16000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/users/16000/*.wav + +%files -n freeswitch-sounds-pt-BR-karina-32000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/ascii/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/base256/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/conference/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/currency/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/digits/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/directory/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/ivr/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/misc/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/phonetic-ascii/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/time/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/voicemail/32000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/zrtp/32000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/users/32000 +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/ascii/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/base256/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/conference/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/currency/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/digits/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/directory/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/ivr/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/misc/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/phonetic-ascii/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/time/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/voicemail/32000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/zrtp/32000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/users/32000/*.wav + +%files -n freeswitch-sounds-pt-BR-karina-48000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/ascii/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/base256/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/conference/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/currency/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/digits/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/directory/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/ivr/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/misc/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/phonetic-ascii/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/time/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/voicemail/48000 +%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/zrtp/48000 +#%attr(0750,freeswitch,daemon) %dir %{SOUNDSDIR}/pt/BR/karina/users/48000 +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/ascii/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/base256/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/conference/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/currency/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/digits/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/directory/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/ivr/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/misc/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/phonetic-ascii/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/time/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/voicemail/48000/*.wav +%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/zrtp/48000/*.wav +#%attr(0640,freeswitch,daemon) %{SOUNDSDIR}/pt/BR/karina/users/48000/*.wav + +%files -n freeswitch-sounds-pt-BR-karina-all + +############################################################################## +# Changelog +############################################################################## + +%changelog +* Fri Sep 12 2014 Ken Rice - 1.0.50-1 +- created out of the spec file for june From 04269fdf19bc5086132c49a2fdb76149f121f006 Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Mon, 15 Sep 2014 16:42:31 -0500 Subject: [PATCH 49/57] mod_skinny: additional logging --- src/mod/endpoints/mod_skinny/skinny_server.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index f54224640f..64b6d16831 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -522,6 +522,8 @@ int skinny_session_set_variables_callback(void *pArg, int argc, char **argv, cha "found user (id=%s) in channel var setup\n", uid); if ((xvariables = switch_xml_child(xuser, "variables"))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, + "found variables section in user xml"); for (xvariable = switch_xml_child(xvariables, "variable"); xvariable; xvariable = xvariable->next) { char *name = (char *) switch_xml_attr_soft(xvariable, "name"); From f78007766b628b36f4c8af74a60688817c040467 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Tue, 16 Sep 2014 19:13:32 +0800 Subject: [PATCH 50/57] don't reset when video floor is locked when video floor is locked by a member, changing audio floor on del_member will cause the video floor lock cleared unexpectedly, this commit fixes that. --- src/mod/applications/mod_conference/mod_conference.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 406aa14b95..c431f11286 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2531,7 +2531,7 @@ static void conference_set_floor_holder(conference_obj_t *conference, conference int old_id = 0; if (!switch_test_flag(conference, CFLAG_VIDEO_BRIDGE) && - ((conference->video_floor_holder && !member) || + ((conference->video_floor_holder && !member && !switch_test_flag(conference, CFLAG_VID_FLOOR_LOCK)) || (member && member->channel && switch_channel_test_flag(member->channel, CF_VIDEO)))) { conference_set_video_floor_holder(conference, member, SWITCH_FALSE); } From 36addd5b6147e0fd865354a20e644d28234be5ab Mon Sep 17 00:00:00 2001 From: Seven Du Date: Tue, 16 Sep 2014 19:15:01 +0800 Subject: [PATCH 51/57] bytes is signed --- src/mod/endpoints/mod_verto/mod_verto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 5586e55d1e..9ab74cd071 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1716,7 +1716,7 @@ static void client_run(jsock_t *jsock) bytes = ws_read_frame(&jsock->ws, &oc, &data); if (bytes < 0) { - die("BAD READ %" SWITCH_SIZE_T_FMT "\n", bytes); + die("BAD READ %" SWITCH_SSIZE_T_FMT "\n", bytes); break; } From 47ae1837d52bd907174540b37326894bd391fdbb Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 16 Sep 2014 20:44:06 +0500 Subject: [PATCH 52/57] add some asserts --- src/switch_resample.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/switch_resample.c b/src/switch_resample.c index ed584e39af..dcb5d1610e 100644 --- a/src/switch_resample.c +++ b/src/switch_resample.c @@ -191,6 +191,7 @@ SWITCH_DECLARE(void) switch_generate_sln_silence(int16_t *data, uint32_t samples if (channels == 0) channels = 1; + switch_assert((samples * channels * 2) < SWITCH_RECOMMENDED_BUFFER_SIZE); assert(divisor); if (divisor == (uint32_t)-1) { @@ -260,7 +261,8 @@ SWITCH_DECLARE(void) switch_mux_channels(int16_t *data, switch_size_t samples, u uint32_t j = 0; switch_assert(channels < 11); - + switch_assert((samples * channels * 2) < SWITCH_RECOMMENDED_BUFFER_SIZE); + if (orig_channels > channels) { for (i = 0; i < samples; i++) { int32_t z = 0; From b2917e06dbb794053432793084a5db62a9cb44cf Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 17 Sep 2014 02:14:43 +0500 Subject: [PATCH 53/57] improve ssl errors --- src/mod/endpoints/mod_verto/mod_verto.c | 99 ++++++++++++++++++------- 1 file changed, 74 insertions(+), 25 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 9ab74cd071..ce5dcd0d4b 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -137,15 +137,36 @@ static void verto_deinit_ssl(verto_profile_t *profile) } } +static void close_file(int *sock) +{ + if (*sock > -1) { + close(*sock); + *sock = -1; + } +} + +static void close_socket(int *sock) +{ + if (*sock > -1) { + shutdown(*sock, 2); + close_file(sock); + } +} + + static int ssl_init = 0; -static void verto_init_ssl(verto_profile_t *profile) +static int verto_init_ssl(verto_profile_t *profile) { + const char *err = ""; + int i = 0; + if (!ssl_init) { SSL_library_init(); ssl_init = 1; } + profile->ssl_method = SSLv23_server_method(); /* create server instance */ profile->ssl_ctx = SSL_CTX_new(profile->ssl_method); /* create context */ profile->ssl_ready = 1; @@ -162,21 +183,65 @@ static void verto_init_ssl(verto_profile_t *profile) /* set the local certificate from CertFile */ if (!zstr(profile->chain)) { - SSL_CTX_use_certificate_chain_file(profile->ssl_ctx, profile->chain); + if (switch_file_exists(profile->chain, NULL) != SWITCH_STATUS_SUCCESS) { + err = "SUPPLIED CHAIN FILE NOT FOUND\n"; + goto fail; + } + + if (!SSL_CTX_use_certificate_chain_file(profile->ssl_ctx, profile->chain)) { + err = "CERT CHAIN FILE ERROR"; + goto fail; + } } - SSL_CTX_use_certificate_file(profile->ssl_ctx, profile->cert, SSL_FILETYPE_PEM); + if (switch_file_exists(profile->cert, NULL) != SWITCH_STATUS_SUCCESS) { + err = "SUPPLIED CERT FILE NOT FOUND\n"; + goto fail; + } + + if (!SSL_CTX_use_certificate_file(profile->ssl_ctx, profile->cert, SSL_FILETYPE_PEM)) { + err = "CERT FILE ERROR"; + goto fail; + } /* set the private key from KeyFile */ - SSL_CTX_use_PrivateKey_file(profile->ssl_ctx, profile->key, SSL_FILETYPE_PEM); + + if (switch_file_exists(profile->key, NULL) != SWITCH_STATUS_SUCCESS) { + err = "SUPPLIED KEY FILE NOT FOUND\n"; + goto fail; + } + + if (!SSL_CTX_use_PrivateKey_file(profile->ssl_ctx, profile->key, SSL_FILETYPE_PEM)) { + err = "PRIVATE KEY FILE ERROR"; + goto fail; + } + /* verify private key */ if ( !SSL_CTX_check_private_key(profile->ssl_ctx) ) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SSL NOT AVAILABLE\n"); - profile->ssl_ready = 0; - verto_deinit_ssl(profile); - } else { - SSL_CTX_set_cipher_list(profile->ssl_ctx, "HIGH:!DSS:!aNULL@STRENGTH"); + err = "PRIVATE KEY FILE ERROR"; + goto fail; } + + SSL_CTX_set_cipher_list(profile->ssl_ctx, "HIGH:!DSS:!aNULL@STRENGTH"); + + return 1; + + fail: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SSL ERR: %s\n", err); + + profile->ssl_ready = 0; + verto_deinit_ssl(profile); + + for (i = 0; i < profile->i; i++) { + if (profile->ip[i].secure) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SSL NOT ENABLED FOR LISTENER %s:%d. REVERTING TO WS\n", + profile->ip[i].local_ip, profile->ip[i].local_port); + profile->ip[i].secure = 0; + } + } + + return 0; + } @@ -385,22 +450,6 @@ static switch_status_t jsock_sub_channel(jsock_t *jsock, const char *event_chann static uint32_t ID = 1; -static void close_file(int *sock) -{ - if (*sock > -1) { - close(*sock); - *sock = -1; - } -} - -static void close_socket(int *sock) -{ - if (*sock > -1) { - shutdown(*sock, 2); - close_file(sock); - } -} - static void del_jsock(jsock_t *jsock) { jsock_t *p, *last = NULL; From 16d947dd7aacf1717afe399f53e8a9d34edd933e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 17 Sep 2014 02:14:54 +0500 Subject: [PATCH 54/57] can't have asserts here after all --- src/switch_resample.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/switch_resample.c b/src/switch_resample.c index dcb5d1610e..ed584e39af 100644 --- a/src/switch_resample.c +++ b/src/switch_resample.c @@ -191,7 +191,6 @@ SWITCH_DECLARE(void) switch_generate_sln_silence(int16_t *data, uint32_t samples if (channels == 0) channels = 1; - switch_assert((samples * channels * 2) < SWITCH_RECOMMENDED_BUFFER_SIZE); assert(divisor); if (divisor == (uint32_t)-1) { @@ -261,8 +260,7 @@ SWITCH_DECLARE(void) switch_mux_channels(int16_t *data, switch_size_t samples, u uint32_t j = 0; switch_assert(channels < 11); - switch_assert((samples * channels * 2) < SWITCH_RECOMMENDED_BUFFER_SIZE); - + if (orig_channels > channels) { for (i = 0; i < samples; i++) { int32_t z = 0; From 295fcce8a80a98d84b674a17e7e2da7db56db04a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 17 Sep 2014 04:54:38 +0500 Subject: [PATCH 55/57] add buffer_seconds param to shout filehandles to override the original default of 1 and remove previous code to attempt to buffer several seconds of audio in the open routine. Any experiencing jittery playback from slow shout destinations should add {buffer_seconds=N} to the file path to increase the amount of time allotted for buffering when no audio is discovered on the wire --- src/mod/formats/mod_shout/mod_shout.c | 36 +++++++++++++-------------- src/switch_ivr_play_say.c | 1 + 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index ae1ee83d38..6dfa0726ea 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -130,6 +130,7 @@ struct shout_context { unsigned char *mp3buf; switch_size_t mp3buflen; switch_thread_rwlock_t *rwlock; + int buffer_seconds; }; typedef struct shout_context shout_context_t; @@ -477,27 +478,12 @@ static void launch_read_stream_thread(shout_context_t *context) { switch_thread_t *thread; switch_threadattr_t *thd_attr = NULL; - int sanity = 10; - size_t used; context->thread_running = 1; switch_threadattr_create(&thd_attr, context->memory_pool); switch_threadattr_detach_set(thd_attr, 1); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); switch_thread_create(&thread, thd_attr, read_stream_thread, context, context->memory_pool); - - while (context->thread_running && --sanity) { - /* at least 1s of audio and up to 5s initialize */ - switch_mutex_lock(context->audio_mutex); - used = switch_buffer_inuse(context->audio_buffer); - switch_mutex_unlock(context->audio_mutex); - - if (used >= (2 * context->samplerate)) { - break; - } - - switch_yield(500000); - } } #define error_check() if (context->err) goto error; @@ -628,6 +614,7 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char long rate = 0; int channels = 0; int encoding = 0; + const char *var = NULL; if ((context = switch_core_alloc(handle->memory_pool, sizeof(*context))) == 0) { return SWITCH_STATUS_MEMERR; @@ -640,6 +627,7 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char context->memory_pool = handle->memory_pool; context->samplerate = handle->samplerate; context->handle = handle; + context->buffer_seconds = 1; switch_thread_rwlock_create(&(context->rwlock), context->memory_pool); @@ -647,6 +635,17 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, context->memory_pool); + if (handle->params && (var = switch_event_get_header(handle->params, "buffer_seconds"))) { + int bs = atol(var); + if (bs < 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Buffer Seconds %d too low\n", bs); + } else if (bs > 60) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Buffer Seconds %d too high\n", bs); + } else { + context->buffer_seconds = bs; + } + } + if (switch_test_flag(handle, SWITCH_FILE_FLAG_READ)) { if (switch_buffer_create_dynamic(&context->audio_buffer, TC_BUFFER_SIZE, TC_BUFFER_SIZE * 2, 0) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n"); @@ -944,12 +943,13 @@ static switch_status_t shout_file_read(switch_file_handle_t *handle, void *data, if (rb) { *len = rb / sizeof(int16_t) / handle->real_channels; } else { - /* no data, so insert 1 second of silence */ - newbytes = 2 * handle->samplerate; + /* no data, so insert N seconds of silence */ + newbytes = (2 * handle->samplerate * handle->real_channels) * context->buffer_seconds; if (newbytes < bytes) { bytes = newbytes; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Padding mp3 stream with 1s of empty audio. (%s)\n", context->stream_url); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Padding mp3 stream with %ds of empty audio. (%s)\n", + context->buffer_seconds, context->stream_url); memset(data, 255, bytes); *len = bytes / sizeof(int16_t) / handle->real_channels; diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index f487fcec78..24a4ede9b1 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1238,6 +1238,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess continue; } + switch_channel_audio_sync(channel); switch_core_session_io_write_lock(session); switch_channel_set_private(channel, "__fh", fh); switch_core_session_io_rwunlock(session); From d2f8fca18a398d6e2103abb272aa151d1f267132 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 17 Sep 2014 20:32:18 +0500 Subject: [PATCH 56/57] FS-6825 #resolve #comment caused by regression in commit 0732c0b0 pertaining to FS-6825 --- src/switch_core_media.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index e09b8108c9..2616237fbe 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -3480,7 +3480,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s match = (map->rm_pt == imp->ianacode) ? 1 : 0; } else { match = (!strcasecmp(rm_encoding, imp->iananame) && - ((map->rm_pt < 96 && imp->ianacode < 96) || (map->rm_pt > 96 && imp->ianacode > 96)) && + ((map->rm_pt < 96 && imp->ianacode < 96) || (map->rm_pt > 95 && imp->ianacode > 95)) && (remote_codec_rate == codec_rate || fmtp_remote_codec_rate == imp->actual_samples_per_second)) ? 1 : 0; if (fmtp_remote_codec_rate) { remote_codec_rate = fmtp_remote_codec_rate; @@ -8410,7 +8410,7 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess } else { if (map->rm_encoding) { match = !strcasecmp(map->rm_encoding, imp->iananame) && - ((map->rm_pt < 96 && imp->ianacode < 96) || (map->rm_pt > 96 && imp->ianacode > 96)); + ((map->rm_pt < 96 && imp->ianacode < 96) || (map->rm_pt > 95 && imp->ianacode > 95)); } else { match = 0; } @@ -8440,7 +8440,7 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess } else { if (map->rm_encoding) { match = !strcasecmp(map->rm_encoding, imp->iananame) && - ((map->rm_pt < 96 && imp->ianacode < 96) || (map->rm_pt > 96 && imp->ianacode > 96)); + ((map->rm_pt < 96 && imp->ianacode < 96) || (map->rm_pt > 95 && imp->ianacode > 95)); } else { match = 0; } @@ -8487,7 +8487,7 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess } else { if (map->rm_encoding) { match = !strcasecmp(map->rm_encoding, imp->iananame) && - ((map->rm_pt < 96 && imp->ianacode < 96) || (map->rm_pt > 96 && imp->ianacode > 96)); + ((map->rm_pt < 96 && imp->ianacode < 96) || (map->rm_pt > 95 && imp->ianacode > 95)); } else { match = 0; } From 1f5bb3470dbbe7d1582b7783661afa0928794b54 Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Wed, 17 Sep 2014 11:13:15 -0500 Subject: [PATCH 57/57] mod_skinny: avoid truncation of non-null-terminated strings in protocol --- src/mod/endpoints/mod_skinny/skinny_protocol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.c b/src/mod/endpoints/mod_skinny/skinny_protocol.c index 5f3a831345..fc4ee532a0 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.c +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.c @@ -501,7 +501,7 @@ switch_status_t perform_send_register_ack(listener_t *listener, skinny_create_message(message, REGISTER_ACK_MESSAGE, reg_ack); message->data.reg_ack.keep_alive = keep_alive; - switch_copy_string(message->data.reg_ack.date_format, date_format, 6); + memcpy(message->data.reg_ack.date_format, date_format, 6); switch_copy_string(message->data.reg_ack.reserved, reserved, 2); message->data.reg_ack.secondary_keep_alive = keep_alive; switch_copy_string(message->data.reg_ack.reserved2, reserved2, 4); @@ -871,7 +871,7 @@ switch_status_t perform_send_version(listener_t *listener, skinny_create_message(message, VERSION_MESSAGE, version); - switch_copy_string(message->data.version.version, version, 16); + memcpy(message->data.version.version, version, 16); skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Send Version with Version(%s)\n", version);