Merge branch 'master' into v1.4

This commit is contained in:
Ken Rice 2014-11-03 13:51:39 -06:00
commit ace49af950
62 changed files with 1289 additions and 409 deletions

View File

@ -603,6 +603,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download LDNS", "libs\win32
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download PORTAUDIO", "libs\win32\Download PORTAUDIO.2012.vcxproj", "{C0779BCC-C037-4F58-B890-EF37BA956B3C}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download PORTAUDIO", "libs\win32\Download PORTAUDIO.2012.vcxproj", "{C0779BCC-C037-4F58-B890-EF37BA956B3C}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_vp8", "src\mod\codecs\mod_vp8\mod_vp8.2012.vcxproj", "{ABFD88E1-7710-4BCC-AC34-56038DAC9652}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_rtc", "src\mod\endpoints\mod_rtc\mod_rtc.2012.vcxproj", "{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_verto", "src\mod\endpoints\mod_verto\mod_verto.2012.vcxproj", "{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
All|Win32 = All|Win32 All|Win32 = All|Win32
@ -4043,6 +4049,58 @@ Global
{C0779BCC-C037-4F58-B890-EF37BA956B3C}.Release|x64.Build.0 = Release|Win32 {C0779BCC-C037-4F58-B890-EF37BA956B3C}.Release|x64.Build.0 = Release|Win32
{C0779BCC-C037-4F58-B890-EF37BA956B3C}.Release|x64 Setup.ActiveCfg = Release|Win32 {C0779BCC-C037-4F58-B890-EF37BA956B3C}.Release|x64 Setup.ActiveCfg = Release|Win32
{C0779BCC-C037-4F58-B890-EF37BA956B3C}.Release|x86 Setup.ActiveCfg = Release|Win32 {C0779BCC-C037-4F58-B890-EF37BA956B3C}.Release|x86 Setup.ActiveCfg = Release|Win32
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.All|Win32.ActiveCfg = Release|Win32
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.All|Win32.Build.0 = Release|Win32
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.All|x64.ActiveCfg = Release|x64
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.All|x64.Build.0 = Release|x64
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.All|x64 Setup.ActiveCfg = Release|Win32
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.All|x86 Setup.ActiveCfg = Release|Win32
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Debug|Win32.ActiveCfg = Debug|Win32
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Debug|Win32.Build.0 = Debug|Win32
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Debug|x64.ActiveCfg = Debug|x64
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Debug|x64.Build.0 = Debug|x64
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Debug|x64 Setup.ActiveCfg = Debug|Win32
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Debug|x86 Setup.ActiveCfg = Debug|Win32
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Release|Win32.ActiveCfg = Release|Win32
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Release|Win32.Build.0 = Release|Win32
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Release|x64.ActiveCfg = Release|x64
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Release|x64.Build.0 = Release|x64
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Release|x64 Setup.ActiveCfg = Release|Win32
{ABFD88E1-7710-4BCC-AC34-56038DAC9652}.Release|x86 Setup.ActiveCfg = Release|Win32
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.All|Win32.ActiveCfg = Release|x64
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.All|x64.ActiveCfg = Release|x64
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.All|x64.Build.0 = Release|x64
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.All|x64 Setup.ActiveCfg = Release|x64
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.All|x86 Setup.ActiveCfg = Release|x64
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Debug|Win32.ActiveCfg = Debug|Win32
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Debug|Win32.Build.0 = Debug|Win32
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Debug|x64.ActiveCfg = Debug|x64
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Debug|x64.Build.0 = Debug|x64
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Debug|x64 Setup.ActiveCfg = Debug|x64
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Debug|x86 Setup.ActiveCfg = Debug|x64
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Release|Win32.ActiveCfg = Release|Win32
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Release|Win32.Build.0 = Release|Win32
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Release|x64.ActiveCfg = Release|x64
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Release|x64.Build.0 = Release|x64
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Release|x64 Setup.ActiveCfg = Release|x64
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}.Release|x86 Setup.ActiveCfg = Release|x64
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.All|Win32.ActiveCfg = Release|x64
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.All|x64.ActiveCfg = Release|x64
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.All|x64.Build.0 = Release|x64
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.All|x64 Setup.ActiveCfg = Release|x64
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.All|x86 Setup.ActiveCfg = Release|x64
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Debug|Win32.ActiveCfg = Debug|Win32
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Debug|Win32.Build.0 = Debug|Win32
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Debug|x64.ActiveCfg = Debug|x64
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Debug|x64.Build.0 = Debug|x64
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Debug|x64 Setup.ActiveCfg = Debug|x64
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Debug|x86 Setup.ActiveCfg = Debug|x64
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Release|Win32.ActiveCfg = Release|Win32
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Release|Win32.Build.0 = Release|Win32
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Release|x64.ActiveCfg = Release|x64
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Release|x64.Build.0 = Release|x64
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Release|x64 Setup.ActiveCfg = Release|x64
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}.Release|x86 Setup.ActiveCfg = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -4059,6 +4117,7 @@ Global
{4D418176-3B33-47E6-A63E-01BA34ADD21C} = {F881ADA2-2F1A-4046-9FEB-191D9422D781} {4D418176-3B33-47E6-A63E-01BA34ADD21C} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
{AFA983D6-4569-4F88-BA94-555ED00FD9A8} = {F881ADA2-2F1A-4046-9FEB-191D9422D781} {AFA983D6-4569-4F88-BA94-555ED00FD9A8} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
{64E99CCA-3C6F-4AEB-9FA3-CFAC711257BB} = {F881ADA2-2F1A-4046-9FEB-191D9422D781} {64E99CCA-3C6F-4AEB-9FA3-CFAC711257BB} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
{ABFD88E1-7710-4BCC-AC34-56038DAC9652} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
{5FD31A25-5D83-4794-8BEE-904DAD84CE71} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {5FD31A25-5D83-4794-8BEE-904DAD84CE71} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
{0DF3ABD0-DDC0-4265-B778-07C66780979B} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {0DF3ABD0-DDC0-4265-B778-07C66780979B} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
@ -4069,6 +4128,8 @@ Global
{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
{05C9FB27-480E-4D53-B3B7-7338E2514666} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {05C9FB27-480E-4D53-B3B7-7338E2514666} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
{74B120FF-6935-4DFE-A142-CDB6BEA99C90} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {74B120FF-6935-4DFE-A142-CDB6BEA99C90} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
{30A5B29C-983E-4580-9FD0-D647CCDCC7EB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {30A5B29C-983E-4580-9FD0-D647CCDCC7EB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{C24FB505-05D7-4319-8485-7540B44C8603} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {C24FB505-05D7-4319-8485-7540B44C8603} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}

View File

@ -11,7 +11,7 @@ FSPREFIX=/usr/local/freeswitch
PREFIX=/usr/local/freeswitch PREFIX=/usr/local/freeswitch
DOWNLOAD=http://files.freeswitch.org/downloads/libs DOWNLOAD=http://files.freeswitch.org/downloads/libs
JPEG=v8d JPEG=v8d
OPENSSL=1.0.1i OPENSSL=1.0.1j
SQLITE=autoconf-3080403 SQLITE=autoconf-3080403
PCRE=8.35 PCRE=8.35
CURL=7.35.0 CURL=7.35.0
@ -29,7 +29,7 @@ freeswitch.git/configure: freeswitch.git/bootstrap.sh
cd freeswitch.git && sh bootstrap.sh cd freeswitch.git && sh bootstrap.sh
freeswitch.git/bootstrap.sh: has-git freeswitch.git/bootstrap.sh: has-git
test -d freeswitch.git || git clone https://stash.freeswitch.org/scm/fs/freeswitch.git freeswitch.git test -d freeswitch.git || git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch.git
install: freeswitch install: freeswitch
cd freeswitch.git && make install cd-sounds-install cd-moh-install cd freeswitch.git && make install cd-sounds-install cd-moh-install

View File

@ -7,7 +7,7 @@
# #
# #
RPMS=git gcc-c++ autoconf automake libtool wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel RPMS=git gcc-c++ autoconf automake libtool wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel
DEBS=git build-essential automake autoconf libtool wget python zlib1g-dev libjpeg-dev libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libspeexdsp-dev libsqlite3-dev DEBS=git build-essential automake autoconf libtool wget python zlib1g-dev libjpeg-dev libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison libvlc-dev
freeswitch: deps has-git freeswitch.git/Makefile freeswitch: deps has-git freeswitch.git/Makefile
cd freeswitch.git && make cd freeswitch.git && make
@ -19,7 +19,7 @@ freeswitch.git/configure: freeswitch.git/bootstrap.sh
cd freeswitch.git && sh bootstrap.sh cd freeswitch.git && sh bootstrap.sh
freeswitch.git/bootstrap.sh: has-git freeswitch.git/bootstrap.sh: has-git
test -d freeswitch.git || git clone https://stash.freeswitch.org/scm/fs/freeswitch.git freeswitch.git test -d freeswitch.git || git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch.git
rpmforge: rpmforge:
(which rpm && rpm -i http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm) || true (which rpm && rpm -i http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm) || true

View File

@ -10,7 +10,7 @@
PKG=rsync-3.1.0 git automake-1.14.1 autoconf-2.69p1 libtool gmake bzip2 jpeg wget pcre speex libldns PKG=rsync-3.1.0 git automake-1.14.1 autoconf-2.69p1 libtool gmake bzip2 jpeg wget pcre speex libldns
PREFIX=/usr/local/freeswitch PREFIX=/usr/local/freeswitch
DOWNLOAD=http://files.freeswitch.org/downloads/libs DOWNLOAD=http://files.freeswitch.org/downloads/libs
OPENSSL=1.0.1i OPENSSL=1.0.1j
LIBEDIT=20140618-3.1 LIBEDIT=20140618-3.1
CURL=7.35.0 CURL=7.35.0
@ -24,7 +24,7 @@ freeswitch.git/configure: freeswitch.git/bootstrap.sh
cd freeswitch.git && AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.14 LIBTOOL=/usr/local/bin/libtoolize sh bootstrap.sh cd freeswitch.git && AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.14 LIBTOOL=/usr/local/bin/libtoolize sh bootstrap.sh
freeswitch.git/bootstrap.sh: has-git freeswitch.git/bootstrap.sh: has-git
test -d freeswitch.git || git clone https://stash.freeswitch.org/scm/fs/freeswitch.git freeswitch.git test -d freeswitch.git || git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch.git
install: install:
cd freeswitch.git && AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.14 LIBTOOL=/usr/local/bin/libtoolize gmake install cd-sounds-install cd-moh-install cd freeswitch.git && AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.14 LIBTOOL=/usr/local/bin/libtoolize gmake install cd-sounds-install cd-moh-install

View File

@ -10,7 +10,7 @@ FSPREFIX=/usr/local/freeswitch
PREFIX=/usr/local/ PREFIX=/usr/local/
DOWNLOAD=http://files.freeswitch.org/downloads/libs DOWNLOAD=http://files.freeswitch.org/downloads/libs
JP=v8d JP=v8d
SSL=1.0.1i SSL=1.0.1j
SQLITE=autoconf-3080403 SQLITE=autoconf-3080403
PCRE=8.35 PCRE=8.35
CURL=7.35.0 CURL=7.35.0
@ -31,7 +31,7 @@ freeswitch.git/configure: freeswitch.git/bootstrap.sh
cd freeswitch.git && sh bootstrap.sh cd freeswitch.git && sh bootstrap.sh
freeswitch.git/bootstrap.sh: has-git freeswitch.git/bootstrap.sh: has-git
test -d freeswitch.git || git clone https://stash.freeswitch.org/scm/fs/freeswitch.git freeswitch.git test -d freeswitch.git || git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch.git
install: freeswitch install: freeswitch
cd freeswitch.git && gmake install cd-sounds-install cd-moh-install cd freeswitch.git && gmake install cd-sounds-install cd-moh-install

View File

@ -6,5 +6,11 @@
<param name="auth-realm" value="freeswitch"/> <param name="auth-realm" value="freeswitch"/>
<param name="auth-user" value="freeswitch"/> <param name="auth-user" value="freeswitch"/>
<param name="auth-pass" value="works"/> <param name="auth-pass" value="works"/>
<!-- regex pattern to match against commands called against this service.
If a command with arguments matches, it will be logged at INFO level -->
<!--<param name="commands-to-log" value=""/> -->
</settings> </settings>
</configuration> </configuration>

View File

@ -138,15 +138,15 @@
<macro name="voicemail_record_file_check"> <macro name="voicemail_record_file_check">
<input pattern="^([0-9#*]):([0-9#*]):([0-9#*])$"> <input pattern="^([0-9#*]):([0-9#*]):([0-9#*])$">
<match> <match>
<action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$1" method="pronounced" type="name_spelled"/>
<action function="play-file" data="voicemail/vm-listen_to_recording.wav"/> <action function="play-file" data="voicemail/vm-listen_to_recording.wav"/>
<action function="play-file" data="voicemail/vm-press.wav"/> <action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$2" method="pronounced" type="name_spelled"/> <action function="say" data="$1" method="pronounced" type="name_spelled"/>
<action function="play-file" data="voicemail/vm-save_recording.wav"/> <action function="play-file" data="voicemail/vm-save_recording.wav"/>
<action function="play-file" data="voicemail/vm-press.wav"/> <action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$3" method="pronounced" type="name_spelled"/> <action function="say" data="$2" method="pronounced" type="name_spelled"/>
<action function="play-file" data="voicemail/vm-rerecord.wav"/> <action function="play-file" data="voicemail/vm-rerecord.wav"/>
<action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$3" method="pronounced" type="name_spelled"/>
</match> </match>
</input> </input>
</macro> </macro>

View File

@ -160,15 +160,15 @@
<macro name="voicemail_record_file_check"> <macro name="voicemail_record_file_check">
<input pattern="^([0-9#*]):([0-9#*]):([0-9#*])$"> <input pattern="^([0-9#*]):([0-9#*]):([0-9#*])$">
<match> <match>
<action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$1" method="pronounced" type="name_spelled"/>
<action function="play-file" data="voicemail/vm-listen_to_recording.wav"/> <action function="play-file" data="voicemail/vm-listen_to_recording.wav"/>
<action function="play-file" data="voicemail/vm-press.wav"/> <action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$2" method="pronounced" type="name_spelled"/> <action function="say" data="$1" method="pronounced" type="name_spelled"/>
<action function="play-file" data="voicemail/vm-save_recording.wav"/> <action function="play-file" data="voicemail/vm-save_recording.wav"/>
<action function="play-file" data="voicemail/vm-press.wav"/> <action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$3" method="pronounced" type="name_spelled"/> <action function="say" data="$2" method="pronounced" type="name_spelled"/>
<action function="play-file" data="voicemail/vm-rerecord.wav"/> <action function="play-file" data="voicemail/vm-rerecord.wav"/>
<action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$3" method="pronounced" type="name_spelled"/>
</match> </match>
</input> </input>
</macro> </macro>

View File

@ -144,15 +144,15 @@
<macro name="voicemail_record_file_check"> <macro name="voicemail_record_file_check">
<input pattern="^([0-9#*]):([0-9#*]):([0-9#*])$"> <input pattern="^([0-9#*]):([0-9#*]):([0-9#*])$">
<match> <match>
<action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$1" method="pronounced" type="name_spelled"/>
<action function="play-file" data="voicemail/vm-listen_to_recording.wav"/> <action function="play-file" data="voicemail/vm-listen_to_recording.wav"/>
<action function="play-file" data="voicemail/vm-press.wav"/> <action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$2" method="pronounced" type="name_spelled"/> <action function="say" data="$1" method="pronounced" type="name_spelled"/>
<action function="play-file" data="voicemail/vm-save_recording.wav"/> <action function="play-file" data="voicemail/vm-save_recording.wav"/>
<action function="play-file" data="voicemail/vm-press.wav"/> <action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$3" method="pronounced" type="name_spelled"/> <action function="say" data="$2" method="pronounced" type="name_spelled"/>
<action function="play-file" data="voicemail/vm-rerecord.wav"/> <action function="play-file" data="voicemail/vm-rerecord.wav"/>
<action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$3" method="pronounced" type="name_spelled"/>
</match> </match>
</input> </input>
</macro> </macro>

View File

@ -133,15 +133,15 @@
<macro name="voicemail_record_file_check"> <macro name="voicemail_record_file_check">
<input pattern="^([0-9#*]):([0-9#*]):([0-9#*])$"> <input pattern="^([0-9#*]):([0-9#*]):([0-9#*])$">
<match> <match>
<action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$1" method="pronounced" type="name_spelled"/>
<action function="play-file" data="voicemail/vm-listen_to_recording.wav"/> <action function="play-file" data="voicemail/vm-listen_to_recording.wav"/>
<action function="play-file" data="voicemail/vm-press.wav"/> <action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$2" method="pronounced" type="name_spelled"/> <action function="say" data="$1" method="pronounced" type="name_spelled"/>
<action function="play-file" data="voicemail/vm-save_recording.wav"/> <action function="play-file" data="voicemail/vm-save_recording.wav"/>
<action function="play-file" data="voicemail/vm-press.wav"/> <action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$3" method="pronounced" type="name_spelled"/> <action function="say" data="$2" method="pronounced" type="name_spelled"/>
<action function="play-file" data="voicemail/vm-rerecord.wav"/> <action function="play-file" data="voicemail/vm-rerecord.wav"/>
<action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$3" method="pronounced" type="name_spelled"/>
</match> </match>
</input> </input>
</macro> </macro>

View File

@ -365,6 +365,22 @@
<X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/> <X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/>
<X-PRE-PROCESS cmd="set" data="beep=%(1000,0,640)"/> <X-PRE-PROCESS cmd="set" data="beep=%(1000,0,640)"/>
<X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/> <X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/>
<!--
Digits Dialed filter: (FS-6940)
The digits stream may contain valid credit card numbers or social security numbers, These digit
filters will allow you to make a valant effort to stamp out sensitive information for
PCI/HIPPA compliance. (see xml_cdr dialed_digits)
df_us_ssn = US Social Security Number pattern
df_us_luhn = Visa, MasterCard, American Express, Diners Club, Discover and JCB
-->
<X-PRE-PROCESS cmd="set" data="df_us_ssn=(?!219099999|078051120)(?!666|000|9\d{2})\d{3}(?!00)\d{2}(?!0{4})\d{4}"/>
<X-PRE-PROCESS cmd="set" data="df_luhn=?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|6(?:011|5[0-9]{2})[0-9]{12}|(?:2131|1800|35\d{3})\d{11}"/>
<!-- change XX to X below to enable -->
<XX-PRE-PROCESS cmd="set" data="digits_dialed_filter=(($${df_luhn})|($${df_us_ssn}))"/>
<!-- <!--
Setting up your default sip provider is easy. Setting up your default sip provider is easy.
Below are some values that should work in most cases. Below are some values that should work in most cases.

View File

@ -383,10 +383,14 @@ elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
fi fi
if test "${enable_64}" = "yes"; then if test "${enable_64}" = "yes"; then
case "$host" in case "$host" in
*darwin12.*|*darwin11.*|*darwin10.*|*darwin9.*|*darwin8.*) *darwin*)
APR_ADDTO(CFLAGS, -arch x86_64) osxvrm=`sw_vers -productVersion` # Get version.release.modlevel
APR_ADDTO(LDFLAGS, -arch x86_64) osxrel=`echo $osxvrm | cut -d. -f2` # Get release only
APR_ADDTO(CXXFLAGS, -arch x86_64) if test "$osxrel" -ge 4; then # 10.4 and up are x64
APR_ADDTO(CFLAGS, -arch x86_64)
APR_ADDTO(LDFLAGS, -arch x86_64)
APR_ADDTO(CXXFLAGS, -arch x86_64)
fi
;; ;;
*-solaris2*) *-solaris2*)
APR_ADDTO(CFLAGS, -m64) APR_ADDTO(CFLAGS, -m64)
@ -649,39 +653,32 @@ path_push_unique () {
# tweak platform specific flags # tweak platform specific flags
case "$host" in case "$host" in
*darwin13.*|*darwin12.*|*darwin11.*)
APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
APR_ADDTO(CFLAGS, -pipe -no-cpp-precomp -Wno-deprecated-declarations)
APR_ADDTO(CPPFLAGS, -I/usr/local/opt/openssl/include)
APR_ADDTO(LDFLAGS, -pipe -bind_at_load -L/usr/local/opt/openssl/lib)
APR_ADDTO(CXXFLAGS, -pipe)
APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
if test "x$enable_core_odbc_support" != "xno"; then
APR_ADDTO([PLATFORM_CORE_LDFLAGS], [--framework CoreFoundation])
fi
APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl])
;;
*darwin10.*)
APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
APR_ADDTO(CFLAGS, -pipe -no-cpp-precomp)
APR_ADDTO(CPPFLAGS, -I/usr/local/opt/openssl/include)
APR_ADDTO(LDFLAGS, -pipe -bind_at_load -L/usr/local/opt/openssl/lib)
APR_ADDTO(CXXFLAGS, -pipe)
APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
if test "x$enable_core_odbc_support" != "xno"; then
APR_ADDTO([PLATFORM_CORE_LDFLAGS], [--framework CoreFoundation])
fi
APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl])
;;
*darwin*) *darwin*)
# Common Apple Darwin settings
APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
APR_ADDTO(CPPFLAGS, -I/usr/local/opt/openssl/include) APR_ADDTO(CPPFLAGS, -I/usr/local/opt/openssl/include)
APR_ADDTO(LDFLAGS, -L/usr/local/opt/openssl/lib) APR_ADDTO(LDFLAGS, -L/usr/local/opt/openssl/lib)
APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX) if test "x$enable_core_odbc_support" != "xno"; then
APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC) APR_ADDTO([PLATFORM_CORE_LDFLAGS], [--framework CoreFoundation])
if test "x$enable_core_odbc_support" != "xno"; then
APR_ADDTO([PLATFORM_CORE_LDFLAGS], [--framework CoreFoundation])
fi fi
APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl]) APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl])
# Get OSX and clang version
osxvrm=`sw_vers -productVersion` # Get version.release.modlevel
osxrel=`echo $osxvrm | cut -d. -f2` # Get release only
clangvers="`clang -v 2>&1 >/dev/null | grep version | sed -e 's/.*version \([[0-9]]*\).*$/\1/'`"
if test "$clangvers" -ge 6; then # Xcode 6 drops std lib search, add it to clang
APR_ADDTO(LDFLAGS, -L/usr/local/lib)
APR_ADDTO(CPPFLAGS, -I/usr/local/include)
fi
if test "$clangvers" -ge 4; then # Xcode 4 / 10.7 and up
APR_ADDTO(CFLAGS, -Wno-deprecated-declarations)
fi
if test "$osxrel" -ge 6; then # 10.6 and up
APR_ADDTO(CFLAGS, -pipe -no-cpp-precomp)
APR_ADDTO(LDFLAGS, -pipe -bind_at_load)
APR_ADDTO(CXXFLAGS, -pipe)
fi
;; ;;
*-solaris2*) *-solaris2*)
if test "${enable_64}" = "yes"; then if test "${enable_64}" = "yes"; then
@ -1107,16 +1104,8 @@ case $host in
size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"' size_t_fmt='#define SWITCH_SIZE_T_FMT "ld"'
;; ;;
*apple-darwin*) *apple-darwin*)
osver=`uname -r` ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
case $osver in size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
[0-7].*)
ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "d"'
;;
*)
ssize_t_fmt='#define SWITCH_SSIZE_T_FMT "ld"'
;;
esac
size_t_fmt='#define SWITCH_SIZE_T_FMT "lu"'
;; ;;
esac esac

6
debian/bootstrap.sh vendored
View File

@ -274,6 +274,10 @@ list_freeswitch_all_dbg_replaces () {
} }
print_source_control () { print_source_control () {
local libtool_dep="libtool, libtool-bin"
if test "$codename" = wheezy || test "$codename" = squeeze; then
libtool_dep="libtool"
fi
cat <<EOF cat <<EOF
Source: freeswitch Source: freeswitch
Section: comm Section: comm
@ -283,7 +287,7 @@ Build-Depends:
# for debian # for debian
debhelper (>= 8.0.0), debhelper (>= 8.0.0),
# bootstrapping # bootstrapping
automake (>= 1.9), autoconf, libtool, automake (>= 1.9), autoconf, ${libtool_dep},
# core build # core build
dpkg-dev (>= 1.15.8.12), gcc (>= 4:4.4.5), g++ (>= 4:4.4.5), dpkg-dev (>= 1.15.8.12), gcc (>= 4:4.4.5), g++ (>= 4:4.4.5),
libc6-dev (>= 2.11.3), make (>= 3.81), libc6-dev (>= 2.11.3), make (>= 3.81),

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 773 KiB

View File

@ -86,7 +86,7 @@
</div> </div>
<br> <br>
<a target="_CC2104" href="https://www.cluecon.com"><img border="0" width="300" src="img/cc_banner2014.gif"></a> <a target="_CC2104" href="https://www.cluecon.com"><img border="0" width="300" src="img/cc_banner.gif"></a>
<br><br> <br><br>
<div id="conf"> <div id="conf">
@ -146,7 +146,7 @@
FreeSWITCH Verto&trade; Demo FreeSWITCH Verto&trade; Demo
</div> </div>
<br> <br>
<a target="_CC2104" href="https://www.cluecon.com"><img border="0" width="300" src="img/cc_banner2014.gif"></a> <a target="_CC2104" href="https://www.cluecon.com"><img border="0" width="300" src="img/cc_banner.gif"></a>
<div id="offline"> <div id="offline">
<div id="errordisplay" style="font-weight:bold;font-size:18px;color:#ae0000"></div> <div id="errordisplay" style="font-weight:bold;font-size:18px;color:#ae0000"></div>

View File

@ -6,7 +6,7 @@ function getCodecPayloadType(sdpLine){var pattern=new RegExp('a=rtpmap:(\\d+) \\
function setDefaultCodec(mLine,payload){var elements=mLine.split(' ');var newLine=[];var index=0;for(var i=0;i<elements.length;i++){if(index===3) function setDefaultCodec(mLine,payload){var elements=mLine.split(' ');var newLine=[];var index=0;for(var i=0;i<elements.length;i++){if(index===3)
newLine[index++]=payload;if(elements[i]!==payload)newLine[index++]=elements[i];} newLine[index++]=payload;if(elements[i]!==payload)newLine[index++]=elements[i];}
return newLine.join(' ');} return newLine.join(' ');}
$.FSRTC=function(options){this.options=$.extend({useVideo:null,useStereo:false,userData:null,iceServers:false,videoParams:{},callbacks:{onICEComplete:function(){},onICE:function(){},onOfferSDP:function(){}}},options);this.mediaData={SDP:null,profile:{},candidateList:[]};this.constraints={optional:[{'DtlsSrtpKeyAgreement':'true'}],mandatory:{OfferToReceiveAudio:true,OfferToReceiveVideo:this.options.useVideo?true:false,}};if(self.options.useVideo){self.options.useVideo.style.display='none';} $.FSRTC=function(options){this.options=$.extend({useVideo:null,useStereo:false,userData:null,iceServers:false,videoParams:{},audioParams:{},callbacks:{onICEComplete:function(){},onICE:function(){},onOfferSDP:function(){}}},options);this.mediaData={SDP:null,profile:{},candidateList:[]};this.constraints={optional:[{'DtlsSrtpKeyAgreement':'true'}],mandatory:{OfferToReceiveAudio:true,OfferToReceiveVideo:this.options.useVideo?true:false,}};if(self.options.useVideo){self.options.useVideo.style.display='none';}
setCompat();checkCompat();};$.FSRTC.prototype.useVideo=function(obj){var self=this;if(obj){self.options.useVideo=obj;self.constraints.mandatory.OfferToReceiveVideo=true;}else{self.options.useVideo=null;self.constraints.mandatory.OfferToReceiveVideo=false;} setCompat();checkCompat();};$.FSRTC.prototype.useVideo=function(obj){var self=this;if(obj){self.options.useVideo=obj;self.constraints.mandatory.OfferToReceiveVideo=true;}else{self.options.useVideo=null;self.constraints.mandatory.OfferToReceiveVideo=false;}
if(self.options.useVideo){self.options.useVideo.style.display='none';}};$.FSRTC.prototype.useStereo=function(on){var self=this;self.options.useStereo=on;};$.FSRTC.prototype.stereoHack=function(sdp){var self=this;if(!self.options.useStereo){return sdp;} if(self.options.useVideo){self.options.useVideo.style.display='none';}};$.FSRTC.prototype.useStereo=function(on){var self=this;self.options.useStereo=on;};$.FSRTC.prototype.stereoHack=function(sdp){var self=this;if(!self.options.useStereo){return sdp;}
var sdpLines=sdp.split('\r\n');var opusIndex=findLine(sdpLines,'a=rtpmap','opus/48000'),opusPayload;if(opusIndex){opusPayload=getCodecPayloadType(sdpLines[opusIndex]);} var sdpLines=sdp.split('\r\n');var opusIndex=findLine(sdpLines,'a=rtpmap','opus/48000'),opusPayload;if(opusIndex){opusPayload=getCodecPayloadType(sdpLines[opusIndex]);}
@ -30,9 +30,9 @@ $.FSRTC.prototype.answer=function(sdp,onSuccess,onError){this.peer.addAnswerSDP(
if(self.localStream){self.localStream.stop();self.localStream=null;} if(self.localStream){self.localStream.stop();self.localStream=null;}
if(self.peer){console.log("stopping peer");self.peer.stop();}};$.FSRTC.prototype.createAnswer=function(sdp){var self=this;self.type="answer";self.remoteSDP=sdp;console.debug("inbound sdp: ",sdp);function onSuccess(stream){self.localStream=stream;self.peer=RTCPeerConnection({type:self.type,attachStream:self.localStream,onICE:function(candidate){return onICE(self,candidate);},onICEComplete:function(){return onICEComplete(self);},onRemoteStream:function(stream){return onRemoteStream(self,stream);},onICESDP:function(sdp){return onICESDP(self,sdp);},onChannelError:function(e){return onChannelError(self,e);},constraints:self.constraints,iceServers:self.options.iceServers,offerSDP:{type:"offer",sdp:self.remoteSDP}});onStreamSuccess(self);} if(self.peer){console.log("stopping peer");self.peer.stop();}};$.FSRTC.prototype.createAnswer=function(sdp){var self=this;self.type="answer";self.remoteSDP=sdp;console.debug("inbound sdp: ",sdp);function onSuccess(stream){self.localStream=stream;self.peer=RTCPeerConnection({type:self.type,attachStream:self.localStream,onICE:function(candidate){return onICE(self,candidate);},onICEComplete:function(){return onICEComplete(self);},onRemoteStream:function(stream){return onRemoteStream(self,stream);},onICESDP:function(sdp){return onICESDP(self,sdp);},onChannelError:function(e){return onChannelError(self,e);},constraints:self.constraints,iceServers:self.options.iceServers,offerSDP:{type:"offer",sdp:self.remoteSDP}});onStreamSuccess(self);}
function onError(){onStreamError(self);} function onError(){onStreamError(self);}
getUserMedia({constraints:{audio:true,video:this.options.useVideo?{mandatory:this.options.videoParams,optional:[]}:null},video:this.options.useVideo?true:false,onsuccess:onSuccess,onerror:onError});};$.FSRTC.prototype.call=function(profile){checkCompat();var self=this;self.type="offer";function onSuccess(stream){self.localStream=stream;self.peer=RTCPeerConnection({type:self.type,attachStream:self.localStream,onICE:function(candidate){return onICE(self,candidate);},onICEComplete:function(){return onICEComplete(self);},onRemoteStream:function(stream){return onRemoteStream(self,stream);},onOfferSDP:function(sdp){return onOfferSDP(self,sdp);},onICESDP:function(sdp){return onICESDP(self,sdp);},onChannelError:function(e){return onChannelError(self,e);},constraints:self.constraints,iceServers:self.options.iceServers,});onStreamSuccess(self);} getUserMedia({constraints:{audio:{mandatory:this.options.audioParams,optional:[]},video:this.options.useVideo?{mandatory:this.options.videoParams,optional:[]}:null},video:this.options.useVideo?true:false,onsuccess:onSuccess,onerror:onError});};$.FSRTC.prototype.call=function(profile){checkCompat();var self=this;self.type="offer";function onSuccess(stream){self.localStream=stream;self.peer=RTCPeerConnection({type:self.type,attachStream:self.localStream,onICE:function(candidate){return onICE(self,candidate);},onICEComplete:function(){return onICEComplete(self);},onRemoteStream:function(stream){return onRemoteStream(self,stream);},onOfferSDP:function(sdp){return onOfferSDP(self,sdp);},onICESDP:function(sdp){return onICESDP(self,sdp);},onChannelError:function(e){return onChannelError(self,e);},constraints:self.constraints,iceServers:self.options.iceServers,});onStreamSuccess(self);}
function onError(){onStreamError(self);} function onError(){onStreamError(self);}
getUserMedia({constraints:{audio:true,video:this.options.useVideo?{mandatory:this.options.videoParams,optional:[]}:null},video:this.options.useVideo?true:false,onsuccess:onSuccess,onerror:onError});};window.moz=!!navigator.mozGetUserMedia;function RTCPeerConnection(options){var w=window,PeerConnection=w.mozRTCPeerConnection||w.webkitRTCPeerConnection,SessionDescription=w.mozRTCSessionDescription||w.RTCSessionDescription,IceCandidate=w.mozRTCIceCandidate||w.RTCIceCandidate;var STUN={url:!moz?'stun:stun.l.google.com:19302':'stun:23.21.150.121'};var TURN={url:'turn:homeo@turn.bistri.com:80',credential:'homeo'};var iceServers=null;if(options.iceServers){var tmp=options.iceServers;;if(typeof(tmp)==="boolean"){tmp=null;} getUserMedia({constraints:{audio:{mandatory:this.options.audioParams,optional:[]},video:this.options.useVideo?{mandatory:this.options.videoParams,optional:[]}:null},video:this.options.useVideo?true:false,onsuccess:onSuccess,onerror:onError});};window.moz=!!navigator.mozGetUserMedia;function RTCPeerConnection(options){var w=window,PeerConnection=w.mozRTCPeerConnection||w.webkitRTCPeerConnection,SessionDescription=w.mozRTCSessionDescription||w.RTCSessionDescription,IceCandidate=w.mozRTCIceCandidate||w.RTCIceCandidate;var STUN={url:!moz?'stun:stun.l.google.com:19302':'stun:23.21.150.121'};var TURN={url:'turn:homeo@turn.bistri.com:80',credential:'homeo'};var iceServers=null;if(options.iceServers){var tmp=options.iceServers;;if(typeof(tmp)==="boolean"){tmp=null;}
if(tmp&&typeof(tmp)!=="array"){console.warn("iceServers must be an array, reverting to default ice servers");tmp=null;} if(tmp&&typeof(tmp)!=="array"){console.warn("iceServers must be an array, reverting to default ice servers");tmp=null;}
iceServers={iceServers:tmp||[STUN]};if(!moz&&!tmp){if(parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2])>=28)TURN={url:'turn:turn.bistri.com:80',credential:'homeo',username:'homeo'};iceServers.iceServers=[STUN];}} iceServers={iceServers:tmp||[STUN]};if(!moz&&!tmp){if(parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2])>=28)TURN={url:'turn:turn.bistri.com:80',credential:'homeo',username:'homeo'};iceServers.iceServers=[STUN];}}
var optional={optional:[]};if(!moz){optional.optional=[{DtlsSrtpKeyAgreement:true},{RtpDataChannels:options.onChannelMessage?true:false}];} var optional={optional:[]};if(!moz){optional.optional=[{DtlsSrtpKeyAgreement:true},{RtpDataChannels:options.onChannelMessage?true:false}];}
@ -102,7 +102,7 @@ $.ajax({url:self.jsonrpcclient.options.ajaxUrl,data:$.toJSON(batch_request),data
else handlers[response.id].error_cb(response.error,this);} else handlers[response.id].error_cb(response.error,this);}
else{if(!(response.id in handlers)&&'console'in window)console.log(response);else handlers[response.id].success_cb(response.result,this);}} else{if(!(response.id in handlers)&&'console'in window)console.log(response);else handlers[response.id].success_cb(response.result,this);}}
if(typeof all_done_cb==='function')all_done_cb(result);};})(jQuery);(function($){var generateGUID=(typeof(window.crypto)!=='undefined'&&typeof(window.crypto.getRandomValues)!=='undefined')?function(){var buf=new Uint16Array(8);window.crypto.getRandomValues(buf);var S4=function(num){var ret=num.toString(16);while(ret.length<4){ret="0"+ret;} if(typeof all_done_cb==='function')all_done_cb(result);};})(jQuery);(function($){var generateGUID=(typeof(window.crypto)!=='undefined'&&typeof(window.crypto.getRandomValues)!=='undefined')?function(){var buf=new Uint16Array(8);window.crypto.getRandomValues(buf);var S4=function(num){var ret=num.toString(16);while(ret.length<4){ret="0"+ret;}
return ret;};return(S4(buf[0])+S4(buf[1])+"-"+S4(buf[2])+"-"+S4(buf[3])+"-"+S4(buf[4])+"-"+S4(buf[5])+S4(buf[6])+S4(buf[7]));}:function(){return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=='x'?r:(r&0x3|0x8);return v.toString(16);});};$.verto=function(options,callbacks){var verto=this;$.verto.saved.push(verto);verto.options=$.extend({login:null,passwd:null,socketUrl:null,tag:null,videoParams:{},iceServers:false,ringSleep:6000},options);verto.sessid=$.cookie('verto_session_uuid')||generateGUID();$.cookie('verto_session_uuid',verto.sessid,{expires:1});verto.dialogs={};verto.callbacks=callbacks||{};verto.eventSUBS={};verto.rpcClient=new $.JsonRpcClient({login:verto.options.login,passwd:verto.options.passwd,socketUrl:verto.options.socketUrl,sessid:verto.sessid,onmessage:function(e){return verto.handleMessage(e.eventData);},onWSConnect:function(o){o.call('login',{});},onWSLogin:function(success){if(verto.callbacks.onWSLogin){verto.callbacks.onWSLogin(verto,success);}},onWSClose:function(success){if(verto.callbacks.onWSClose){verto.callbacks.onWSClose(verto,success);} return ret;};return(S4(buf[0])+S4(buf[1])+"-"+S4(buf[2])+"-"+S4(buf[3])+"-"+S4(buf[4])+"-"+S4(buf[5])+S4(buf[6])+S4(buf[7]));}:function(){return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=='x'?r:(r&0x3|0x8);return v.toString(16);});};$.verto=function(options,callbacks){var verto=this;$.verto.saved.push(verto);verto.options=$.extend({login:null,passwd:null,socketUrl:null,tag:null,videoParams:{},audioParams:{},iceServers:false,ringSleep:6000},options);verto.sessid=$.cookie('verto_session_uuid')||generateGUID();$.cookie('verto_session_uuid',verto.sessid,{expires:1});verto.dialogs={};verto.callbacks=callbacks||{};verto.eventSUBS={};verto.rpcClient=new $.JsonRpcClient({login:verto.options.login,passwd:verto.options.passwd,socketUrl:verto.options.socketUrl,sessid:verto.sessid,onmessage:function(e){return verto.handleMessage(e.eventData);},onWSConnect:function(o){o.call('login',{});},onWSLogin:function(success){if(verto.callbacks.onWSLogin){verto.callbacks.onWSLogin(verto,success);}},onWSClose:function(success){if(verto.callbacks.onWSClose){verto.callbacks.onWSClose(verto,success);}
verto.purge();}});if(verto.options.ringFile&&verto.options.tag){verto.ringer=$("#"+verto.options.tag);} verto.purge();}});if(verto.options.ringFile&&verto.options.tag){verto.ringer=$("#"+verto.options.tag);}
verto.rpcClient.call('login',{});};$.verto.prototype.iceServers=function(on){var verto=this;verto.options.iceServers=on;};$.verto.prototype.loginData=function(params){verto.options.login=params.login;verto.options.passwd=params.passwd;verto.rpcClient.loginData(params);};$.verto.prototype.logout=function(msg){var verto=this;verto.rpcClient.closeSocket();verto.purge();};$.verto.prototype.login=function(msg){var verto=this;verto.logout();verto.rpcClient.call('login',{});};$.verto.prototype.message=function(msg){var verto=this;var err=0;if(!msg.to){console.error("Missing To");err++;} verto.rpcClient.call('login',{});};$.verto.prototype.iceServers=function(on){var verto=this;verto.options.iceServers=on;};$.verto.prototype.loginData=function(params){verto.options.login=params.login;verto.options.passwd=params.passwd;verto.rpcClient.loginData(params);};$.verto.prototype.logout=function(msg){var verto=this;verto.rpcClient.closeSocket();verto.purge();};$.verto.prototype.login=function(msg){var verto=this;verto.logout();verto.rpcClient.call('login',{});};$.verto.prototype.message=function(msg){var verto=this;var err=0;if(!msg.to){console.error("Missing To");err++;}
if(!msg.body){console.error("Missing Body");err++;} if(!msg.body){console.error("Missing Body");err++;}
@ -192,7 +192,7 @@ dialog.verto.dialogs[dialog.callID]=dialog;var RTCcallbacks={};if(dialog.directi
if(!dialog.params.remote_caller_id_name){dialog.params.remote_caller_id_name="Nobody";} if(!dialog.params.remote_caller_id_name){dialog.params.remote_caller_id_name="Nobody";}
if(!dialog.params.remote_caller_id_number){dialog.params.remote_caller_id_number="UNKNOWN";} if(!dialog.params.remote_caller_id_number){dialog.params.remote_caller_id_number="UNKNOWN";}
RTCcallbacks.onMessage=function(rtc,msg){console.debug(msg);};RTCcallbacks.onAnswerSDP=function(rtc,sdp){console.error("answer sdp",sdp);};}else{dialog.params.remote_caller_id_name="Outbound Call";dialog.params.remote_caller_id_number=dialog.params.destination_number;} RTCcallbacks.onMessage=function(rtc,msg){console.debug(msg);};RTCcallbacks.onAnswerSDP=function(rtc,sdp){console.error("answer sdp",sdp);};}else{dialog.params.remote_caller_id_name="Outbound Call";dialog.params.remote_caller_id_number=dialog.params.destination_number;}
RTCcallbacks.onICESDP=function(rtc){if(rtc.type=="offer"){console.log("offer",rtc.mediaData.SDP);dialog.setState($.verto.enum.state.requesting);dialog.sendMethod("verto.invite",{sdp:rtc.mediaData.SDP});}else{dialog.setState($.verto.enum.state.answering);dialog.sendMethod(dialog.attach?"verto.attach":"verto.answer",{sdp:dialog.rtc.mediaData.SDP});}};RTCcallbacks.onICE=function(rtc){if(rtc.type=="offer"){console.log("offer",rtc.mediaData.candidate);return;}};RTCcallbacks.onError=function(e){console.error("ERROR:",e);dialog.hangup();};dialog.rtc=new $.FSRTC({callbacks:RTCcallbacks,useVideo:dialog.videoStream,useAudio:dialog.audioStream,useStereo:dialog.params.useStereo,videoParams:verto.options.videoParams,iceServers:verto.options.iceServers});dialog.rtc.verto=dialog.verto;if(dialog.direction==$.verto.enum.direction.inbound){if(dialog.attach){dialog.answer();}else{dialog.ring();}}};$.verto.dialog.prototype.invite=function(){var dialog=this;dialog.rtc.call();};$.verto.dialog.prototype.sendMethod=function(method,obj){var dialog=this;obj.dialogParams={};for(var i in dialog.params){if(i=="sdp"&&method!="verto.invite"&&method!="verto.attach"){continue;} RTCcallbacks.onICESDP=function(rtc){if(rtc.type=="offer"){console.log("offer",rtc.mediaData.SDP);dialog.setState($.verto.enum.state.requesting);dialog.sendMethod("verto.invite",{sdp:rtc.mediaData.SDP});}else{dialog.setState($.verto.enum.state.answering);dialog.sendMethod(dialog.attach?"verto.attach":"verto.answer",{sdp:dialog.rtc.mediaData.SDP});}};RTCcallbacks.onICE=function(rtc){if(rtc.type=="offer"){console.log("offer",rtc.mediaData.candidate);return;}};RTCcallbacks.onError=function(e){console.error("ERROR:",e);dialog.hangup();};dialog.rtc=new $.FSRTC({callbacks:RTCcallbacks,useVideo:dialog.videoStream,useAudio:dialog.audioStream,useStereo:dialog.params.useStereo,videoParams:verto.options.videoParams,audioParams:verto.options.audioParams,iceServers:verto.options.iceServers});dialog.rtc.verto=dialog.verto;if(dialog.direction==$.verto.enum.direction.inbound){if(dialog.attach){dialog.answer();}else{dialog.ring();}}};$.verto.dialog.prototype.invite=function(){var dialog=this;dialog.rtc.call();};$.verto.dialog.prototype.sendMethod=function(method,obj){var dialog=this;obj.dialogParams={};for(var i in dialog.params){if(i=="sdp"&&method!="verto.invite"&&method!="verto.attach"){continue;}
obj.dialogParams[i]=dialog.params[i];} obj.dialogParams[i]=dialog.params[i];}
dialog.verto.rpcClient.call(method,obj,function(e){dialog.processReply(method,true,e);},function(e){dialog.processReply(method,false,e);});};function checkStateChange(oldS,newS){if(newS==$.verto.enum.state.purge||$.verto.enum.states[oldS.name][newS.name]){return true;} dialog.verto.rpcClient.call(method,obj,function(e){dialog.processReply(method,true,e);},function(e){dialog.processReply(method,false,e);});};function checkStateChange(oldS,newS){if(newS==$.verto.enum.state.purge||$.verto.enum.states[oldS.name][newS.name]){return true;}
return false;} return false;}

View File

@ -448,7 +448,7 @@ function init() {
}); });
}); });
tmp = $.cookie("verto_demo_stun_checked") || "false"; tmp = $.cookie("verto_demo_stun_checked") || "true";
$.cookie("verto_demo_stun_checked", tmp, { $.cookie("verto_demo_stun_checked", tmp, {
expires: 365 expires: 365
}); });
@ -473,6 +473,11 @@ function init() {
"minWidth": "1280", "minWidth": "1280",
"minHeight": "720" "minHeight": "720"
}, },
audioParams: {
googAutoGainControl: false,
googNoiseSuppression: false,
googHighpassFilter: false
},
iceServers: $("#use_stun").is(':checked') iceServers: $("#use_stun").is(':checked')
},callbacks); },callbacks);

View File

@ -78,6 +78,7 @@
userData: null, userData: null,
iceServers: false, iceServers: false,
videoParams: {}, videoParams: {},
audioParams: {},
callbacks: { callbacks: {
onICEComplete: function() {}, onICEComplete: function() {},
onICE: function() {}, onICE: function() {},
@ -322,7 +323,10 @@
getUserMedia({ getUserMedia({
constraints: { constraints: {
audio: true, audio: {
mandatory: this.options.audioParams,
optional: []
},
video: this.options.useVideo ? { video: this.options.useVideo ? {
mandatory: this.options.videoParams, mandatory: this.options.videoParams,
optional: [] optional: []
@ -379,7 +383,10 @@
getUserMedia({ getUserMedia({
constraints: { constraints: {
audio: true, audio: {
mandatory: this.options.audioParams,
optional: []
},
video: this.options.useVideo ? { video: this.options.useVideo ? {
mandatory: this.options.videoParams, mandatory: this.options.videoParams,
optional: [] optional: []

View File

@ -72,6 +72,7 @@
socketUrl: null, socketUrl: null,
tag: null, tag: null,
videoParams: {}, videoParams: {},
audioParams: {},
iceServers: false, iceServers: false,
ringSleep: 6000 ringSleep: 6000
}, },
@ -1498,6 +1499,7 @@
useAudio: dialog.audioStream, useAudio: dialog.audioStream,
useStereo: dialog.params.useStereo, useStereo: dialog.params.useStereo,
videoParams: verto.options.videoParams, videoParams: verto.options.videoParams,
audioParams: verto.options.audioParams,
iceServers: verto.options.iceServers iceServers: verto.options.iceServers
}); });

1
libs/.gitignore vendored
View File

@ -828,3 +828,4 @@ unimrcp/build/compile
/sqlite-*/ /sqlite-*/
/ldns/ /ldns/
/portaudio/ /portaudio/
portaudio.*.log

View File

@ -58,7 +58,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ESL.2010.cs" /> <Compile Include="ESL.2010.cs" />
<Compile Include="ESLconnection.2010.cs" /> <Compile Include="ESLconnection.cs" />
<Compile Include="ESLevent.2010.cs" /> <Compile Include="ESLevent.2010.cs" />
<Compile Include="ESLPINVOKE.2010.cs" /> <Compile Include="ESLPINVOKE.2010.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

View File

@ -1 +1 @@
Wed Oct 1 18:09:52 CDT 2014 Fri Oct 31 13:48:09 CDT 2014

View File

@ -483,7 +483,7 @@ static void parse_message(sdp_parser_t *p)
post_session(p, sdp); post_session(p, sdp);
} }
#ifdef SOFIA_AUTO_CORRECT_INADDR_ANY
int sdp_connection_is_inaddr_any(sdp_connection_t const *c) int sdp_connection_is_inaddr_any(sdp_connection_t const *c)
{ {
return return
@ -492,6 +492,7 @@ int sdp_connection_is_inaddr_any(sdp_connection_t const *c)
((c->c_addrtype == sdp_addr_ip4 && su_strmatch(c->c_address, "0.0.0.0")) || ((c->c_addrtype == sdp_addr_ip4 && su_strmatch(c->c_address, "0.0.0.0")) ||
(c->c_addrtype == sdp_addr_ip6 && su_strmatch(c->c_address, "::"))); (c->c_addrtype == sdp_addr_ip6 && su_strmatch(c->c_address, "::")));
} }
#endif
/**Postprocess session description. /**Postprocess session description.
* *
@ -501,7 +502,9 @@ int sdp_connection_is_inaddr_any(sdp_connection_t const *c)
static void post_session(sdp_parser_t *p, sdp_session_t *sdp) static void post_session(sdp_parser_t *p, sdp_session_t *sdp)
{ {
sdp_media_t *m; sdp_media_t *m;
#ifdef SOFIA_AUTO_CORRECT_INADDR_ANY
sdp_connection_t const *c; sdp_connection_t const *c;
#endif
if (!p->pr_ok) if (!p->pr_ok)
return; return;
@ -525,12 +528,15 @@ static void post_session(sdp_parser_t *p, sdp_session_t *sdp)
continue; continue;
} }
#ifdef SOFIA_AUTO_CORRECT_INADDR_ANY
c = sdp_media_connections(m); c = sdp_media_connections(m);
if (p->pr_mode_0000 && sdp_connection_is_inaddr_any(c)) { if (p->pr_mode_0000 && sdp_connection_is_inaddr_any(c)) {
/* Reset recvonly flag */ /* Reset recvonly flag */
m->m_mode &= ~sdp_recvonly; m->m_mode &= ~sdp_recvonly;
} }
#endif
} }
if (p->pr_insane) if (p->pr_insane)

View File

@ -129,7 +129,7 @@ SOFIA_BEGIN_DECLS
#define SU_WAIT_INIT NULL #define SU_WAIT_INIT NULL
#define SU_WAIT_MAX (64) #define SU_WAIT_MAX (0x7fffffff)
#else #else
/* If nothing works, try these */ /* If nothing works, try these */

View File

@ -224,10 +224,37 @@ int su_wait(su_wait_t waits[], unsigned n, su_duration_t timeout)
#if SU_HAVE_WINSOCK #if SU_HAVE_WINSOCK
DWORD i; DWORD i;
if (n > 0) if (n > 0) {
i = WSAWaitForMultipleEvents(n, waits, FALSE, timeout, FALSE); #define WAIT_EVENT_BLOCK_SIZE WSA_MAXIMUM_WAIT_EVENTS
else
/* Handle at most WAIT_EVENT_BLOCK_SIZE wait objects at a time */
int blocks = (n + WAIT_EVENT_BLOCK_SIZE - 1) / WAIT_EVENT_BLOCK_SIZE;
int block_index = 0;
int first_wait_index = 0;
int millisec_per_block = timeout / blocks;
if (timeout > 0)
millisec_per_block = max(1, millisec_per_block);
i = WSA_WAIT_TIMEOUT;
for(block_index = 0; block_index < blocks; block_index++,first_wait_index+=WAIT_EVENT_BLOCK_SIZE)
{
int remaining_blocks = n - block_index * WAIT_EVENT_BLOCK_SIZE;
int waits_in_current_block = min( WAIT_EVENT_BLOCK_SIZE, remaining_blocks );
i = WSAWaitForMultipleEvents(waits_in_current_block, waits + first_wait_index, FALSE, millisec_per_block, FALSE);
if (i != WSA_WAIT_TIMEOUT) {
/* Did not timeout, return something NOW, ignore remaining blocks */
if (i != WSA_WAIT_FAILED) {
/* Return the right index */
i += first_wait_index;
}
break;
}
}
} else {
return Sleep(timeout), SU_WAIT_TIMEOUT; return Sleep(timeout), SU_WAIT_TIMEOUT;
}
if (i == WSA_WAIT_TIMEOUT) if (i == WSA_WAIT_TIMEOUT)
return SU_WAIT_TIMEOUT; return SU_WAIT_TIMEOUT;

View File

@ -216,6 +216,7 @@ SWITCH_DECLARE(void) switch_core_media_set_udptl_image_sdp(switch_core_session_t
SWITCH_DECLARE(switch_core_media_params_t *) switch_core_media_get_mparams(switch_media_handle_t *smh); SWITCH_DECLARE(switch_core_media_params_t *) switch_core_media_get_mparams(switch_media_handle_t *smh);
SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *session, switch_bool_t force); SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *session, switch_bool_t force);
SWITCH_DECLARE(void) switch_core_media_start_udptl(switch_core_session_t *session, switch_t38_options_t *t38_options); SWITCH_DECLARE(void) switch_core_media_start_udptl(switch_core_session_t *session, switch_t38_options_t *t38_options);
SWITCH_DECLARE(void) switch_core_media_hard_mute(switch_core_session_t *session, switch_bool_t on);
SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg); SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg);

View File

@ -181,7 +181,7 @@ typedef void (*stfu_n_call_me_t)(stfu_instance_t *i, void *);
void stfu_n_report(stfu_instance_t *i, stfu_report_t *r); void stfu_n_report(stfu_instance_t *i, stfu_report_t *r);
void stfu_n_destroy(stfu_instance_t **i); void stfu_n_destroy(stfu_instance_t **i);
stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_per_packet, uint32_t samples_per_second, uint32_t max_drift_ms); stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_per_packet, uint32_t samples_per_second, uint32_t max_drift_ms);
stfu_status_t _stfu_n_resize(stfu_instance_t *i, int32_t qlen, int line); stfu_status_t _stfu_n_resize(stfu_instance_t *i, uint32_t qlen, int line);
#define stfu_n_resize(_i, _ql) _stfu_n_resize(_i, _ql, __LINE__) #define stfu_n_resize(_i, _ql) _stfu_n_resize(_i, _ql, __LINE__)
stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint16_t seq, uint32_t pt, void *data, size_t datalen, uint32_t timer_ts, int last); stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint16_t seq, uint32_t pt, void *data, size_t datalen, uint32_t timer_ts, int last);
stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i); stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i);

View File

@ -727,6 +727,7 @@ typedef enum {
SWITCH_RTP_FLAG_FIR, SWITCH_RTP_FLAG_FIR,
SWITCH_RTP_FLAG_PLI, SWITCH_RTP_FLAG_PLI,
SWITCH_RTP_FLAG_RESET, SWITCH_RTP_FLAG_RESET,
SWITCH_RTP_FLAG_MUTE,
SWITCH_RTP_FLAG_INVALID SWITCH_RTP_FLAG_INVALID
} switch_rtp_flag_t; } switch_rtp_flag_t;
@ -1039,6 +1040,7 @@ typedef enum {
SWITCH_MESSAGE_INDICATE_STUN_ERROR, SWITCH_MESSAGE_INDICATE_STUN_ERROR,
SWITCH_MESSAGE_INDICATE_MEDIA_RENEG, SWITCH_MESSAGE_INDICATE_MEDIA_RENEG,
SWITCH_MESSAGE_INDICATE_KEEPALIVE, SWITCH_MESSAGE_INDICATE_KEEPALIVE,
SWITCH_MESSAGE_INDICATE_HARD_MUTE,
SWITCH_MESSAGE_REFER_EVENT, SWITCH_MESSAGE_REFER_EVENT,
SWITCH_MESSAGE_ANSWER_EVENT, SWITCH_MESSAGE_ANSWER_EVENT,
SWITCH_MESSAGE_PROGRESS_EVENT, SWITCH_MESSAGE_PROGRESS_EVENT,

View File

@ -2822,6 +2822,10 @@ static switch_status_t conference_del_member(conference_obj_t *conference, confe
gen_arc(conference, NULL); gen_arc(conference, NULL);
} }
if (member->session) {
switch_core_media_hard_mute(member->session, SWITCH_FALSE);
}
switch_mutex_unlock(conference->mutex); switch_mutex_unlock(conference->mutex);
status = SWITCH_STATUS_SUCCESS; status = SWITCH_STATUS_SUCCESS;
@ -6139,6 +6143,10 @@ static switch_status_t conf_api_sub_mute(conference_member_t *member, switch_str
switch_clear_flag_locked(member, MFLAG_CAN_SPEAK); switch_clear_flag_locked(member, MFLAG_CAN_SPEAK);
switch_clear_flag_locked(member, MFLAG_TALKING); switch_clear_flag_locked(member, MFLAG_TALKING);
if (member->session && !switch_test_flag(member, MFLAG_INDICATE_MUTE)) {
switch_core_media_hard_mute(member->session, SWITCH_TRUE);
}
if (!(data) || !strstr((char *) data, "quiet")) { if (!(data) || !strstr((char *) data, "quiet")) {
switch_set_flag(member, MFLAG_INDICATE_MUTE); switch_set_flag(member, MFLAG_INDICATE_MUTE);
} }
@ -6232,6 +6240,11 @@ static switch_status_t conf_api_sub_unmute(conference_member_t *member, switch_s
return SWITCH_STATUS_GENERR; return SWITCH_STATUS_GENERR;
switch_set_flag_locked(member, MFLAG_CAN_SPEAK); switch_set_flag_locked(member, MFLAG_CAN_SPEAK);
if (member->session && !switch_test_flag(member, MFLAG_INDICATE_MUTE)) {
switch_core_media_hard_mute(member->session, SWITCH_FALSE);
}
if (!(data) || !strstr((char *) data, "quiet")) { if (!(data) || !strstr((char *) data, "quiet")) {
switch_set_flag(member, MFLAG_INDICATE_UNMUTE); switch_set_flag(member, MFLAG_INDICATE_UNMUTE);
} }
@ -9264,6 +9277,13 @@ SWITCH_STANDARD_APP(conference_function)
/* no conference yet, so check for join-only flag */ /* no conference yet, so check for join-only flag */
if (flags_str) { if (flags_str) {
set_mflags(flags_str,&mflags); set_mflags(flags_str,&mflags);
if (!(mflags & MFLAG_CAN_SPEAK)) {
if (!(mflags & MFLAG_INDICATE_MUTE)) {
switch_core_media_hard_mute(session, SWITCH_TRUE);
}
}
if (mflags & MFLAG_JOIN_ONLY) { if (mflags & MFLAG_JOIN_ONLY) {
switch_event_t *event; switch_event_t *event;
switch_xml_t jos_xml; switch_xml_t jos_xml;
@ -9560,6 +9580,13 @@ SWITCH_STANDARD_APP(conference_function)
mflags = conference->mflags; mflags = conference->mflags;
set_mflags(flags_str, &mflags); set_mflags(flags_str, &mflags);
mflags |= MFLAG_RUNNING; mflags |= MFLAG_RUNNING;
if (!(mflags & MFLAG_CAN_SPEAK)) {
if (!(mflags & MFLAG_INDICATE_MUTE)) {
switch_core_media_hard_mute(member.session, SWITCH_TRUE);
}
}
if (mpin_matched) { if (mpin_matched) {
mflags |= MFLAG_MOD; mflags |= MFLAG_MOD;
} }

View File

@ -873,7 +873,7 @@ switch_status_t navigate_entrys(switch_core_session_t *session, dir_profile_t *p
globals.hostname, switch_core_session_get_uuid(session), (params->search_by == SEARCH_BY_LAST_NAME ? "last_name_digit" : "first_name_digit"), params->digits); globals.hostname, switch_core_session_get_uuid(session), (params->search_by == SEARCH_BY_LAST_NAME ? "last_name_digit" : "first_name_digit"), params->digits);
} }
sql = switch_mprintf("select count(*) from directory_search where %s group by last_name, first_name, extension", sql_where); sql = switch_mprintf("select count(*) from (select distinct first_name, last_name, extension from directory_search where %s) AS dsearch", sql_where);
directory_execute_sql_callback(globals.mutex, sql, sql2str_callback, &cbt); directory_execute_sql_callback(globals.mutex, sql, sql2str_callback, &cbt);
switch_safe_free(sql); switch_safe_free(sql);

View File

@ -116,8 +116,10 @@ SWITCH_STANDARD_API(snom_command_api_function)
{ {
int argc; int argc;
long httpRes = 0; long httpRes = 0;
char *key = NULL;
char *url = NULL; char *url = NULL;
char *argv[5] = { 0 }; char *argv[5] = { 0 };
char host[32];
char *argdata = NULL; char *argdata = NULL;
char *userpwd = NULL; char *userpwd = NULL;
char *apiresp = NULL; char *apiresp = NULL;
@ -135,16 +137,15 @@ SWITCH_STANDARD_API(snom_command_api_function)
goto end; goto end;
} }
if (strcasecmp(argv[1],"key")) { if (strcasecmp(argv[1],"key") && strcasecmp(argv[1],"action")) {
stream->write_function(stream, "-ERR only KEY command allowed at the moment\n"); stream->write_function(stream, "-ERR only key or action commands allowed at the moment\n");
goto end; goto end;
} }
if (switch_inet_pton(AF_INET, argv[0], &ip)) { if (switch_inet_pton(AF_INET, argv[0], &ip)) {
url = switch_mprintf("http://%s/command.htm?%s=%s",argv[0],argv[1],argv[2]); strncpy(host, argv[0], sizeof(host));
} else { } else {
char *sql = NULL; char *sql = NULL;
char buf[32];
char *ret = NULL; char *ret = NULL;
switch_cache_db_handle_t *db = NULL; switch_cache_db_handle_t *db = NULL;
switch_stream_handle_t apistream = { 0 }; switch_stream_handle_t apistream = { 0 };
@ -173,7 +174,7 @@ SWITCH_STANDARD_API(snom_command_api_function)
sql = switch_mprintf("select network_ip from registrations where url = '%s'", apiresp); sql = switch_mprintf("select network_ip from registrations where url = '%s'", apiresp);
ret = switch_cache_db_execute_sql2str(db, sql, buf, sizeof(buf), NULL); ret = switch_cache_db_execute_sql2str(db, sql, host, sizeof(host), NULL);
switch_safe_free(sql); switch_safe_free(sql);
switch_cache_db_release_db_handle(&db); switch_cache_db_release_db_handle(&db);
@ -181,11 +182,34 @@ SWITCH_STANDARD_API(snom_command_api_function)
stream->write_function(stream, "%s", "-ERR Query '%s' failed!\n", sql); stream->write_function(stream, "%s", "-ERR Query '%s' failed!\n", sql);
goto end; goto end;
} }
url = switch_mprintf("http://%s/command.htm?%s=%s",buf,argv[1],argv[2]);
} }
curl_handle = curl_easy_init(); curl_handle = curl_easy_init();
if (0 == strcasecmp(argv[1],"key")) {
key = curl_easy_escape(curl_handle, argv[2], 0);
url = switch_mprintf("http://%s/command.htm?key=%s", host, key);
curl_free(key);
}
if (0 == strcasecmp(argv[1],"action")) {
if (0 == strcasecmp(argv[2],"reboot")) {
url = switch_mprintf("http://%s/advanced_update.htm?reboot=Reboot", host);
} else if (0 == strcasecmp(argv[2],"reset")) {
url = switch_mprintf("http://%s/advanced_update.htm?reset=Reset", host);
} else if (0 == strcasecmp(argv[2],"dialeddel")) {
url = switch_mprintf("http://%s/index.htm?dialeddel=0", host);
} else if (0 == strcasecmp(argv[2],"misseddel")) {
url = switch_mprintf("http://%s/index.htm?misseddel=0", host);
} else if (0 == strcasecmp(argv[2],"receiveddel")) {
url = switch_mprintf("http://%s/index.htm?receiveddel=0", host);
} else {
stream->write_function(stream, "-ERR action '%s' not supported (supported actions are reboot, reset, dialeddel, misseddel, receiveddel)\n", argv[2]);
curl_easy_cleanup(curl_handle);
goto end;
}
}
curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, 1); curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, 1);
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, curl_callback); curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, curl_callback);
curl_easy_setopt(curl_handle, CURLOPT_URL, url); curl_easy_setopt(curl_handle, CURLOPT_URL, url);

View File

@ -260,7 +260,7 @@ static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag
} }
context->frame_size = codec->implementation->samples_per_packet; context->frame_size = codec->implementation->samples_per_packet;
memset(&codec_fmtp, '\0', sizeof(struct switch_codec_fmtp)); memset(&codec_fmtp, '\0', sizeof(struct switch_codec_fmtp));
codec_fmtp.private_info = &opus_codec_settings; codec_fmtp.private_info = &opus_codec_settings;
switch_opus_fmtp_parse(codec->fmtp_in, &codec_fmtp); switch_opus_fmtp_parse(codec->fmtp_in, &codec_fmtp);
@ -474,7 +474,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load)
settings.samplerate = rate; settings.samplerate = rate;
settings.stereo = 0; settings.stereo = 0;
dft_fmtp = gen_fmtp(&settings, pool); dft_fmtp = gen_fmtp(&settings, pool);
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
116, /* the IANA code number */ 116, /* the IANA code number */
"opus",/* the IANA code name */ "opus",/* the IANA code name */
@ -525,9 +525,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load)
bytes = 160; bytes = 160;
mss = 10000; mss = 10000;
rate = 8000; rate = 8000;
for (x = 0; x < 3; x++) { for (x = 0; x < 3; x++) {
settings.stereo = 0;
settings.ptime = mss / 1000; settings.ptime = mss / 1000;
settings.maxptime = settings.ptime; settings.maxptime = settings.ptime;
settings.minptime = settings.ptime; settings.minptime = settings.ptime;
@ -551,6 +551,26 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load)
switch_opus_encode, /* function to encode raw data into encoded data */ switch_opus_encode, /* function to encode raw data into encoded data */
switch_opus_decode, /* function to decode encoded data into raw data */ switch_opus_decode, /* function to decode encoded data into raw data */
switch_opus_destroy); /* deinitalize a codec handle using this implementation */ switch_opus_destroy); /* deinitalize a codec handle using this implementation */
settings.stereo = 1;
dft_fmtp = gen_fmtp(&settings, pool);
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
116, /* the IANA code number */
"opus",/* the IANA code name */
dft_fmtp, /* default fmtp to send (can be overridden by the init function) */
48000, /* samples transferred per second */
rate, /* actual samples transferred per second */
bits, /* bits transferred per second */
mss, /* number of microseconds per frame */
samples, /* number of samples per frame */
bytes * 2, /* number of bytes per frame decompressed */
0, /* number of bytes per frame compressed */
2,/* number of channels represented */
1, /* number of frames per network packet */
switch_opus_init, /* function to initialize a codec handle using this implementation */
switch_opus_encode, /* function to encode raw data into encoded data */
switch_opus_decode, /* function to decode encoded data into raw data */
switch_opus_destroy); /* deinitalize a codec handle using this implementation */
bytes += 160; bytes += 160;
samples += 80; samples += 80;

View File

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>mod_vp8</ProjectName>
<ProjectGuid>{ABFD88E1-7710-4BCC-AC34-56038DAC9652}</ProjectGuid>
<RootNamespace>mod_vp8</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="mod_vp8.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2012.vcxproj">
<Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>mod_rtc</ProjectName>
<ProjectGuid>{3884ADD2-91D0-4CD6-86D3-D5FB2D4AAB9E}</ProjectGuid>
<RootNamespace>mod_rtc</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="mod_rtc.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2012.vcxproj">
<Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -633,7 +633,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str), SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
SOATAG_REUSE_REJECTED(1), SOATAG_REUSE_REJECTED(1),
SOATAG_RTP_SELECT(1), SOATAG_RTP_SELECT(1),
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), SOATAG_AUDIO_AUX("cn telephone-event"),
TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)),
TAG_END()); TAG_END());
sofia_clear_flag(tech_pvt, TFLAG_3PCC_INVITE); // all done sofia_clear_flag(tech_pvt, TFLAG_3PCC_INVITE); // all done
@ -697,7 +697,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)), TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
SOATAG_REUSE_REJECTED(1), SOATAG_REUSE_REJECTED(1),
SOATAG_RTP_SELECT(1), SOATAG_RTP_SELECT(1),
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote), TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), TAG_END()); SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), TAG_END());
@ -840,7 +840,8 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
SIPTAG_CONTACT_STR(tech_pvt->reply_contact), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")), SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str), SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), SOATAG_REUSE_REJECTED(1),
SOATAG_AUDIO_AUX("cn telephone-event"),
TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)),
SOATAG_RTP_SELECT(1), SOATAG_RTP_SELECT(1),
TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
@ -1323,7 +1324,8 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
nua_respond(tech_pvt->nh, SIP_200_OK, nua_respond(tech_pvt->nh, SIP_200_OK,
SIPTAG_CONTACT_STR(tech_pvt->reply_contact), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str), SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), SOATAG_REUSE_REJECTED(1),
SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
TAG_END()); TAG_END());
} else { } else {
nua_respond(tech_pvt->nh, SIP_200_OK, nua_respond(tech_pvt->nh, SIP_200_OK,
@ -1382,7 +1384,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
SIPTAG_CONTACT_STR(tech_pvt->reply_contact), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")), SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str), SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1),
SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END()); TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
} else { } else {
nua_respond(tech_pvt->nh, SIP_200_OK, nua_respond(tech_pvt->nh, SIP_200_OK,
@ -1986,7 +1990,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str), SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
SOATAG_REUSE_REJECTED(1), SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END()); TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
} else { } else {
nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
@ -2140,7 +2144,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)), TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
SOATAG_REUSE_REJECTED(1), SOATAG_REUSE_REJECTED(1),
SOATAG_RTP_SELECT(1), SOATAG_RTP_SELECT(1),
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote), TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), TAG_END()); SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), TAG_END());
@ -2275,7 +2279,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
TAG_IF(cid, SIPTAG_HEADER_STR(cid)), TAG_IF(cid, SIPTAG_HEADER_STR(cid)),
SIPTAG_CONTACT_STR(tech_pvt->reply_contact), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_REUSE_REJECTED(1), SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1),
SOATAG_RTP_SELECT(1), SOATAG_RTP_SELECT(1),
SOATAG_ADDRESS(tech_pvt->mparams.adv_sdp_audio_ip), SOATAG_ADDRESS(tech_pvt->mparams.adv_sdp_audio_ip),
SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"),
@ -2523,7 +2526,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
uint32_t ob_failed = 0; uint32_t ob_failed = 0;
uint32_t ob = 0; uint32_t ob = 0;
stream->write_function(stream, "%25s\t%32s\t%s\t%s\t%s\n", "Profile::Gateway-Name", " Data ", "State", "IB Calls(F/T)", "OB Calls(F/T)"); stream->write_function(stream, "%25s\t%32s\t%s\t%9s\t%s\t%s\n", "Profile::Gateway-Name", " Data ", "State", "Ping Time", "IB Calls(F/T)", "OB Calls(F/T)");
stream->write_function(stream, "%s\n", line); stream->write_function(stream, "%s\n", line);
switch_mutex_lock(mod_sofia_globals.hash_mutex); switch_mutex_lock(mod_sofia_globals.hash_mutex);
for (hi = switch_core_hash_first(mod_sofia_globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { for (hi = switch_core_hash_first(mod_sofia_globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) {
@ -2543,8 +2546,8 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
ob_failed += gp->ob_failed_calls; ob_failed += gp->ob_failed_calls;
ob += gp->ob_calls; ob += gp->ob_calls;
stream->write_function(stream, "%25s\t%32s\t%s\t%u/%u\t%u/%u", stream->write_function(stream, "%25s\t%32s\t%s\t%6.2f\t%u/%u\t%u/%u",
pkey, gp->register_to, sofia_state_names[gp->state], pkey, gp->register_to, sofia_state_names[gp->state], gp->ping_time,
gp->ib_failed_calls, gp->ib_calls, gp->ob_failed_calls, gp->ob_calls); gp->ib_failed_calls, gp->ib_calls, gp->ob_failed_calls, gp->ob_calls);
if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) {
@ -2589,6 +2592,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
stream->write_function(stream, "Freq \t%d\n", gp->freq); stream->write_function(stream, "Freq \t%d\n", gp->freq);
stream->write_function(stream, "Ping \t%d\n", gp->ping); stream->write_function(stream, "Ping \t%d\n", gp->ping);
stream->write_function(stream, "PingFreq\t%d\n", gp->ping_freq); stream->write_function(stream, "PingFreq\t%d\n", gp->ping_freq);
stream->write_function(stream, "PingTime\t%0.2f\n", gp->ping_time);
stream->write_function(stream, "PingState\t%d/%d/%d\n", gp->ping_min, gp->ping_count, gp->ping_max); stream->write_function(stream, "PingState\t%d/%d/%d\n", gp->ping_min, gp->ping_count, gp->ping_max);
stream->write_function(stream, "State \t%s\n", sofia_state_names[gp->state]); stream->write_function(stream, "State \t%s\n", sofia_state_names[gp->state]);
stream->write_function(stream, "Status \t%s%s\n", status_names[gp->status], gp->pinging ? " (ping)" : ""); stream->write_function(stream, "Status \t%s%s\n", status_names[gp->status], gp->pinging ? " (ping)" : "");
@ -2831,8 +2835,9 @@ static void xml_gateway_status(sofia_gateway_t *gp, switch_stream_handle_t *stre
stream->write_function(stream, " <ping>%d</ping>\n", gp->ping); stream->write_function(stream, " <ping>%d</ping>\n", gp->ping);
stream->write_function(stream, " <pingfreq>%d</pingfreq>\n", gp->ping_freq); stream->write_function(stream, " <pingfreq>%d</pingfreq>\n", gp->ping_freq);
stream->write_function(stream, " <pingmin>%d</pingmin>\n", gp->ping_min); stream->write_function(stream, " <pingmin>%d</pingmin>\n", gp->ping_min);
stream->write_function(stream, " <pingcount>%d</pingcount>\n", gp->ping_count); stream->write_function(stream, " <pingcount>%d</pingcount>\n", gp->ping_count);
stream->write_function(stream, " <pingmax>%d</pingmax>\n", gp->ping_max); stream->write_function(stream, " <pingmax>%d</pingmax>\n", gp->ping_max);
stream->write_function(stream, " <pingtime>%0.2f</pingtime>\n", gp->ping_time);
stream->write_function(stream, " <pinging>%d</pinging>\n", gp->pinging); stream->write_function(stream, " <pinging>%d</pinging>\n", gp->pinging);
stream->write_function(stream, " <state>%s</state>\n", sofia_state_names[gp->state]); stream->write_function(stream, " <state>%s</state>\n", sofia_state_names[gp->state]);
stream->write_function(stream, " <status>%s</status>\n", status_names[gp->status]); stream->write_function(stream, " <status>%s</status>\n", status_names[gp->status]);

View File

@ -43,6 +43,8 @@
#define SQL_CACHE_TIMEOUT 300 #define SQL_CACHE_TIMEOUT 300
#define DEFAULT_NONCE_TTL 60 #define DEFAULT_NONCE_TTL 60
#define IREG_SECONDS 30 #define IREG_SECONDS 30
#define IPING_SECONDS 30
#define IPING_FREQUENCY 1
#define GATEWAY_SECONDS 1 #define GATEWAY_SECONDS 1
#define SOFIA_QUEUE_SIZE 50000 #define SOFIA_QUEUE_SIZE 50000
#define HAVE_APR #define HAVE_APR
@ -502,6 +504,8 @@ struct sofia_gateway {
int ping_count; int ping_count;
int ping_max; int ping_max;
int ping_min; int ping_min;
switch_time_t ping_sent;
float ping_time;
switch_bool_t ping_monitoring; switch_bool_t ping_monitoring;
uint8_t flags[REG_FLAG_MAX]; uint8_t flags[REG_FLAG_MAX];
int32_t retry_seconds; int32_t retry_seconds;
@ -720,6 +724,8 @@ struct sofia_profile {
uint32_t sip_expires_late_margin; uint32_t sip_expires_late_margin;
uint32_t sip_subscription_max_deviation; uint32_t sip_subscription_max_deviation;
int ireg_seconds; int ireg_seconds;
int iping_seconds;
int iping_freq;
sofia_paid_type_t paid_type; sofia_paid_type_t paid_type;
uint32_t rtp_digit_delay; uint32_t rtp_digit_delay;
switch_queue_t *event_queue; switch_queue_t *event_queue;
@ -976,6 +982,7 @@ void sofia_glue_actually_execute_sql_trans(sofia_profile_t *profile, char *sql,
void sofia_glue_execute_sql_now(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic); void sofia_glue_execute_sql_now(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic);
void sofia_glue_execute_sql_soon(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic); void sofia_glue_execute_sql_soon(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic);
void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot); void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot);
void sofia_reg_check_ping_expire(sofia_profile_t *profile, time_t now, int interval);
void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now); void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now);
void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now); void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now);
void sofia_reg_unregister(sofia_profile_t *profile); void sofia_reg_unregister(sofia_profile_t *profile);

View File

@ -2073,6 +2073,7 @@ void sofia_event_callback(nua_event_t event,
switch_mutex_lock(profile->flag_mutex); switch_mutex_lock(profile->flag_mutex);
switch_core_hash_insert(profile->chat_hash, tech_pvt->call_id, strdup(switch_core_session_get_uuid(session))); switch_core_hash_insert(profile->chat_hash, tech_pvt->call_id, strdup(switch_core_session_get_uuid(session)));
switch_mutex_unlock(profile->flag_mutex); switch_mutex_unlock(profile->flag_mutex);
nua_handle_destroy(nh);
} else { } else {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
} }
@ -2574,6 +2575,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
{ {
sofia_profile_t *profile = (sofia_profile_t *) obj; sofia_profile_t *profile = (sofia_profile_t *) obj;
uint32_t ireg_loops = profile->ireg_seconds; /* Number of loop iterations done when we haven't checked for registrations */ uint32_t ireg_loops = profile->ireg_seconds; /* Number of loop iterations done when we haven't checked for registrations */
uint32_t iping_loops = profile->iping_freq; /* Number of loop iterations done when we haven't checked for ping expires */
uint32_t gateway_loops = GATEWAY_SECONDS; /* Number of loop iterations done when we haven't checked for gateways */ uint32_t gateway_loops = GATEWAY_SECONDS; /* Number of loop iterations done when we haven't checked for gateways */
sofia_set_pflag_locked(profile, PFLAG_WORKER_RUNNING); sofia_set_pflag_locked(profile, PFLAG_WORKER_RUNNING);
@ -2618,6 +2620,12 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
sofia_reg_check_expire(profile, now, 0); sofia_reg_check_expire(profile, now, 0);
ireg_loops = 0; ireg_loops = 0;
} }
if(++iping_loops >= (uint32_t)profile->iping_freq) {
time_t now = switch_epoch_time_now(NULL);
sofia_reg_check_ping_expire(profile, now, profile->iping_seconds);
iping_loops = 0;
}
if (++gateway_loops >= GATEWAY_SECONDS) { if (++gateway_loops >= GATEWAY_SECONDS) {
sofia_reg_check_gateway(profile, switch_epoch_time_now(NULL)); sofia_reg_check_gateway(profile, switch_epoch_time_now(NULL));
@ -3343,6 +3351,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
gateway->ping_freq = 0; gateway->ping_freq = 0;
gateway->ping_max = 0; gateway->ping_max = 0;
gateway->ping_min = 0; gateway->ping_min = 0;
gateway->ping_sent = 0;
gateway->ping_time = 0;
gateway->ping_count = 0; gateway->ping_count = 0;
gateway->ping_monitoring = SWITCH_FALSE; gateway->ping_monitoring = SWITCH_FALSE;
gateway->ib_calls = 0; gateway->ib_calls = 0;
@ -4099,6 +4109,8 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
profile->mndlb |= SM_NDLB_ALLOW_NONDUP_SDP; profile->mndlb |= SM_NDLB_ALLOW_NONDUP_SDP;
profile->te = 101; profile->te = 101;
profile->ireg_seconds = IREG_SECONDS; profile->ireg_seconds = IREG_SECONDS;
profile->iping_seconds = IPING_SECONDS;
profile->iping_freq = IPING_FREQUENCY;
profile->paid_type = PAID_DEFAULT; profile->paid_type = PAID_DEFAULT;
profile->bind_attempts = 2; profile->bind_attempts = 2;
profile->bind_attempt_interval = 5; profile->bind_attempt_interval = 5;
@ -4229,6 +4241,16 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
if (profile->ireg_seconds < 0) { if (profile->ireg_seconds < 0) {
profile->ireg_seconds = IREG_SECONDS; profile->ireg_seconds = IREG_SECONDS;
} }
} else if (!strcasecmp(var, "ping-mean-interval")) {
profile->iping_seconds = atoi(val);
if (profile->iping_seconds < 0) {
profile->iping_seconds = IPING_SECONDS;
}
} else if (!strcasecmp(var, "ping-thread-frequency")) {
profile->iping_freq = atoi(val);
if (profile->iping_freq < 0) {
profile->iping_freq = IPING_FREQUENCY;
}
} else if (!strcasecmp(var, "user-agent-string")) { } else if (!strcasecmp(var, "user-agent-string")) {
profile->user_agent = switch_core_strdup(profile->pool, val); profile->user_agent = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "auto-restart")) { } else if (!strcasecmp(var, "auto-restart")) {
@ -5660,10 +5682,15 @@ static void sofia_handle_sip_r_options(switch_core_session_t *session, int statu
"Ping succeeded %s with code %d - count %d/%d/%d, state %s\n", "Ping succeeded %s with code %d - count %d/%d/%d, state %s\n",
gateway->name, status, gateway->ping_min, gateway->ping_count, gateway->ping_max, sofia_gateway_status_name(gateway->status)); gateway->name, status, gateway->ping_min, gateway->ping_count, gateway->ping_max, sofia_gateway_status_name(gateway->status));
} }
if (gateway->ping_sent) {
gateway->ping_time = (float)(switch_time_now() - gateway->ping_sent) / 1000;
gateway->ping_sent = 0;
}
} else { } else {
if (gateway->state == REG_STATE_REGED) { if (gateway->state == REG_STATE_REGED) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Unregister %s\n", gateway->name); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Unregister %s\n", gateway->name);
gateway->state = REG_STATE_FAILED; gateway->state = REG_STATE_FAILED;
gateway->ping_time = 0;
} }
if (gateway->ping_count > 0) { if (gateway->ping_count > 0) {
@ -5673,6 +5700,7 @@ static void sofia_handle_sip_r_options(switch_core_session_t *session, int statu
if (gateway->ping_count < gateway->ping_min && gateway->status != SOFIA_GATEWAY_DOWN) { if (gateway->ping_count < gateway->ping_min && gateway->status != SOFIA_GATEWAY_DOWN) {
gateway->status = SOFIA_GATEWAY_DOWN; gateway->status = SOFIA_GATEWAY_DOWN;
do_fire_gateway_state_event = SWITCH_TRUE; do_fire_gateway_state_event = SWITCH_TRUE;
gateway->ping_time = 0;
} }
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
@ -6934,7 +6962,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
SIPTAG_CONTACT_STR(tech_pvt->profile->url), SIPTAG_CONTACT_STR(tech_pvt->profile->url),
SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str), SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
SOATAG_REUSE_REJECTED(1), SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), SOATAG_AUDIO_AUX("cn telephone-event"),
TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END()); TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
} else { } else {
nua_respond(tech_pvt->nh, SIP_200_OK, nua_respond(tech_pvt->nh, SIP_200_OK,
@ -7095,7 +7123,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
SIPTAG_CONTACT_STR(tech_pvt->reply_contact), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str), SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
SOATAG_REUSE_REJECTED(1), SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), SOATAG_AUDIO_AUX("cn telephone-event"),
TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END()); TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
} else { } else {
nua_respond(tech_pvt->nh, SIP_200_OK, nua_respond(tech_pvt->nh, SIP_200_OK,
@ -7230,7 +7258,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
SIPTAG_CONTACT_STR(tech_pvt->reply_contact), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str), SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
SOATAG_REUSE_REJECTED(1), SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), SOATAG_AUDIO_AUX("cn telephone-event"),
TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END()); TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
} else { } else {
nua_respond(tech_pvt->nh, SIP_200_OK, nua_respond(tech_pvt->nh, SIP_200_OK,

View File

@ -1268,7 +1268,6 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
TAG_IF(!zstr(tech_pvt->mparams.local_sdp_str), SOATAG_ADDRESS(tech_pvt->mparams.adv_sdp_audio_ip)), TAG_IF(!zstr(tech_pvt->mparams.local_sdp_str), SOATAG_ADDRESS(tech_pvt->mparams.adv_sdp_audio_ip)),
TAG_IF(!zstr(tech_pvt->mparams.local_sdp_str), SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str)), TAG_IF(!zstr(tech_pvt->mparams.local_sdp_str), SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str)),
TAG_IF(!zstr(tech_pvt->mparams.local_sdp_str), SOATAG_REUSE_REJECTED(1)), TAG_IF(!zstr(tech_pvt->mparams.local_sdp_str), SOATAG_REUSE_REJECTED(1)),
TAG_IF(!zstr(tech_pvt->mparams.local_sdp_str), SOATAG_ORDERED_USER(1)),
TAG_IF(!zstr(tech_pvt->mparams.local_sdp_str), SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE)), TAG_IF(!zstr(tech_pvt->mparams.local_sdp_str), SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE)),
TAG_IF(!zstr(tech_pvt->mparams.local_sdp_str), SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL)), TAG_IF(!zstr(tech_pvt->mparams.local_sdp_str), SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL)),
TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)),
@ -1350,7 +1349,6 @@ void sofia_glue_do_xfer_invite(switch_core_session_t *session)
SOATAG_ADDRESS(tech_pvt->mparams.adv_sdp_audio_ip), SOATAG_ADDRESS(tech_pvt->mparams.adv_sdp_audio_ip),
SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str), SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
SOATAG_REUSE_REJECTED(1), SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1),
SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE), SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), TAG_END()); SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE), SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), TAG_END());
} else { } else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Memory Error!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Memory Error!\n");
@ -1993,6 +1991,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
" ping_count INTEGER,\n" " ping_count INTEGER,\n"
" rpid VARCHAR(255),\n" " rpid VARCHAR(255),\n"
" expires BIGINT,\n" " expires BIGINT,\n"
" ping_expires INTEGER not null default 0,\n"
" user_agent VARCHAR(255),\n" " user_agent VARCHAR(255),\n"
" server_user VARCHAR(255),\n" " server_user VARCHAR(255),\n"
" server_host VARCHAR(255),\n" " server_host VARCHAR(255),\n"
@ -2121,6 +2120,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
"create index sr_presence_hosts on sip_registrations (presence_hosts)", "create index sr_presence_hosts on sip_registrations (presence_hosts)",
"create index sr_contact on sip_registrations (contact)", "create index sr_contact on sip_registrations (contact)",
"create index sr_expires on sip_registrations (expires)", "create index sr_expires on sip_registrations (expires)",
"create index sr_ping_expires on sip_registrations (ping_expires)",
"create index sr_hostname on sip_registrations (hostname)", "create index sr_hostname on sip_registrations (hostname)",
"create index sr_status on sip_registrations (status)", "create index sr_status on sip_registrations (status)",
"create index sr_ping_status on sip_registrations (ping_status)", "create index sr_ping_status on sip_registrations (ping_status)",
@ -2205,6 +2205,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
switch_cache_db_test_reactive(dbh, "select ping_count from sip_registrations", NULL, "alter table sip_registrations add column ping_count INTEGER default 0"); switch_cache_db_test_reactive(dbh, "select ping_count from sip_registrations", NULL, "alter table sip_registrations add column ping_count INTEGER default 0");
switch_cache_db_test_reactive(dbh, "select ping_status from sip_registrations", NULL, "alter table sip_registrations add column ping_status VARCHAR(255) default \"Reachable\""); switch_cache_db_test_reactive(dbh, "select ping_status from sip_registrations", NULL, "alter table sip_registrations add column ping_status VARCHAR(255) default \"Reachable\"");
switch_cache_db_test_reactive(dbh, "select ping_expires from sip_registrations", NULL, "alter table sip_registrations add column ping_expires INTEGER not null default 0");
test2 = switch_mprintf("%s;%s", test_sql, test_sql); test2 = switch_mprintf("%s;%s", test_sql, test_sql);

View File

@ -3905,10 +3905,10 @@ void sofia_presence_handle_sip_i_subscribe(int status,
sql = switch_mprintf("update sip_subscriptions " sql = switch_mprintf("update sip_subscriptions "
"set expires=%ld, " "set expires=%ld, "
"network_ip='%q',network_port='%d',sip_user='%q',sip_host='%q',full_via='%q',full_to='%q',full_from='%q',contact='%q' " "network_ip='%q',network_port='%d',sip_user='%q',sip_host='%q',full_via='%q',full_to='%q',full_from='%q' "
"where call_id='%q' and profile_name='%q' and hostname='%q'", "where call_id='%q' and profile_name='%q' and hostname='%q'",
(long) switch_epoch_time_now(NULL) + exp_delta, (long) switch_epoch_time_now(NULL) + exp_delta,
np.network_ip, np.network_port, from_user, from_host, full_via, full_to, full_from, contact_str, np.network_ip, np.network_port, from_user, from_host, full_via, full_to, full_from,
call_id, profile->name, mod_sofia_globals.hostname); call_id, profile->name, mod_sofia_globals.hostname);

View File

@ -379,6 +379,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
nua_handle_bind(nh, pvt); nua_handle_bind(nh, pvt);
gateway_ptr->pinging = 1; gateway_ptr->pinging = 1;
gateway_ptr->ping_sent = switch_time_now();
nua_options(nh, nua_options(nh,
TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)), TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)),
TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
@ -846,21 +847,45 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot)
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
long sofia_reg_uniform_distribution(int max)
{
/*
* Generate a random number following a uniform distribution between 0 and max
*/
int result;
int range = max + 1;
srand((unsigned) switch_thread_self() + switch_micro_time_now());
result = (int)((double)rand() / (((double)RAND_MAX + (double)1) / range));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Generated random %ld, max is %d\n", (long) result, max);
return (long) result;
}
void sofia_reg_check_ping_expire(sofia_profile_t *profile, time_t now, int interval)
{
char *sql;
int mean = interval / 2;
long next, irand;
if (now) { if (now) {
if (sofia_test_pflag(profile, PFLAG_ALL_REG_OPTIONS_PING)) { if (sofia_test_pflag(profile, PFLAG_ALL_REG_OPTIONS_PING)) {
sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,rpid," sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,rpid,"
"expires,user_agent,server_user,server_host,profile_name" "expires,user_agent,server_user,server_host,profile_name"
" from sip_registrations where hostname='%s' and " " from sip_registrations where hostname='%s' and "
"profile_name='%s' and orig_hostname='%s'", mod_sofia_globals.hostname, profile->name, mod_sofia_globals.hostname); "profile_name='%s' and orig_hostname='%s' and "
"ping_expires > 0 and ping_expires <= %ld", mod_sofia_globals.hostname, profile->name, mod_sofia_globals.hostname, (long) now);
sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile); sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile);
switch_safe_free(sql); switch_safe_free(sql);
} else if (sofia_test_pflag(profile, PFLAG_UDP_NAT_OPTIONS_PING)) { } else if (sofia_test_pflag(profile, PFLAG_UDP_NAT_OPTIONS_PING)) {
sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,rpid," sql = switch_mprintf( " select call_id,sip_user,sip_host,contact,status,rpid, "
"expires,user_agent,server_user,server_host,profile_name" " expires,user_agent,server_user,server_host,profile_name "
" from sip_registrations where status like '%%UDP-NAT%%' " " from sip_registrations where status like '%%UDP-NAT%%' "
"and hostname='%s' and profile_name='%s'", mod_sofia_globals.hostname, profile->name); " and hostname='%s' and profile_name='%s' and ping_expires > 0 and ping_expires <= %ld ",
mod_sofia_globals.hostname, profile->name, (long) now);
sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile); sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile);
switch_safe_free(sql); switch_safe_free(sql);
@ -869,11 +894,37 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot)
"expires,user_agent,server_user,server_host,profile_name" "expires,user_agent,server_user,server_host,profile_name"
" from sip_registrations where (status like '%%NAT%%' " " from sip_registrations where (status like '%%NAT%%' "
"or contact like '%%fs_nat=yes%%') and hostname='%s' " "or contact like '%%fs_nat=yes%%') and hostname='%s' "
"and profile_name='%s' and orig_hostname='%s'", mod_sofia_globals.hostname, profile->name, mod_sofia_globals.hostname); "and profile_name='%s' and orig_hostname='%s' and "
"ping_expires > 0 and ping_expires <= %ld", mod_sofia_globals.hostname, profile->name, mod_sofia_globals.hostname, (long) now);
sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile); sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile);
switch_safe_free(sql); switch_safe_free(sql);
} }
if (sofia_test_pflag(profile, PFLAG_ALL_REG_OPTIONS_PING) ||
sofia_test_pflag(profile, PFLAG_UDP_NAT_OPTIONS_PING) ||
sofia_test_pflag(profile, PFLAG_NAT_OPTIONS_PING)) {
char buf[32] = "";
int count;
sql = switch_mprintf("select count(*) from sip_registrations where hostname='%q' and profile_name='%q' and ping_expires <= %ld",
mod_sofia_globals.hostname, profile->name, (long) now);
sofia_glue_execute_sql2str(profile, profile->dbh_mutex, sql, buf, sizeof(buf));
switch_safe_free(sql);
count = atoi(buf);
/* only update if needed */
if (count) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Updating ping expires for profile %s\n", profile->name);
irand = mean + sofia_reg_uniform_distribution(interval);
next = (long) now + irand;
sql = switch_mprintf("update sip_registrations set ping_expires = %ld where hostname='%q' and profile_name='%q' and ping_expires <= %ld ",
next, mod_sofia_globals.hostname, profile->name, (long) now);
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
}
} }
} }
@ -2311,7 +2362,7 @@ void sofia_reg_handle_sip_r_register(int status,
default: default:
gateway->state = REG_STATE_FAILED; gateway->state = REG_STATE_FAILED;
gateway->failure_status = status; gateway->failure_status = status;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Registration Failed with status %s [%d]. failure #%d\n", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Failed Registration with status %s [%d]. failure #%d\n",
gateway->name, switch_str_nil(phrase), status, ++gateway->failures); gateway->name, switch_str_nil(phrase), status, ++gateway->failures);
break; break;
} }

View File

@ -37,13 +37,21 @@
#include <stdint.h> #include <stdint.h>
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32
#include <winsock2.h>
#else
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#endif
#include <time.h> #include <time.h>
#ifndef WIN32
#include <unistd.h> #include <unistd.h>
#endif
#include "mcast.h" #include "mcast.h"
#ifndef WIN32
#include <poll.h> #include <poll.h>
#endif
#include <switch_utils.h> #include <switch_utils.h>
int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, mcast_flag_t flags) int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, mcast_flag_t flags)

View File

@ -42,9 +42,29 @@ extern "C" {
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32
#include <WinSock2.h>
#else
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#endif
#ifdef _MSC_VER
#include <stdint.h>
#ifndef strncasecmp
#define strncasecmp _strnicmp
#endif
#define snprintf _snprintf
#ifdef _WIN64
#define WS_SSIZE_T __int64
#elif _MSC_VER >= 1400
#define WS_SSIZE_T __int32 __w64
#else
#define WS_SSIZE_T __int32
#endif
typedef WS_SSIZE_T ssize_t;
#endif
typedef struct { typedef struct {
int sock; int sock;

View File

@ -34,7 +34,9 @@
#include "mcast.h" #include "mcast.h"
#include "mcast_cpp.h" #include "mcast_cpp.h"
#include <string.h> #include <string.h>
#ifndef WIN32
#include <poll.h> #include <poll.h>
#endif
McastHandle::McastHandle(const char *host, int port, int flags) McastHandle::McastHandle(const char *host, int port, int flags)
{ {

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
@ -20,7 +20,7 @@
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectName>mod_verto</ProjectName> <ProjectName>mod_verto</ProjectName>
<ProjectGuid>{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}</ProjectGuid> <ProjectGuid>{5B2BACE4-0F5A-4A21-930D-C0F4B1F58FA6}</ProjectGuid>
<RootNamespace>mod_verto</RootNamespace> <RootNamespace>mod_verto</RootNamespace>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
</PropertyGroup> </PropertyGroup>
@ -51,18 +51,22 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" /> <Import Project="..\..\..\..\w32\module_release.props" />
<Import Project="..\..\..\..\w32\openssl-version.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" /> <Import Project="..\..\..\..\w32\module_debug.props" />
<Import Project="..\..\..\..\w32\openssl-version.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" /> <Import Project="..\..\..\..\w32\module_release.props" />
<Import Project="..\..\..\..\w32\openssl-version.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" /> <Import Project="..\..\..\..\w32\module_debug.props" />
<Import Project="..\..\..\..\w32\openssl-version.props" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup> <PropertyGroup>
@ -72,6 +76,7 @@
<ClCompile> <ClCompile>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<AdditionalIncludeDirectories>$(SolutionDir)\src\include;%(AdditionalIncludeDirectories);..\..\..\..\libs\openssl-$(OpenSSLVersion)\include;$(ProjectDir)..\..\..\..\libs\pthreads-w32-2-9-1;.\;.\mcast</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress> <RandomizedBaseAddress>false</RandomizedBaseAddress>
@ -86,6 +91,7 @@
<ClCompile> <ClCompile>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<AdditionalIncludeDirectories>$(SolutionDir)\src\include;%(AdditionalIncludeDirectories);..\..\..\..\libs\openssl-$(OpenSSLVersion)\include;$(ProjectDir)..\..\..\..\libs\pthreads-w32-2-9-1;.\;.\mcast</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress> <RandomizedBaseAddress>false</RandomizedBaseAddress>
@ -98,6 +104,7 @@
<ClCompile> <ClCompile>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<AdditionalIncludeDirectories>$(SolutionDir)\src\include;%(AdditionalIncludeDirectories);..\..\..\..\libs\openssl-$(OpenSSLVersion)\include;$(ProjectDir)..\..\..\..\libs\pthreads-w32-2-9-1;.\;.\mcast</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress> <RandomizedBaseAddress>false</RandomizedBaseAddress>
@ -112,6 +119,7 @@
<ClCompile> <ClCompile>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<AdditionalIncludeDirectories>$(SolutionDir)\src\include;%(AdditionalIncludeDirectories);..\..\..\..\libs\openssl-$(OpenSSLVersion)\include;$(ProjectDir)..\..\..\..\libs\pthreads-w32-2-9-1;.\;.\mcast</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress> <RandomizedBaseAddress>false</RandomizedBaseAddress>
@ -122,14 +130,27 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="mod_verto.c" /> <ClCompile Include="mod_verto.c" />
<ClCompile Include="ws.c" />
<ClCompile Include="mcast\mcast.c" />
<ClCompile Include="mcast\mcast_cpp.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2012.vcxproj"> <ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2012.vcxproj">
<Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project> <Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly> <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\..\libs\win32\openssl\libeay32.2012.vcxproj">
<Project>{d331904d-a00a-4694-a5a3-fcff64ab5dbe}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\..\libs\win32\openssl\ssleay32.2012.vcxproj">
<Project>{b4b62169-5ad4-4559-8707-3d933ac5db39}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\..\libs\win32\pthread\pthread.2012.vcxproj">
<Project>{df018947-0fff-4eb3-bdee-441dc81da7a4}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -46,10 +46,14 @@ SWITCH_MODULE_DEFINITION(mod_verto, mod_verto_load, mod_verto_shutdown, mod_vert
////////////////////////// //////////////////////////
#include <mod_verto.h> #include <mod_verto.h>
#ifndef WIN32
#include <sys/param.h> #include <sys/param.h>
#endif
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#ifndef WIN32
#include <sys/file.h> #include <sys/file.h>
#endif
#include <ctype.h> #include <ctype.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -137,15 +141,19 @@ static void verto_deinit_ssl(verto_profile_t *profile)
} }
} }
static void close_file(int *sock) static void close_file(ws_socket_t *sock)
{ {
if (*sock > -1) { if (*sock > -1) {
#ifndef WIN32
close(*sock); close(*sock);
*sock = -1; #else
closesocket(*sock);
#endif
*sock = ws_sock_invalid;
} }
} }
static void close_socket(int *sock) static void close_socket(ws_socket_t *sock)
{ {
if (*sock > -1) { if (*sock > -1) {
shutdown(*sock, 2); shutdown(*sock, 2);
@ -2161,7 +2169,7 @@ static switch_state_handler_table_t verto_state_handlers = {
static void verto_set_media_options(verto_pvt_t *tech_pvt, verto_profile_t *profile) static void verto_set_media_options(verto_pvt_t *tech_pvt, verto_profile_t *profile)
{ {
int i; uint32_t i;
tech_pvt->mparams->rtpip = switch_core_session_strdup(tech_pvt->session, profile->rtpip[profile->rtpip_cur++]); tech_pvt->mparams->rtpip = switch_core_session_strdup(tech_pvt->session, profile->rtpip[profile->rtpip_cur++]);
@ -3034,7 +3042,17 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
if ((dtmf = cJSON_GetObjectCstr(params, "dtmf"))) { if ((dtmf = cJSON_GetObjectCstr(params, "dtmf"))) {
verto_pvt_t *tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY); verto_pvt_t *tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY);
char *send = switch_mprintf("~%s", dtmf); char *send = switch_mprintf("~%s", dtmf);
switch_channel_queue_dtmf_string(tech_pvt->channel, send);
if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE)) {
switch_core_session_t *other_session = NULL;
if (switch_core_session_get_partner(tech_pvt->session, &other_session) == SWITCH_STATUS_SUCCESS) {
switch_core_session_send_dtmf_string(other_session, send);
switch_core_session_rwunlock(other_session);
}
} else {
switch_channel_queue_dtmf_string(tech_pvt->channel, send);
}
free(send); free(send);
cJSON_AddItemToObject(*response, "message", cJSON_CreateString("SENT")); cJSON_AddItemToObject(*response, "message", cJSON_CreateString("SENT"));
} }
@ -3622,12 +3640,16 @@ static void jrpc_init(void)
static int start_jsock(verto_profile_t *profile, int sock) static int start_jsock(verto_profile_t *profile, ws_socket_t sock)
{ {
jsock_t *jsock = NULL; jsock_t *jsock = NULL;
int flag = 1; int flag = 1;
int i; int i;
unsigned int len; #ifndef WIN32
unsigned int len;
#else
int len;
#endif
jsock_type_t ptype = PTYPE_CLIENT; jsock_type_t ptype = PTYPE_CLIENT;
switch_thread_data_t *td; switch_thread_data_t *td;
switch_memory_pool_t *pool; switch_memory_pool_t *pool;
@ -3713,10 +3735,14 @@ static int start_jsock(verto_profile_t *profile, int sock)
return -1; return -1;
} }
static int prepare_socket(int ip, int port) static ws_socket_t prepare_socket(int ip, int port)
{ {
int sock = -1; ws_socket_t sock = ws_sock_invalid;
#ifndef WIN32
int reuse_addr = 1; int reuse_addr = 1;
#else
char reuse_addr = 1;
#endif
struct sockaddr_in addr; struct sockaddr_in addr;
if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
@ -3734,12 +3760,12 @@ static int prepare_socket(int ip, int port)
if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) { if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
die("Bind Error!\n"); die("Bind Error!\n");
return -1; return ws_sock_invalid;
} }
if (listen(sock, MAXPENDING) < 0) { if (listen(sock, MAXPENDING) < 0) {
die("Listen error\n"); die("Listen error\n");
return -1; return ws_sock_invalid;
} }
return sock; return sock;
@ -3748,7 +3774,7 @@ static int prepare_socket(int ip, int port)
close_file(&sock); close_file(&sock);
return -1; return ws_sock_invalid;
} }
static void handle_mcast_sub(verto_profile_t *profile) static void handle_mcast_sub(verto_profile_t *profile)
@ -3925,7 +3951,7 @@ static void kill_profiles(void)
while(--sanity > 0 && globals.profile_threads > 0) { while(--sanity > 0 && globals.profile_threads > 0) {
usleep(100000); switch_yield(100000);
} }
} }
@ -4365,13 +4391,14 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
int cp = 0; int cp = 0;
int cc = 0; int cc = 0;
const char *line = "================================================================================================="; const char *line = "=================================================================================================";
int i;
stream->write_function(stream, "%25s\t%s\t %40s\t%s\n", "Name", " Type", "Data", "State"); stream->write_function(stream, "%25s\t%s\t %40s\t%s\n", "Name", " Type", "Data", "State");
stream->write_function(stream, "%s\n", line); stream->write_function(stream, "%s\n", line);
switch_mutex_lock(globals.mutex); switch_mutex_lock(globals.mutex);
for(profile = globals.profile_head; profile; profile = profile->next) { for(profile = globals.profile_head; profile; profile = profile->next) {
for (int i = 0; i < profile->i; i++) { for (i = 0; i < profile->i; i++) {
char *tmpurl = switch_mprintf("%s:%s:%d",(profile->ip[i].secure == 1) ? "wss" : "ws", profile->ip[i].local_ip, profile->ip[i].local_port); char *tmpurl = switch_mprintf("%s:%s:%d",(profile->ip[i].secure == 1) ? "wss" : "ws", profile->ip[i].local_ip, profile->ip[i].local_port);
stream->write_function(stream, "%25s\t%s\t %40s\t%s\n", profile->name, "profile", tmpurl, (profile->running) ? "RUNNING" : "DOWN"); stream->write_function(stream, "%25s\t%s\t %40s\t%s\n", profile->name, "profile", tmpurl, (profile->running) ? "RUNNING" : "DOWN");
switch_safe_free(tmpurl); switch_safe_free(tmpurl);
@ -4408,12 +4435,13 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
int cp = 0; int cp = 0;
int cc = 0; int cc = 0;
const char *header = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"; const char *header = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
int i;
stream->write_function(stream, "%s\n", header); stream->write_function(stream, "%s\n", header);
stream->write_function(stream, "<profiles>\n"); stream->write_function(stream, "<profiles>\n");
switch_mutex_lock(globals.mutex); switch_mutex_lock(globals.mutex);
for(profile = globals.profile_head; profile; profile = profile->next) { for(profile = globals.profile_head; profile; profile = profile->next) {
for (int i = 0; i < profile->i; i++) { for (i = 0; i < profile->i; i++) {
char *tmpurl = switch_mprintf("%s:%s:%d",(profile->ip[i].secure == 1) ? "wss" : "ws", profile->ip[i].local_ip, profile->ip[i].local_port); char *tmpurl = switch_mprintf("%s:%s:%d",(profile->ip[i].secure == 1) ? "wss" : "ws", profile->ip[i].local_ip, profile->ip[i].local_port);
stream->write_function(stream, "<profile>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s</state>\n</profile>\n", profile->name, "profile", tmpurl, (profile->running) ? "RUNNING" : "DOWN"); stream->write_function(stream, "<profile>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s</state>\n</profile>\n", profile->name, "profile", tmpurl, (profile->running) ? "RUNNING" : "DOWN");
switch_safe_free(tmpurl); switch_safe_free(tmpurl);
@ -4506,7 +4534,7 @@ static void *SWITCH_THREAD_FUNC profile_thread(switch_thread_t *thread, void *ob
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "profile %s shutdown, Waiting for %d threads\n", profile->name, profile->jsock_count); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "profile %s shutdown, Waiting for %d threads\n", profile->name, profile->jsock_count);
while(--sanity > 0 && profile->jsock_count > 0) { while(--sanity > 0 && profile->jsock_count > 0) {
usleep(100000); switch_yield(100000);
} }
verto_deinit_ssl(profile); verto_deinit_ssl(profile);
@ -5321,7 +5349,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load)
memset(&globals, 0, sizeof(globals)); memset(&globals, 0, sizeof(globals));
globals.pool = pool; globals.pool = pool;
#ifndef WIN32
globals.ready = SIGUSR1; globals.ready = SIGUSR1;
#endif
globals.enable_presence = SWITCH_TRUE; globals.enable_presence = SWITCH_TRUE;
globals.enable_fs_events = SWITCH_FALSE; globals.enable_fs_events = SWITCH_FALSE;

View File

@ -36,19 +36,29 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32
#include <WinSock2.h>
#else
#include <sys/socket.h> #include <sys/socket.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <sys/wait.h> #include <sys/wait.h>
#endif
#include <string.h> #include <string.h>
#ifndef WIN32
#include <unistd.h> #include <unistd.h>
#include <poll.h> #include <poll.h>
#endif
#include <stdarg.h> #include <stdarg.h>
#ifndef WIN32
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <sys/un.h> #include <sys/un.h>
#endif
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#ifndef WIN32
#include <pwd.h> #include <pwd.h>
#include <netdb.h> #include <netdb.h>
#endif
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include "mcast.h" #include "mcast.h"
@ -89,7 +99,7 @@ typedef enum {
struct verto_profile_s; struct verto_profile_s;
struct jsock_s { struct jsock_s {
int client_socket; ws_socket_t client_socket;
switch_memory_pool_t *pool; switch_memory_pool_t *pool;
switch_thread_t *thread; switch_thread_t *thread;
wsh_t ws; wsh_t ws;
@ -99,10 +109,12 @@ struct jsock_s {
struct sockaddr_in local_addr; struct sockaddr_in local_addr;
struct sockaddr_in remote_addr; struct sockaddr_in remote_addr;
struct sockaddr_in send_addr; struct sockaddr_in send_addr;
#ifndef WIN32
struct passwd pw; struct passwd pw;
#endif
int drop; int drop;
int local_sock; ws_socket_t local_sock;
SSL *ssl; SSL *ssl;
jpflag_t flags; jpflag_t flags;
@ -198,7 +210,7 @@ struct verto_profile_s {
jsock_t *jsock_head; jsock_t *jsock_head;
int jsock_count; int jsock_count;
int server_socket[MAX_BIND]; ws_socket_t server_socket[MAX_BIND];
int running; int running;
int ssl_ready; int ssl_ready;

View File

@ -656,7 +656,11 @@ ssize_t ws_close(wsh_t *wsh, int16_t reason)
restore_socket(wsh->sock); restore_socket(wsh->sock);
if (wsh->close_sock && wsh->sock != ws_sock_invalid) { if (wsh->close_sock && wsh->sock != ws_sock_invalid) {
#ifndef WIN32
close(wsh->sock); close(wsh->sock);
#else
closesocket(wsh->sock);
#endif
} }
wsh->sock = ws_sock_invalid; wsh->sock = ws_sock_invalid;

View File

@ -11,11 +11,11 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <unistd.h>
#else #else
#pragma warning(disable:4996) #pragma warning(disable:4996)
#endif #endif
#include <string.h> #include <string.h>
#include <unistd.h>
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
@ -26,7 +26,9 @@
#include <openssl/ssl.h> #include <openssl/ssl.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#ifndef strncasecmp
#define strncasecmp _strnicmp #define strncasecmp _strnicmp
#endif
#define snprintf _snprintf #define snprintf _snprintf
#ifdef _WIN64 #ifdef _WIN64
#define WS_SSIZE_T __int64 #define WS_SSIZE_T __int64
@ -48,8 +50,12 @@ struct ws_globals_s {
extern struct ws_globals_s ws_globals; extern struct ws_globals_s ws_globals;
#ifndef WIN32
typedef int ws_socket_t; typedef int ws_socket_t;
#define ws_sock_invalid -1 #else
typedef SOCKET ws_socket_t;
#endif
#define ws_sock_invalid (ws_socket_t)-1
typedef enum { typedef enum {

View File

@ -948,19 +948,20 @@ void rayo_actor_destroy(struct rayo_actor *actor, const char *file, int line)
} else { } else {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, "", line, "", SWITCH_LOG_DEBUG, "Destroying %s\n", RAYO_JID(actor)); switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, "", line, "", SWITCH_LOG_DEBUG, "Destroying %s\n", RAYO_JID(actor));
} }
switch_core_hash_delete(globals.destroy_actors, RAYO_JID(actor));
switch_mutex_unlock(globals.actors_mutex);
/* safe to destroy parent now */
if (actor->cleanup_fn) { if (actor->cleanup_fn) {
actor->cleanup_fn(actor); actor->cleanup_fn(actor);
} }
if (actor->parent) { if (actor->parent) {
/* safe to destroy parent now */
RAYO_RELEASE(actor->parent); RAYO_RELEASE(actor->parent);
} }
switch_core_hash_delete(globals.destroy_actors, RAYO_JID(actor));
switch_core_destroy_memory_pool(&pool); switch_core_destroy_memory_pool(&pool);
} else { } else {
switch_core_hash_insert(globals.destroy_actors, RAYO_JID(actor), actor); switch_core_hash_insert(globals.destroy_actors, RAYO_JID(actor), actor);
switch_mutex_unlock(globals.actors_mutex);
} }
switch_mutex_unlock(globals.actors_mutex);
} }
/** /**
@ -2671,7 +2672,6 @@ static void *SWITCH_THREAD_FUNC rayo_dial_thread(switch_thread_t *thread, void *
switch_core_session_t *called_session = NULL; switch_core_session_t *called_session = NULL;
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING; switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
const char *dialstring = NULL; const char *dialstring = NULL;
const char *rayo_app_args = "";
if (join) { if (join) {
/* check join args */ /* check join args */
@ -2698,11 +2698,11 @@ static void *SWITCH_THREAD_FUNC rayo_dial_thread(switch_thread_t *thread, void *
RAYO_RELEASE(peer_call); RAYO_RELEASE(peer_call);
goto done; goto done;
} }
rayo_app_args = switch_core_sprintf(dtdata->pool, "bridge %s", rayo_call_get_uuid(peer_call)); switch_event_add_header(originate_vars, SWITCH_STACK_BOTTOM, "rayo_origination_args", "bridge %s", rayo_call_get_uuid(peer_call));
RAYO_RELEASE(peer_call); RAYO_RELEASE(peer_call);
} else { } else {
/* conference */ /* conference */
rayo_app_args = switch_core_sprintf(dtdata->pool, "conference %s@%s", mixer_name, globals.mixer_conf_profile); switch_event_add_header(originate_vars, SWITCH_STACK_BOTTOM, "rayo_origination_args", "conference %s@%s", mixer_name, globals.mixer_conf_profile);
} }
} }
@ -2715,11 +2715,11 @@ static void *SWITCH_THREAD_FUNC rayo_dial_thread(switch_thread_t *thread, void *
switch_caller_extension_t *extension = NULL; switch_caller_extension_t *extension = NULL;
switch_channel_t *called_channel = switch_core_session_get_channel(called_session); switch_channel_t *called_channel = switch_core_session_get_channel(called_session);
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "dial: Call originated\n"); switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "dial: Call originated\n");
if ((extension = switch_caller_extension_new(called_session, "rayo", rayo_app_args)) == 0) { if ((extension = switch_caller_extension_new(called_session, "rayo", NULL)) == 0) {
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(rayo_call_get_uuid(call)), SWITCH_LOG_CRIT, "Memory Error!\n"); switch_log_printf(SWITCH_CHANNEL_UUID_LOG(rayo_call_get_uuid(call)), SWITCH_LOG_CRIT, "Memory Error!\n");
abort(); abort();
} }
switch_caller_extension_add_application(called_session, extension, "rayo", rayo_app_args); switch_caller_extension_add_application(called_session, extension, "rayo", NULL);
switch_channel_set_caller_extension(called_channel, extension); switch_channel_set_caller_extension(called_channel, extension);
switch_channel_set_state(called_channel, CS_EXECUTE); switch_channel_set_state(called_channel, CS_EXECUTE);
switch_core_session_rwunlock(called_session); switch_core_session_rwunlock(called_session);
@ -3723,7 +3723,46 @@ static switch_status_t rayo_call_on_read_frame(switch_core_session_t *session, s
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
#define RAYO_USAGE "[bridge <uuid>|conference <name>]" /**
* @param rclient to check
* @param offer_filters optional list of username or username@server to match with client JID.
* @param offer_filter_count
* @return 1 if client is online and optional filter(s) match the client. 0 otherwise.
*/
static int should_offer_to_client(struct rayo_client *rclient, char **offer_filters, int offer_filter_count)
{
if (!rclient->availability == PS_ONLINE) {
return 0;
}
if (offer_filter_count == 0) {
/* online and no filters to match */
return 1;
} else {
/* check if one of the filters matches the client */
int i;
const char *client_jid = RAYO_JID(rclient);
size_t client_jid_len = strlen(client_jid);
for (i = 0; i < offer_filter_count; i++) {
char *offer_filter = offer_filters[i];
if (!zstr(offer_filter)) {
size_t offer_filter_len = strlen(offer_filter);
if (strchr(offer_filter, '@')) {
if (offer_filter_len <= client_jid_len && !strncmp(offer_filter, client_jid, offer_filter_len)) {
/* username + server match */
return 1;
}
} else if (offer_filter_len < client_jid_len && !strncmp(offer_filter, client_jid, offer_filter_len) && client_jid[offer_filter_len] == '@') {
/* username match */
return 1;
}
}
}
}
return 0;
}
#define RAYO_USAGE "[client username 1,client username n]"
/** /**
* Offer call and park channel * Offer call and park channel
*/ */
@ -3731,7 +3770,7 @@ SWITCH_STANDARD_APP(rayo_app)
{ {
int ok = 0; int ok = 0;
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
struct rayo_call *call = RAYO_CALL_LOCATE_BY_ID(switch_core_session_get_uuid(session)); struct rayo_call *call = RAYO_CALL_LOCATE_BY_ID(switch_core_session_get_uuid(session));
const char *app = ""; /* optional app to execute */ const char *app = ""; /* optional app to execute */
const char *app_args = ""; /* app args */ const char *app_args = ""; /* app args */
@ -3742,10 +3781,11 @@ SWITCH_STANDARD_APP(rayo_app)
/* is outbound call already under control? */ /* is outbound call already under control? */
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
const char *origination_args = switch_channel_get_variable(channel, "rayo_origination_args");
/* check origination args */ /* check origination args */
if (!zstr(data)) { if (!zstr(origination_args)) {
char *argv[2] = { 0 }; char *argv[2] = { 0 };
char *args = switch_core_session_strdup(session, data); char *args = switch_core_session_strdup(session, origination_args);
int argc = switch_separate_string(args, ' ', argv, sizeof(argv) / sizeof(argv[0])); int argc = switch_separate_string(args, ' ', argv, sizeof(argv) / sizeof(argv[0]));
if (argc) { if (argc) {
if (!strcmp("conference", argv[0])) { if (!strcmp("conference", argv[0])) {
@ -3772,6 +3812,8 @@ SWITCH_STANDARD_APP(rayo_app)
/* offer control */ /* offer control */
switch_hash_index_t *hi = NULL; switch_hash_index_t *hi = NULL;
iks *offer = NULL; iks *offer = NULL;
char *clients_to_offer[16] = { 0 };
int clients_to_offer_count = 0;
call = rayo_call_create(switch_core_session_get_uuid(session)); call = rayo_call_create(switch_core_session_get_uuid(session));
if (!call) { if (!call) {
@ -3786,7 +3828,12 @@ SWITCH_STANDARD_APP(rayo_app)
offer = rayo_create_offer(call, session); offer = rayo_create_offer(call, session);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Offering call for Rayo 3PCC\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Offering call for Rayo 3PCC\n");
/* Offer call to all ONLINE clients */ if (!zstr(data)) {
char *data_dup = switch_core_session_strdup(session, data);
clients_to_offer_count = switch_separate_string(data_dup, ',', clients_to_offer, sizeof(clients_to_offer) / sizeof(clients_to_offer[0]));
}
/* Offer call to all (or specified) ONLINE clients */
/* TODO load balance offers so first session doesn't always get offer first? */ /* TODO load balance offers so first session doesn't always get offer first? */
switch_mutex_lock(globals.clients_mutex); switch_mutex_lock(globals.clients_mutex);
for (hi = switch_core_hash_first(globals.clients_roster); hi; hi = switch_core_hash_next(&hi)) { for (hi = switch_core_hash_first(globals.clients_roster); hi; hi = switch_core_hash_next(&hi)) {
@ -3798,7 +3845,7 @@ SWITCH_STANDARD_APP(rayo_app)
switch_assert(rclient); switch_assert(rclient);
/* is session available to take call? */ /* is session available to take call? */
if (rclient->availability == PS_ONLINE) { if (should_offer_to_client(rclient, clients_to_offer, clients_to_offer_count)) {
ok = 1; ok = 1;
switch_core_hash_insert(call->pcps, RAYO_JID(rclient), "1"); switch_core_hash_insert(call->pcps, RAYO_JID(rclient), "1");
iks_insert_attrib(offer, "to", RAYO_JID(rclient)); iks_insert_attrib(offer, "to", RAYO_JID(rclient));

View File

@ -134,11 +134,17 @@ static void on_call_record_stop_event(switch_event_t *event)
struct rayo_component *component = RAYO_COMPONENT_LOCATE(file_path); struct rayo_component *component = RAYO_COMPONENT_LOCATE(file_path);
if (component) { if (component) {
const char *completion_cause = switch_event_get_header(event, "Record-Completion-Cause");
completion_cause = zstr(completion_cause) ? "" : completion_cause;
RECORD_COMPONENT(component)->duration_ms += (switch_micro_time_now() - RECORD_COMPONENT(component)->start_time) / 1000; RECORD_COMPONENT(component)->duration_ms += (switch_micro_time_now() - RECORD_COMPONENT(component)->start_time) / 1000;
if (RECORD_COMPONENT(component)->stop) { if (RECORD_COMPONENT(component)->stop) {
complete_record(component, COMPONENT_COMPLETE_STOP); complete_record(component, COMPONENT_COMPLETE_STOP);
} else if (!strcmp(completion_cause, "no-input-timeout")) {
complete_record(component, RECORD_COMPLETE_INITIAL_TIMEOUT);
} else if (!strcmp(completion_cause, "success-maxtime")) {
complete_record(component, RECORD_COMPLETE_MAX_DURATION);
} else { } else {
/* TODO assume final timeout, for now */ /* assume final timeout */
complete_record(component, RECORD_COMPLETE_FINAL_TIMEOUT); complete_record(component, RECORD_COMPLETE_FINAL_TIMEOUT);
} }
RAYO_RELEASE(component); RAYO_RELEASE(component);

View File

@ -166,7 +166,7 @@ static inline void free_context(shout_context_t *context)
mpg123_delete(context->mh); mpg123_delete(context->mh);
} }
if (context->fp) { if (context->fp && context->lame_ready) {
unsigned char mp3buffer[20480]; unsigned char mp3buffer[20480];
int len; int len;
int16_t blank[2048] = { 0 }, *r = NULL; int16_t blank[2048] = { 0 }, *r = NULL;
@ -854,11 +854,6 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", path); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", path);
goto error; goto error;
} }
if (!context->lame_ready) {
lame_init_params(context->gfp);
lame_print_config(context->gfp);
context->lame_ready = 1;
}
} }
} }

View File

@ -250,6 +250,8 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi
goto done_swap_out; goto done_swap_out;
} }
PyRun_SimpleString("import freeswitch");
if (session) { if (session) {
sp = mod_python_conjure_session(module, session); sp = mod_python_conjure_session(module, session);
} }

View File

@ -89,6 +89,7 @@ static struct {
TServer abyssServer; TServer abyssServer;
xmlrpc_registry *registryP; xmlrpc_registry *registryP;
switch_bool_t enable_websocket; switch_bool_t enable_websocket;
char *commands_to_log;
} globals; } globals;
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_realm, globals.realm); SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_realm, globals.realm);
@ -103,6 +104,8 @@ static switch_status_t do_config(void)
char *realm, *user, *pass, *default_domain; char *realm, *user, *pass, *default_domain;
default_domain = realm = user = pass = NULL; default_domain = realm = user = pass = NULL;
globals.commands_to_log = NULL;
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) { if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
return SWITCH_STATUS_TERM; return SWITCH_STATUS_TERM;
@ -130,6 +133,8 @@ static switch_status_t do_config(void)
globals.virtual_host = switch_true(val); globals.virtual_host = switch_true(val);
} else if (!strcasecmp(var, "enable-websocket")) { } else if (!strcasecmp(var, "enable-websocket")) {
globals.enable_websocket = switch_true(val); globals.enable_websocket = switch_true(val);
} else if (!strcasecmp(var, "commands-to-log")) {
globals.commands_to_log = val;
} }
} }
} }
@ -800,6 +805,7 @@ abyss_bool handler_hook(TSession * r)
{ {
switch_stream_handle_t stream = { 0 }; switch_stream_handle_t stream = { 0 };
char *command; char *command;
char *full_command;
int i; int i;
char *fs_user = NULL, *fs_domain = NULL; char *fs_user = NULL, *fs_domain = NULL;
char *path_info = NULL; char *path_info = NULL;
@ -1054,6 +1060,16 @@ abyss_bool handler_hook(TSession * r)
/* fs api command will write to stream, calling http_stream_write / http_stream_raw_write */ /* fs api command will write to stream, calling http_stream_write / http_stream_raw_write */
/* switch_api_execute will stream INVALID COMMAND before it fails */ /* switch_api_execute will stream INVALID COMMAND before it fails */
switch_api_execute(command, api_str, NULL, &stream); switch_api_execute(command, api_str, NULL, &stream);
if (globals.commands_to_log != NULL) {
full_command = switch_mprintf("%s%s%s", command, (api_str==NULL ? "" : " "), api_str);
if (switch_regex_match(full_command, globals.commands_to_log) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Executed HTTP request command: [%s].\n", full_command);
}
switch_safe_free(full_command);
}
r->responseStarted = TRUE; r->responseStarted = TRUE;
ResponseStatus(r, 200); /* we don't want an assertion failure */ ResponseStatus(r, 200); /* we don't want an assertion failure */

View File

@ -33,7 +33,7 @@
#include <switch.h> #include <switch.h>
#include <switch_channel.h> #include <switch_channel.h>
#include <pcre.h>
struct switch_cause_table { struct switch_cause_table {
const char *name; const char *name;
@ -4277,7 +4277,47 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
} }
if (x) { if (x) {
switch_channel_set_variable(channel, "digits_dialed", dtstr); const char *var = switch_channel_get_variable(channel, "digits_dialed_filter");
char *digit_string = dtstr;
char *X = NULL;
switch_regex_t *re = NULL;
char *substituted = NULL;
if (!zstr(var)) {
int proceed = 0;
int ovector[30];
if ((proceed = switch_regex_perform(dtstr, var, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
int len = (strlen(dtstr) + strlen(var) + 10) * proceed;
int i = 0;
const char *replace = NULL;
X = malloc(len);
for (i = 0; i < proceed; i++) {
if (pcre_get_substring(dtstr, ovector, proceed, i, &replace) > 0) {
switch_size_t plen = strlen(replace);
memset(X, 'X', plen);
*(X+plen) = '\0';
switch_safe_free(substituted);
substituted = switch_string_replace(substituted ? substituted : dtstr, replace, X);
printf("WTF [%s][%s]\n", replace, substituted);
pcre_free_substring(replace);
}
}
if (!zstr(substituted)) {
digit_string = substituted;
}
}
}
switch_channel_set_variable(channel, "digits_dialed", digit_string);
switch_regex_safe_free(re);
switch_safe_free(substituted);
switch_safe_free(X);
} else { } else {
switch_channel_set_variable(channel, "digits_dialed", "none"); switch_channel_set_variable(channel, "digits_dialed", "none");
} }

View File

@ -892,12 +892,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
switch_assert(enc_frame->data != NULL); switch_assert(enc_frame->data != NULL);
session->read_codec->cur_frame = enc_frame; session->read_codec->cur_frame = enc_frame;
enc_frame->codec->cur_frame = enc_frame; enc_frame->codec->cur_frame = enc_frame;
switch_assert(enc_frame->datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE);
switch_assert(session->enc_read_frame.datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE);
status = switch_core_codec_encode(session->read_codec, status = switch_core_codec_encode(session->read_codec,
enc_frame->codec, enc_frame->codec,
enc_frame->data, enc_frame->data,
enc_frame->datalen, enc_frame->datalen,
session->read_impl.actual_samples_per_second, session->read_impl.actual_samples_per_second,
session->enc_read_frame.data, &session->enc_read_frame.datalen, &session->enc_read_frame.rate, &flag); session->enc_read_frame.data, &session->enc_read_frame.datalen, &session->enc_read_frame.rate, &flag);
switch_assert(session->enc_read_frame.datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE);
session->read_codec->cur_frame = NULL; session->read_codec->cur_frame = NULL;
enc_frame->codec->cur_frame = NULL; enc_frame->codec->cur_frame = NULL;
switch (status) { switch (status) {
@ -1475,6 +1479,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
session->enc_write_frame.datalen = session->enc_write_frame.buflen; session->enc_write_frame.datalen = session->enc_write_frame.buflen;
session->write_codec->cur_frame = frame; session->write_codec->cur_frame = frame;
frame->codec->cur_frame = frame; frame->codec->cur_frame = frame;
switch_assert(enc_frame->datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE);
switch_assert(session->enc_read_frame.datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE);
status = switch_core_codec_encode(session->write_codec, status = switch_core_codec_encode(session->write_codec,
frame->codec, frame->codec,
enc_frame->data, enc_frame->data,
@ -1482,6 +1488,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
session->write_impl.actual_samples_per_second, session->write_impl.actual_samples_per_second,
session->enc_write_frame.data, &session->enc_write_frame.datalen, &session->enc_write_frame.rate, &flag); session->enc_write_frame.data, &session->enc_write_frame.datalen, &session->enc_write_frame.rate, &flag);
switch_assert(session->enc_read_frame.datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE);
session->write_codec->cur_frame = NULL; session->write_codec->cur_frame = NULL;
frame->codec->cur_frame = NULL; frame->codec->cur_frame = NULL;
switch (status) { switch (status) {
@ -1582,6 +1590,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
session->write_codec->cur_frame = frame; session->write_codec->cur_frame = frame;
frame->codec->cur_frame = frame; frame->codec->cur_frame = frame;
switch_assert(enc_frame->datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE);
switch_assert(session->enc_read_frame.datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE);
status = switch_core_codec_encode(session->write_codec, status = switch_core_codec_encode(session->write_codec,
frame->codec, frame->codec,
enc_frame->data, enc_frame->data,
@ -1589,6 +1599,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
rate, rate,
session->enc_write_frame.data, &session->enc_write_frame.datalen, &session->enc_write_frame.rate, &flag); session->enc_write_frame.data, &session->enc_write_frame.datalen, &session->enc_write_frame.rate, &flag);
switch_assert(session->enc_read_frame.datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE);
session->write_codec->cur_frame = NULL; session->write_codec->cur_frame = NULL;
frame->codec->cur_frame = NULL; frame->codec->cur_frame = NULL;
switch (status) { switch (status) {

View File

@ -1628,6 +1628,106 @@ SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *ses
} }
static void check_jb(switch_core_session_t *session, const char *input)
{
const char *val;
switch_media_handle_t *smh;
switch_rtp_engine_t *a_engine;
switch_assert(session);
if (!(smh = session->media_handle)) {
return;
}
a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
if (!a_engine->rtp_session) return;
if (!zstr(input)) {
const char *s;
if (!strcasecmp(input, "pause")) {
switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_TRUE);
return;
} else if (!strcasecmp(input, "resume")) {
switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_FALSE);
return;
} else if (!strcasecmp(input, "stop")) {
switch_rtp_deactivate_jitter_buffer(a_engine->rtp_session);
return;
} else if (!strncasecmp(input, "debug:", 6)) {
s = input + 6;
if (s && !strcmp(s, "off")) {
s = NULL;
}
switch_rtp_debug_jitter_buffer(a_engine->rtp_session, s);
return;
}
switch_channel_set_variable(session->channel, "jitterbuffer_msec", input);
}
if ((val = switch_channel_get_variable(session->channel, "jitterbuffer_msec")) || (val = smh->mparams->jb_msec)) {
int jb_msec = atoi(val);
int maxlen = 0, max_drift = 0;
char *p, *q;
if ((p = strchr(val, ':'))) {
p++;
maxlen = atoi(p);
if ((q = strchr(p, ':'))) {
q++;
max_drift = abs(atoi(q));
}
}
if (jb_msec < 0 && jb_msec > -20) {
jb_msec = (a_engine->read_codec.implementation->microseconds_per_packet / 1000) * abs(jb_msec);
}
if (maxlen < 0 && maxlen > -20) {
maxlen = (a_engine->read_codec.implementation->microseconds_per_packet / 1000) * abs(maxlen);
}
if (jb_msec < 20 || jb_msec > 10000) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
"Invalid Jitterbuffer spec [%d] must be between 20 and 10000\n", jb_msec);
} else {
int qlen, maxqlen = 10;
qlen = jb_msec / (a_engine->read_impl.microseconds_per_packet / 1000);
if (maxlen) {
maxqlen = maxlen / (a_engine->read_impl.microseconds_per_packet / 1000);
}
if (maxqlen < qlen) {
maxqlen = qlen * 5;
}
if (switch_rtp_activate_jitter_buffer(a_engine->rtp_session, qlen, maxqlen,
a_engine->read_impl.samples_per_packet,
a_engine->read_impl.samples_per_second, max_drift) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames) (%d max drift)\n",
jb_msec, qlen, maxqlen, max_drift);
switch_channel_set_flag(session->channel, CF_JITTERBUFFER);
if (!switch_false(switch_channel_get_variable(session->channel, "rtp_jitter_buffer_plc"))) {
switch_channel_set_flag(session->channel, CF_JITTERBUFFER_PLC);
}
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
SWITCH_LOG_WARNING, "Error Setting Jitterbuffer to %dms (%d frames)\n", jb_msec, qlen);
}
}
}
}
//? //?
SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session_t *session, switch_frame_t **frame, SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session_t *session, switch_frame_t **frame,
switch_io_flag_t flags, int stream_id, switch_media_type_t type) switch_io_flag_t flags, int stream_id, switch_media_type_t type)
@ -1741,7 +1841,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
engine->read_impl.samples_per_packet; engine->read_impl.samples_per_packet;
} }
} }
check_jb(session, NULL);
engine->check_frames = 0; engine->check_frames = 0;
engine->last_ts = 0; engine->last_ts = 0;
engine->last_seq = 0; engine->last_seq = 0;
@ -3097,90 +3199,6 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
switch_channel_set_flag(session->channel, CF_LIBERAL_DTMF); switch_channel_set_flag(session->channel, CF_LIBERAL_DTMF);
} }
if ((m = sdp->sdp_media) &&
(m->m_mode == sdp_sendonly || m->m_mode == sdp_inactive ||
(m->m_connections && m->m_connections->c_address && !strcmp(m->m_connections->c_address, "0.0.0.0")))) {
sendonly = 2; /* global sendonly always wins */
}
for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
if (zstr(attr->a_name)) {
continue;
}
if (!strcasecmp(attr->a_name, "sendonly")) {
sendonly = 1;
switch_channel_set_variable(session->channel, "media_audio_mode", "recvonly");
} else if (!strcasecmp(attr->a_name, "inactive")) {
sendonly = 1;
switch_channel_set_variable(session->channel, "media_audio_mode", "inactive");
} else if (!strcasecmp(attr->a_name, "recvonly")) {
switch_channel_set_variable(session->channel, "media_audio_mode", "sendonly");
recvonly = 1;
if (switch_rtp_ready(a_engine->rtp_session)) {
switch_rtp_set_max_missed_packets(a_engine->rtp_session, 0);
a_engine->max_missed_hold_packets = 0;
a_engine->max_missed_packets = 0;
} else {
switch_channel_set_variable(session->channel, "rtp_timeout_sec", "0");
switch_channel_set_variable(session->channel, "rtp_hold_timeout_sec", "0");
}
} else if (sendonly < 2 && !strcasecmp(attr->a_name, "sendrecv")) {
sendonly = 0;
} else if (!strcasecmp(attr->a_name, "ptime")) {
dptime = atoi(attr->a_value);
} else if (!strcasecmp(attr->a_name, "maxptime")) {
dmaxptime = atoi(attr->a_value);
}
}
if (sendonly != 1 && recvonly != 1) {
switch_channel_set_variable(session->channel, "media_audio_mode", NULL);
}
if (!(switch_media_handle_test_media_flag(smh, SCMF_DISABLE_HOLD)
|| ((val = switch_channel_get_variable(session->channel, "rtp_disable_hold"))
&& switch_true(val)))
&& !smh->mparams->hold_laps) {
smh->mparams->hold_laps++;
if (switch_core_media_toggle_hold(session, sendonly)) {
reneg = switch_media_handle_test_media_flag(smh, SCMF_RENEG_ON_HOLD);
if ((val = switch_channel_get_variable(session->channel, "rtp_renegotiate_codec_on_hold"))) {
reneg = switch_true(val);
}
}
}
if (reneg) {
reneg = switch_media_handle_test_media_flag(smh, SCMF_RENEG_ON_REINVITE);
if ((val = switch_channel_get_variable(session->channel, "rtp_renegotiate_codec_on_reinvite"))) {
reneg = switch_true(val);
}
}
if (session->bugs) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
"Session is connected to a media bug. "
"Re-Negotiation implicitly disabled.\n");
reneg = 0;
}
if (switch_channel_test_flag(session->channel, CF_RECOVERING)) {
reneg = 0;
}
if (!reneg && smh->num_negotiated_codecs) {
codec_array = smh->negotiated_codecs;
total_codecs = smh->num_negotiated_codecs;
} else if (reneg) {
smh->mparams->num_codecs = 0;
switch_core_media_prepare_codecs(session, SWITCH_FALSE);
codec_array = smh->codecs;
total_codecs = smh->mparams->num_codecs;
}
if (switch_stristr("T38FaxFillBitRemoval:", r_sdp) || switch_stristr("T38FaxTranscodingMMR:", r_sdp) || if (switch_stristr("T38FaxFillBitRemoval:", r_sdp) || switch_stristr("T38FaxTranscodingMMR:", r_sdp) ||
switch_stristr("T38FaxTranscodingJBIG:", r_sdp)) { switch_stristr("T38FaxTranscodingJBIG:", r_sdp)) {
switch_channel_set_variable(session->channel, "t38_broken_boolean", "true"); switch_channel_set_variable(session->channel, "t38_broken_boolean", "true");
@ -3197,6 +3215,10 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
sdp_connection_t *connection; sdp_connection_t *connection;
switch_core_session_t *other_session; switch_core_session_t *other_session;
if (!m->m_port) {
continue;
}
ptime = dptime; ptime = dptime;
maxptime = dmaxptime; maxptime = dmaxptime;
@ -3336,6 +3358,100 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
goto done; goto done;
} else if (m->m_type == sdp_media_audio && m->m_port && !got_audio) { } else if (m->m_type == sdp_media_audio && m->m_port && !got_audio) {
sdp_rtpmap_t *map; sdp_rtpmap_t *map;
int ice = 0;
if ((m->m_mode == sdp_sendonly || m->m_mode == sdp_inactive ||
(m->m_connections && m->m_connections->c_address && !strcmp(m->m_connections->c_address, "0.0.0.0")))) {
sendonly = 2; /* global sendonly always wins */
}
for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
if (zstr(attr->a_name)) {
continue;
}
if (!strncasecmp(attr->a_name, "ice", 3)) {
ice++;
} else if (sendonly < 2 && !strcasecmp(attr->a_name, "sendonly")) {
sendonly = 1;
switch_channel_set_variable(session->channel, "media_audio_mode", "recvonly");
} else if (sendonly < 2 && !strcasecmp(attr->a_name, "inactive")) {
sendonly = 1;
switch_channel_set_variable(session->channel, "media_audio_mode", "inactive");
} else if (!strcasecmp(attr->a_name, "recvonly")) {
switch_channel_set_variable(session->channel, "media_audio_mode", "sendonly");
recvonly = 1;
if (switch_rtp_ready(a_engine->rtp_session)) {
switch_rtp_set_max_missed_packets(a_engine->rtp_session, 0);
a_engine->max_missed_hold_packets = 0;
a_engine->max_missed_packets = 0;
} else {
switch_channel_set_variable(session->channel, "rtp_timeout_sec", "0");
switch_channel_set_variable(session->channel, "rtp_hold_timeout_sec", "0");
}
} else if (sendonly < 2 && !strcasecmp(attr->a_name, "sendrecv")) {
sendonly = 0;
} else if (!strcasecmp(attr->a_name, "ptime")) {
ptime = dptime = atoi(attr->a_value);
} else if (!strcasecmp(attr->a_name, "maxptime")) {
maxptime = dmaxptime = atoi(attr->a_value);
}
}
if (sendonly == 2 && ice) {
sendonly = 0;
}
if (sendonly != 1 && recvonly != 1) {
switch_channel_set_variable(session->channel, "media_audio_mode", NULL);
}
if (!(switch_media_handle_test_media_flag(smh, SCMF_DISABLE_HOLD)
|| ((val = switch_channel_get_variable(session->channel, "rtp_disable_hold"))
&& switch_true(val)))
&& !smh->mparams->hold_laps) {
smh->mparams->hold_laps++;
if (switch_core_media_toggle_hold(session, sendonly)) {
reneg = switch_media_handle_test_media_flag(smh, SCMF_RENEG_ON_HOLD);
if ((val = switch_channel_get_variable(session->channel, "rtp_renegotiate_codec_on_hold"))) {
reneg = switch_true(val);
}
}
}
if (reneg) {
reneg = switch_media_handle_test_media_flag(smh, SCMF_RENEG_ON_REINVITE);
if ((val = switch_channel_get_variable(session->channel, "rtp_renegotiate_codec_on_reinvite"))) {
reneg = switch_true(val);
}
}
if (session->bugs) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
"Session is connected to a media bug. "
"Re-Negotiation implicitly disabled.\n");
reneg = 0;
}
if (switch_channel_test_flag(session->channel, CF_RECOVERING)) {
reneg = 0;
}
if (!reneg && smh->num_negotiated_codecs) {
codec_array = smh->negotiated_codecs;
total_codecs = smh->num_negotiated_codecs;
} else if (reneg) {
smh->mparams->num_codecs = 0;
switch_core_media_prepare_codecs(session, SWITCH_FALSE);
codec_array = smh->codecs;
total_codecs = smh->mparams->num_codecs;
}
if (switch_rtp_has_dtls() && dtls_ok(session)) { if (switch_rtp_has_dtls() && dtls_ok(session)) {
for (attr = m->m_attributes; attr; attr = attr->a_next) { for (attr = m->m_attributes; attr; attr = attr->a_next) {
@ -4084,7 +4200,7 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session
if (switch_channel_test_flag(session->channel, CF_PROTO_HOLD)) { if (switch_channel_test_flag(session->channel, CF_PROTO_HOLD)) {
const char *val; const char *val;
int media_on_hold_a = switch_true(switch_channel_get_variable_dup(session->channel, "bypass_media_resume_on_hold", SWITCH_FALSE, -1)); int media_on_hold_a = switch_true(switch_channel_get_variable_dup(session->channel, "bypass_media_resume_on_hold", SWITCH_FALSE, -1));
int media_on_hold_b = switch_true(switch_channel_get_variable_dup(b_channel, "bypass_media_resume_on_hold", SWITCH_FALSE, -1)); int media_on_hold_b = 0;
int bypass_after_hold_a = 0; int bypass_after_hold_a = 0;
int bypass_after_hold_b = 0; int bypass_after_hold_b = 0;
@ -4092,10 +4208,12 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session
bypass_after_hold_a = switch_true(switch_channel_get_variable_dup(session->channel, "bypass_media_after_hold", SWITCH_FALSE, -1)); bypass_after_hold_a = switch_true(switch_channel_get_variable_dup(session->channel, "bypass_media_after_hold", SWITCH_FALSE, -1));
} }
if (media_on_hold_b) { if (b_channel) {
bypass_after_hold_b = switch_true(switch_channel_get_variable_dup(b_channel, "bypass_media_after_hold", SWITCH_FALSE, -1)); if ((media_on_hold_b = switch_true(switch_channel_get_variable_dup(b_channel, "bypass_media_resume_on_hold", SWITCH_FALSE, -1)))) {
bypass_after_hold_b = switch_true(switch_channel_get_variable_dup(b_channel, "bypass_media_after_hold", SWITCH_FALSE, -1));
}
} }
switch_yield(250000); switch_yield(250000);
if (b_channel && (switch_channel_test_flag(session->channel, CF_BYPASS_MEDIA_AFTER_HOLD) || if (b_channel && (switch_channel_test_flag(session->channel, CF_BYPASS_MEDIA_AFTER_HOLD) ||
@ -5246,61 +5364,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
} }
check_jb(session, NULL);
if ((val = switch_channel_get_variable(session->channel, "jitterbuffer_msec")) || (val = smh->mparams->jb_msec)) {
int jb_msec = atoi(val);
int maxlen = 0, max_drift = 0;
char *p, *q;
if ((p = strchr(val, ':'))) {
p++;
maxlen = atoi(p);
if ((q = strchr(p, ':'))) {
q++;
max_drift = abs(atoi(q));
}
}
if (jb_msec < 0 && jb_msec > -10) {
jb_msec = (a_engine->read_codec.implementation->microseconds_per_packet / 1000) * abs(jb_msec);
}
if (jb_msec < 20 || jb_msec > 10000) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
"Invalid Jitterbuffer spec [%d] must be between 20 and 10000\n", jb_msec);
} else {
int qlen, maxqlen = 50;
qlen = jb_msec / (a_engine->read_impl.microseconds_per_packet / 1000);
if (qlen < 1) {
qlen = 3;
}
if (maxlen) {
maxqlen = maxlen / (a_engine->read_impl.microseconds_per_packet / 1000);
}
if (maxqlen < qlen) {
maxqlen = qlen * 5;
}
if (switch_rtp_activate_jitter_buffer(a_engine->rtp_session, qlen, maxqlen,
a_engine->read_impl.samples_per_packet,
a_engine->read_impl.samples_per_second, max_drift) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames)\n", jb_msec, qlen);
switch_channel_set_flag(session->channel, CF_JITTERBUFFER);
if (!switch_false(switch_channel_get_variable(session->channel, "rtp_jitter_buffer_plc"))) {
switch_channel_set_flag(session->channel, CF_JITTERBUFFER_PLC);
}
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
SWITCH_LOG_WARNING, "Error Setting Jitterbuffer to %dms (%d frames)\n", jb_msec, qlen);
}
}
}
if ((val = switch_channel_get_variable(session->channel, "rtp_timeout_sec"))) { if ((val = switch_channel_get_variable(session->channel, "rtp_timeout_sec"))) {
int v = atoi(val); int v = atoi(val);
@ -7606,8 +7670,17 @@ SWITCH_DECLARE(void) switch_core_media_start_udptl(switch_core_session_t *sessio
} }
} }
//?
SWITCH_DECLARE(void) switch_core_media_hard_mute(switch_core_session_t *session, switch_bool_t on)
{
switch_core_session_message_t msg = { 0 };
msg.from = __FILE__;
msg.message_id = SWITCH_MESSAGE_INDICATE_HARD_MUTE;
msg.numeric_arg = on;
switch_core_session_receive_message(session, &msg);
}
//? //?
@ -7664,77 +7737,26 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se
case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER: case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER:
{ {
if (switch_rtp_ready(a_engine->rtp_session)) { if (switch_rtp_ready(a_engine->rtp_session)) {
int len = 0, maxlen = 0, qlen = 0, maxqlen = 50, max_drift = 0; check_jb(session, msg->string_arg);
if (msg->string_arg) {
char *p, *q;
const char *s;
if (!strcasecmp(msg->string_arg, "pause")) {
switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_TRUE);
goto end;
} else if (!strcasecmp(msg->string_arg, "resume")) {
switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_FALSE);
goto end;
} else if (!strncasecmp(msg->string_arg, "debug:", 6)) {
s = msg->string_arg + 6;
if (s && !strcmp(s, "off")) {
s = NULL;
}
status = switch_rtp_debug_jitter_buffer(a_engine->rtp_session, s);
goto end;
}
if ((len = atoi(msg->string_arg))) {
qlen = len / (a_engine->read_impl.microseconds_per_packet / 1000);
if (qlen < 1) {
qlen = 3;
}
}
if (qlen) {
if ((p = strchr(msg->string_arg, ':'))) {
p++;
maxlen = atol(p);
if ((q = strchr(p, ':'))) {
q++;
max_drift = abs(atoi(q));
}
}
}
if (maxlen) {
maxqlen = maxlen / (a_engine->read_impl.microseconds_per_packet / 1000);
}
}
if (qlen) {
if (maxqlen < qlen) {
maxqlen = qlen * 5;
}
if (switch_rtp_activate_jitter_buffer(a_engine->rtp_session, qlen, maxqlen,
a_engine->read_impl.samples_per_packet,
a_engine->read_impl.samples_per_second, max_drift) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames) (%d max drift)\n",
len, qlen, maxqlen, max_drift);
switch_channel_set_flag(session->channel, CF_JITTERBUFFER);
if (!switch_false(switch_channel_get_variable(session->channel, "rtp_jitter_buffer_plc"))) {
switch_channel_set_flag(session->channel, CF_JITTERBUFFER_PLC);
}
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
SWITCH_LOG_WARNING, "Error Setting Jitterbuffer to %dms (%d frames)\n", len, qlen);
}
} else {
switch_rtp_deactivate_jitter_buffer(a_engine->rtp_session);
}
} }
} }
break; break;
case SWITCH_MESSAGE_INDICATE_HARD_MUTE:
{
if (a_engine->rtp_session) {
if (msg->numeric_arg) {
switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_MUTE);
} else {
switch_rtp_clear_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_MUTE);
}
rtp_flush_read_buffer(a_engine->rtp_session, SWITCH_RTP_FLUSH_ONCE);
}
}
break;
case SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA: case SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA:
{ {
switch_rtp_t *rtp = a_engine->rtp_session; switch_rtp_t *rtp = a_engine->rtp_session;

View File

@ -1043,8 +1043,20 @@ struct record_helper {
switch_time_t last_write_time; switch_time_t last_write_time;
switch_bool_t hangup_on_error; switch_bool_t hangup_on_error;
switch_codec_implementation_t read_impl; switch_codec_implementation_t read_impl;
switch_bool_t speech_detected;
const char *completion_cause;
}; };
/**
* Set the recording completion cause. The cause can only be set once, to minimize the logic in the record_callback.
* [The completion_cause strings are essentially those of an MRCP Recorder resource.]
*/
static void set_completion_cause(struct record_helper *rh, const char *completion_cause)
{
if (!rh->completion_cause) {
rh->completion_cause = completion_cause;
}
}
static switch_bool_t is_silence_frame(switch_frame_t *frame, int silence_threshold, switch_codec_implementation_t *codec_impl) static switch_bool_t is_silence_frame(switch_frame_t *frame, int silence_threshold, switch_codec_implementation_t *codec_impl)
{ {
@ -1072,6 +1084,30 @@ static switch_bool_t is_silence_frame(switch_frame_t *frame, int silence_thresho
return is_silence; return is_silence;
} }
static void send_record_stop_event(switch_channel_t *channel, switch_codec_implementation_t *read_impl, struct record_helper *rh)
{
switch_event_t *event;
if (read_impl->actual_samples_per_second) {
switch_channel_set_variable_printf(channel, "record_seconds", "%d", rh->fh->samples_out / read_impl->actual_samples_per_second);
switch_channel_set_variable_printf(channel, "record_ms", "%d", rh->fh->samples_out / (read_impl->actual_samples_per_second / 1000));
}
if (!zstr(rh->completion_cause)) {
switch_channel_set_variable_printf(channel, "record_completion_cause", "%s", rh->completion_cause);
}
switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out);
if (switch_event_create(&event, SWITCH_EVENT_RECORD_STOP) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-File-Path", rh->file);
if (!zstr(rh->completion_cause)) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-Completion-Cause", rh->completion_cause);
}
switch_event_fire(&event);
}
}
static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
{ {
@ -1093,6 +1129,8 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
} }
rh->silence_time = switch_micro_time_now(); rh->silence_time = switch_micro_time_now();
rh->silence_timeout_ms = rh->initial_timeout_ms; rh->silence_timeout_ms = rh->initial_timeout_ms;
rh->speech_detected = SWITCH_FALSE;
rh->completion_cause = NULL;
switch_core_session_get_read_impl(session, &rh->read_impl); switch_core_session_get_read_impl(session, &rh->read_impl);
@ -1199,10 +1237,15 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
while (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { while (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
len = (switch_size_t) frame.datalen / 2; len = (switch_size_t) frame.datalen / 2;
if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS && rh->hangup_on_error) { if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing %s\n", rh->file); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing %s\n", rh->file);
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); /* File write failed */
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); set_completion_cause(rh, "uri-failure");
if (rh->hangup_on_error) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
}
send_record_stop_event(channel, &read_impl, rh);
return SWITCH_FALSE; return SWITCH_FALSE;
} }
} }
@ -1213,22 +1256,27 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Discarding short file %s\n", rh->file); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Discarding short file %s\n", rh->file);
switch_channel_set_variable(channel, "RECORD_DISCARDED", "true"); switch_channel_set_variable(channel, "RECORD_DISCARDED", "true");
switch_file_remove(rh->file, switch_core_session_get_pool(session)); switch_file_remove(rh->file, switch_core_session_get_pool(session));
set_completion_cause(rh, "input-too-short");
} }
if (read_impl.actual_samples_per_second) { if (switch_channel_down_nosig(channel)) {
switch_channel_set_variable_printf(channel, "record_seconds", "%d", rh->fh->samples_out / read_impl.actual_samples_per_second); /* We got hung up */
switch_channel_set_variable_printf(channel, "record_ms", "%d", rh->fh->samples_out / (read_impl.actual_samples_per_second / 1000)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Channel is hung up\n");
if (rh->speech_detected) {
/* Treat it as equivalent with final-silence */
set_completion_cause(rh, "success-silence");
} else {
/* Treat it as equivalent with inital-silence timeout */
set_completion_cause(rh, "no-input-timeout");
}
} else {
/* Set the completion_cause to maxtime reached, unless it's already set */
set_completion_cause(rh, "success-maxtime");
} }
switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out);
} }
if (switch_event_create(&event, SWITCH_EVENT_RECORD_STOP) == SWITCH_STATUS_SUCCESS) { send_record_stop_event(channel, &read_impl, rh);
switch_channel_event_set_data(channel, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-File-Path", rh->file);
switch_event_fire(&event);
}
switch_channel_execute_on(channel, SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE); switch_channel_execute_on(channel, SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE);
if ((var = switch_channel_get_variable(channel, SWITCH_RECORD_POST_PROCESS_EXEC_API_VARIABLE))) { if ((var = switch_channel_get_variable(channel, SWITCH_RECORD_POST_PROCESS_EXEC_API_VARIABLE))) {
@ -1275,10 +1323,14 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
len = (switch_size_t) frame.datalen / 2; len = (switch_size_t) frame.datalen / 2;
if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS && rh->hangup_on_error) { if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing %s\n", rh->file); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing %s\n", rh->file);
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); /* File write failed */
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); set_completion_cause(rh, "uri-failure");
if (rh->hangup_on_error) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
}
return SWITCH_FALSE; return SWITCH_FALSE;
} }
@ -1289,23 +1341,40 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
if (is_silence_frame(&frame, rh->silence_threshold, &read_impl)) { if (is_silence_frame(&frame, rh->silence_threshold, &read_impl)) {
if (!rh->silence_time) { if (!rh->silence_time) {
/* start of silence */ /* start of silence */
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Start of silence detected\n");
rh->silence_time = switch_micro_time_now(); rh->silence_time = switch_micro_time_now();
} else { } else {
/* continuing silence */ /* continuing silence */
int duration_ms = (int)((switch_micro_time_now() - rh->silence_time) / 1000); int duration_ms = (int)((switch_micro_time_now() - rh->silence_time) / 1000);
if (rh->silence_timeout_ms > 0 && duration_ms >= rh->silence_timeout_ms) { if (rh->silence_timeout_ms > 0 && duration_ms >= rh->silence_timeout_ms) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Recording file %s timeout: %i >= %i\n", rh->file, duration_ms, rh->silence_timeout_ms); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Recording file %s timeout: %i >= %i\n", rh->file, duration_ms, rh->silence_timeout_ms);
if (rh->speech_detected) {
/* Reached final silence timeout */
set_completion_cause(rh, "success-silence");
} else {
/* Reached initial silence timeout */
set_completion_cause(rh, "no-input-timeout");
/* Discard the silent file? */
}
switch_core_media_bug_set_flag(bug, SMBF_PRUNE); switch_core_media_bug_set_flag(bug, SMBF_PRUNE);
} }
} }
} else { /* not silence */ } else { /* not silence */
if (rh->silence_time) { if (rh->silence_time) {
/* end of silence */ /* end of silence */
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Start of speech detected\n");
rh->speech_detected = SWITCH_TRUE;
rh->silence_time = 0; rh->silence_time = 0;
/* switch from initial timeout to final timeout */ /* switch from initial timeout to final timeout */
rh->silence_timeout_ms = rh->final_timeout_ms; rh->silence_timeout_ms = rh->final_timeout_ms;
} }
} }
} else {
/* no silence detection */
if (!rh->speech_detected) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No silence detection configured; assuming start of speech\n");
rh->speech_detected = SWITCH_TRUE;
}
} }
} }
} }

View File

@ -3825,11 +3825,13 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *
} }
READ_INC(rtp_session); READ_INC(rtp_session);
if (rtp_session->jb) { if (rtp_session->jb) {
stfu_n_resize(rtp_session->jb, queue_frames); stfu_n_destroy(&rtp_session->jb);
} else {
rtp_session->jb = stfu_n_init(queue_frames, max_queue_frames ? max_queue_frames : 50, samples_per_packet, samples_per_second, max_drift);
} }
rtp_session->jb = stfu_n_init(queue_frames, max_queue_frames ? max_queue_frames : 50, samples_per_packet, samples_per_second, max_drift);
READ_DEC(rtp_session); READ_DEC(rtp_session);
if (rtp_session->jb) { if (rtp_session->jb) {
@ -5913,6 +5915,10 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
result_continue: result_continue:
timer_check: timer_check:
if (rtp_session->flags[SWITCH_RTP_FLAG_MUTE]) {
do_cng++;
}
if (do_cng) { if (do_cng) {
uint8_t *data = (uint8_t *) RTP_BODY(rtp_session); uint8_t *data = (uint8_t *) RTP_BODY(rtp_session);

View File

@ -276,7 +276,7 @@ void stfu_n_report(stfu_instance_t *i, stfu_report_t *r)
stfu_status_t stfu_n_auto_size(stfu_instance_t *i, int check_down) stfu_status_t stfu_n_auto_size(stfu_instance_t *i, int check_down)
{ {
stfu_status_t r = STFU_IT_FAILED; stfu_status_t r = STFU_IT_FAILED;
int len; uint32_t len;
if (!i->ms_per_packet) { if (!i->ms_per_packet) {
return r; return r;
@ -294,7 +294,7 @@ stfu_status_t stfu_n_auto_size(stfu_instance_t *i, int check_down)
return r; return r;
} }
stfu_status_t _stfu_n_resize(stfu_instance_t *i, int32_t qlen, int line) stfu_status_t _stfu_n_resize(stfu_instance_t *i, uint32_t qlen, int line)
{ {
stfu_status_t s; stfu_status_t s;
int diff; int diff;
@ -526,7 +526,7 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint16_t seq, uin
} }
if (i->ready && i->out_queue->array_len && (i->last_time_skew > 1 || i->last_ts_skew)) { if (i->ready && i->out_queue->array_len && (i->last_time_skew > 1 || i->last_ts_skew)) {
int time_ms = i->last_time_skew, ts_ms = (i->last_ts_skew / i->samples_per_packet) * i->ms_per_packet; uint32_t time_ms = i->last_time_skew, ts_ms = (i->last_ts_skew / i->samples_per_packet) * i->ms_per_packet;
if (time_ms > i->period_jitter_size_time) { if (time_ms > i->period_jitter_size_time) {
i->period_jitter_size_time = time_ms; i->period_jitter_size_time = time_ms;
@ -709,7 +709,7 @@ static int stfu_n_find_any_frame(stfu_instance_t *in, stfu_queue_t *queue, stfu_
int best_diff = 1000000, cur_diff = 0; int best_diff = 1000000, cur_diff = 0;
stfu_frame_t *frame = NULL, *best_frame = NULL; stfu_frame_t *frame = NULL, *best_frame = NULL;
int newer = 0; int newer = 0;
int was_read = 0; uint32_t was_read = 0;
stfu_assert(r_frame); stfu_assert(r_frame);

View File

@ -18,11 +18,12 @@ if [ "`id -u`" = "0" ]; then
export AUTOMAKE_VERSION=1.13 export AUTOMAKE_VERSION=1.13
export LIBTOOL=/usr/local/bin/libtoolize export LIBTOOL=/usr/local/bin/libtoolize
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
export PKG_PATH=http://openbsd.mirrors.pair.com/`uname -r`/packages/`machine -a`/
fi fi
if [ "${UNAME}" = "NetBSD" ]; then if [ "${UNAME}" = "NetBSD" ]; then
export PATH="$PATH:/usr/local/freeswitch/bin" export PATH="$PATH:/usr/local/freeswitch/bin"
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig:/usr/pkg/lib/pkgconfig export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig:/usr/pkg/lib/pkgconfig
export PKG_PATH=ftp://199.233.217.249/pub/pkgsrc/packages/NetBSD/amd64/6.1.3/All export PKG_PATH=http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/`uname -r`/All/
fi fi
if [ "${UNAME}" = "FreeBSD" ]; then if [ "${UNAME}" = "FreeBSD" ]; then
export PATH="$PATH:/usr/local/freeswitch/bin" export PATH="$PATH:/usr/local/freeswitch/bin"
@ -40,6 +41,7 @@ fi
set -o emacs set -o emacs
export TERM=xterm-256color
export LESSCHARSET="latin1" export LESSCHARSET="latin1"
export LESS="-R" export LESS="-R"
export CHARSET="ISO-8859-1" export CHARSET="ISO-8859-1"