Merge branch 'master' of git.sangoma.com:smg_freeswitch

This commit is contained in:
Moises Silva 2011-01-18 13:14:25 -05:00
commit 44ac5d8b99
16 changed files with 556 additions and 119 deletions

View File

@ -1,3 +1,3 @@
en-us-callie 1.0.13 en-us-callie 1.0.14
ru-RU-elena 1.0.12 ru-RU-elena 1.0.12

View File

@ -0,0 +1,339 @@
##############################################################################
# Copyright and license
##############################################################################
#
# Spec file for package freeswitch-sounds-en-us-callie (version 1.0.12-8)
#
# Copyright (c) 2009 Patrick Laimbock
# Some fixes and additions (c) 2011 Michal Bielicki
# 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
##############################################################################
%define version 1.0.14
%define release 1
%define fsname freeswitch
# you could add a version number to be more strict
%define prefix /opt/freeswitch
%define _prefix %{prefix}
##############################################################################
# General
##############################################################################
Summary: FreeSWITCH en-us Callie prompts
Name: freeswitch-sounds-en-us-callie
Version: %{version}
Release: %{release}%{?dist}
License: MPL
Group: Applications/Communications
Packager: Patrick Laimbock <vc-rpms@voipconsulting.nl>
URL: http://www.freeswitch.org
Source0:http://files.freeswitch.org/%{name}-48000-%{version}.tar.gz
BuildArch: noarch
BuildRequires: sox
Requires: freeswitch
Requires: freeswitch-sounds-en-us-callie-48000
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
FreeSWITCH 48kHz en-us Callie prompts plus, during the installation,
it will also install locally generated 8KHz, 16KHz and 32KHz prompts
%package -n freeswitch-sounds-en-us-callie-8000
Summary: FreeSWITCH 8kHz en-us Callie prompts
Group: Applications/Communications
BuildArch: noarch
Requires: %{fsname}
%description -n freeswitch-sounds-en-us-callie-8000
FreeSWITCH 8kHz en-us Callie prompts
%package -n freeswitch-sounds-en-us-callie-16000
Summary: FreeSWITCH 16kHz en-us Callie prompts
Group: Applications/Communications
BuildArch: noarch
Requires: %{fsname}
%description -n freeswitch-sounds-en-us-callie-16000
FreeSWITCH 16kHz en-us Callie prompts
%package -n freeswitch-sounds-en-us-callie-32000
Summary: FreeSWITCH 32kHz en-us Callie prompts
Group: Applications/Communications
BuildArch: noarch
Requires: %{fsname}
%description -n freeswitch-sounds-en-us-callie-32000
FreeSWITCH 32kHz en-us Callie prompts
%package -n freeswitch-sounds-en-us-callie-48000
Summary: FreeSWITCH 48kHz en-us Callie prompts
Group: Applications/Communications
BuildArch: noarch
Requires: %{fsname}
%description -n freeswitch-sounds-en-us-callie-48000
FreeSWITCH 48kHz en-us Callie prompts
%package -n freeswitch-sounds-en-us-callie-all
Summary: FreeSWITCH en-us Callie prompts
Group: Applications/Communications
BuildArch: noarch
Requires: %{fsname}
Requires: freeswitch-sounds-en-us-callie-8000 = %{version}
Requires: freeswitch-sounds-en-us-callie-16000 = %{version}
Requires: freeswitch-sounds-en-us-callie-32000 = %{version}
Requires: freeswitch-sounds-en-us-callie-48000 = %{version}
%description -n freeswitch-sounds-en-us-callie-all
FreeSWITCH Callie prompts package that pulls in the 8KHz, 16KHz,
32KHz and 48KHz RPMs
##############################################################################
# Prep
##############################################################################
%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
##############################################################################
# Build
##############################################################################
%build
# nothing to do here
##############################################################################
# Install
##############################################################################
%install
[ "%{buildroot}" != '/' ] && rm -rf %{buildroot}
# create the sounds directories
%{__install} -d -m 0750 %{buildroot}%{_prefix}/sounds/en/us/callie
pushd us/callie
# first install the 48KHz sounds
%{__cp} -prv ./* %{buildroot}%{_prefix}/sounds/en/us/callie
# now resample the 48KHz ones to 8KHz, 16KHz and 32KHz
./buildsounds-callie.sh %{buildroot}%{_prefix}/sounds/en/us/callie
popd
##############################################################################
# Clean
##############################################################################
%clean
[ "%{buildroot}" != '/' ] && rm -rf %{buildroot}
##############################################################################
# Post
##############################################################################
%post
# generate the 8KHz, 16KHz and 32KHz prompts from the 48KHz ones
cd %{_prefix}/sounds/en/us/callie
./buildsounds-callie.sh %{_prefix}/sounds/en/us/callie
##############################################################################
# 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
##############################################################################
%files
%defattr(-,root,root)
%attr(0750,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/buildsounds-callie.sh
%files -n freeswitch-sounds-en-us-callie-8000
%defattr(-,root,root,-)
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ascii/8000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/base256/8000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/conference/8000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/currency/8000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/digits/8000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/directory/8000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ivr/8000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/misc/8000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/phonetic-ascii/8000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/time/8000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/voicemail/8000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/zrtp/8000
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ascii/8000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/base256/8000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/conference/8000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/currency/8000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/digits/8000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/directory/8000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ivr/8000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/misc/8000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/phonetic-ascii/8000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/time/8000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/voicemail/8000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/zrtp/8000/*.wav
%files -n freeswitch-sounds-en-us-callie-16000
%defattr(-,root,root,-)
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ascii/16000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/base256/16000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/conference/16000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/currency/16000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/digits/16000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/directory/16000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ivr/16000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/misc/16000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/phonetic-ascii/16000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/time/16000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/voicemail/16000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/zrtp/16000
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ascii/16000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/base256/16000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/conference/16000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/currency/16000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/digits/16000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/directory/16000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ivr/16000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/misc/16000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/phonetic-ascii/16000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/time/16000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/voicemail/16000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/zrtp/16000/*.wav
%files -n freeswitch-sounds-en-us-callie-32000
%defattr(-,root,root,-)
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ascii/32000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/base256/32000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/conference/32000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/currency/32000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/digits/32000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/directory/32000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ivr/32000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/misc/32000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/phonetic-ascii/32000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/time/32000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/voicemail/32000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/zrtp/32000
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ascii/32000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/base256/32000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/conference/32000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/currency/32000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/digits/32000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/directory/32000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ivr/32000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/misc/32000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/phonetic-ascii/32000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/time/32000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/voicemail/32000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/zrtp/32000/*.wav
%files -n freeswitch-sounds-en-us-callie-48000
%defattr(-,root,root,-)
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ascii/48000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/base256/48000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/conference/48000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/currency/48000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/digits/48000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/directory/48000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ivr/48000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/misc/48000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/phonetic-ascii/48000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/time/48000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/voicemail/48000
%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/zrtp/48000
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ascii/48000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/base256/48000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/conference/48000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/currency/48000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/digits/48000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/directory/48000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ivr/48000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/misc/48000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/phonetic-ascii/48000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/time/48000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/voicemail/48000/*.wav
%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/zrtp/48000/*.wav
%files -n freeswitch-sounds-en-us-callie-all
##############################################################################
# Changelog
##############################################################################
%changelog
* Tue Jan 18 2011 Michal Bielicki <michal.bielicki@seventhsignal.de> - 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 <vc-rpms@voipconsulting.nl> - 1.0.12-8
- update perms and user/group to sync with the old situation
* Wed Dec 16 2009 Patrick Laimbock <vc-rpms@voipconsulting.nl> - 1.0.12-7
- make main package require freeswitch-sounds-en-us-callie-48000 and
- generate the 8KHz, 16KHz and 32KHz sounds from there
- add license to spec file
* Wed Dec 16 2009 Patrick Laimbock <vc-rpms@voipconsulting.nl> - 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 <vc-rpms@voipconsulting.nl> - 1.0.12-4
- add freeswitch-sounds-en-us-callie-all package that pulls in the 8KHz,
- 16KHz, 32KHz and 48KHz RPM packages
* Tue Dec 15 2009 Patrick Laimbock <vc-rpms@voipconsulting.nl> - 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-callie.sh in post to generate 8KHz, 16KHz and 32KHz prompts
* Tue Dec 15 2009 Patrick Laimbock <vc-rpms@voipconsulting.nl> - 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 <vc-rpms@voipconsulting.nl> - 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

View File

@ -89,8 +89,13 @@ BuildRequires: libtool >= 1.5.17
BuildRequires: ncurses-devel BuildRequires: ncurses-devel
BuildRequires: openssl-devel BuildRequires: openssl-devel
BuildRequires: perl BuildRequires: perl
%if 0%{?fedora_version} >= 8
BuildRequires: perl-ExtUtils-Embed
%endif
BuildRequires: pkgconfig BuildRequires: pkgconfig
%if %{_vendor} == redhat && 0%{?fedora} <= 6
BuildRequires: termcap BuildRequires: termcap
%endif
BuildRequires: unixODBC-devel BuildRequires: unixODBC-devel
BuildRequires: gdbm-devel BuildRequires: gdbm-devel
BuildRequires: db4-devel BuildRequires: db4-devel
@ -893,7 +898,7 @@ fi
%files python %files python
%defattr(-,freeswitch,daemon) %defattr(-,freeswitch,daemon)
%{prefix}/mod/mod_python*.so* %{prefix}/mod/mod_python*.so*
%attr(0644, root, bin) /usr/lib/python2.4/site-packages/freeswitch.py* %attr(0644, root, bin) /usr/lib/python*/site-packages/freeswitch.py*
%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/python.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/python.conf.xml
@ -951,6 +956,8 @@ fi
# #
###################################################################################################################### ######################################################################################################################
%changelog %changelog
* Tue Jan 18 2011 - michal.bielicki@seventhsignal.de
- Fedora adjustments
* Fri Oct 15 2010 - michal.bielicki@seventhsignal.de * Fri Oct 15 2010 - michal.bielicki@seventhsignal.de
- added mod_curl - added mod_curl
* Sat Oct 09 2010 - michal.bielicki@seventhsignal.de * Sat Oct 09 2010 - michal.bielicki@seventhsignal.de

View File

@ -404,38 +404,38 @@ static __inline__ void ftdm_std_free(void *pool, void *ptr)
free(ptr); free(ptr);
} }
static void ftdm_set_echocancel_call_begin(ftdm_channel_t *chan) FT_DECLARE(void) ftdm_set_echocancel_call_begin(ftdm_channel_t *chan)
{ {
ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan);
if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC)) { if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC)) {
if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE)) { if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE)) {
/* If the ec is disabled on idle, we need to enable it unless is a digital call */
if (caller_data->bearer_capability != FTDM_BEARER_CAP_64K_UNRESTRICTED) { if (caller_data->bearer_capability != FTDM_BEARER_CAP_64K_UNRESTRICTED) {
ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Enabling ec for call in channel state %s\n", ftdm_channel_state2str(chan->state));
ftdm_channel_command(chan, FTDM_COMMAND_ENABLE_ECHOCANCEL, NULL); ftdm_channel_command(chan, FTDM_COMMAND_ENABLE_ECHOCANCEL, NULL);
} }
} else { } else {
/* If the ec is enabled on idle, we do nothing unless is a digital call that needs it disabled */
if (caller_data->bearer_capability == FTDM_BEARER_CAP_64K_UNRESTRICTED) { if (caller_data->bearer_capability == FTDM_BEARER_CAP_64K_UNRESTRICTED) {
ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Disabling ec for digital call in channel state %s\n", ftdm_channel_state2str(chan->state));
ftdm_channel_command(chan, FTDM_COMMAND_DISABLE_ECHOCANCEL, NULL); ftdm_channel_command(chan, FTDM_COMMAND_DISABLE_ECHOCANCEL, NULL);
} }
} }
} }
} }
static void ftdm_set_echocancel_call_end(ftdm_channel_t *chan) FT_DECLARE(void) ftdm_set_echocancel_call_end(ftdm_channel_t *chan)
{ {
ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan);
if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC)) { if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC)) {
if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE)) { if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE)) {
if (caller_data->bearer_capability != FTDM_BEARER_CAP_64K_UNRESTRICTED) { ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Disabling ec on call end in channel state %s\n", ftdm_channel_state2str(chan->state));
ftdm_channel_command(chan, FTDM_COMMAND_DISABLE_ECHOCANCEL, NULL); ftdm_channel_command(chan, FTDM_COMMAND_DISABLE_ECHOCANCEL, NULL);
}
} else { } else {
if (caller_data->bearer_capability == FTDM_BEARER_CAP_64K_UNRESTRICTED) { ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Enabling ec back on call end in channel state %s\n", ftdm_channel_state2str(chan->state));
ftdm_channel_command(chan, FTDM_COMMAND_ENABLE_ECHOCANCEL, NULL); ftdm_channel_command(chan, FTDM_COMMAND_ENABLE_ECHOCANCEL, NULL);
} }
} }
} }
}
FT_DECLARE_DATA ftdm_memory_handler_t g_ftdm_mem_handler = FT_DECLARE_DATA ftdm_memory_handler_t g_ftdm_mem_handler =
{ {
@ -2417,8 +2417,6 @@ static ftdm_status_t _ftdm_channel_call_place_nl(const char *file, const char *f
ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel"); ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel");
ftdm_assert_return(ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND), FTDM_FAIL, "Call place, but outbound flag not set\n"); ftdm_assert_return(ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND), FTDM_FAIL, "Call place, but outbound flag not set\n");
ftdm_set_echocancel_call_begin(ftdmchan);
if (!ftdmchan->span->outgoing_call) { if (!ftdmchan->span->outgoing_call) {
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "outgoing_call method not implemented in this span!\n"); ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "outgoing_call method not implemented in this span!\n");
status = FTDM_ENOSYS; status = FTDM_ENOSYS;
@ -5548,21 +5546,47 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t
} }
break; break;
case FTDM_SIGEVENT_PROGRESS_MEDIA:
{
/* test signaling module compliance */
if (sigmsg->channel->state != FTDM_CHANNEL_STATE_PROGRESS_MEDIA) {
ftdm_log_chan(sigmsg->channel, FTDM_LOG_WARNING, "FTDM_SIGEVENT_PROGRESS_MEDIA sent in state %s\n", ftdm_channel_state2str(sigmsg->channel->state));
}
}
break;
case FTDM_SIGEVENT_UP:
{
/* test signaling module compliance */
if (sigmsg->channel->state != FTDM_CHANNEL_STATE_UP) {
ftdm_log_chan(sigmsg->channel, FTDM_LOG_WARNING, "FTDM_SIGEVENT_UP sent in state %s\n", ftdm_channel_state2str(sigmsg->channel->state));
}
}
break;
case FTDM_SIGEVENT_STOP: case FTDM_SIGEVENT_STOP:
{
/* TODO: we could test for compliance here and check the state is FTDM_CHANNEL_STATE_TERMINATING
* but several modules need to be updated first */
/* if the call was never started, do not send SIGEVENT_STOP
this happens for FXS devices in ftmod_analog which blindly send SIGEVENT_STOP, we should fix it there ... */
if (!ftdm_test_flag(sigmsg->channel, FTDM_CHANNEL_CALL_STARTED)) { if (!ftdm_test_flag(sigmsg->channel, FTDM_CHANNEL_CALL_STARTED)) {
/* this happens for FXS devices which blindly send SIGEVENT_STOP, we should fix it there ... */
ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Ignoring SIGEVENT_STOP since user never knew about a call in this channel\n"); ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Ignoring SIGEVENT_STOP since user never knew about a call in this channel\n");
goto done; goto done;
} }
if (ftdm_test_flag(sigmsg->channel, FTDM_CHANNEL_USER_HANGUP)) { if (ftdm_test_flag(sigmsg->channel, FTDM_CHANNEL_USER_HANGUP)) {
ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Ignoring SIGEVENT_STOP since user already requested hangup\n"); ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Ignoring SIGEVENT_STOP since user already requested hangup\n");
goto done; goto done;
} }
if (sigmsg->channel->state == FTDM_CHANNEL_STATE_TERMINATING) { if (sigmsg->channel->state == FTDM_CHANNEL_STATE_TERMINATING) {
ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Scheduling safety hangup timer\n"); ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Scheduling safety hangup timer\n");
/* if the user does not move us to hangup in 2 seconds, we will do it ourselves */ /* if the user does not move us to hangup in 2 seconds, we will do it ourselves */
ftdm_sched_timer(globals.timingsched, "safety-hangup", FORCE_HANGUP_TIMER, execute_safety_hangup, sigmsg->channel, &sigmsg->channel->hangup_timer); ftdm_sched_timer(globals.timingsched, "safety-hangup", FORCE_HANGUP_TIMER, execute_safety_hangup, sigmsg->channel, &sigmsg->channel->hangup_timer);
} }
}
break; break;
default: default:

View File

@ -70,13 +70,13 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const c
if (state == FTDM_CHANNEL_STATE_PROGRESS) { if (state == FTDM_CHANNEL_STATE_PROGRESS) {
ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS); ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS);
} else if (state == FTDM_CHANNEL_STATE_UP) {
ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS);
ftdm_set_flag(fchan, FTDM_CHANNEL_MEDIA);
ftdm_set_flag(fchan, FTDM_CHANNEL_ANSWERED);
} else if (state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { } else if (state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) {
ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS); ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS);
ftdm_set_flag(fchan, FTDM_CHANNEL_MEDIA); ftdm_test_and_set_media(fchan);
} else if (state == FTDM_CHANNEL_STATE_UP) {
ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS);
ftdm_set_flag(fchan, FTDM_CHANNEL_ANSWERED);
ftdm_test_and_set_media(fchan);
} else if (state == FTDM_CHANNEL_STATE_DIALING) { } else if (state == FTDM_CHANNEL_STATE_DIALING) {
ftdm_sigmsg_t msg; ftdm_sigmsg_t msg;
memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg));

View File

@ -647,9 +647,6 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan)
return; return;
} }
/* mark the channel in use (so no outgoing calls can be placed here) */
ftdm_channel_use(ftdmchan);
memset(ftdmchan->caller_data.dnis.digits, 0, sizeof(ftdmchan->caller_data.collected)); memset(ftdmchan->caller_data.dnis.digits, 0, sizeof(ftdmchan->caller_data.collected));
memset(ftdmchan->caller_data.ani.digits, 0, sizeof(ftdmchan->caller_data.collected)); memset(ftdmchan->caller_data.ani.digits, 0, sizeof(ftdmchan->caller_data.collected));

View File

@ -326,9 +326,11 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_
ftdm_set_ton(val, &span->default_caller_data.rdnis.type); ftdm_set_ton(val, &span->default_caller_data.rdnis.type);
} else if (!strcasecmp(var, "outbound-rdnis-npi")) { } else if (!strcasecmp(var, "outbound-rdnis-npi")) {
ftdm_set_npi(val, &span->default_caller_data.rdnis.plan); ftdm_set_npi(val, &span->default_caller_data.rdnis.plan);
} else if (!strcasecmp(var, "outbound-bearer_cap")) { } else if (!strcasecmp(var, "outbound-bearer_cap") ||
!strcasecmp(var, "outbound-bc-transfer-cap")) {
ftdm_set_bearer_capability(val, (uint8_t*)&span->default_caller_data.bearer_capability); ftdm_set_bearer_capability(val, (uint8_t*)&span->default_caller_data.bearer_capability);
} else if (!strcasecmp(var, "outbound-bearer_layer1")) { } else if (!strcasecmp(var, "outbound-bearer_layer1") ||
!strcasecmp(var, "outbound-bc-user-layer1")) {
ftdm_set_bearer_layer1(val, (uint8_t*)&span->default_caller_data.bearer_layer1); ftdm_set_bearer_layer1(val, (uint8_t*)&span->default_caller_data.bearer_layer1);
} else if (!strcasecmp(var, "channel-restart-on-link-up")) { } else if (!strcasecmp(var, "channel-restart-on-link-up")) {
parse_yesno(var, val, &signal_data->restart_opt); parse_yesno(var, val, &signal_data->restart_opt);

View File

@ -230,6 +230,8 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start
ftdm_channel_t *chan; ftdm_channel_t *chan;
ftdm_socket_t sockfd = FTDM_INVALID_SOCKET; ftdm_socket_t sockfd = FTDM_INVALID_SOCKET;
const char *dtmf = "none"; const char *dtmf = "none";
const char *hwec_str = "none";
const char *hwec_idle = "none";
if (!strncasecmp(span->name, "smg_prid_nfas", 8) && span->trunk_type == FTDM_TRUNK_T1 && x == 24) { if (!strncasecmp(span->name, "smg_prid_nfas", 8) && span->trunk_type == FTDM_TRUNK_T1 && x == 24) {
#ifdef LIBSANGOMA_VERSION #ifdef LIBSANGOMA_VERSION
sockfd = __tdmv_api_open_span_chan(spanno, x); sockfd = __tdmv_api_open_span_chan(spanno, x);
@ -271,6 +273,8 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start
|| type == FTDM_CHAN_TYPE_B) { || type == FTDM_CHAN_TYPE_B) {
int err; int err;
hwec_str = "unavailable";
hwec_idle = "enabled";
dtmf = "software"; dtmf = "software";
err = sangoma_tdm_get_hw_coding(chan->sockfd, &tdm_api); err = sangoma_tdm_get_hw_coding(chan->sockfd, &tdm_api);
@ -289,6 +293,7 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start
err = sangoma_tdm_get_hw_ec(chan->sockfd, &tdm_api); err = sangoma_tdm_get_hw_ec(chan->sockfd, &tdm_api);
if (err > 0) { if (err > 0) {
hwec_str = "available";
ftdm_channel_set_feature(chan, FTDM_CHANNEL_FEATURE_HWEC); ftdm_channel_set_feature(chan, FTDM_CHANNEL_FEATURE_HWEC);
} }
@ -296,6 +301,7 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start
err = sangoma_tdm_get_hwec_persist_status(chan->sockfd, &tdm_api); err = sangoma_tdm_get_hwec_persist_status(chan->sockfd, &tdm_api);
if (err == 0) { if (err == 0) {
ftdm_channel_set_feature(chan, FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE); ftdm_channel_set_feature(chan, FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE);
hwec_idle = "disabled";
} }
#else #else
if (span->trunk_type == FTDM_TRUNK_BRI || span->trunk_type == FTDM_TRUNK_BRI_PTMP) { if (span->trunk_type == FTDM_TRUNK_BRI || span->trunk_type == FTDM_TRUNK_BRI_PTMP) {
@ -365,7 +371,8 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start
ftdm_copy_string(chan->chan_number, number, sizeof(chan->chan_number)); ftdm_copy_string(chan->chan_number, number, sizeof(chan->chan_number));
} }
configured++; configured++;
ftdm_log_chan(chan, FTDM_LOG_INFO, "Configured wanpipe device fd:%d DTMF: %s\n", sockfd, dtmf); ftdm_log_chan(chan, FTDM_LOG_INFO, "Configured wanpipe device FD: %d, DTMF: %s, HWEC: %s, HWEC_IDLE: %s\n",
sockfd, dtmf, hwec_str, hwec_idle);
} else { } else {
ftdm_log(FTDM_LOG_ERROR, "ftdm_span_add_channel failed for wanpipe span %d channel %d\n", spanno, x); ftdm_log(FTDM_LOG_ERROR, "ftdm_span_add_channel failed for wanpipe span %d channel %d\n", spanno, x);

View File

@ -574,84 +574,84 @@ typedef struct ftdm_iterator ftdm_iterator_t;
/*! \brief Channel commands that can be executed through ftdm_channel_command() */ /*! \brief Channel commands that can be executed through ftdm_channel_command() */
typedef enum { typedef enum {
FTDM_COMMAND_NOOP, FTDM_COMMAND_NOOP = 0,
FTDM_COMMAND_SET_INTERVAL, FTDM_COMMAND_SET_INTERVAL = 1,
FTDM_COMMAND_GET_INTERVAL, FTDM_COMMAND_GET_INTERVAL = 2,
FTDM_COMMAND_SET_CODEC, FTDM_COMMAND_SET_CODEC = 3,
FTDM_COMMAND_GET_CODEC, FTDM_COMMAND_GET_CODEC = 4,
FTDM_COMMAND_SET_NATIVE_CODEC, FTDM_COMMAND_SET_NATIVE_CODEC = 5,
FTDM_COMMAND_GET_NATIVE_CODEC, FTDM_COMMAND_GET_NATIVE_CODEC = 6,
FTDM_COMMAND_ENABLE_DTMF_DETECT, FTDM_COMMAND_ENABLE_DTMF_DETECT = 7,
FTDM_COMMAND_DISABLE_DTMF_DETECT, FTDM_COMMAND_DISABLE_DTMF_DETECT = 8,
FTDM_COMMAND_SEND_DTMF, FTDM_COMMAND_SEND_DTMF = 9,
FTDM_COMMAND_SET_DTMF_ON_PERIOD, FTDM_COMMAND_SET_DTMF_ON_PERIOD = 10,
FTDM_COMMAND_GET_DTMF_ON_PERIOD, FTDM_COMMAND_GET_DTMF_ON_PERIOD = 11,
FTDM_COMMAND_SET_DTMF_OFF_PERIOD, FTDM_COMMAND_SET_DTMF_OFF_PERIOD = 12,
FTDM_COMMAND_GET_DTMF_OFF_PERIOD, FTDM_COMMAND_GET_DTMF_OFF_PERIOD = 13,
FTDM_COMMAND_GENERATE_RING_ON, FTDM_COMMAND_GENERATE_RING_ON = 14,
FTDM_COMMAND_GENERATE_RING_OFF, FTDM_COMMAND_GENERATE_RING_OFF = 15,
FTDM_COMMAND_OFFHOOK, FTDM_COMMAND_OFFHOOK = 16,
FTDM_COMMAND_ONHOOK, FTDM_COMMAND_ONHOOK = 17,
FTDM_COMMAND_FLASH, FTDM_COMMAND_FLASH = 18,
FTDM_COMMAND_WINK, FTDM_COMMAND_WINK = 19,
FTDM_COMMAND_ENABLE_PROGRESS_DETECT, FTDM_COMMAND_ENABLE_PROGRESS_DETECT = 20,
FTDM_COMMAND_DISABLE_PROGRESS_DETECT, FTDM_COMMAND_DISABLE_PROGRESS_DETECT = 21,
/*!< Start tracing input and output from channel to the given file */ /*!< Start tracing input and output from channel to the given file */
FTDM_COMMAND_TRACE_INPUT, FTDM_COMMAND_TRACE_INPUT = 22,
FTDM_COMMAND_TRACE_OUTPUT, FTDM_COMMAND_TRACE_OUTPUT = 23,
/*!< Stop both Input and Output trace, closing the files */ /*!< Stop both Input and Output trace, closing the files */
FTDM_COMMAND_TRACE_END_ALL, FTDM_COMMAND_TRACE_END_ALL = 24,
/*!< Enable DTMF debugging */ /*!< Enable DTMF debugging */
FTDM_COMMAND_ENABLE_DEBUG_DTMF, FTDM_COMMAND_ENABLE_DEBUG_DTMF = 25,
/*!< Disable DTMF debugging (if not disabled explicitly, it is disabled automatically when calls hangup) */ /*!< Disable DTMF debugging (if not disabled explicitly, it is disabled automatically when calls hangup) */
FTDM_COMMAND_DISABLE_DEBUG_DTMF, FTDM_COMMAND_DISABLE_DEBUG_DTMF = 26,
/*!< Start dumping all input to a circular buffer. The size of the circular buffer can be specified, default used otherwise */ /*!< Start dumping all input to a circular buffer. The size of the circular buffer can be specified, default used otherwise */
FTDM_COMMAND_ENABLE_INPUT_DUMP, FTDM_COMMAND_ENABLE_INPUT_DUMP = 27,
/*!< Stop dumping all input to a circular buffer. */ /*!< Stop dumping all input to a circular buffer. */
FTDM_COMMAND_DISABLE_INPUT_DUMP, FTDM_COMMAND_DISABLE_INPUT_DUMP = 28,
/*!< Start dumping all output to a circular buffer. The size of the circular buffer can be specified, default used otherwise */ /*!< Start dumping all output to a circular buffer. The size of the circular buffer can be specified, default used otherwise */
FTDM_COMMAND_ENABLE_OUTPUT_DUMP, FTDM_COMMAND_ENABLE_OUTPUT_DUMP = 29,
/*!< Stop dumping all output to a circular buffer. */ /*!< Stop dumping all output to a circular buffer. */
FTDM_COMMAND_DISABLE_OUTPUT_DUMP, FTDM_COMMAND_DISABLE_OUTPUT_DUMP = 30,
/*!< Dump the current input circular buffer to the specified FILE* structure */ /*!< Dump the current input circular buffer to the specified FILE* structure */
FTDM_COMMAND_DUMP_INPUT, FTDM_COMMAND_DUMP_INPUT = 31,
/*!< Dump the current output circular buffer to the specified FILE* structure */ /*!< Dump the current output circular buffer to the specified FILE* structure */
FTDM_COMMAND_DUMP_OUTPUT, FTDM_COMMAND_DUMP_OUTPUT = 32,
FTDM_COMMAND_ENABLE_CALLERID_DETECT, FTDM_COMMAND_ENABLE_CALLERID_DETECT = 33,
FTDM_COMMAND_DISABLE_CALLERID_DETECT, FTDM_COMMAND_DISABLE_CALLERID_DETECT = 34,
FTDM_COMMAND_ENABLE_ECHOCANCEL, FTDM_COMMAND_ENABLE_ECHOCANCEL = 35,
FTDM_COMMAND_DISABLE_ECHOCANCEL, FTDM_COMMAND_DISABLE_ECHOCANCEL = 36,
FTDM_COMMAND_ENABLE_ECHOTRAIN, FTDM_COMMAND_ENABLE_ECHOTRAIN = 37,
FTDM_COMMAND_DISABLE_ECHOTRAIN, FTDM_COMMAND_DISABLE_ECHOTRAIN = 38,
FTDM_COMMAND_SET_CAS_BITS, FTDM_COMMAND_SET_CAS_BITS = 39,
FTDM_COMMAND_GET_CAS_BITS, FTDM_COMMAND_GET_CAS_BITS = 40,
FTDM_COMMAND_SET_RX_GAIN, FTDM_COMMAND_SET_RX_GAIN = 41,
FTDM_COMMAND_GET_RX_GAIN, FTDM_COMMAND_GET_RX_GAIN = 42,
FTDM_COMMAND_SET_TX_GAIN, FTDM_COMMAND_SET_TX_GAIN = 43,
FTDM_COMMAND_GET_TX_GAIN, FTDM_COMMAND_GET_TX_GAIN = 44,
FTDM_COMMAND_FLUSH_TX_BUFFERS, FTDM_COMMAND_FLUSH_TX_BUFFERS = 45,
FTDM_COMMAND_FLUSH_RX_BUFFERS, FTDM_COMMAND_FLUSH_RX_BUFFERS = 46,
FTDM_COMMAND_FLUSH_BUFFERS, FTDM_COMMAND_FLUSH_BUFFERS = 47,
FTDM_COMMAND_FLUSH_IOSTATS, FTDM_COMMAND_FLUSH_IOSTATS = 48,
FTDM_COMMAND_SET_PRE_BUFFER_SIZE, FTDM_COMMAND_SET_PRE_BUFFER_SIZE = 49,
FTDM_COMMAND_SET_LINK_STATUS, FTDM_COMMAND_SET_LINK_STATUS = 50,
FTDM_COMMAND_GET_LINK_STATUS, FTDM_COMMAND_GET_LINK_STATUS = 51,
FTDM_COMMAND_ENABLE_LOOP, FTDM_COMMAND_ENABLE_LOOP = 52,
FTDM_COMMAND_DISABLE_LOOP, FTDM_COMMAND_DISABLE_LOOP = 53,
FTDM_COMMAND_SET_RX_QUEUE_SIZE, FTDM_COMMAND_SET_RX_QUEUE_SIZE = 54,
FTDM_COMMAND_SET_TX_QUEUE_SIZE, FTDM_COMMAND_SET_TX_QUEUE_SIZE = 55,
FTDM_COMMAND_SET_POLARITY, FTDM_COMMAND_SET_POLARITY = 56,
FTDM_COMMAND_COUNT, FTDM_COMMAND_COUNT,
} ftdm_command_t; } ftdm_command_t;

View File

@ -622,6 +622,9 @@ FT_DECLARE(ftdm_status_t) ftdm_span_trigger_signals(const ftdm_span_t *span);
/*! \brief clear the tone detector state */ /*! \brief clear the tone detector state */
FT_DECLARE(void) ftdm_channel_clear_detected_tones(ftdm_channel_t *ftdmchan); FT_DECLARE(void) ftdm_channel_clear_detected_tones(ftdm_channel_t *ftdmchan);
/* start/stop echo cancelling at the beginning/end of a call */
FT_DECLARE(void) ftdm_set_echocancel_call_begin(ftdm_channel_t *chan);
FT_DECLARE(void) ftdm_set_echocancel_call_end(ftdm_channel_t *chan);
/*! /*!
\brief Assert condition \brief Assert condition
@ -677,6 +680,14 @@ FT_DECLARE(void) ftdm_channel_clear_detected_tones(ftdm_channel_t *ftdmchan);
#define ftdm_span_lock(span) ftdm_mutex_lock(span->mutex) #define ftdm_span_lock(span) ftdm_mutex_lock(span->mutex)
#define ftdm_span_unlock(span) ftdm_mutex_unlock(span->mutex) #define ftdm_span_unlock(span) ftdm_mutex_unlock(span->mutex)
#define ftdm_test_and_set_media(fchan) \
do { \
if (!ftdm_test_flag((fchan), FTDM_CHANNEL_MEDIA)) { \
ftdm_set_flag((fchan), FTDM_CHANNEL_MEDIA); \
ftdm_set_echocancel_call_begin((fchan)); \
} \
} while (0);
FT_DECLARE_DATA extern const char *FTDM_LEVEL_NAMES[9]; FT_DECLARE_DATA extern const char *FTDM_LEVEL_NAMES[9];
static __inline__ void ftdm_abort(void) static __inline__ void ftdm_abort(void)

View File

@ -227,16 +227,11 @@ typedef enum {
#define FTDM_CHANNEL_OUTBOUND (1ULL << 18) #define FTDM_CHANNEL_OUTBOUND (1ULL << 18)
#define FTDM_CHANNEL_SUSPENDED (1ULL << 19) #define FTDM_CHANNEL_SUSPENDED (1ULL << 19)
#define FTDM_CHANNEL_3WAY (1ULL << 20) #define FTDM_CHANNEL_3WAY (1ULL << 20)
/* this 3 flags are really nonsense used by boost module only, as soon
* as we deprecate/delete boost module we can get rid of them
* ==================
* */
#define FTDM_CHANNEL_PROGRESS (1ULL << 21) #define FTDM_CHANNEL_PROGRESS (1ULL << 21)
/*!< There is media on the channel already */
#define FTDM_CHANNEL_MEDIA (1ULL << 22) #define FTDM_CHANNEL_MEDIA (1ULL << 22)
/*!< The channel was answered */
#define FTDM_CHANNEL_ANSWERED (1ULL << 23) #define FTDM_CHANNEL_ANSWERED (1ULL << 23)
/* ================== */
#define FTDM_CHANNEL_MUTE (1ULL << 24) #define FTDM_CHANNEL_MUTE (1ULL << 24)
#define FTDM_CHANNEL_USE_RX_GAIN (1ULL << 25) #define FTDM_CHANNEL_USE_RX_GAIN (1ULL << 25)
#define FTDM_CHANNEL_USE_TX_GAIN (1ULL << 26) #define FTDM_CHANNEL_USE_TX_GAIN (1ULL << 26)

View File

@ -311,6 +311,7 @@ static void destroy_profile(const char *profile_name, switch_bool_t block)
/* Static buffer, 2 bytes */ /* Static buffer, 2 bytes */
static switch_xml_config_string_options_t config_dtmf = { NULL, 2, "[0-9#\\*]" }; static switch_xml_config_string_options_t config_dtmf = { NULL, 2, "[0-9#\\*]" };
static switch_xml_config_string_options_t config_dtmf_optional = { NULL, 2, "[0-9#\\*]?" };
static switch_xml_config_string_options_t config_login_keys = { NULL, 16, "[0-9#\\*]*" }; static switch_xml_config_string_options_t config_login_keys = { NULL, 16, "[0-9#\\*]*" };
static switch_xml_config_string_options_t config_file_ext = { NULL, 10, NULL }; static switch_xml_config_string_options_t config_file_ext = { NULL, 10, NULL };
static switch_xml_config_int_options_t config_int_0_10000 = { SWITCH_TRUE, 0, SWITCH_TRUE, 10000 }; static switch_xml_config_int_options_t config_int_0_10000 = { SWITCH_TRUE, 0, SWITCH_TRUE, 10000 };
@ -520,8 +521,8 @@ vm_profile_t *profile_set_config(vm_profile_t *profile)
SWITCH_CONFIG_SET_ITEM(profile->config[i++], "urgent-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, SWITCH_CONFIG_SET_ITEM(profile->config[i++], "urgent-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
&profile->urgent_key, "*", &config_dtmf, NULL, NULL); &profile->urgent_key, "*", &config_dtmf, NULL, NULL);
SWITCH_CONFIG_SET_ITEM(profile->config[i++], "operator-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, SWITCH_CONFIG_SET_ITEM(profile->config[i++], "operator-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
&profile->operator_key, "", &config_dtmf, NULL, NULL); &profile->operator_key, "", &config_dtmf_optional, NULL, NULL);
SWITCH_CONFIG_SET_ITEM(profile->config[i++], "vmain-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->vmain_key, "", &config_dtmf, NULL, NULL); SWITCH_CONFIG_SET_ITEM(profile->config[i++], "vmain-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->vmain_key, "", &config_dtmf_optional, NULL, NULL);
SWITCH_CONFIG_SET_ITEM(profile->config[i++], "vmain-extension", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, SWITCH_CONFIG_SET_ITEM(profile->config[i++], "vmain-extension", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
&profile->vmain_ext, "", &profile->config_str_pool, NULL, NULL); &profile->vmain_ext, "", &profile->config_str_pool, NULL, NULL);
SWITCH_CONFIG_SET_ITEM(profile->config[i++], "forward-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, SWITCH_CONFIG_SET_ITEM(profile->config[i++], "forward-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,

View File

@ -3627,7 +3627,7 @@ SWITCH_STANDARD_API(sofia_function)
"--------------------------------------------------------------------------------\n" "--------------------------------------------------------------------------------\n"
"sofia help\n" "sofia help\n"
"sofia profile <profile_name> [[start|stop|restart|rescan]|" "sofia profile <profile_name> [[start|stop|restart|rescan]|"
"flush_inbound_reg [<call_id>] [reboot]|" "flush_inbound_reg [<call_id>|<[user]@domain>] [reboot]|"
"[register|unregister] [<gateway name>|all]|" "[register|unregister] [<gateway name>|all]|"
"killgw <gateway name>|" "killgw <gateway name>|"
"[stun-auto-disable|stun-enabled] [true|false]]|" "[stun-auto-disable|stun-enabled] [true|false]]|"

View File

@ -377,6 +377,13 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
sofia_glue_check_dtmf_type(tech_pvt); sofia_glue_check_dtmf_type(tech_pvt);
if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) ||
((val = switch_channel_get_variable(tech_pvt->channel, "supress_cng")) && switch_true(val)) ||
((val = switch_channel_get_variable(tech_pvt->channel, "suppress_cng")) && switch_true(val))) {
use_cng = 0;
tech_pvt->cng_pt = 0;
}
if (!tech_pvt->payload_space) { if (!tech_pvt->payload_space) {
int i; int i;
@ -388,6 +395,13 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
tech_pvt->ianacodes[i] = imp->ianacode; tech_pvt->ianacodes[i] = imp->ianacode;
if (tech_pvt->ianacodes[i] > 64) { if (tech_pvt->ianacodes[i] > 64) {
if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95 && tech_pvt->te == tech_pvt->payload_space) {
tech_pvt->payload_space++;
}
if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) &&
tech_pvt->cng_pt && use_cng && tech_pvt->cng_pt == tech_pvt->payload_space) {
tech_pvt->payload_space++;
}
tech_pvt->ianacodes[i] = tech_pvt->payload_space++; tech_pvt->ianacodes[i] = tech_pvt->payload_space++;
} }
} }
@ -401,13 +415,6 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
verbose_sdp = 1; verbose_sdp = 1;
} }
if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) ||
((val = switch_channel_get_variable(tech_pvt->channel, "supress_cng")) && switch_true(val)) ||
((val = switch_channel_get_variable(tech_pvt->channel, "suppress_cng")) && switch_true(val))) {
use_cng = 0;
tech_pvt->cng_pt = 0;
}
if (!force && !ip && !sr if (!force && !ip && !sr
&& (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA))) { && (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA))) {
return; return;
@ -4040,7 +4047,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
sdp_attribute_t *attr; sdp_attribute_t *attr;
int first = 0, last = 0; int first = 0, last = 0;
int ptime = 0, dptime = 0, maxptime = 0, dmaxptime = 0; int ptime = 0, dptime = 0, maxptime = 0, dmaxptime = 0;
int sendonly = 0; int sendonly = 0, recvonly = 0;
int greedy = 0, x = 0, skip = 0, mine = 0; int greedy = 0, x = 0, skip = 0, mine = 0;
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
const char *val; const char *val;
@ -4108,6 +4115,19 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
if (!strcasecmp(attr->a_name, "sendonly") || !strcasecmp(attr->a_name, "inactive")) { if (!strcasecmp(attr->a_name, "sendonly") || !strcasecmp(attr->a_name, "inactive")) {
sendonly = 1; sendonly = 1;
switch_channel_set_variable(tech_pvt->channel, "media_audio_mode", "recvonly");
} else if (!strcasecmp(attr->a_name, "recvonly")) {
switch_channel_set_variable(tech_pvt->channel, "media_audio_mode", "sendonly");
recvonly = 1;
if (switch_rtp_ready(tech_pvt->rtp_session)) {
switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, 0);
tech_pvt->max_missed_hold_packets = 0;
tech_pvt->max_missed_packets = 0;
} else {
switch_channel_set_variable(tech_pvt->channel, "rtp_timeout_sec", "0");
switch_channel_set_variable(tech_pvt->channel, "rtp_hold_timeout_sec", "0");
}
} else if (sendonly < 2 && !strcasecmp(attr->a_name, "sendrecv")) { } else if (sendonly < 2 && !strcasecmp(attr->a_name, "sendrecv")) {
sendonly = 0; sendonly = 0;
} else if (!strcasecmp(attr->a_name, "ptime")) { } else if (!strcasecmp(attr->a_name, "ptime")) {
@ -4117,6 +4137,11 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
} }
} }
if (sendonly != 1 && recvonly != 1) {
switch_channel_set_variable(tech_pvt->channel, "media_audio_mode", NULL);
}
if (sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_HOLD) || if (sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_HOLD) ||
((val = switch_channel_get_variable(tech_pvt->channel, "sip_disable_hold")) && switch_true(val))) { ((val = switch_channel_get_variable(tech_pvt->channel, "sip_disable_hold")) && switch_true(val))) {
sendonly = 0; sendonly = 0;

View File

@ -606,16 +606,16 @@ void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id, int
sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,rpid,expires" sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,rpid,expires"
",user_agent,server_user,server_host,profile_name,network_ip" ",user_agent,server_user,server_host,profile_name,network_ip"
",%d from sip_registrations where call_id='%q' %s", reboot, call_id, sqlextra); ",%d from sip_registrations where call_id='%q' %s", reboot, call_id, sqlextra);
switch_safe_free(sqlextra);
switch_mutex_lock(profile->ireg_mutex); switch_mutex_lock(profile->ireg_mutex);
sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_del_callback, profile); sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_del_callback, profile);
switch_mutex_unlock(profile->ireg_mutex); switch_mutex_unlock(profile->ireg_mutex);
switch_safe_free(sql); switch_safe_free(sql);
sql = switch_mprintf("delete from sip_registrations where call_id='%q' or (sip_user='%q' and sip_host='%q')", call_id, user, host); sql = switch_mprintf("delete from sip_registrations where call_id='%q' %s", call_id, sqlextra);
sofia_glue_execute_sql_now(profile, &sql, SWITCH_FALSE); sofia_glue_execute_sql_now(profile, &sql, SWITCH_FALSE);
switch_safe_free(sqlextra);
switch_safe_free(sql); switch_safe_free(sql);
switch_safe_free(dup); switch_safe_free(dup);

View File

@ -1705,6 +1705,16 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void *
switch_channel_get_state(_peer) == CS_RESET || \ switch_channel_get_state(_peer) == CS_RESET || \
!switch_channel_test_flag(_peer, CF_ORIGINATING))) !switch_channel_test_flag(_peer, CF_ORIGINATING)))
static void wait_for_cause(switch_channel_t *channel)
{
int sanity = 5;
while (--sanity > 0 && peer_eligible(channel) && switch_channel_get_cause(channel) == SWITCH_CAUSE_NONE) {
switch_yield(10000);
}
}
SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *session, SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *session,
switch_core_session_t **bleg, switch_core_session_t **bleg,
@ -3280,6 +3290,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
} else { } else {
if (and_argc > 1) { if (and_argc > 1) {
reason = SWITCH_CAUSE_LOSE_RACE; reason = SWITCH_CAUSE_LOSE_RACE;
} else if (!switch_channel_ready(originate_status[i].peer_channel)) {
wait_for_cause(originate_status[i].peer_channel);
if (switch_channel_down(originate_status[i].peer_channel)) {
reason = switch_channel_get_cause(originate_status[i].peer_channel);
}
} else { } else {
reason = SWITCH_CAUSE_NO_ANSWER; reason = SWITCH_CAUSE_NO_ANSWER;
} }
@ -3385,6 +3400,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
} }
if (peer_channel) { if (peer_channel) {
wait_for_cause(peer_channel);
*cause = switch_channel_get_cause(peer_channel); *cause = switch_channel_get_cause(peer_channel);
} else { } else {
for (i = 0; i < and_argc; i++) { for (i = 0; i < and_argc; i++) {
@ -3435,6 +3451,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
*cause = switch_channel_get_cause(caller_channel); *cause = switch_channel_get_cause(caller_channel);
} else { } else {
*cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; *cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
for (i = 0; i < and_argc; i++) {
if (!peer_eligible(originate_status[i].peer_channel)) {
continue;
}
wait_for_cause(originate_status[i].peer_channel);
if (switch_channel_down(originate_status[i].peer_channel)) {
*cause = switch_channel_get_cause(originate_status[i].peer_channel);
break;
}
}
} }
} }
@ -3529,7 +3558,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
continue; continue;
} }
pchannel = switch_core_session_get_channel(originate_status[i].peer_session); pchannel = switch_core_session_get_channel(originate_status[i].peer_session);
wait_for_cause(pchannel);
if (switch_channel_down(pchannel)) { if (switch_channel_down(pchannel)) {
cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel)); cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel));
if (switch_stristr(cause_str, fail_on_single_reject_var)) { if (switch_stristr(cause_str, fail_on_single_reject_var)) {