Merge branch 'master' into v1.4

This commit is contained in:
Ken Rice 2014-09-10 13:11:55 -05:00
commit 9f72b11892
85 changed files with 5654 additions and 644 deletions

View File

@ -8,10 +8,10 @@
# Brian West <brian@freeswitch.org>
#
FSPREFIX=/usr/local/freeswitch
PREFIX=/opt/fs-libs
PREFIX=/usr/local/freeswitch
DOWNLOAD=http://files.freeswitch.org/downloads/libs
JPEG=v8d
OPENSSL=1.0.1h
OPENSSL=1.0.1i
SQLITE=autoconf-3080403
PCRE=8.35
CURL=7.35.0

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
PREFIX=/usr/local/freeswitch
DOWNLOAD=http://files.freeswitch.org/downloads/libs
LIBRESSL=2.0.3
OPENSSL=1.0.1i
LIBEDIT=20140618-3.1
CURL=7.35.0
@ -39,11 +39,11 @@ has-git:
deps: libedit libressl curl
@PKG_PATH=http://openbsd.mirrors.pair.com/`uname -r`/packages/`machine -a`/ pkg_add -r $(PKG)
libressl: libressl-$(LIBRESSL)/Makefile
libressl-$(LIBRESSL)/Makefile: libressl-$(LIBRESSL)
libressl-$(LIBRESSL):
openssl: openssl-$(OPENSSL)/.done
openssl-$(OPENSSL)/.done: openssl-$(OPENSSL)
openssl-$(OPENSSL):
(test -d $@) || (wget -4 -O $@.tar.gz $(DOWNLOAD)/$@.tar.gz && tar zxfv $@.tar.gz)
(cd $@ && ./configure --prefix=$(PREFIX) && make && sudo make install)
(cd $@ && ./Configure --prefix=$(PREFIX) BSD-x86_64 shared && make && sudo make install && touch .done)
libedit: libedit-$(LIBEDIT)/Makefile
libedit-$(LIBEDIT)/Makefile: libedit-$(LIBEDIT)

View File

@ -10,7 +10,7 @@ FSPREFIX=/usr/local/freeswitch
PREFIX=/usr/local/
DOWNLOAD=http://files.freeswitch.org/downloads/libs
JP=v8d
SSL=1.0.1h
SSL=1.0.1i
SQLITE=autoconf-3080403
PCRE=8.35
CURL=7.35.0

View File

@ -1,5 +1,6 @@
#applications/mod_abstraction
#applications/mod_avmd
#applications/mod_bert
#applications/mod_blacklist
#applications/mod_callcenter
#applications/mod_cidlookup

View File

@ -5,7 +5,7 @@
NOTE: make sure the file exists and is readable by FreeSWITCH.
<list name="example" filename="/usr/local/freeswitch/conf/blacklists/example.list"/>
<list name="example" filename="$${conf_dir}/blacklists/example.list"/>
-->
</lists>
</configuration>

View File

@ -9,7 +9,7 @@
<queue name="support@default">
<param name="strategy" value="longest-idle-agent"/>
<param name="moh-sound" value="$${hold_music}"/>
<!--<param name="record-template" value="$${base_dir}/recordings/${strftime(%Y-%m-%d-%H-%M-%S)}.${destination_number}.${caller_id_number}.${uuid}.wav"/>-->
<!--<param name="record-template" value="$${recordings_dir}/${strftime(%Y-%m-%d-%H-%M-%S)}.${destination_number}.${caller_id_number}.${uuid}.wav"/>-->
<param name="time-base-score" value="system"/>
<param name="max-wait-time" value="0"/>
<param name="max-wait-time-with-no-agent" value="0"/>

View File

@ -9,7 +9,7 @@
<param name="legs" value="a"/>
<!-- Directory in which to spool failed SQL inserts -->
<!-- <param name="spool-dir" value="$${base_dir}/log/cdr-pg-csv"/> -->
<!-- <param name="spool-dir" value="$${log_dir}/cdr-pg-csv"/> -->
<!-- Disk spool format if DB connection/insert fails - csv (default) or sql -->
<param name="spool-format" value="csv"/>
<param name="rotate-on-hup" value="true"/>

View File

@ -11,7 +11,7 @@
<!-- Specify this OR 'cookie-file' or $HOME/.erlang.cookie will be read -->
<param name="cookie" value="ClueCon"/>
<!-- Read a cookie from an arbitary erlang cookie file instead -->
<!--<param name="cookie-file" value="/tmp/erlang.cookie"/>-->
<!--<param name="cookie-file" value="/$${temp_dir}/erlang.cookie"/>-->
<param name="shortname" value="true"/>
<!-- in additon to cookie, optionally restrict by ACL -->
<!--<param name="apply-inbound-acl" value="lan"/>-->

View File

@ -6,7 +6,7 @@
<param name="ident" value="SpanDSP Fax Ident"/>
<param name="header" value="SpanDSP Fax Header"/>
<param name="spool-dir" value="/tmp"/>
<param name="spool-dir" value="$${temp_dir}"/>
<param name="file-prefix" value="faxrx"/>
</settings>
</configuration>

View File

@ -46,7 +46,7 @@
<!-- optional: full path to the error log dir for failed web posts if not specified its the same as log-dir -->
<!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank or omitted value will default to ${prefix}/logs/format_cdr -->
<!-- <param name="err-log-dir" value="/tmp"/> -->
<!-- <param name="err-log-dir" value="$${temp_dir}"/> -->
<!-- which auhtentification scheme to use. Supported values are: basic, digest, NTLM, GSS-NEGOTIATE or "any" for automatic detection -->
<!--<param name="auth-scheme" value="basic"/>-->
@ -63,21 +63,21 @@
Specify your public key with 'ssl-cert-path' and the private key with
'ssl-key-path'. If your private key has a password, specify it with
'ssl-key-password'. -->
<!-- <param name="ssl-cert-path" value="$${base_dir}/conf/certs/public_key.pem"/> -->
<!-- <param name="ssl-key-path" value="$${base_dir}/conf/certs/private_key.pem"/> -->
<!-- <param name="ssl-cert-path" value="$${certs_dir}/public_key.pem"/> -->
<!-- <param name="ssl-key-path" value="$${certs_dir}/private_key.pem"/> -->
<!-- <param name="ssl-key-password" value="MyPrivateKeyPassword"/> -->
<!-- optional: use a custom CA certificate in PEM format to verify the peer
with. This is useful if you are acting as your own certificate authority.
note: only makes sense if used in combination with "enable-cacert-check." -->
<!-- <param name="ssl-cacert-file" value="$${base_dir}/conf/certs/cacert.pem"/> -->
<!-- <param name="ssl-cacert-file" value="$${certs_dir}/cacert.pem"/> -->
<!-- optional: specify the SSL version to force HTTPS to use. Valid options are
"SSLv3" and "TLSv1". Otherwise libcurl will auto-negotiate the version. -->
<!-- <param name="ssl-version" value="TLSv1"/> -->
<!-- optional: enables cookies and stores them in the specified file. -->
<!-- <param name="cookie-file" value="/tmp/cookie-mod_format_cdr_curl.txt"/> -->
<!-- <param name="cookie-file" value="/$${temp_dir}/cookie-mod_format_cdr_curl.txt"/> -->
<!-- Whether to URL encode the individual JSON values. Defaults to true, set to false for standard JSON. -->
<param name="encode-values" value="true"/>

View File

@ -100,8 +100,8 @@
Specify your public key with 'ssl-cert-path' and the private key with
'ssl-key-path'. If your private key has a password, specify it with
'ssl-key-password'. -->
<!-- <param name="ssl-cert-path" value="$${base_dir}/conf/certs/public_key.pem"/> -->
<!-- <param name="ssl-key-path" value="$${base_dir}/conf/certs/private_key.pem"/> -->
<!-- <param name="ssl-cert-path" value="$${certs_dir}/public_key.pem"/> -->
<!-- <param name="ssl-key-path" value="$${certs_dir}/private_key.pem"/> -->
<!-- <param name="ssl-key-password" value="MyPrivateKeyPassword"/> -->
<!-- optional timeout -->
<!-- <param name="timeout" value="10"/> -->
@ -109,14 +109,14 @@
<!-- optional: use a custom CA certificate in PEM format to verify the peer
with. This is useful if you are acting as your own certificate authority.
note: only makes sense if used in combination with "enable-cacert-check." -->
<!-- <param name="ssl-cacert-file" value="$${base_dir}/conf/certs/cacert.pem"/> -->
<!-- <param name="ssl-cacert-file" value="$${certs_dir}/cacert.pem"/> -->
<!-- optional: specify the SSL version to force HTTPS to use. Valid options are
"SSLv3" and "TLSv1". Otherwise libcurl will auto-negotiate the version. -->
<!-- <param name="ssl-version" value="TLSv1"/> -->
<!-- optional: enables cookies and stores them in the specified file. -->
<!-- <param name="cookie-file" value="/tmp/cookie-mod_xml_curl.txt"/> -->
<!-- <param name="cookie-file" value="$${temp_dir}/cookie-mod_xml_curl.txt"/> -->
<!-- one or more of these imply you want to pick the exact variables that are transmitted -->
<!--<param name="enable-post-var" value="Caller-Unique-ID"/>-->

View File

@ -3,12 +3,12 @@
<!-- set to true if you want to enable http:// and https:// formats. Do not use if mod_httapi is also loaded -->
<param name="enable-file-formats" value="false"/>
<param name="max-urls" value="10000"/>
<param name="location" value="$${base_dir}/http_cache"/>
<param name="location" value="$${cache_dir}"/>
<param name="default-max-age" value="86400"/>
<param name="prefetch-thread-count" value="8"/>
<param name="prefetch-queue-size" value="100"/>
<!-- absolute path to CA bundle file -->
<param name="ssl-cacert" value="$${base_dir}/conf/cacert.pem"/>
<param name="ssl-cacert" value="$${certs_dir}/cacert.pem"/>
<!-- verify certificates -->
<param name="ssl-verifypeer" value="true"/>
<!-- verify host name matches certificate -->

View File

@ -1,7 +1,7 @@
<configuration name="java.conf" description="Java Plug-Ins">
<javavm path="/opt/jdk1.6.0_04/jre/lib/amd64/server/libjvm.so"/>
<options>
<option value="-Djava.class.path=$${base_dir}/scripts/freeswitch.jar:$${base_dir}/scripts/example.jar"/>
<option value="-Djava.class.path=$${script_dir}/freeswitch.jar:$${script_dir}/example.jar"/>
<option value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8000"/>
</options>
<startup class="org/freeswitch/example/ApplicationLauncher" method="startup"/>

View File

@ -13,7 +13,7 @@
These entries will be pre-pended to the LUA_PATH environment variable
-->
<!-- <param name="script-directory" value="/usr/local/lua/?.lua"/> -->
<!-- <param name="script-directory" value="$${base_dir}/scripts/?.lua"/> -->
<!-- <param name="script-directory" value="$${script_dir}/?.lua"/> -->
<!--<param name="xml-handler-script" value="/dp.lua"/>-->
<!--<param name="xml-handler-bindings" value="dialplan"/>-->

View File

@ -1,6 +1,6 @@
<configuration name="perl.conf" description="PERL Configuration">
<settings>
<!--<param name="xml-handler-script" value="/tmp/xml.pl"/>-->
<!--<param name="xml-handler-script" value="$${temp_dir}/xml.pl"/>-->
<!--<param name="xml-handler-bindings" value="dialplan"/>-->
<!--

View File

@ -32,7 +32,7 @@
<param name="ident" value="SpanDSP Fax Ident"/>
<param name="header" value="SpanDSP Fax Header"/>
<param name="spool-dir" value="/tmp"/>
<param name="spool-dir" value="$${temp_dir}"/>
<param name="file-prefix" value="faxrx"/>
</fax-settings>

View File

@ -8,8 +8,8 @@
<profile name="mine">
<param name="bind-local" value="0.0.0.0:8081"/>
<param name="bind-local" value="0.0.0.0:8082" secure="true"/>
<param name="secure-combined" value="$${base_dir}/certs/wss.pem"/>
<param name="secure-chain" value="$${base_dir}/certs/wss.pem"/>
<param name="secure-combined" value="$${certs_dir}/wss.pem"/>
<param name="secure-chain" value="$${certs_dir}/wss.pem"/>
<param name="userauth" value="true"/>
<!-- setting this to true will allow anyone to register even with no account so use with care -->
<param name="blind-reg" value="false"/>

View File

@ -64,7 +64,7 @@
<param name="date-fmt" value="%A, %B %d %Y, %I %M %p"/>
<param name="email-from" value="${voicemail_account}@${voicemail_domain}"/>
</email>
<!--<param name="storage-dir" value="/tmp"/>-->
<!--<param name="storage-dir" value="$${storage_dir}"/>-->
<!--<param name="odbc-dsn" value="dsn:user:pass"/>-->
<!--<param name="record-comment" value="Your Comment"/>-->
<!--<param name="record-title" value="Your Title"/>-->

View File

@ -35,7 +35,7 @@
<!-- optional: full path to the error log dir for failed web posts if not specified its the same as log-dir -->
<!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank or omitted value will default to ${prefix}/logs/xml_cdr -->
<!-- <param name="err-log-dir" value="/tmp"/> -->
<!-- <param name="err-log-dir" value="$${temp_dir}"/> -->
<!-- which auhtentification scheme to use. Supported values are: basic, digest, NTLM, GSS-NEGOTIATE or "any" for automatic detection -->
<!--<param name="auth-scheme" value="basic"/>-->
@ -52,20 +52,20 @@
Specify your public key with 'ssl-cert-path' and the private key with
'ssl-key-path'. If your private key has a password, specify it with
'ssl-key-password'. -->
<!-- <param name="ssl-cert-path" value="$${base_dir}/conf/certs/public_key.pem"/> -->
<!-- <param name="ssl-key-path" value="$${base_dir}/conf/certs/private_key.pem"/> -->
<!-- <param name="ssl-cert-path" value="$${certs_dir}/public_key.pem"/> -->
<!-- <param name="ssl-key-path" value="$${certs_dir}/private_key.pem"/> -->
<!-- <param name="ssl-key-password" value="MyPrivateKeyPassword"/> -->
<!-- optional: use a custom CA certificate in PEM format to verify the peer
with. This is useful if you are acting as your own certificate authority.
note: only makes sense if used in combination with "enable-cacert-check." -->
<!-- <param name="ssl-cacert-file" value="$${base_dir}/conf/certs/cacert.pem"/> -->
<!-- <param name="ssl-cacert-file" value="$${certs_dir}/cacert.pem"/> -->
<!-- optional: specify the SSL version to force HTTPS to use. Valid options are
"SSLv3" and "TLSv1". Otherwise libcurl will auto-negotiate the version. -->
<!-- <param name="ssl-version" value="TLSv1"/> -->
<!-- optional: enables cookies and stores them in the specified file. -->
<!-- <param name="cookie-file" value="/tmp/cookie-mod_xml_curl.txt"/> -->
<!-- <param name="cookie-file" value="/$${temp_dir}/cookie-mod_xml_curl.txt"/> -->
</settings>
</configuration>

View File

@ -24,8 +24,8 @@
Specify your public key with 'ssl-cert-path' and the private key with
'ssl-key-path'. If your private key has a password, specify it with
'ssl-key-password'. -->
<!-- <param name="ssl-cert-path" value="$${base_dir}/conf/certs/public_key.pem"/> -->
<!-- <param name="ssl-key-path" value="$${base_dir}/conf/certs/private_key.pem"/> -->
<!-- <param name="ssl-cert-path" value="$${certs_dir}/public_key.pem"/> -->
<!-- <param name="ssl-key-path" value="$${certs_dir}/private_key.pem"/> -->
<!-- <param name="ssl-key-password" value="MyPrivateKeyPassword"/> -->
<!-- optional timeout -->
<!-- <param name="timeout" value="10"/> -->
@ -33,14 +33,14 @@
<!-- optional: use a custom CA certificate in PEM format to verify the peer
with. This is useful if you are acting as your own certificate authority.
note: only makes sense if used in combination with "enable-cacert-check." -->
<!-- <param name="ssl-cacert-file" value="$${base_dir}/conf/certs/cacert.pem"/> -->
<!-- <param name="ssl-cacert-file" value="$${certs_dir}/cacert.pem"/> -->
<!-- optional: specify the SSL version to force HTTPS to use. Valid options are
"SSLv3" and "TLSv1". Otherwise libcurl will auto-negotiate the version. -->
<!-- <param name="ssl-version" value="TLSv1"/> -->
<!-- optional: enables cookies and stores them in the specified file. -->
<!-- <param name="cookie-file" value="/tmp/cookie-mod_xml_curl.txt"/> -->
<!-- <param name="cookie-file" value="$${temp_dir}/cookie-mod_xml_curl.txt"/> -->
<!-- one or more of these imply you want to pick the exact variables that are transmitted -->
<!--<param name="enable-post-var" value="Unique-ID"/>-->

View File

@ -129,7 +129,7 @@
<condition field="${default_password}" expression="^1234$" break="never">
<action application="log" data="CRIT WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING "/>
<action application="log" data="CRIT Open ${base_dir}/conf/vars.xml and change the default_password."/>
<action application="log" data="CRIT Open $${conf_dir}/vars.xml and change the default_password."/>
<action application="log" data="CRIT Once changed type 'reloadxml' at the console."/>
<action application="log" data="CRIT WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING "/>
<action application="sleep" data="10000"/>
@ -598,14 +598,14 @@
<condition field="destination_number" expression="^9178$">
<action application="answer" />
<action application="playback" data="silence_stream://2000"/>
<action application="rxfax" data="/tmp/rxfax.tif"/>
<action application="rxfax" data="$${temp_dir}/rxfax.tif"/>
<action application="hangup"/>
</condition>
</extension>
<extension name="fax_transmit">
<condition field="destination_number" expression="^9179$">
<action application="txfax" data="/tmp/txfax.tif"/>
<action application="txfax" data="$${temp_dir}/txfax.tif"/>
<action application="hangup"/>
</condition>
</extension>
@ -675,14 +675,14 @@
<extension name="video_record">
<condition field="destination_number" expression="^9193$">
<action application="answer"/>
<action application="record_fsv" data="/tmp/testrecord.fsv"/>
<action application="record_fsv" data="$${temp_dir}/testrecord.fsv"/>
</condition>
</extension>
<extension name="video_playback">
<condition field="destination_number" expression="^9194$">
<action application="answer"/>
<action application="play_fsv" data="/tmp/testrecord.fsv"/>
<action application="play_fsv" data="$${temp_dir}/testrecord.fsv"/>
</condition>
</extension>
@ -710,7 +710,7 @@
<extension name="tone_stream">
<condition field="destination_number" expression="^9198$">
<action application="answer"/>
<action application="playback" data="{loops=10}tone_stream://path=${base_dir}/conf/tetris.ttml"/>
<action application="playback" data="{loops=10}tone_stream://path=${conf_dir}/tetris.ttml"/>
</condition>
</extension>

View File

@ -307,7 +307,7 @@
<!--<param name="ws-binding" value=":5066"/>-->
<!-- uncomment for sip over secure websocket support -->
<!-- You need wss.pem in /usr/local/freeswitch/certs for wss -->
<!-- You need wss.pem in $${certs_dir} for wss -->
<!--<param name="wss-binding" value=":7443"/>-->

View File

@ -28,6 +28,18 @@
recordings_dir
sound_prefix
sounds_dir
conf_dir
log_dir
run_dir
db_dir
mod_dir
htdocs_dir
script_dir
temp_dir
grammar_dir
certs_dir
storage_dir
cache_dir
core_uuid
zrtp_enabled
nat_public_addr
@ -117,7 +129,7 @@
false - implies forbidden
true - implies mandatory
default if not set is accept SAVP inbound if offered.
default if not set is accept SAVP inbound if offered.
rtp_secure_media_inbound | rtp_secure_media_outbound

View File

@ -84,6 +84,7 @@ default_runtimedir="$rundir"
default_scriptdir="$prefix/scripts"
default_soundsdir="$prefix/sounds"
default_storagedir="$prefix/storage"
default_cachedir="$prefix/cache"
if test "$enable_fhs" = yes; then
prefix="/usr" exec_prefix="$prefix"
@ -102,6 +103,7 @@ if test "$enable_fhs" = yes; then
default_scriptdir="/usr/share/freeswitch/scripts"
default_soundsdir="/usr/share/freeswitch/sounds"
default_storagedir="/var/lib/freeswitch/storage"
default_cachedir="/var/cache/freeswitch"
fi
# Where to install the modules
@ -161,6 +163,11 @@ AC_ARG_WITH([storagedir],
AC_SUBST(storagedir)
AC_DEFINE_UNQUOTED([SWITCH_STORAGE_DIR],"${storagedir}",[where to put storage files])
AC_ARG_WITH([cachedir],
[AS_HELP_STRING([--with-cachedir=DIR], [Put cache files into this location (default: $prefix/cache)])], [cachedir="$withval"], [cachedir="${default_cachedir}"])
AC_SUBST(cachedir)
AC_DEFINE_UNQUOTED([SWITCH_CACHE_DIR],"${cachedir}",[where to put cache files])
if test "$sysconfdir" = "\${prefix}/etc" ; then
confdir="$prefix/conf"
else
@ -1448,6 +1455,7 @@ AC_CONFIG_FILES([Makefile
src/mod/Makefile
src/mod/applications/mod_abstraction/Makefile
src/mod/applications/mod_avmd/Makefile
src/mod/applications/mod_bert/Makefile
src/mod/applications/mod_blacklist/Makefile
src/mod/applications/mod_callcenter/Makefile
src/mod/applications/mod_cidlookup/Makefile
@ -1748,5 +1756,6 @@ echo " runtimedir: ${runtimedir}"
echo " scriptdir: ${scriptdir}"
echo " soundsdir: ${soundsdir}"
echo " storagedir: ${storagedir}"
echo " cachedir: ${cachedir}"
echo ""
echo "------------------------------------------------------------------------------"

1
debian/bootstrap.sh vendored
View File

@ -41,6 +41,7 @@ avoid_mods_jessie=(
languages/mod_java
)
avoid_mods_wheezy=(
languages/mod_java
)
avoid_mods_squeeze=(
formats/mod_vlc

View File

@ -13,6 +13,10 @@ Description: Advanced voicemail detection
This module attempts to determine when a voicemail system has
answered the call.
Module: applications/mod_bert
Description: Line testing tool
This module provides a tool to test a line.
Module: applications/mod_blacklist
Description: Blacklist helper
This module provides tools to blacklist callers.

1
debian/rules vendored
View File

@ -80,6 +80,7 @@ override_dh_auto_clean:
--with-htdocsdir=/usr/share/freeswitch/htdocs \
--with-soundsdir=/usr/share/freeswitch/sounds \
--with-storagedir=/var/lib/freeswitch/storage \
--with-cachedir=/var/cache/freeswitch \
--with-grammardir=/usr/share/freeswitch/grammar \
--with-certsdir=/etc/freeswitch/tls \
--with-scriptdir=/usr/share/freeswitch/scripts \

View File

@ -461,8 +461,6 @@ function init() {
if (verto) {
verto.iceServers(tmp);
}
alert(tmp);
});
verto = new $.verto({

View File

@ -55,7 +55,7 @@ foreach my $name ( sort( keys(%name_to_file) ) ) {
my $data = join( "", <$in> );
close($in);
if ( $data !~ /^TZif2/o ) {
if ( $data !~ /^TZif/o ) {
$debug && print "Skipped $file\n";
next;
}

View File

@ -255,6 +255,7 @@ SWITCH_DECLARE(void) switch_core_session_clear_crypto(switch_core_session_t *ses
SWITCH_DECLARE(switch_status_t) switch_core_session_get_payload_code(switch_core_session_t *session,
switch_media_type_t type,
const char *iananame,
uint32_t rate,
switch_payload_t *ptP,
switch_payload_t *recv_ptP,
char **fmtpP);

View File

@ -149,7 +149,9 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
SWITCH_DECLARE_CONSTRUCTOR Stream(void);
SWITCH_DECLARE_CONSTRUCTOR Stream(switch_stream_handle_t *);
virtual SWITCH_DECLARE_CONSTRUCTOR ~ Stream();
SWITCH_DECLARE(const char *) read(int *len);
SWITCH_DECLARE(void) write(const char *data);
SWITCH_DECLARE(void) raw_write(const char *data, int len);
SWITCH_DECLARE(const char *) get_data(void);
};

View File

@ -91,6 +91,7 @@ struct switch_state_handler_table {
};
struct switch_stream_handle {
switch_stream_handle_read_function_t read_function;
switch_stream_handle_write_function_t write_function;
switch_stream_handle_raw_write_function_t raw_write_function;
void *data;

View File

@ -172,6 +172,8 @@ typedef struct {
uint32_t clean_count;
uint32_t consecutive_good_count;
uint32_t consecutive_bad_count;
double period_jitter_percent;
double period_missing_percent;
} stfu_report_t;
typedef void (*stfu_n_call_me_t)(stfu_instance_t *i, void *);

View File

@ -510,6 +510,7 @@ struct switch_directories {
char *htdocs_dir;
char *grammar_dir;
char *storage_dir;
char *cache_dir;
char *recordings_dir;
char *sounds_dir;
char *lib_dir;
@ -2152,6 +2153,7 @@ typedef void (*switch_scheduler_func_t) (switch_scheduler_task_t *task);
typedef switch_status_t (*switch_state_handler_t) (switch_core_session_t *);
typedef struct switch_stream_handle switch_stream_handle_t;
typedef uint8_t * (*switch_stream_handle_read_function_t) (switch_stream_handle_t *handle, int *len);
typedef switch_status_t (*switch_stream_handle_write_function_t) (switch_stream_handle_t *handle, const char *fmt, ...);
typedef switch_status_t (*switch_stream_handle_raw_write_function_t) (switch_stream_handle_t *handle, uint8_t *data, switch_size_t datalen);

View File

@ -24,6 +24,7 @@
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
* Seven Du <dujinfang@gmail.com>
*
*
* switch_utils.h -- Compatability and Helper Code
@ -1102,6 +1103,52 @@ SWITCH_DECLARE(char *) switch_strerror_r(int errnum, char *buf, switch_size_t bu
SWITCH_DECLARE(int) switch_wait_sock(switch_os_socket_t sock, uint32_t ms, switch_poll_t flags);
SWITCH_DECLARE(int) switch_wait_socklist(switch_waitlist_t *waitlist, uint32_t len, uint32_t ms);
typedef struct switch_http_request_s {
const char *method; /* GET POST PUT DELETE OPTIONS PATCH HEAD */
const char *uri;
const char *qs; /* query string*/
const char *host;
switch_port_t port;
const char *from;
const char *user_agent;
const char *referer;
const char *user;
switch_bool_t keepalive;
const char *content_type;
switch_size_t content_length;
switch_size_t bytes_header;
switch_size_t bytes_read;
switch_size_t bytes_buffered;
switch_event_t *headers;
void *user_data; /* private user data */
/* private members used by the parser internally */
char *_buffer;
switch_bool_t _destroy_headers;
} switch_http_request_t;
/**
* parse http headers in a buffer
* return status of success or not
* \param[in] buffer the buffer start from the very begining of the http request, e.g. 'GET '
* \param[in] datalen the buffer length
* \param[out] the http request pointer or null, need destroy later if got non-NULL pointer
* \return SWITCH_STATUS_SUCCESS | SWITCH_STATUS_FALSE
*/
SWITCH_DECLARE(switch_status_t) switch_http_parse_header(char *buffer, uint32_t datalen, switch_http_request_t *request);
SWITCH_DECLARE(void) switch_http_free_request(switch_http_request_t *request);
SWITCH_DECLARE(void) switch_http_dump_request(switch_http_request_t *request);
/**
* parse http query string
* \param[in] request the http request object
* \param[in] qs the query string buffer
*
* qs buffer will be modified, so be sure to dup the qs before passing into this function if you want to keep the original string untouched
* if qs is NULL, the it will parse request->qs, request->qs will be duplicated before parse to avoid being modified
*/
SWITCH_DECLARE(void) switch_http_parse_qs(switch_http_request_t *request, char *qs);
SWITCH_END_EXTERN_C
#endif
/* For Emacs:

View File

@ -0,0 +1,8 @@
include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_bert
mod_LTLIBRARIES = mod_bert.la
mod_bert_la_SOURCES = mod_bert.c
mod_bert_la_CFLAGS = $(AM_CFLAGS)
mod_bert_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_bert_la_LDFLAGS = -avoid-version -module -no-undefined -shared

View File

@ -0,0 +1,389 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Oreka Recording Module
*
* The Initial Developer of the Original Code is
* Moises Silva <moises.silva@gmail.com>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Moises Silva <moises.silva@gmail.com>
*
* mod_bert -- Naive BERT tester
*
*/
#include <switch.h>
SWITCH_MODULE_LOAD_FUNCTION(mod_bert_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_bert_shutdown);
SWITCH_MODULE_DEFINITION(mod_bert, mod_bert_load, mod_bert_shutdown, NULL);
#define G711_ULAW_IDLE_OCTET 0xFF
/* http://en.wikipedia.org/wiki/Digital_milliwatt */
unsigned char ulaw_digital_milliwatt[8] = { 0x1e, 0x0b, 0x0b, 0x1e, 0x9e, 0x8b, 0x8b, 0x9e };
typedef struct {
uint32_t processed_samples;
uint32_t err_samples;
uint32_t window_ms;
uint32_t window_samples;
uint32_t stats_sync_lost_cnt;
uint32_t stats_cng_cnt;
uint8_t sequence_sample;
uint8_t predicted_sample;
float max_err;
float max_err_hit;
float max_err_ever;
uint8_t in_sync;
uint8_t hangup_on_error;
uint8_t milliwatt_index;
uint8_t milliwatt_prediction_index;
switch_time_t timeout;
FILE *input_debug_f;
FILE *output_debug_f;
switch_timer_t timer;
} bert_t;
#define bert_increase_milliwatt_index(index) \
do { \
if ((index) == (switch_arraylen(ulaw_digital_milliwatt)-1)) { \
(index) = 0; \
} else { \
(index) = ((index) + 1); \
} \
} while (0);
#define bert_close_debug_streams(bert, session) \
do { \
int rc = 0; \
if (bert.input_debug_f) { \
rc = fclose(bert.input_debug_f); \
if (rc) { \
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to close BERT input debug file!\n"); \
} \
bert.input_debug_f = NULL; \
} \
if (bert.output_debug_f) { \
rc = fclose(bert.output_debug_f); \
if (rc) { \
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to close BERT output debug file!\n"); \
} \
bert.output_debug_f = NULL; \
} \
} while (0);
#define BERT_STATS_VAR_SYNC_LOST "bert_stats_sync_lost"
#define BERT_STATS_VAR_SYNC_LOST_CNT "bert_stats_sync_lost_count"
#define BERT_EVENT_TIMEOUT "mod_bert::timeout"
#define BERT_EVENT_LOST_SYNC "mod_bert::lost_sync"
#define BERT_EVENT_IN_SYNC "mod_bert::in_sync"
#define BERT_DEFAULT_WINDOW_MS 1000
#define BERT_DEFAULT_MAX_ERR 10.0
#define BERT_DEFAULT_TIMEOUT_MS 10000
SWITCH_STANDARD_APP(bert_test_function)
{
switch_status_t status;
switch_frame_t *read_frame = NULL, write_frame = { 0 };
switch_codec_implementation_t read_impl = { 0 };
switch_channel_t *channel = NULL;
switch_event_t *event = NULL;
const char *var = NULL;
int i = 0;
int synced = 0;
int32_t timeout_ms = 0;
int32_t interval = 20;
int32_t samples = 0;
uint8_t *write_samples = NULL;
uint8_t *read_samples = NULL;
const char *timer_name = NULL;
bert_t bert = { 0 };
memset(&bert, 0, sizeof(bert));
channel = switch_core_session_get_channel(session);
switch_channel_answer(channel);
switch_core_session_get_read_impl(session, &read_impl);
if (read_impl.ianacode != 0) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "This application only works when using ulaw codec\n");
goto done;
}
bert.window_ms = BERT_DEFAULT_WINDOW_MS;
bert.window_samples = switch_samples_per_packet(read_impl.samples_per_second, bert.window_ms);
bert.max_err = BERT_DEFAULT_MAX_ERR;
timeout_ms = BERT_DEFAULT_TIMEOUT_MS;
/* check if there are user-defined overrides */
if ((var = switch_channel_get_variable(channel, "bert_window_ms"))) {
int tmp = atoi(var);
if (tmp > 0) {
bert.window_ms = tmp;
bert.window_samples = switch_samples_per_packet(read_impl.samples_per_second, bert.window_ms);
}
}
if ((var = switch_channel_get_variable(channel, "bert_timeout_ms"))) {
int tmp = atoi(var);
if (tmp > 0) {
timeout_ms = tmp;
}
}
if ((var = switch_channel_get_variable(channel, "bert_max_err"))) {
double tmp = atoi(var);
if (tmp > 0) {
bert.max_err = (float)tmp;
}
}
if ((var = switch_channel_get_variable(channel, "bert_hangup_on_error"))) {
if (switch_true(var)) {
bert.hangup_on_error = 1;
}
}
if ((var = switch_channel_get_variable(channel, "bert_debug_io_file"))) {
char debug_file[1024];
snprintf(debug_file, sizeof(debug_file), "%s.in", var);
bert.input_debug_f = fopen(debug_file, "w");
if (!bert.input_debug_f) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to open input debug file %s\n", debug_file);
}
snprintf(debug_file, sizeof(debug_file), "%s.out", var);
bert.output_debug_f = fopen(debug_file, "w");
if (!bert.output_debug_f) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to open output debug file %s\n", debug_file);
}
}
if ((var = switch_channel_get_variable(channel, "bert_timer_name"))) {
timer_name = var;
}
/* Setup the timer, so we can send audio at correct time frames even if we do not receive audio */
if (timer_name) {
interval = read_impl.microseconds_per_packet / 1000;
samples = switch_samples_per_packet(read_impl.samples_per_second, interval);
if (switch_core_timer_init(&bert.timer, timer_name, interval, samples, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setup timer success interval: %u samples: %u\n", interval, samples);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer Setup Failed. BERT cannot start!\n");
goto done;
}
switch_core_timer_sync(&bert.timer);
}
bert.timeout = (switch_micro_time_now() + (timeout_ms * 1000));
write_frame.codec = switch_core_session_get_read_codec(session);
write_frame.data = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE);
write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "BERT Test Window=%ums/%u, MaxErr=%f%%, Timeout=%dms\n", bert.window_ms, bert.window_samples, bert.max_err, timeout_ms);
if (bert.window_samples <= 0) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to compute BERT window samples!\n");
goto done;
}
switch_channel_set_variable(channel, BERT_STATS_VAR_SYNC_LOST_CNT, "0");
switch_channel_set_variable(channel, BERT_STATS_VAR_SYNC_LOST, "false");
write_samples = write_frame.data;
for (;;) {
if (!switch_channel_ready(channel)) {
break;
}
switch_ivr_parse_all_events(session);
if (timer_name) {
if (switch_core_timer_next(&bert.timer) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to step on timer!\n");
break;
}
}
/* Write our frame before anything else happens */
for (i = 0; i < read_impl.samples_per_packet; i++) {
/* Calculate our next sequence sample to write */
bert.sequence_sample = ulaw_digital_milliwatt[bert.milliwatt_index];
//switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[%d] 0x%X\n", bert.milliwatt_index, bert.sequence_sample);
bert_increase_milliwatt_index(bert.milliwatt_index);
//switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[%d] 0x%X\n", bert.milliwatt_index, bert.sequence_sample);
write_samples[i] = bert.sequence_sample;
}
write_frame.datalen = read_impl.samples_per_packet;
write_frame.samples = read_impl.samples_per_packet;
if (timer_name) {
write_frame.timestamp = bert.timer.samplecount;
} else {
/* playback() does not set write_frame.timestamp unless a timer is used, what's the catch? */
}
if (bert.output_debug_f) {
fwrite(write_frame.data, write_frame.datalen, 1, bert.output_debug_f);
}
status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
/* Proceed to read and process the read frame ...
* Note core_session_read_frame is a blocking operation, we should probably do reathing in another thread like playback() does using switch_core_service_session() */
status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
if (bert.timeout && !synced) {
switch_time_t now = switch_micro_time_now();
if (now >= bert.timeout) {
bert.timeout = 0;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "BERT Timeout (read_samples=%d, read_bytes=%d, expected_samples=%d, session=%s)\n",
read_frame->samples, read_frame->datalen, read_impl.samples_per_packet, switch_core_session_get_uuid(session));
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, BERT_EVENT_TIMEOUT) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_basic_data(channel, event);
switch_event_fire(&event);
}
if (bert.hangup_on_error) {
switch_channel_hangup(channel, SWITCH_CAUSE_MEDIA_TIMEOUT);
}
}
}
/* Treat CNG as silence */
if (switch_test_flag(read_frame, SFF_CNG)) {
read_frame->samples = read_impl.samples_per_packet;
read_frame->datalen = read_impl.samples_per_packet;
memset(read_frame->data, G711_ULAW_IDLE_OCTET, read_frame->datalen);
bert.stats_cng_cnt++;
}
if (read_frame->samples != read_impl.samples_per_packet || !read_frame->datalen) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Read %d samples, expected %d!\n", read_frame->samples, read_impl.samples_per_packet);
continue;
}
read_samples = read_frame->data;
if (bert.input_debug_f) {
size_t ret = fwrite(read_frame->data, read_frame->datalen, 1, bert.input_debug_f);
if (ret != 1) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to write to BERT input debug file!\n");
}
}
/* BERT Sync Loop */
for (i = 0; i < read_frame->samples; i++) {
if (bert.window_samples == bert.processed_samples) {
float err = 0.0;
/* If the channel is going down, then it is expected we'll have errors, ignore them and bail out */
if (!switch_channel_ready(channel)) {
bert_close_debug_streams(bert, session);
break;
}
/* Calculate error rate */
err = ((float)((float)bert.err_samples / (float)bert.processed_samples) * 100.0);
if (err > bert.max_err) {
if (bert.in_sync) {
bert.in_sync = 0;
bert.stats_sync_lost_cnt++;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "BERT Sync Lost: %f%% loss (count=%u, cng_count=%d, err_samples=%u, session=%s)\n",
err, bert.stats_sync_lost_cnt, bert.stats_cng_cnt, bert.err_samples, switch_core_session_get_uuid(session));
switch_channel_set_variable_printf(channel, BERT_STATS_VAR_SYNC_LOST_CNT, "%u", bert.stats_sync_lost_cnt);
switch_channel_set_variable(channel, BERT_STATS_VAR_SYNC_LOST, "true");
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, BERT_EVENT_LOST_SYNC) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_basic_data(channel, event);
switch_event_fire(&event);
}
if (bert.hangup_on_error) {
switch_channel_hangup(channel, SWITCH_CAUSE_MEDIA_TIMEOUT);
bert_close_debug_streams(bert, session);
}
}
} else if (!bert.in_sync) {
bert.in_sync = 1;
synced = 1;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "BERT Sync Success\n");
bert.stats_cng_cnt = 0;
bert.timeout = 0;
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, BERT_EVENT_IN_SYNC) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_basic_data(channel, event);
switch_event_fire(&event);
}
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "Err=%f%% (%u/%u)\n", err, bert.err_samples, bert.processed_samples);
if (synced && err > bert.max_err_hit) {
bert.max_err_hit = err;
}
if (err > bert.max_err_ever) {
bert.max_err_ever = err;
}
bert.processed_samples = 0;
bert.err_samples = 0;
}
if (bert.predicted_sample != read_samples[i]) {
bert.err_samples++;
if (!bert.in_sync) {
/* If we're not in sync, we must reset the index on error to start the pattern detection again */
bert.milliwatt_prediction_index = 0;
}
}
/* Try to guess what the next sample will be in the milliwatt sequence */
bert.predicted_sample = ulaw_digital_milliwatt[bert.milliwatt_prediction_index];
bert_increase_milliwatt_index(bert.milliwatt_prediction_index);
bert.processed_samples++;
}
}
done:
bert_close_debug_streams(bert, session);
if (bert.timer.interval) {
switch_core_timer_destroy(&bert.timer);
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "BERT Test Completed. MaxErr=%f%%\n", synced ? bert.max_err_hit : bert.max_err_ever);
}
SWITCH_MODULE_LOAD_FUNCTION(mod_bert_load)
{
switch_application_interface_t *app_interface = NULL;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_APP(app_interface, "bert_test", "Start BERT Test", "Start BERT Test", bert_test_function, "", SAF_NONE);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_bert_shutdown)
{
return SWITCH_STATUS_UNLOAD;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/

View File

@ -4633,7 +4633,7 @@ static void member_add_file_data(conference_member_t *member, int16_t *data, swi
pool = fnode->pool;
fnode = NULL;
switch_core_destroy_memory_pool(&pool);
} else {
} else if(!switch_test_flag(member->fnode, NFLAG_PAUSE)) {
/* skip this frame until leadin time has expired */
if (member->fnode->leadin) {
member->fnode->leadin--;
@ -7145,64 +7145,103 @@ static switch_status_t conf_api_sub_xml_list(conference_obj_t *conference, switc
return SWITCH_STATUS_SUCCESS;
}
static void switch_fnode_toggle_pause(conference_file_node_t *fnode, switch_stream_handle_t *stream)
{
if (fnode) {
if (switch_test_flag(fnode, NFLAG_PAUSE)) {
stream->write_function(stream, "+OK Resume\n");
switch_clear_flag(fnode, NFLAG_PAUSE);
} else {
stream->write_function(stream, "+OK Pause\n");
switch_set_flag(fnode, NFLAG_PAUSE);
}
}
}
static switch_status_t conf_api_sub_pause_play(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
if (argc == 2) {
switch_mutex_lock(conference->mutex);
if (conference->fnode) {
if (switch_test_flag(conference->fnode, NFLAG_PAUSE)) {
stream->write_function(stream, "+OK Resume\n");
switch_clear_flag(conference->fnode, NFLAG_PAUSE);
} else {
stream->write_function(stream, "+OK Pause\n");
switch_set_flag(conference->fnode, NFLAG_PAUSE);
}
}
switch_fnode_toggle_pause(conference->fnode, stream);
switch_mutex_unlock(conference->mutex);
return SWITCH_STATUS_SUCCESS;
}
if (argc == 3) {
uint32_t id = atoi(argv[2]);
conference_member_t *member;
if ((member = conference_member_get(conference, id))) {
switch_mutex_lock(member->fnode_mutex);
switch_fnode_toggle_pause(member->fnode, stream);
switch_mutex_unlock(member->fnode_mutex);
switch_thread_rwlock_unlock(member->rwlock);
return SWITCH_STATUS_SUCCESS;
} else {
stream->write_function(stream, "Member: %u not found.\n", id);
}
}
return SWITCH_STATUS_GENERR;
}
static switch_status_t conf_api_sub_file_seek(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
static void switch_fnode_seek(conference_file_node_t *fnode, switch_stream_handle_t *stream, char *arg)
{
if (argc == 3) {
if (fnode && fnode->type == NODE_TYPE_FILE) {
unsigned int samps = 0;
unsigned int pos = 0;
switch_mutex_lock(conference->mutex);
if (conference->fnode && conference->fnode->type == NODE_TYPE_FILE) {
if (*argv[2] == '+' || *argv[2] == '-') {
if (*arg == '+' || *arg == '-') {
int step;
int32_t target;
if (!(step = atoi(argv[2]))) {
if (!(step = atoi(arg))) {
step = 1000;
}
samps = step * (conference->fnode->fh.native_rate / 1000);
target = (int32_t)conference->fnode->fh.pos + samps;
samps = step * (fnode->fh.native_rate / 1000);
target = (int32_t)fnode->fh.pos + samps;
if (target < 0) {
target = 0;
}
stream->write_function(stream, "+OK seek to position %d\n", target);
switch_core_file_seek(&conference->fnode->fh, &pos, target, SEEK_SET);
switch_core_file_seek(&fnode->fh, &pos, target, SEEK_SET);
} else {
samps = switch_atoui(argv[2]) * (conference->fnode->fh.native_rate / 1000);
samps = switch_atoui(arg) * (fnode->fh.native_rate / 1000);
stream->write_function(stream, "+OK seek to position %d\n", samps);
switch_core_file_seek(&conference->fnode->fh, &pos, samps, SEEK_SET);
switch_core_file_seek(&fnode->fh, &pos, samps, SEEK_SET);
}
}
}
static switch_status_t conf_api_sub_file_seek(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
if (argc == 3) {
switch_mutex_lock(conference->mutex);
switch_fnode_seek(conference->fnode, stream, argv[2]);
switch_mutex_unlock(conference->mutex);
return SWITCH_STATUS_SUCCESS;
}
if (argc == 4) {
uint32_t id = atoi(argv[3]);
conference_member_t *member = conference_member_get(conference, id);
if (member == NULL) {
stream->write_function(stream, "Member: %u not found.\n", id);
return SWITCH_STATUS_GENERR;
}
switch_mutex_lock(member->fnode_mutex);
switch_fnode_seek(member->fnode, stream, argv[2]);
switch_mutex_unlock(member->fnode_mutex);
switch_thread_rwlock_unlock(member->rwlock);
return SWITCH_STATUS_SUCCESS;
}
return SWITCH_STATUS_GENERR;
}
@ -8108,8 +8147,8 @@ static api_command_t conf_api_sub_commands[] = {
{"position", (void_fn_t) & conf_api_sub_position, CONF_API_SUB_MEMBER_TARGET, "position", "<member_id> <x>,<y>,<z>"},
{"auto-3d-position", (void_fn_t) & conf_api_sub_auto_position, CONF_API_SUB_ARGS_SPLIT, "auto-3d-position", "[on|off]"},
{"play", (void_fn_t) & conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "play", "<file_path> [async|<member_id> [nomux]]"},
{"pause_play", (void_fn_t) & conf_api_sub_pause_play, CONF_API_SUB_ARGS_SPLIT, "pause", ""},
{"file_seek", (void_fn_t) & conf_api_sub_file_seek, CONF_API_SUB_ARGS_SPLIT, "file_seek", "[+-]<val>"},
{"pause_play", (void_fn_t) & conf_api_sub_pause_play, CONF_API_SUB_ARGS_SPLIT, "pause", "[<member_id>]"},
{"file_seek", (void_fn_t) & conf_api_sub_file_seek, CONF_API_SUB_ARGS_SPLIT, "file_seek", "[+-]<val> [<member_id>]"},
{"say", (void_fn_t) & conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "say", "<text>"},
{"saymember", (void_fn_t) & conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE, "saymember", "<member_id> <text>"},
{"stop", (void_fn_t) & conf_api_sub_stop, CONF_API_SUB_ARGS_SPLIT, "stop", "<[current|all|async|last]> [<member_id>]"},

View File

@ -280,12 +280,13 @@ SWITCH_LIMIT_RELEASE(limit_release_hash)
limit_hash_private_t *pvt = switch_channel_get_private(channel, "limit_hash");
limit_hash_item_t *item = NULL;
switch_thread_rwlock_wrlock(globals.limit_hash_rwlock);
if (!pvt || !pvt->hash) {
switch_thread_rwlock_unlock(globals.limit_hash_rwlock);
return SWITCH_STATUS_SUCCESS;
}
switch_thread_rwlock_wrlock(globals.limit_hash_rwlock);
/* clear for uuid */
if (realm == NULL && resource == NULL) {
switch_hash_index_t *hi = NULL;

View File

@ -117,9 +117,9 @@ static void translate_number(char *number, char *profile, char **translated, swi
translate_rule_t *hi = NULL;
translate_rule_t *rule = NULL;
switch_regex_t *re = NULL;
int proceed = 0, ovector[30];
char *substituted = NULL;
uint32_t len = 0;
int proceed = 0, ovector[30], subbedlen = 0;
char *substituted = NULL, *subbed = NULL, *session_malloc = NULL;
uint32_t len = 1024;
if (!profile) {
profile = "US";
@ -137,7 +137,7 @@ static void translate_number(char *number, char *profile, char **translated, swi
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s =~ /%s/\n", number, rule->regex);
if ((proceed = switch_regex_perform(number, rule->regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s matched %s, replacing with %s\n", number, rule->regex, rule->replace);
if (!(substituted = malloc(len))) {
if (!(substituted = switch_core_session_alloc(session, len))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
switch_regex_safe_free(re);
goto end;
@ -149,10 +149,21 @@ static void translate_number(char *number, char *profile, char **translated, swi
if ((switch_string_var_check_const(substituted) || switch_string_has_escaped_data(substituted))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "perform variable expansion\n");
if (session) {
substituted = switch_channel_expand_variables(switch_core_session_get_channel(session), substituted);
subbed = switch_channel_expand_variables(switch_core_session_get_channel(session), substituted);
} else if (event) {
substituted = switch_event_expand_headers(event, substituted);
subbed = switch_event_expand_headers(event, substituted);
}
subbedlen = strlen(subbed) + 1;
session_malloc = (char *)switch_core_session_alloc(session, subbedlen);
memset(session_malloc, 0, subbedlen);
strncpy(session_malloc, subbed, subbedlen);
if (subbed != substituted)
{
switch_safe_free(subbed);
}
substituted = session_malloc;
}
break;

View File

@ -397,7 +397,7 @@ static switch_status_t read_frame_callback(switch_core_session_t *session, switc
return SWITCH_STATUS_SUCCESS;
}
#define VALET_APP_SYNTAX "<lotname> <extension>|[ask [<min>] [<max>] [<to>] [<prompt>]|auto in [min] [max]]"
#define VALET_APP_SYNTAX "<lotname> <extension>|[ask [<min>] [<max>] [<to>] [<prompt>]|auto [in|out] [min] [max]]"
SWITCH_STANDARD_APP(valet_parking_function)
{
char *argv[6], *lbuf;

View File

@ -191,6 +191,7 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l
goto done;
error:
skinny_log_l(listener, SWITCH_LOG_CRIT, "Failed to create incoming session for line instance %d", *line_instance_p);
if (nsession) {
switch_core_session_destroy(&nsession);
}
@ -896,8 +897,13 @@ switch_status_t skinny_session_transfer(switch_core_session_t *session, listener
switch_status_t status = SWITCH_STATUS_SUCCESS;
private_t *tech_pvt = NULL;
switch_channel_t *channel = NULL;
switch_channel_t *channel2 = NULL;
const char *local_uuid = NULL;
const char *local_uuid2 = NULL;
const char *remote_uuid = NULL;
const char *remote_uuid2 = NULL;
switch_core_session_t *session2 = NULL;
switch_core_session_t *rsession = NULL;
private_t *tech_pvt2 = NULL;
switch_assert(session);
@ -906,30 +912,75 @@ switch_status_t skinny_session_transfer(switch_core_session_t *session, listener
tech_pvt = switch_core_session_get_private(session);
channel = switch_core_session_get_channel(session);
local_uuid = switch_channel_get_uuid(channel);
remote_uuid = switch_channel_get_partner_uuid(channel);
if ( switch_core_session_get_partner(session, &rsession) == SWITCH_STATUS_SUCCESS )
{
switch_channel_t *rchannel = NULL;
rchannel = switch_core_session_get_channel(rsession);
skinny_log_l_msg(listener, SWITCH_LOG_INFO, "SST: setting uuid bridge continue flag on remote channel\n");
switch_channel_set_variable(rchannel, "uuid_bridge_continue_on_cancel", "true");
switch_core_session_rwunlock(rsession);
}
skinny_log_l(listener, SWITCH_LOG_INFO, "SST: local_uuid=%s remote_uuid=%s\n", local_uuid, remote_uuid);
if (tech_pvt->transfer_from_call_id) {
skinny_log_l_msg(listener, SWITCH_LOG_INFO, "SST: transfer_from_call_id\n");
if((session2 = skinny_profile_find_session(listener->profile, listener, &line_instance, tech_pvt->transfer_from_call_id))) {
switch_channel_t *channel2 = switch_core_session_get_channel(session2);
const char *remote_uuid2 = switch_channel_get_partner_uuid(channel2);
if (switch_ivr_uuid_bridge(remote_uuid, remote_uuid2) == SWITCH_STATUS_SUCCESS) {
channel2 = switch_core_session_get_channel(session2);
local_uuid2 = switch_channel_get_uuid(channel2);
remote_uuid2 = switch_channel_get_partner_uuid(channel2);
skinny_log_ls(listener, session2, SWITCH_LOG_INFO, "SST: tx from session - local_uuid=%s remote_uuid=%s local_uuid2=%s remote_uuid2=%s\n",
local_uuid, remote_uuid, local_uuid2, remote_uuid2);
skinny_log_ls(listener, session2, SWITCH_LOG_INFO, "SST: attempting ivr bridge from (%s) to (%s)\n", remote_uuid, remote_uuid2);
if (switch_ivr_uuid_bridge(remote_uuid2, remote_uuid) == SWITCH_STATUS_SUCCESS) {
skinny_log_ls_msg(listener, session2, SWITCH_LOG_INFO, "SST: success on uuid bridge\n");
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
switch_channel_hangup(channel2, SWITCH_CAUSE_NORMAL_CLEARING);
} else {
skinny_log_ls_msg(listener, session2, SWITCH_LOG_INFO, "SST: failure on uuid bridge\n");
/* TODO: How to inform the user that the bridge is not possible? */
}
switch_core_session_rwunlock(session2);
}
} else {
skinny_log_l_msg(listener, SWITCH_LOG_INFO, "SST: !transfer_from_call_id\n");
if(remote_uuid) {
skinny_log_ls_msg(listener, session2, SWITCH_LOG_INFO, "SST: found remote_uuid\n");
/* TODO CallSelectStat */
skinny_log_ls_msg(listener, session2, SWITCH_LOG_INFO, "SST: creating incoming session\n");
status = skinny_create_incoming_session(listener, &line_instance, &session2);
if ( ! session2 ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "SST: Unable to create incoming session for transfer.\n");
return SWITCH_STATUS_FALSE;
}
tech_pvt2 = switch_core_session_get_private(session2);
tech_pvt2->transfer_from_call_id = tech_pvt->call_id;
tech_pvt->transfer_to_call_id = tech_pvt2->call_id;
skinny_log_ls(listener, session2, SWITCH_LOG_INFO, "SST: transfer_to_call_id=%d transfer_from_call_id=%d\n", tech_pvt2->call_id,
tech_pvt->call_id);
skinny_log_ls_msg(listener, session2, SWITCH_LOG_INFO, "SST: triggering dial on incoming session\n");
skinny_session_process_dest(session2, listener, line_instance, NULL, '\0', 0);
channel2 = switch_core_session_get_channel(session2);
local_uuid2 = switch_channel_get_uuid(channel2);
remote_uuid2 = switch_channel_get_partner_uuid(channel2);
skinny_log_ls(listener, session2, SWITCH_LOG_INFO, "SST: new session - local_uuid2=%s remote_uuid2=%s\n", local_uuid2, remote_uuid2);
switch_core_session_rwunlock(session2);
} else {
skinny_log_ls_msg(listener, session2, SWITCH_LOG_INFO, "SST: could not find remote_uuid\n");
/* TODO: How to inform the user that the bridge is not possible? */
}
}
@ -1387,6 +1438,10 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
switch(request->data.stimulus.instance_type) {
case SKINNY_BUTTON_LAST_NUMBER_REDIAL:
skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle last number redial stimulus message, couldn't create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0);
break;
@ -1395,9 +1450,13 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
session = skinny_profile_find_session(listener->profile, listener, &line_instance, 0);
if(strlen(button_speed_dial->line) > 0) {
if (!session) {
if ( !session ) {
skinny_create_incoming_session(listener, &line_instance, &session);
}
if ( !session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle speed dial stimulus message, couldn't create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance, button_speed_dial->line, '\0', 0);
}
break;
@ -1417,6 +1476,10 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
break;
case SKINNY_BUTTON_VOICEMAIL:
skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle stimulus message, couldn't create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_voicemail, listener->profile->ext_voicemail), '\0', 0);
break;
@ -1451,6 +1514,10 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
}
skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle stimulus message, couldn't create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0);
}
break;
@ -1489,6 +1556,10 @@ switch_status_t skinny_handle_off_hook_message(listener_t *listener, skinny_mess
skinny_session_answer(session, listener, line_instance);
} else { /* start a new call */
skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle off hook message, could not create session.\n");
return SWITCH_STATUS_FALSE;
}
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
@ -2003,11 +2074,19 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
switch(request->data.soft_key_event.event) {
case SOFTKEY_REDIAL:
status = skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0);
break;
case SOFTKEY_NEWCALL:
status = skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0);
break;
case SOFTKEY_HOLD:
@ -2064,17 +2143,29 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
break;
case SOFTKEY_MEETME:
skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_meetme, listener->profile->ext_meetme), '\0', 0);
break;
case SOFTKEY_CALLPICKUP:
case SOFTKEY_GRPCALLPICKUP:
skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_pickup, listener->profile->ext_pickup), '\0', 0);
break;
case SOFTKEY_CFWDALL:
skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_cfwdall, listener->profile->ext_cfwdall), '\0', 0);
break;

View File

@ -2584,6 +2584,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
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, "Status \t%s%s\n", status_names[gp->status], gp->pinging ? " (ping)" : "");
stream->write_function(stream, "Uptime \t%lds\n", gp->status == SOFIA_GATEWAY_UP ? (switch_time_now()-gp->uptime)/1000000 : 0);
stream->write_function(stream, "CallsIN \t%u\n", gp->ib_calls);
stream->write_function(stream, "CallsOUT\t%u\n", gp->ob_calls);
stream->write_function(stream, "FailedCallsIN\t%u\n", gp->ib_failed_calls);
@ -2827,6 +2828,7 @@ static void xml_gateway_status(sofia_gateway_t *gp, switch_stream_handle_t *stre
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, " <status>%s</status>\n", status_names[gp->status]);
stream->write_function(stream, " <uptime-usec>%ld</uptime-usec>\n", gp->status == SOFIA_GATEWAY_UP ? switch_time_now()-gp->uptime : 0);
stream->write_function(stream, " <calls-in>%u</calls-in>\n", gp->ib_calls);
stream->write_function(stream, " <calls-out>%u</calls-out>\n", gp->ob_calls);
stream->write_function(stream, " <failed-calls-in>%u</failed-calls-in>\n", gp->ib_failed_calls);
@ -5561,8 +5563,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
switch_management_interface_t *management_interface;
switch_application_interface_t *app_interface;
struct in_addr in;
struct tm tm = {0};
time_t now;
memset(&mod_sofia_globals, 0, sizeof(mod_sofia_globals));
mod_sofia_globals.destroy_private.destroy_nh = 1;
@ -5571,11 +5571,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
mod_sofia_globals.pool = pool;
switch_mutex_init(&mod_sofia_globals.mutex, SWITCH_MUTEX_NESTED, mod_sofia_globals.pool);
now = switch_epoch_time_now(NULL);
tm = *(localtime(&now));
mod_sofia_globals.presence_epoch = now - (tm.tm_yday * 86400) - (tm.tm_hour * 60 * 60) - (tm.tm_min * 60) - tm.tm_sec;
switch_find_local_ip(mod_sofia_globals.guess_ip, sizeof(mod_sofia_globals.guess_ip), &mod_sofia_globals.guess_mask, AF_INET);
in.s_addr = mod_sofia_globals.guess_mask;
switch_set_string(mod_sofia_globals.guess_mask_str, inet_ntoa(in));

View File

@ -369,6 +369,7 @@ struct mod_sofia_globals {
switch_thread_t *presence_thread;
uint32_t max_reg_threads;
time_t presence_epoch;
int presence_year;
};
extern struct mod_sofia_globals mod_sofia_globals;
@ -488,10 +489,12 @@ struct sofia_gateway {
time_t reg_timeout;
int pinging;
sofia_gateway_status_t status;
switch_time_t uptime;
uint32_t ping_freq;
int ping_count;
int ping_max;
int ping_min;
switch_bool_t ping_monitoring;
uint8_t flags[REG_FLAG_MAX];
int32_t retry_seconds;
int32_t reg_timeout_seconds;

View File

@ -3274,7 +3274,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
if ((gateway = switch_core_alloc(profile->pool, sizeof(*gateway)))) {
const char *sipip, *format;
switch_uuid_t uuid;
uint32_t ping_freq = 0, extension_in_contact = 0, distinct_to = 0, rfc_5626 = 0;
uint32_t ping_freq = 0, extension_in_contact = 0, ping_monitoring = 0, distinct_to = 0, rfc_5626 = 0;
int ping_max = 1, ping_min = 1;
char *register_str = "true", *scheme = "Digest",
*realm = NULL,
@ -3311,6 +3311,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
gateway->ping_max = 0;
gateway->ping_min = 0;
gateway->ping_count = 0;
gateway->ping_monitoring = SWITCH_FALSE;
gateway->ib_calls = 0;
gateway->ob_calls = 0;
gateway->ib_failed_calls = 0;
@ -3393,6 +3394,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
ping_min = atoi(val);
} else if (!strcmp(var, "ping-user-agent")) {
options_user_agent = val;
} else if (!strcmp(var, "ping-monitoring")) { // if true then every gw ping result will fire a gateway status event
ping_monitoring = switch_true(val);
} else if (!strcmp(var, "proxy")) {
proxy = val;
} else if (!strcmp(var, "context")) {
@ -3487,6 +3490,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
if (!switch_true(register_str)) {
gateway->state = REG_STATE_NOREG;
gateway->status = SOFIA_GATEWAY_UP;
gateway->uptime = switch_time_now();
}
if (zstr(auth_username)) {
@ -3569,6 +3573,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
gateway->ping_freq = ping_freq;
gateway->ping_max = ping_max;
gateway->ping_min = ping_min;
gateway->ping_monitoring = ping_monitoring;
gateway->ping = switch_epoch_time_now(NULL) + ping_freq;
gateway->options_to_uri = switch_core_sprintf(gateway->pool, "<sip:%s>",
!zstr(from_domain) ? from_domain : proxy);
@ -5542,6 +5547,7 @@ static void sofia_handle_sip_r_options(switch_core_session_t *session, int statu
tagi_t tags[])
{
sofia_gateway_t *gateway = NULL;
switch_bool_t do_fire_gateway_state_event = SWITCH_FALSE;
if (sofia_private && !zstr(sofia_private->gateway_name)) {
gateway = sofia_reg_find_gateway(sofia_private->gateway_name);
@ -5563,9 +5569,10 @@ 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_UP) {
gateway->status = SOFIA_GATEWAY_UP;
sofia_reg_fire_custom_gateway_state_event(gateway, status, phrase);
gateway->uptime = switch_time_now();
do_fire_gateway_state_event = SWITCH_TRUE;
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
"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));
@ -5582,13 +5589,16 @@ 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) {
gateway->status = SOFIA_GATEWAY_DOWN;
sofia_reg_fire_custom_gateway_state_event(gateway, status, phrase);
do_fire_gateway_state_event = SWITCH_TRUE;
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
"Ping failed %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));
}
if (gateway->ping_monitoring || do_fire_gateway_state_event) {
sofia_reg_fire_custom_gateway_state_event(gateway, status, phrase);
}
gateway->ping = switch_epoch_time_now(NULL) + gateway->ping_freq;
sofia_reg_release_gateway(gateway);

View File

@ -2105,17 +2105,44 @@ static int sofia_dialog_probe_callback(void *pArg, int argc, char **argv, char *
return 0;
}
#define SOFIA_PRESENCE_COLLISION_DELTA 50
#define SOFIA_PRESENCE_ROLLOVER_YEAR (86400 * 365 * SOFIA_PRESENCE_COLLISION_DELTA)
static uint32_t check_presence_epoch(void)
{
struct tm tm = {0};
time_t now = switch_epoch_time_now(NULL);
uint32_t callsequence = (now - mod_sofia_globals.presence_epoch) * SOFIA_PRESENCE_COLLISION_DELTA;
if (!mod_sofia_globals.presence_year || callsequence >= SOFIA_PRESENCE_ROLLOVER_YEAR) {
switch_mutex_lock(mod_sofia_globals.mutex);
tm = *(localtime(&now));
if (tm.tm_year != mod_sofia_globals.presence_year) {
mod_sofia_globals.presence_epoch = (uint32_t)now - (tm.tm_yday * 86400) - (tm.tm_hour * 60 * 60) - (tm.tm_min * 60) - tm.tm_sec;
mod_sofia_globals.presence_year = tm.tm_year;
callsequence = ((uint32_t)now - mod_sofia_globals.presence_epoch) * SOFIA_PRESENCE_COLLISION_DELTA;
}
switch_mutex_unlock(mod_sofia_globals.mutex);
}
return callsequence;
}
uint32_t sofia_presence_get_cseq(sofia_profile_t *profile)
{
uint32_t callsequence;
uint32_t now = (uint32_t) switch_epoch_time_now(NULL);
int diff = 0;
switch_mutex_lock(profile->ireg_mutex);
callsequence = (now - mod_sofia_globals.presence_epoch) * 100;
callsequence = check_presence_epoch();
if (profile->last_cseq && callsequence <= profile->last_cseq) {
callsequence = ++profile->last_cseq;
if (profile->last_cseq) {
diff = callsequence - profile->last_cseq;
if (diff <= 0 && diff > -100000) {
callsequence = ++profile->last_cseq;
}
}
profile->last_cseq = callsequence;

View File

@ -372,8 +372,9 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
switch (ostate) {
case REG_STATE_NOREG:
if (!gateway_ptr->ping && !gateway_ptr->pinging) {
if (!gateway_ptr->ping && !gateway_ptr->pinging && gateway_ptr->status != SOFIA_GATEWAY_UP) {
gateway_ptr->status = SOFIA_GATEWAY_UP;
gateway_ptr->uptime = switch_time_now();
}
break;
case REG_STATE_REGISTER:
@ -396,7 +397,10 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
gateway_ptr->expires = now + delta;
gateway_ptr->state = REG_STATE_REGED;
gateway_ptr->status = SOFIA_GATEWAY_UP;
if (gateway_ptr->status != SOFIA_GATEWAY_UP) {
gateway_ptr->status = SOFIA_GATEWAY_UP;
gateway_ptr->uptime = switch_time_now();
}
break;
case REG_STATE_UNREGISTER:

View File

@ -24,6 +24,7 @@
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
* Seven Du <dujinfang@gmail.com>
*
* mod_verto.c -- HTML5 Verto interface
*
@ -1279,6 +1280,391 @@ static void jsock_check_event_queue(jsock_t *jsock)
switch_mutex_unlock(jsock->write_mutex);
}
/* DO NOT use this unless you know what you are doing, you are WARNNED!!! */
static uint8_t *http_stream_read(switch_stream_handle_t *handle, int *len)
{
switch_http_request_t *r = (switch_http_request_t *) handle->data;
jsock_t *jsock = r->user_data;
wsh_t *wsh = &jsock->ws;
if (!jsock->profile->running) {
*len = 0;
return NULL;
}
*len = r->bytes_buffered - r->bytes_read;
if (*len > 0) { // we already read part of the body
uint8_t *data = (uint8_t *)wsh->buffer + r->bytes_read;
r->bytes_read = r->bytes_buffered;
return data;
}
if (r->content_length && (r->bytes_read - r->bytes_header) >= r->content_length) {
*len = 0;
return NULL;
}
*len = r->content_length - (r->bytes_read - r->bytes_header);
*len = *len > sizeof(wsh->buffer) ? sizeof(wsh->buffer) : *len;
if ((*len = ws_raw_read(wsh, wsh->buffer, *len, wsh->block)) < 0) {
*len = 0;
return NULL;
}
r->bytes_read += *len;
return (uint8_t *)wsh->buffer;
}
static switch_status_t http_stream_raw_write(switch_stream_handle_t *handle, uint8_t *data, switch_size_t datalen)
{
switch_http_request_t *r = (switch_http_request_t *) handle->data;
jsock_t *jsock = r->user_data;
return ws_raw_write(&jsock->ws, data, (uint32_t)datalen) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
}
static switch_status_t http_stream_write(switch_stream_handle_t *handle, const char *fmt, ...)
{
switch_http_request_t *r = (switch_http_request_t *) handle->data;
jsock_t *jsock = r->user_data;
int ret = 1;
char *data;
va_list ap;
va_start(ap, fmt);
ret = switch_vasprintf(&data, fmt, ap);
va_end(ap);
if (data) {
if (ret) {
ret = ws_raw_write(&jsock->ws, data, (uint32_t)strlen(data));
}
switch_safe_free(data);
}
return ret ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
}
static void http_static_handler(switch_http_request_t *request, verto_vhost_t *vhost)
{
jsock_t *jsock = request->user_data;
char path[512];
switch_file_t *fd;
char *ext;
uint8_t chunk[4096];
const char *mime_type = "text/html", *new_type;
if (strncmp(request->method, "GET", 3) && strncmp(request->method, "HEAD", 4)) {
char *data = "HTTP/1.1 415 Method Not Allowed\r\n"
"Content-Length: 0\r\n\r\n";
ws_raw_write(&jsock->ws, data, strlen(data));
return;
}
switch_snprintf(path, sizeof(path), "%s%s", vhost->root, request->uri);
if (switch_directory_exists(path, NULL) == SWITCH_STATUS_SUCCESS) {
switch_snprintf(path, sizeof(path), "%s%s%s%s",
vhost->root, request->uri, end_of(path) == '/' ? "" : SWITCH_PATH_SEPARATOR, vhost->index);
// printf("local path: %s\n", path);
}
if ((ext = strrchr(path, '.'))) {
ext++;
if ((new_type = switch_core_mime_ext2type(ext))) {
mime_type = new_type;
}
}
if (switch_file_exists(path, NULL) == SWITCH_STATUS_SUCCESS &&
switch_file_open(&fd, path, SWITCH_FOPEN_READ, SWITCH_FPROT_UREAD, jsock->pool) == SWITCH_STATUS_SUCCESS) {
switch_size_t flen = switch_file_get_size(fd);
switch_snprintf((char *)chunk, sizeof(chunk),
"HTTP/1.1 200 OK\r\n"
"Date: %s\r\n"
"Server: FreeSWITCH-%s-mod_verto\r\n"
"Content-Type: %s\r\n"
"Content-Length: %" SWITCH_SIZE_T_FMT "\r\n\r\n",
switch_event_get_header(request->headers, "Event-Date-GMT"),
switch_version_full(),
mime_type,
flen);
ws_raw_write(&jsock->ws, chunk, strlen((char *)chunk));
for (;;) {
switch_status_t status;
flen = sizeof(chunk);
status = switch_file_read(fd, chunk, &flen);
if (status != SWITCH_STATUS_SUCCESS || flen == 0) {
break;
}
ws_raw_write(&jsock->ws, chunk, flen);
}
switch_file_close(fd);
} else {
char *data = "HTTP/1.1 404 Not Found\r\n"
"Content-Length: 0\r\n\r\n";
ws_raw_write(&jsock->ws, data, strlen(data));
}
}
static void http_run(jsock_t *jsock)
{
switch_http_request_t request = { 0 };
switch_stream_handle_t stream = { 0 };
char *data = NULL;
char *ext;
verto_vhost_t *vhost;
switch_bool_t keepalive;
new_req:
request.user_data = jsock;
if (switch_event_create(&stream.param_event, SWITCH_EVENT_CHANNEL_DATA) != SWITCH_STATUS_SUCCESS) {
goto err;
}
request.headers = stream.param_event;
if (switch_http_parse_header(jsock->ws.buffer, jsock->ws.datalen, &request) != SWITCH_STATUS_SUCCESS) {
switch_event_destroy(&stream.param_event);
goto err;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s [%4" SWITCH_SIZE_T_FMT "] %s\n", jsock->name, jsock->ws.datalen, request.uri);
if (!strncmp(request.method, "OPTIONS", 7)) {
char data[512];
switch_snprintf(data, sizeof(data),
"HTTP/1.1 200 OK\r\n"
"Content-Length: 0\r\n"
"Date: %s\r\n"
"Allow: HEAD,GET,POST,PUT,DELETE,PATCH,OPTIONS\r\n"
"Server: FreeSWITCH-%s-mod_verto\r\n\r\n",
switch_event_get_header(request.headers, "Event-Date-GMT"),
switch_version_full());
ws_raw_write(&jsock->ws, data, strlen(data));
goto done;
}
if (!strncmp(request.method, "POST", 4) && request.content_length &&
!strncmp(request.content_type, "application/x-www-form-urlencoded", 33)) {
char *buffer = NULL;
int len = 0, bytes = 0;
if (request.content_length > 2 * 1024 * 1024 - 1) {
char *data = "HTTP/1.1 413 Request Entity Too Large\r\n"
"Content-Length: 0\r\n\r\n";
ws_raw_write(&jsock->ws, data, strlen(data));
goto done;
}
if (!(buffer = malloc(2 * 1024 * 1024))) {
goto request_err;
}
if ((bytes = request.bytes_buffered - (request.bytes_read - request.bytes_header)) > 0) {
memcpy(buffer, jsock->ws.buffer + request.bytes_read, bytes);
}
while(bytes < request.content_length) {
len = request.content_length - bytes;
if ((len = ws_raw_read(&jsock->ws, buffer + bytes, len, jsock->ws.block)) < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read error %d\n", len);
goto done;
}
bytes += len;
}
*(buffer + bytes) = '\0';
switch_http_parse_qs(&request, buffer);
free(buffer);
}
// switch_http_dump_request(&request);
stream.data = &request;
stream.read_function = http_stream_read;
stream.write_function = http_stream_write;
stream.raw_write_function = http_stream_raw_write;
switch_event_add_header_string(request.headers, SWITCH_STACK_BOTTOM, "Request-Method", request.method);
switch_event_add_header_string(request.headers, SWITCH_STACK_BOTTOM, "HTTP-Request-URI", request.uri);
if (!jsock->profile->vhosts) goto err;
/* only one vhost supported for now */
vhost = jsock->profile->vhosts;
if (!switch_test_flag(jsock, JPFLAG_AUTHED) && vhost->auth_realm) {
int code = CODE_AUTH_REQUIRED;
char message[128] = "Authentication Required";
cJSON *params = NULL;
char *www_auth;
char auth_buffer[512];
char *auth_user = NULL, *auth_pass = NULL;
www_auth = switch_event_get_header(request.headers, "Authorization");
if (zstr(www_auth)) {
switch_snprintf(auth_buffer, sizeof(auth_buffer),
"HTTP/1.1 401 Authentication Required\r\n"
"WWW-Authenticate: Basic realm=\"%s\"\r\n"
"Content-Length: 0\r\n\r\n",
vhost->auth_realm);
ws_raw_write(&jsock->ws, auth_buffer, strlen(auth_buffer));
goto done;
}
if (strncasecmp(www_auth, "Basic ", 6)) goto err;
www_auth += 6;
switch_b64_decode(www_auth, auth_buffer, sizeof(auth_buffer));
auth_user = auth_buffer;
if ((auth_pass = strchr(auth_user, ':'))) {
*auth_pass++ = '\0';
}
if (vhost->auth_user && vhost->auth_pass &&
!strcmp(vhost->auth_user, auth_user) &&
!strcmp(vhost->auth_pass, auth_pass)) {
goto authed;
}
if (!(params = cJSON_CreateObject())) {
goto request_err;
}
cJSON_AddItemToObject(params, "login", cJSON_CreateString(auth_user));
cJSON_AddItemToObject(params, "passwd", cJSON_CreateString(auth_pass));
if (!check_auth(jsock, params, &code, message, sizeof(message))) {
switch_snprintf(auth_buffer, sizeof(auth_buffer),
"HTTP/1.1 401 Authentication Required\r\n"
"WWW-Authenticate: Basic realm=\"%s\"\r\n"
"Content-Length: 0\r\n\r\n",
vhost->auth_realm);
ws_raw_write(&jsock->ws, auth_buffer, strlen(auth_buffer));
cJSON_Delete(params);
goto done;
} else {
cJSON_Delete(params);
}
authed:
switch_set_flag(jsock, JPFLAG_AUTHED);
switch_event_add_header_string(request.headers, SWITCH_STACK_BOTTOM, "HTTP-USER", auth_user);
}
if (vhost->rewrites) {
switch_event_header_t *rule = vhost->rewrites->headers;
switch_regex_t *re = NULL;
int ovector[30];
int proceed;
while(rule) {
char *expression = rule->name;
if ((proceed = switch_regex_perform(request.uri, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"%d request [%s] matched expr [%s]\n", proceed, request.uri, expression);
request.uri = rule->value;
break;
}
rule = rule->next;
}
}
switch_event_add_header_string(request.headers, SWITCH_STACK_BOTTOM, "HTTP-URI", request.uri);
if ((ext = strrchr(request.uri, '.'))) {
char path[1024];
if (!strncmp(ext, ".lua", 4)) {
switch_snprintf(path, sizeof(path), "%s%s", vhost->script_root, request.uri);
switch_api_execute("lua", path, NULL, &stream);
} else {
http_static_handler(&request, vhost);
}
} else {
http_static_handler(&request, vhost);
}
done:
keepalive = request.keepalive;
switch_http_free_request(&request);
if (keepalive) {
wsh_t *wsh = &jsock->ws;
memset(&request, 0, sizeof(request));
wsh->datalen = 0;
*wsh->buffer = '\0';
while(jsock->profile->running) {
int pflags = switch_wait_sock(jsock->client_socket, 3000, SWITCH_POLL_READ | SWITCH_POLL_ERROR | SWITCH_POLL_HUP);
if (jsock->drop) { die("%s Dropping Connection\n", jsock->name); }
if (pflags < 0 && (errno != EINTR)) { die("%s POLL FAILED\n", jsock->name); }
if (pflags & SWITCH_POLL_ERROR) { die("%s POLL ERROR\n", jsock->name); }
if (pflags & SWITCH_POLL_HUP) { die("%s POLL HANGUP DETECTED\n", jsock->name); }
if (pflags & SWITCH_POLL_INVALID) { die("%s POLL INVALID SOCKET\n", jsock->name); }
if (pflags & SWITCH_POLL_READ) {
ssize_t bytes;
bytes = ws_raw_read(wsh, wsh->buffer + wsh->datalen, wsh->buflen - wsh->datalen, wsh->block);
if (bytes < 0) {
die("BAD READ %" SWITCH_SIZE_T_FMT "\n", bytes);
break;
}
wsh->datalen += bytes;
if (strstr(wsh->buffer, "\r\n\r\n") || strstr(wsh->buffer, "\n\n")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "socket %s is going to handle a new request\n", jsock->name);
goto new_req;
}
} else {
break;
}
}
}
return;
request_err:
switch_http_free_request(&request);
err:
data = "HTTP/1.1 500 Internal Server Error\r\n"
"Content-Length: 0\r\n\r\n";
ws_raw_write(&jsock->ws, data, strlen(data));
error:
return;
}
static void client_run(jsock_t *jsock)
{
@ -1287,8 +1673,14 @@ static void client_run(jsock_t *jsock)
jsock->local_addr.sin_port = 0;
if (ws_init(&jsock->ws, jsock->client_socket, (jsock->ptype & PTYPE_CLIENT_SSL) ? jsock->profile->ssl_ctx : NULL, 0, 1) < 0) {
die("%s WS SETUP FAILED", jsock->name);
if (ws_init(&jsock->ws, jsock->client_socket, (jsock->ptype & PTYPE_CLIENT_SSL) ? jsock->profile->ssl_ctx : NULL, 0, 1, !!jsock->profile->vhosts) < 0) {
if (jsock->profile->vhosts) {
http_run(jsock);
ws_close(&jsock->ws, WS_NONE);
goto error;
} else {
die("%s WS SETUP FAILED [%s]", jsock->name, jsock->ws.buffer);
}
}
while(jsock->profile->running) {
@ -3436,6 +3828,7 @@ static int runtime(verto_profile_t *profile)
static void kill_profile(verto_profile_t *profile)
{
jsock_t *p;
verto_vhost_t *h;
int i;
profile->running = 0;
@ -3452,6 +3845,16 @@ static void kill_profile(verto_profile_t *profile)
for(p = profile->jsock_head; p; p = p->next) {
close_socket(&p->client_socket);
}
h = profile->vhosts;
while(h) {
if (h->rewrites) {
switch_event_destroy(&h->rewrites);
}
h = h->next;
}
switch_mutex_unlock(profile->mutex);
@ -3601,6 +4004,7 @@ static switch_status_t parse_config(const char *cf)
{
switch_xml_t cfg, xml, settings, param, xprofile, xprofiles;
switch_xml_t xvhosts, xvhost, rewrites, rule;
switch_status_t status = SWITCH_STATUS_SUCCESS;
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
@ -3749,8 +4153,89 @@ static switch_status_t parse_config(const char *cf)
profile->name, profile->ip[i].local_ip, profile->ip[i].local_port);
}
}
}
}
/* parse vhosts */
/* WARNNING: Experimental feature, DO NOT use until we remove this warnning!! */
if ((xvhosts = switch_xml_child(xprofile, "vhosts"))) {
verto_vhost_t *vhost_tail = NULL;
for (xvhost = switch_xml_child(xvhosts, "vhost"); xvhost; xvhost = xvhost->next) {
verto_vhost_t *vhost;
const char *domain = switch_xml_attr(xvhost, "domain");
if (zstr(domain)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Required field domain missing\n");
continue;
}
vhost = switch_core_alloc(profile->pool, sizeof(*vhost));
memset(vhost, 0, sizeof(*vhost));
vhost->pool = profile->pool;
vhost->domain = switch_core_strdup(profile->pool, domain);
if (!vhost_tail) {
profile->vhosts = vhost;
} else {
vhost_tail->next = vhost;
}
vhost_tail = vhost;
for (param = switch_xml_child(xvhost, "param"); param; param = param->next) {
char *var = NULL;
char *val = NULL;
var = (char *) switch_xml_attr_soft(param, "name");
val = (char *) switch_xml_attr_soft(param, "value");
if (!strcasecmp(var, "alias")) {
vhost->alias = switch_core_strdup(vhost->pool, val);
} else if (!strcasecmp(var, "root")) {
vhost->root = switch_core_strdup(vhost->pool, val);
} else if (!strcasecmp(var, "script_root")) {
vhost->script_root = switch_core_strdup(vhost->pool, val);
} else if (!strcasecmp(var, "index")) {
vhost->index = switch_core_strdup(vhost->pool, val);
} else if (!strcasecmp(var, "auth-realm")) {
vhost->auth_realm = switch_core_strdup(vhost->pool, val);
} else if (!strcasecmp(var, "auth-user")) {
vhost->auth_user = switch_core_strdup(vhost->pool, val);
} else if (!strcasecmp(var, "auth-pass")) {
vhost->auth_pass = switch_core_strdup(vhost->pool, val);
}
}
if (zstr(vhost->root)) {
vhost->root = SWITCH_GLOBAL_dirs.htdocs_dir;
}
if (zstr(vhost->script_root)) {
vhost->root = SWITCH_GLOBAL_dirs.script_dir;
}
if (zstr(vhost->index)) {
vhost->index = "index.html";
}
if ((rewrites = switch_xml_child(xvhost, "rewrites"))) {
if (switch_event_create(&vhost->rewrites, SWITCH_EVENT_CLONE) == SWITCH_STATUS_SUCCESS) {
for (rule = switch_xml_child(rewrites, "rule"); rule; rule = rule->next) {
char *expr = NULL;
char *val = NULL;
expr = (char *) switch_xml_attr_soft(rule, "expression");
val = (char *) switch_xml_attr_soft(rule, "value");
if (zstr(expr)) continue;
switch_event_add_header_string(vhost->rewrites, SWITCH_STACK_BOTTOM, expr, val);
}
}
} // rewrites
} // xvhost
} // xvhosts
} // xprofile
} // xprofiles
if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
@ -3826,6 +4311,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
{
verto_profile_t *profile = NULL;
jsock_t *jsock;
verto_vhost_t *vhost;
int cp = 0;
int cc = 0;
const char *line = "=================================================================================================";
@ -3838,14 +4324,22 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
for (int 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);
stream->write_function(stream, "%25s\t%s\t %40s\t%s\n", profile->name, "profile", tmpurl, (profile->running) ? "RUNNING" : "DOWN");
switch_safe_free(tmpurl);
}
cp++;
switch_mutex_lock(profile->mutex);
for(jsock = profile->jsock_head; jsock; jsock = jsock->next) {
for (vhost = profile->vhosts; vhost; vhost = vhost->next) {
char *tmpname = switch_mprintf("%s::%s", profile->name, vhost->domain);
stream->write_function(stream, "%25s\t%s\t %40s\t%s (%s)\n", tmpname, "vhost", vhost->root, vhost->auth_user ? "AUTH" : "NOAUTH", vhost->auth_user ? vhost->auth_user : "");
switch_safe_free(tmpname);
}
for (jsock = profile->jsock_head; jsock; jsock = jsock->next) {
char *tmpname = switch_mprintf("%s::%s@%s", profile->name, jsock->id, jsock->domain);
stream->write_function(stream, "%25s\t%s\t %40s\t%s (%s)\n", tmpname, "client", jsock->name, (!zstr(jsock->uid)) ? "CONN_REG" : "CONN_NO_REG", (jsock->ptype & PTYPE_CLIENT_SSL) ? "WSS": "WS");
cc++;
switch_safe_free(tmpname);
}
switch_mutex_unlock(profile->mutex);
}
@ -3872,6 +4366,7 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
for (int 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);
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);
}
cp++;
@ -3881,6 +4376,7 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
stream->write_function(stream, "<client>\n<profile>%s</profile>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s (%s)</state>\n</client>\n", profile->name, tmpname, "client", jsock->name,
(!zstr(jsock->uid)) ? "CONN_REG" : "CONN_NO_REG", (jsock->ptype & PTYPE_CLIENT_SSL) ? "WSS": "WS");
cc++;
switch_safe_free(tmpname);
}
switch_mutex_unlock(profile->mutex);
}

View File

@ -24,6 +24,7 @@
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
* Seven Du <dujinfang@gmail.com>
*
* mod_html.h -- HTML 5 interface
*
@ -166,6 +167,20 @@ typedef struct verto_pvt_s {
struct verto_pvt_s *next;
} verto_pvt_t;
typedef struct verto_vhost_s {
char *domain;
char *alias;
char *root;
char *script_root;
char *index;
char *auth_realm;
char *auth_user;
char *auth_pass;
switch_event_t *rewrites;
switch_memory_pool_t *pool;
struct verto_vhost_s *next;
} verto_vhost_t;
struct verto_profile_s {
char *name;
switch_mutex_t *mutex;
@ -220,7 +235,7 @@ struct verto_profile_s {
char *timer_name;
char *local_network;
verto_vhost_t *vhosts;
struct verto_profile_s *next;
};

View File

@ -264,7 +264,7 @@ int ws_handshake(wsh_t *wsh)
goto err;
}
*(wsh->buffer+bytes) = '\0';
*(wsh->buffer + wsh->datalen) = '\0';
if (strncasecmp(wsh->buffer, "GET ", 4)) {
goto err;
@ -312,15 +312,15 @@ int ws_handshake(wsh_t *wsh)
err:
snprintf(respond, sizeof(respond), "HTTP/1.1 400 Bad Request\r\n"
"Sec-WebSocket-Version: 13\r\n\r\n");
if (!wsh->stay_open) {
//printf("ERR:\n%s\n", respond);
snprintf(respond, sizeof(respond), "HTTP/1.1 400 Bad Request\r\n"
"Sec-WebSocket-Version: 13\r\n\r\n");
ws_raw_write(wsh, respond, strlen(respond));
ws_raw_write(wsh, respond, strlen(respond));
ws_close(wsh, WS_NONE);
ws_close(wsh, WS_NONE);
}
return -1;
@ -538,7 +538,7 @@ static int establish_logical_layer(wsh_t *wsh)
}
int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock, int block)
int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock, int block, int stay_open)
{
memset(wsh, 0, sizeof(*wsh));
@ -546,6 +546,7 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock, int
wsh->block = block;
wsh->sanity = 5000;
wsh->ssl_ctx = ssl_ctx;
wsh->stay_open = stay_open;
if (!ssl_ctx) {
ssl_ctx = ws_globals.ssl_ctx;

View File

@ -88,6 +88,7 @@ typedef struct wsh_s {
int sanity;
int secure_established;
int logical_established;
int stay_open;
int x;
void *write_buffer;
size_t write_buffer_len;
@ -101,7 +102,7 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block);
ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes);
ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data);
ssize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes);
int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock, int block);
int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock, int block, int stay_open);
ssize_t ws_close(wsh_t *wsh, int16_t reason);
void ws_destroy(wsh_t *wsh);
void init_ssl(void);

View File

@ -83,6 +83,13 @@ static switch_status_t native_file_file_open(switch_file_handle_t *handle, const
handle->samples = 0;
handle->samplerate = 8000;
if (ext) {
if (!strcasecmp(ext, "G722")) {
handle->samplerate = 16000;
}
}
handle->channels = 1;
handle->format = 0;
handle->sections = 0;

View File

@ -1 +1,2 @@
switch_swig_wrap.cpp -diff
src/org/freeswitch/swig/* -diff

View File

@ -0,0 +1,26 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 1.3.35
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package org.freeswitch.swig;
public class SWIGTYPE_p_int {
private long swigCPtr;
protected SWIGTYPE_p_int(long cPtr, boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_int() {
swigCPtr = 0;
}
protected static long getCPtr(SWIGTYPE_p_int obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}

View File

@ -41,10 +41,18 @@ public class Stream {
this(freeswitchJNI.new_Stream__SWIG_1(SWIGTYPE_p_switch_stream_handle_t.getCPtr(arg0)), true);
}
public String read(SWIGTYPE_p_int len) {
return freeswitchJNI.Stream_read(swigCPtr, this, SWIGTYPE_p_int.getCPtr(len));
}
public void write(String data) {
freeswitchJNI.Stream_write(swigCPtr, this, data);
}
public void raw_write(String data, int len) {
freeswitchJNI.Stream_raw_write(swigCPtr, this, data, len);
}
public String get_data() {
return freeswitchJNI.Stream_get_data(swigCPtr, this);
}

View File

@ -47,7 +47,9 @@ class freeswitchJNI {
public final static native long new_Stream__SWIG_0();
public final static native long new_Stream__SWIG_1(long jarg1);
public final static native void delete_Stream(long jarg1);
public final static native String Stream_read(long jarg1, Stream jarg1_, long jarg2);
public final static native void Stream_write(long jarg1, Stream jarg1_, String jarg2);
public final static native void Stream_raw_write(long jarg1, Stream jarg1_, String jarg2, int jarg3);
public final static native String Stream_get_data(long jarg1, Stream jarg1_);
public final static native void Event_event_set(long jarg1, Event jarg1_, long jarg2);
public final static native long Event_event_get(long jarg1, Event jarg1_);

View File

@ -972,6 +972,23 @@ SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_delete_1Stream(JN
}
SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_Stream_1read(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
jstring jresult = 0 ;
Stream *arg1 = (Stream *) 0 ;
int *arg2 = (int *) 0 ;
char *result = 0 ;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(Stream **)&jarg1;
arg2 = *(int **)&jarg2;
result = (char *)(arg1)->read(arg2);
if(result) jresult = jenv->NewStringUTF((const char *)result);
return jresult;
}
SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_Stream_1write(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
Stream *arg1 = (Stream *) 0 ;
char *arg2 = (char *) 0 ;
@ -990,6 +1007,26 @@ SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_Stream_1write(JNI
}
SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_Stream_1raw_1write(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3) {
Stream *arg1 = (Stream *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 ;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(Stream **)&jarg1;
arg2 = 0;
if (jarg2) {
arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
if (!arg2) return ;
}
arg3 = (int)jarg3;
(arg1)->raw_write((char const *)arg2,arg3);
if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
}
SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_Stream_1get_1data(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jstring jresult = 0 ;
Stream *arg1 = (Stream *) 0 ;

View File

@ -43,6 +43,9 @@
%newobject API::execute;
%newobject API::executeString;
%include "typemaps.i"
%apply int *OUTPUT { int *len };
/**
* tell swig to grok everything defined in these header files and
* build all sorts of c wrappers and lua shadows of the c wrappers.

View File

@ -1,6 +1,15 @@
--- mod_lua_wrap.cpp.orig 2013-11-13 07:48:40.587304736 +0500
+++ mod_lua_wrap.cpp 2013-11-13 07:43:09.059309154 +0500
@@ -6427,7 +6427,7 @@
--- mod_lua_wrap.cpp.orig 2014-09-06 19:25:05.000000000 +0800
+++ mod_lua_wrap.cpp 2014-09-06 19:27:17.000000000 +0800
@@ -2799,7 +2799,7 @@
result = (char *)(arg1)->read(arg2);
SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
+ lua_pushlstring(L,(const char*)result, (*arg2)); SWIG_arg++;
lua_pushnumber(L, (lua_Number) *arg2); SWIG_arg++;
return SWIG_arg;
@@ -6750,7 +6750,7 @@
SWIG_check_num_args("LUA::Session",0,0)
result = (LUA::Session *)new LUA::Session();
SWIG_arg=0;
@ -9,7 +18,7 @@
return SWIG_arg;
if(0) SWIG_fail;
@@ -6455,7 +6455,7 @@
@@ -6778,7 +6778,7 @@
result = (LUA::Session *)new LUA::Session(arg1,arg2);
SWIG_arg=0;
@ -18,7 +27,7 @@
return SWIG_arg;
if(0) SWIG_fail;
@@ -6476,7 +6476,7 @@
@@ -6799,7 +6799,7 @@
arg1 = (char *)lua_tostring(L, 1);
result = (LUA::Session *)new LUA::Session(arg1);
SWIG_arg=0;
@ -27,7 +36,7 @@
return SWIG_arg;
if(0) SWIG_fail;
@@ -6501,7 +6501,7 @@
@@ -6824,7 +6824,7 @@
result = (LUA::Session *)new LUA::Session(arg1);
SWIG_arg=0;
@ -36,7 +45,7 @@
return SWIG_arg;
if(0) SWIG_fail;
@@ -7913,7 +7913,7 @@
@@ -8236,7 +8236,7 @@
}
#endif
@ -45,7 +54,7 @@
{ "setGlobalVariable", _wrap_setGlobalVariable},
{ "getGlobalVariable", _wrap_getGlobalVariable},
{ "consoleLog", _wrap_consoleLog},
@@ -8325,7 +8325,7 @@
@@ -8654,7 +8654,7 @@
{
int i;
/* start with global table */

View File

@ -1495,26 +1495,27 @@ SWIG_Lua_dostring(lua_State *L, const char* str) {
#define SWIGTYPE_p_SWIGLUA_FN swig_types[8]
#define SWIGTYPE_p_Stream swig_types[9]
#define SWIGTYPE_p_input_callback_state swig_types[10]
#define SWIGTYPE_p_lua_State swig_types[11]
#define SWIGTYPE_p_p_switch_event_node_t swig_types[12]
#define SWIGTYPE_p_session_flag_t swig_types[13]
#define SWIGTYPE_p_switch_call_cause_t swig_types[14]
#define SWIGTYPE_p_switch_channel_state_t swig_types[15]
#define SWIGTYPE_p_switch_channel_t swig_types[16]
#define SWIGTYPE_p_switch_core_session_t swig_types[17]
#define SWIGTYPE_p_switch_event_t swig_types[18]
#define SWIGTYPE_p_switch_event_types_t swig_types[19]
#define SWIGTYPE_p_switch_input_args_t swig_types[20]
#define SWIGTYPE_p_switch_input_type_t swig_types[21]
#define SWIGTYPE_p_switch_priority_t swig_types[22]
#define SWIGTYPE_p_switch_queue_t swig_types[23]
#define SWIGTYPE_p_switch_state_handler_table_t swig_types[24]
#define SWIGTYPE_p_switch_status_t swig_types[25]
#define SWIGTYPE_p_switch_stream_handle_t swig_types[26]
#define SWIGTYPE_p_uint32_t swig_types[27]
#define SWIGTYPE_p_void swig_types[28]
static swig_type_info *swig_types[30];
static swig_module_info swig_module = {swig_types, 29, 0, 0, 0, 0};
#define SWIGTYPE_p_int swig_types[11]
#define SWIGTYPE_p_lua_State swig_types[12]
#define SWIGTYPE_p_p_switch_event_node_t swig_types[13]
#define SWIGTYPE_p_session_flag_t swig_types[14]
#define SWIGTYPE_p_switch_call_cause_t swig_types[15]
#define SWIGTYPE_p_switch_channel_state_t swig_types[16]
#define SWIGTYPE_p_switch_channel_t swig_types[17]
#define SWIGTYPE_p_switch_core_session_t swig_types[18]
#define SWIGTYPE_p_switch_event_t swig_types[19]
#define SWIGTYPE_p_switch_event_types_t swig_types[20]
#define SWIGTYPE_p_switch_input_args_t swig_types[21]
#define SWIGTYPE_p_switch_input_type_t swig_types[22]
#define SWIGTYPE_p_switch_priority_t swig_types[23]
#define SWIGTYPE_p_switch_queue_t swig_types[24]
#define SWIGTYPE_p_switch_state_handler_table_t swig_types[25]
#define SWIGTYPE_p_switch_status_t swig_types[26]
#define SWIGTYPE_p_switch_stream_handle_t swig_types[27]
#define SWIGTYPE_p_uint32_t swig_types[28]
#define SWIGTYPE_p_void swig_types[29]
static swig_type_info *swig_types[31];
static swig_module_info swig_module = {swig_types, 30, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@ -1536,6 +1537,161 @@ typedef struct{} LANGUAGE_OBJ;
#include "switch_cpp.h"
#include "freeswitch_lua.h"
#ifdef __cplusplus /* generic alloc/dealloc fns*/
#define SWIG_ALLOC_ARRAY(TYPE,LEN) new TYPE[LEN]
#define SWIG_FREE_ARRAY(PTR) delete[] PTR;
#else
#define SWIG_ALLOC_ARRAY(TYPE,LEN) (TYPE *)malloc(LEN*sizeof(TYPE))
#define SWIG_FREE_ARRAY(PTR) free(PTR);
#endif
/* counting the size of arrays:*/
int SWIG_itable_size(lua_State* L, int index)
{
int n=0;
while(1){
lua_rawgeti(L,index,n+1);
if (lua_isnil(L,-1))break;
++n;
lua_pop(L,1);
}
lua_pop(L,1);
return n;
}
int SWIG_table_size(lua_State* L, int index)
{
int n=0;
lua_pushnil(L); /* first key*/
while (lua_next(L, index) != 0) {
++n;
lua_pop(L, 1); /* removes `value'; keeps `key' for next iteration*/
}
return n;
}
/* super macro to declare array typemap helper fns */
#define SWIG_DECLARE_TYPEMAP_ARR_FN(NAME,TYPE)\
int SWIG_read_##NAME##_num_array(lua_State* L,int index,TYPE *array,int size){\
int i;\
for (i = 0; i < size; i++) {\
lua_rawgeti(L,index,i+1);\
if (lua_isnumber(L,-1)){\
array[i] = (TYPE)lua_tonumber(L,-1);\
} else {\
lua_pop(L,1);\
return 0;\
}\
lua_pop(L,1);\
}\
return 1;\
}\
static TYPE* SWIG_get_##NAME##_num_array_fixed(lua_State* L, int index, int size){\
TYPE *array;\
if (!lua_istable(L,index) || SWIG_itable_size(L,index) != size) {\
lua_pushfstring(L,"expected a table of size %d",size);\
return 0;\
}\
array=SWIG_ALLOC_ARRAY(TYPE,size);\
if (!SWIG_read_##NAME##_num_array(L,index,array,size)){\
lua_pushstring(L,"table must contain numbers");\
SWIG_FREE_ARRAY(array);\
return 0;\
}\
return array;\
}\
static TYPE* SWIG_get_##NAME##_num_array_var(lua_State* L, int index, int* size)\
{\
TYPE *array;\
if (!lua_istable(L,index)) {\
lua_pushstring(L,"expected a table");\
return 0;\
}\
*size=SWIG_itable_size(L,index);\
if (*size<1){\
lua_pushstring(L,"table appears to be empty");\
return 0;\
}\
array=SWIG_ALLOC_ARRAY(TYPE,*size);\
if (!SWIG_read_##NAME##_num_array(L,index,array,*size)){\
lua_pushstring(L,"table must contain numbers");\
SWIG_FREE_ARRAY(array);\
return 0;\
}\
return array;\
}\
void SWIG_write_##NAME##_num_array(lua_State* L,TYPE *array,int size){\
int i;\
lua_newtable(L);\
for (i = 0; i < size; i++){\
lua_pushnumber(L,(lua_Number)array[i]);\
lua_rawseti(L,-2,i+1);/* -1 is the number, -2 is the table*/ \
}\
}
SWIG_DECLARE_TYPEMAP_ARR_FN(int,int);
SWIG_DECLARE_TYPEMAP_ARR_FN(uint,unsigned int);
SWIG_DECLARE_TYPEMAP_ARR_FN(short,short);
SWIG_DECLARE_TYPEMAP_ARR_FN(ushort,unsigned short);
SWIG_DECLARE_TYPEMAP_ARR_FN(long,long);
SWIG_DECLARE_TYPEMAP_ARR_FN(ulong,unsigned long);
SWIG_DECLARE_TYPEMAP_ARR_FN(float,float);
SWIG_DECLARE_TYPEMAP_ARR_FN(double,double);
int SWIG_read_ptr_array(lua_State* L,int index,void **array,int size,swig_type_info *type){
int i;
for (i = 0; i < size; i++) {
lua_rawgeti(L,index,i+1);
if (!lua_isuserdata(L,-1) || SWIG_ConvertPtr(L,-1,&array[i],type,0)==-1){
lua_pop(L,1);
return 0;
}
lua_pop(L,1);
}
return 1;
}
static void** SWIG_get_ptr_array_fixed(lua_State* L, int index, int size,swig_type_info *type){
void **array;
if (!lua_istable(L,index) || SWIG_itable_size(L,index) != size) {
lua_pushfstring(L,"expected a table of size %d",size);
return 0;
}
array=SWIG_ALLOC_ARRAY(void*,size);
if (!SWIG_read_ptr_array(L,index,array,size,type)){
lua_pushfstring(L,"table must contain pointers of type %s",type->name);
SWIG_FREE_ARRAY(array);
return 0;
}
return array;
}
static void** SWIG_get_ptr_array_var(lua_State* L, int index, int* size,swig_type_info *type){
void **array;
if (!lua_istable(L,index)) {
lua_pushstring(L,"expected a table");
return 0;
}
*size=SWIG_itable_size(L,index);
if (*size<1){
lua_pushstring(L,"table appears to be empty");
return 0;
}
array=SWIG_ALLOC_ARRAY(void*,*size);
if (!SWIG_read_ptr_array(L,index,array,*size,type)){
lua_pushfstring(L,"table must contain pointers of type %s",type->name);
SWIG_FREE_ARRAY(array);
return 0;
}
return array;
}
void SWIG_write_ptr_array(lua_State* L,void **array,int size,swig_type_info *type,int own){
int i;
lua_newtable(L);
for (i = 0; i < size; i++){
SWIG_NewPointerObj(L,array[i],type,own);
lua_rawseti(L,-2,i+1);/* -1 is the number, -2 is the table*/
}
}
#ifdef __cplusplus
extern "C" {
#endif
@ -2626,6 +2782,35 @@ fail:
}
static int _wrap_Stream_read(lua_State* L) {
int SWIG_arg = -1;
Stream *arg1 = (Stream *) 0 ;
int *arg2 = (int *) 0 ;
char *result = 0 ;
int temp2 ;
arg2 = &temp2;
SWIG_check_num_args("read",1,1)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("read",1,"Stream *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,0))){
SWIG_fail_ptr("Stream_read",1,SWIGTYPE_p_Stream);
}
result = (char *)(arg1)->read(arg2);
SWIG_arg=0;
lua_pushlstring(L,(const char*)result, (*arg2)); SWIG_arg++;
lua_pushnumber(L, (lua_Number) *arg2); SWIG_arg++;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_Stream_write(lua_State* L) {
int SWIG_arg = -1;
Stream *arg1 = (Stream *) 0 ;
@ -2653,6 +2838,36 @@ fail:
}
static int _wrap_Stream_raw_write(lua_State* L) {
int SWIG_arg = -1;
Stream *arg1 = (Stream *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 ;
SWIG_check_num_args("raw_write",3,3)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("raw_write",1,"Stream *");
if(!lua_isstring(L,2)) SWIG_fail_arg("raw_write",2,"char const *");
if(!lua_isnumber(L,3)) SWIG_fail_arg("raw_write",3,"int");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,0))){
SWIG_fail_ptr("Stream_raw_write",1,SWIGTYPE_p_Stream);
}
arg2 = (char *)lua_tostring(L, 2);
arg3 = (int)lua_tonumber(L, 3);
(arg1)->raw_write((char const *)arg2,arg3);
SWIG_arg=0;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_Stream_get_data(lua_State* L) {
int SWIG_arg = -1;
Stream *arg1 = (Stream *) 0 ;
@ -2683,7 +2898,9 @@ Stream *arg1 = (Stream *) obj;
delete arg1;
}
static swig_lua_method swig_Stream_methods[] = {
{"read", _wrap_Stream_read},
{"write", _wrap_Stream_write},
{"raw_write", _wrap_Stream_raw_write},
{"get_data", _wrap_Stream_get_data},
{0,0}
};
@ -8064,6 +8281,7 @@ static swig_type_info _swigt__p_LUA__Session = {"_p_LUA__Session", "LUA::Session
static swig_type_info _swigt__p_SWIGLUA_FN = {"_p_SWIGLUA_FN", "SWIGLUA_FN *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)&_wrap_class_Stream, 0};
static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)&_wrap_class_input_callback_state_t, 0};
static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_lua_State = {"_p_lua_State", "lua_State *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_switch_event_node_t = {"_p_p_switch_event_node_t", "switch_event_node_t **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
@ -8095,6 +8313,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_SWIGLUA_FN,
&_swigt__p_Stream,
&_swigt__p_input_callback_state,
&_swigt__p_int,
&_swigt__p_lua_State,
&_swigt__p_p_switch_event_node_t,
&_swigt__p_session_flag_t,
@ -8126,6 +8345,7 @@ static swig_cast_info _swigc__p_LUA__Session[] = { {&_swigt__p_LUA__Session, 0,
static swig_cast_info _swigc__p_SWIGLUA_FN[] = { {&_swigt__p_SWIGLUA_FN, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_lua_State[] = { {&_swigt__p_lua_State, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_switch_event_node_t[] = { {&_swigt__p_p_switch_event_node_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0},{0, 0, 0, 0}};
@ -8157,6 +8377,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_SWIGLUA_FN,
_swigc__p_Stream,
_swigc__p_input_callback_state,
_swigc__p_int,
_swigc__p_lua_State,
_swigc__p_p_switch_event_node_t,
_swigc__p_session_flag_t,

View File

@ -22,7 +22,12 @@ class Stream {
Stream(void);
Stream(switch_stream_handle_t *);
virtual ~ Stream();
%inline %{
char *read(int *len);
%}
void write(const char *data);
void raw_write(void *data, int len);
const char *get_data(void);
};

View File

@ -2720,6 +2720,36 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_storage_dir_get(void * j
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_cache_dir_set(void * jarg1, char * jarg2) {
switch_directories *arg1 = (switch_directories *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_directories *)jarg1;
arg2 = (char *)jarg2;
{
if (arg1->cache_dir) delete [] arg1->cache_dir;
if (arg2) {
arg1->cache_dir = (char *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->cache_dir, (const char *)arg2);
} else {
arg1->cache_dir = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_cache_dir_get(void * jarg1) {
char * jresult ;
switch_directories *arg1 = (switch_directories *) 0 ;
char *result = 0 ;
arg1 = (switch_directories *)jarg1;
result = (char *) ((arg1)->cache_dir);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_recordings_dir_set(void * jarg1, char * jarg2) {
switch_directories *arg1 = (switch_directories *) 0 ;
char *arg2 = (char *) 0 ;
@ -4890,6 +4920,16 @@ SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MEDIA_TYPE_TOTAL_get() {
}
SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_SOCK_INVALID_get() {
int jresult ;
int result;
result = (int)(-1);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_console_callback_match_node_val_set(void * jarg1, char * jarg2) {
switch_console_callback_match_node *arg1 = (switch_console_callback_match_node *) 0 ;
char *arg2 = (char *) 0 ;
@ -6230,6 +6270,90 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_payload_map_t(void * jarg1) {
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_waitlist_t_sock_set(void * jarg1, int jarg2) {
switch_waitlist_t *arg1 = (switch_waitlist_t *) 0 ;
switch_os_socket_t arg2 ;
arg1 = (switch_waitlist_t *)jarg1;
arg2 = (switch_os_socket_t)jarg2;
if (arg1) (arg1)->sock = arg2;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_waitlist_t_sock_get(void * jarg1) {
int jresult ;
switch_waitlist_t *arg1 = (switch_waitlist_t *) 0 ;
switch_os_socket_t result;
arg1 = (switch_waitlist_t *)jarg1;
result = (switch_os_socket_t) ((arg1)->sock);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_waitlist_t_events_set(void * jarg1, unsigned long jarg2) {
switch_waitlist_t *arg1 = (switch_waitlist_t *) 0 ;
uint32_t arg2 ;
arg1 = (switch_waitlist_t *)jarg1;
arg2 = (uint32_t)jarg2;
if (arg1) (arg1)->events = arg2;
}
SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_waitlist_t_events_get(void * jarg1) {
unsigned long jresult ;
switch_waitlist_t *arg1 = (switch_waitlist_t *) 0 ;
uint32_t result;
arg1 = (switch_waitlist_t *)jarg1;
result = (uint32_t) ((arg1)->events);
jresult = (unsigned long)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_waitlist_t_revents_set(void * jarg1, unsigned long jarg2) {
switch_waitlist_t *arg1 = (switch_waitlist_t *) 0 ;
uint32_t arg2 ;
arg1 = (switch_waitlist_t *)jarg1;
arg2 = (uint32_t)jarg2;
if (arg1) (arg1)->revents = arg2;
}
SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_waitlist_t_revents_get(void * jarg1) {
unsigned long jresult ;
switch_waitlist_t *arg1 = (switch_waitlist_t *) 0 ;
uint32_t result;
arg1 = (switch_waitlist_t *)jarg1;
result = (uint32_t) ((arg1)->revents);
jresult = (unsigned long)result;
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_waitlist_t() {
void * jresult ;
switch_waitlist_t *result = 0 ;
result = (switch_waitlist_t *)new switch_waitlist_t();
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_waitlist_t(void * jarg1) {
switch_waitlist_t *arg1 = (switch_waitlist_t *) 0 ;
arg1 = (switch_waitlist_t *)jarg1;
delete arg1;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_close(void * jarg1) {
int jresult ;
switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
@ -18102,6 +18226,18 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_find_end_paren(char * jarg1, char ja
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_separate_file_params(char * jarg1, void * jarg2, void * jarg3) {
char *arg1 = (char *) 0 ;
char **arg2 = (char **) 0 ;
char **arg3 = (char **) 0 ;
arg1 = (char *)jarg1;
arg2 = (char **)jarg2;
arg3 = (char **)jarg3;
switch_separate_file_params((char const *)arg1,arg2,arg3);
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_file_path(char * jarg1) {
int jresult ;
char *arg1 = (char *) 0 ;
@ -18426,6 +18562,611 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strerror_r(int jarg1, char * jarg2,
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_wait_sock(int jarg1, unsigned long jarg2, int jarg3) {
int jresult ;
switch_os_socket_t arg1 ;
uint32_t arg2 ;
switch_poll_t arg3 ;
int result;
arg1 = (switch_os_socket_t)jarg1;
arg2 = (uint32_t)jarg2;
arg3 = (switch_poll_t)jarg3;
result = (int)switch_wait_sock(arg1,arg2,arg3);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_wait_socklist(void * jarg1, unsigned long jarg2, unsigned long jarg3) {
int jresult ;
switch_waitlist_t *arg1 = (switch_waitlist_t *) 0 ;
uint32_t arg2 ;
uint32_t arg3 ;
int result;
arg1 = (switch_waitlist_t *)jarg1;
arg2 = (uint32_t)jarg2;
arg3 = (uint32_t)jarg3;
result = (int)switch_wait_socklist(arg1,arg2,arg3);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_method_set(void * jarg1, char * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->method = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->method, (const char *)arg2);
} else {
arg1->method = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_method_get(void * jarg1) {
char * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_t *)jarg1;
result = (char *) ((arg1)->method);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_uri_set(void * jarg1, char * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->uri = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->uri, (const char *)arg2);
} else {
arg1->uri = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_uri_get(void * jarg1) {
char * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_t *)jarg1;
result = (char *) ((arg1)->uri);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_qs_set(void * jarg1, char * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->qs = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->qs, (const char *)arg2);
} else {
arg1->qs = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_qs_get(void * jarg1) {
char * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_t *)jarg1;
result = (char *) ((arg1)->qs);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_host_set(void * jarg1, char * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->host = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->host, (const char *)arg2);
} else {
arg1->host = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_host_get(void * jarg1) {
char * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_t *)jarg1;
result = (char *) ((arg1)->host);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_port_set(void * jarg1, unsigned short jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_port_t arg2 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (switch_port_t)jarg2;
if (arg1) (arg1)->port = arg2;
}
SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_http_request_t_port_get(void * jarg1) {
unsigned short jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_port_t result;
arg1 = (switch_http_request_t *)jarg1;
result = (switch_port_t) ((arg1)->port);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_from_set(void * jarg1, char * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->from = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->from, (const char *)arg2);
} else {
arg1->from = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_from_get(void * jarg1) {
char * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_t *)jarg1;
result = (char *) ((arg1)->from);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_user_agent_set(void * jarg1, char * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->user_agent = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->user_agent, (const char *)arg2);
} else {
arg1->user_agent = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_user_agent_get(void * jarg1) {
char * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_t *)jarg1;
result = (char *) ((arg1)->user_agent);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_referer_set(void * jarg1, char * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->referer = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->referer, (const char *)arg2);
} else {
arg1->referer = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_referer_get(void * jarg1) {
char * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_t *)jarg1;
result = (char *) ((arg1)->referer);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_user_set(void * jarg1, char * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->user = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->user, (const char *)arg2);
} else {
arg1->user = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_user_get(void * jarg1) {
char * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_t *)jarg1;
result = (char *) ((arg1)->user);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_keepalive_set(void * jarg1, int jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_bool_t arg2 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (switch_bool_t)jarg2;
if (arg1) (arg1)->keepalive = arg2;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_http_request_t_keepalive_get(void * jarg1) {
int jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_bool_t result;
arg1 = (switch_http_request_t *)jarg1;
result = (switch_bool_t) ((arg1)->keepalive);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_content_type_set(void * jarg1, char * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->content_type = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->content_type, (const char *)arg2);
} else {
arg1->content_type = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_content_type_get(void * jarg1) {
char * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_t *)jarg1;
result = (char *) ((arg1)->content_type);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_content_length_set(void * jarg1, void * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_size_t arg2 ;
switch_size_t *argp2 ;
arg1 = (switch_http_request_t *)jarg1;
argp2 = (switch_size_t *)jarg2;
if (!argp2) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
return ;
}
arg2 = *argp2;
if (arg1) (arg1)->content_length = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_http_request_t_content_length_get(void * jarg1) {
void * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_size_t result;
arg1 = (switch_http_request_t *)jarg1;
result = ((arg1)->content_length);
jresult = new switch_size_t((const switch_size_t &)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_bytes_header_set(void * jarg1, void * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_size_t arg2 ;
switch_size_t *argp2 ;
arg1 = (switch_http_request_t *)jarg1;
argp2 = (switch_size_t *)jarg2;
if (!argp2) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
return ;
}
arg2 = *argp2;
if (arg1) (arg1)->bytes_header = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_http_request_t_bytes_header_get(void * jarg1) {
void * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_size_t result;
arg1 = (switch_http_request_t *)jarg1;
result = ((arg1)->bytes_header);
jresult = new switch_size_t((const switch_size_t &)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_bytes_read_set(void * jarg1, void * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_size_t arg2 ;
switch_size_t *argp2 ;
arg1 = (switch_http_request_t *)jarg1;
argp2 = (switch_size_t *)jarg2;
if (!argp2) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
return ;
}
arg2 = *argp2;
if (arg1) (arg1)->bytes_read = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_http_request_t_bytes_read_get(void * jarg1) {
void * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_size_t result;
arg1 = (switch_http_request_t *)jarg1;
result = ((arg1)->bytes_read);
jresult = new switch_size_t((const switch_size_t &)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_bytes_buffered_set(void * jarg1, void * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_size_t arg2 ;
switch_size_t *argp2 ;
arg1 = (switch_http_request_t *)jarg1;
argp2 = (switch_size_t *)jarg2;
if (!argp2) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
return ;
}
arg2 = *argp2;
if (arg1) (arg1)->bytes_buffered = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_http_request_t_bytes_buffered_get(void * jarg1) {
void * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_size_t result;
arg1 = (switch_http_request_t *)jarg1;
result = ((arg1)->bytes_buffered);
jresult = new switch_size_t((const switch_size_t &)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_headers_set(void * jarg1, void * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_event_t *arg2 = (switch_event_t *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (switch_event_t *)jarg2;
if (arg1) (arg1)->headers = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_http_request_t_headers_get(void * jarg1) {
void * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_event_t *result = 0 ;
arg1 = (switch_http_request_t *)jarg1;
result = (switch_event_t *) ((arg1)->headers);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_user_data_set(void * jarg1, void * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
void *arg2 = (void *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (void *)jarg2;
if (arg1) (arg1)->user_data = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_http_request_t_user_data_get(void * jarg1) {
void * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
void *result = 0 ;
arg1 = (switch_http_request_t *)jarg1;
result = (void *) ((arg1)->user_data);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t__buffer_set(void * jarg1, char * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (char *)jarg2;
{
if (arg1->_buffer) delete [] arg1->_buffer;
if (arg2) {
arg1->_buffer = (char *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->_buffer, (const char *)arg2);
} else {
arg1->_buffer = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t__buffer_get(void * jarg1) {
char * jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_t *)jarg1;
result = (char *) ((arg1)->_buffer);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t__destroy_headers_set(void * jarg1, int jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_bool_t arg2 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (switch_bool_t)jarg2;
if (arg1) (arg1)->_destroy_headers = arg2;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_http_request_t__destroy_headers_get(void * jarg1) {
int jresult ;
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
switch_bool_t result;
arg1 = (switch_http_request_t *)jarg1;
result = (switch_bool_t) ((arg1)->_destroy_headers);
jresult = result;
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_http_request_t() {
void * jresult ;
switch_http_request_t *result = 0 ;
result = (switch_http_request_t *)new switch_http_request_t();
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_http_request_t(void * jarg1) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
delete arg1;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_http_parse_header(char * jarg1, unsigned long jarg2, void * jarg3) {
int jresult ;
char *arg1 = (char *) 0 ;
uint32_t arg2 ;
switch_http_request_t *arg3 = (switch_http_request_t *) 0 ;
switch_status_t result;
arg1 = (char *)jarg1;
arg2 = (uint32_t)jarg2;
arg3 = (switch_http_request_t *)jarg3;
result = (switch_status_t)switch_http_parse_header(arg1,arg2,arg3);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_free_request(void * jarg1) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
switch_http_free_request(arg1);
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_dump_request(void * jarg1) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
switch_http_dump_request(arg1);
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_parse_qs(void * jarg1, char * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (char *)jarg2;
switch_http_parse_qs(arg1,arg2);
}
SWIGEXPORT void SWIGSTDCALL CSharp_profile_node_t_var_set(void * jarg1, char * jarg2) {
profile_node_t *arg1 = (profile_node_t *) 0 ;
char *arg2 = (char *) 0 ;
@ -20859,6 +21600,28 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_state_handler_table(void * jarg
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_read_function_set(void * jarg1, void * jarg2) {
switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
switch_stream_handle_read_function_t arg2 = (switch_stream_handle_read_function_t) 0 ;
arg1 = (switch_stream_handle *)jarg1;
arg2 = (switch_stream_handle_read_function_t)jarg2;
if (arg1) (arg1)->read_function = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_read_function_get(void * jarg1) {
void * jresult ;
switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
switch_stream_handle_read_function_t result;
arg1 = (switch_stream_handle *)jarg1;
result = (switch_stream_handle_read_function_t) ((arg1)->read_function);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_write_function_set(void * jarg1, void * jarg2) {
switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
switch_stream_handle_write_function_t arg2 = (switch_stream_handle_write_function_t) 0 ;
@ -36232,6 +36995,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_force_exists(char * jarg1) {
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_is_parsing(void * jarg1) {
int jresult ;
switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ;
switch_bool_t result;
arg1 = (switch_ivr_dmachine_t *)jarg1;
result = (switch_bool_t)switch_ivr_dmachine_is_parsing(arg1);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_last_ping(void * jarg1) {
int jresult ;
switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ;
@ -42238,6 +43013,20 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_Stream(void * jarg1) {
}
SWIGEXPORT char * SWIGSTDCALL CSharp_Stream_read(void * jarg1, void * jarg2) {
char * jresult ;
Stream *arg1 = (Stream *) 0 ;
int *arg2 = (int *) 0 ;
char *result = 0 ;
arg1 = (Stream *)jarg1;
arg2 = (int *)jarg2;
result = (char *)(arg1)->read(arg2);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_Stream_Write(void * jarg1, char * jarg2) {
Stream *arg1 = (Stream *) 0 ;
char *arg2 = (char *) 0 ;
@ -42248,6 +43037,18 @@ SWIGEXPORT void SWIGSTDCALL CSharp_Stream_Write(void * jarg1, char * jarg2) {
}
SWIGEXPORT void SWIGSTDCALL CSharp_Stream_raw_write(void * jarg1, char * jarg2, int jarg3) {
Stream *arg1 = (Stream *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 ;
arg1 = (Stream *)jarg1;
arg2 = (char *)jarg2;
arg3 = (int)jarg3;
(arg1)->raw_write((char const *)arg2,arg3);
}
SWIGEXPORT char * SWIGSTDCALL CSharp_Stream_get_data(void * jarg1) {
char * jresult ;
Stream *arg1 = (Stream *) 0 ;

View File

@ -1,11 +1,11 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.12
*
* This file is not intended to be easily readable and contains a number of
* Version 2.0.7
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
* ----------------------------------------------------------------------------- */
#define SWIGCSHARP
@ -65,28 +65,28 @@ template <typename T> T SwigValueInit() {
#ifndef SWIGUNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define SWIGUNUSED __attribute__ ((__unused__))
# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
# elif defined(__ICC)
# define SWIGUNUSED __attribute__ ((__unused__))
# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# define SWIGUNUSED
# endif
#endif
#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
# pragma warning(disable : 4505) /* unreferenced local function has been removed */
# endif
# endif
#endif
#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
# define SWIGUNUSEDPARM(p)
# else
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
# endif
#endif
@ -129,7 +129,7 @@ template <typename T> T SwigValueInit() {
# define SWIGSTDCALL __stdcall
# else
# define SWIGSTDCALL
# endif
# endif
#endif
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@ -2720,6 +2720,36 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_storage_dir_get(void * j
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_cache_dir_set(void * jarg1, char * jarg2) {
switch_directories *arg1 = (switch_directories *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_directories *)jarg1;
arg2 = (char *)jarg2;
{
delete [] arg1->cache_dir;
if (arg2) {
arg1->cache_dir = (char *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->cache_dir, (const char *)arg2);
} else {
arg1->cache_dir = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_cache_dir_get(void * jarg1) {
char * jresult ;
switch_directories *arg1 = (switch_directories *) 0 ;
char *result = 0 ;
arg1 = (switch_directories *)jarg1;
result = (char *) ((arg1)->cache_dir);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_recordings_dir_set(void * jarg1, char * jarg2) {
switch_directories *arg1 = (switch_directories *) 0 ;
char *arg2 = (char *) 0 ;
@ -4890,6 +4920,16 @@ SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MEDIA_TYPE_TOTAL_get() {
}
SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_SOCK_INVALID_get() {
int jresult ;
int result;
result = (int)(-1);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_console_callback_match_node_val_set(void * jarg1, char * jarg2) {
switch_console_callback_match_node *arg1 = (switch_console_callback_match_node *) 0 ;
char *arg2 = (char *) 0 ;
@ -6230,6 +6270,90 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_payload_map_t(void * jarg1) {
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_waitlist_t_sock_set(void * jarg1, int jarg2) {
switch_waitlist_s *arg1 = (switch_waitlist_s *) 0 ;
switch_os_socket_t arg2 ;
arg1 = (switch_waitlist_s *)jarg1;
arg2 = (switch_os_socket_t)jarg2;
if (arg1) (arg1)->sock = arg2;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_waitlist_t_sock_get(void * jarg1) {
int jresult ;
switch_waitlist_s *arg1 = (switch_waitlist_s *) 0 ;
switch_os_socket_t result;
arg1 = (switch_waitlist_s *)jarg1;
result = (switch_os_socket_t) ((arg1)->sock);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_waitlist_t_events_set(void * jarg1, unsigned long jarg2) {
switch_waitlist_s *arg1 = (switch_waitlist_s *) 0 ;
uint32_t arg2 ;
arg1 = (switch_waitlist_s *)jarg1;
arg2 = (uint32_t)jarg2;
if (arg1) (arg1)->events = arg2;
}
SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_waitlist_t_events_get(void * jarg1) {
unsigned long jresult ;
switch_waitlist_s *arg1 = (switch_waitlist_s *) 0 ;
uint32_t result;
arg1 = (switch_waitlist_s *)jarg1;
result = (uint32_t) ((arg1)->events);
jresult = (unsigned long)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_waitlist_t_revents_set(void * jarg1, unsigned long jarg2) {
switch_waitlist_s *arg1 = (switch_waitlist_s *) 0 ;
uint32_t arg2 ;
arg1 = (switch_waitlist_s *)jarg1;
arg2 = (uint32_t)jarg2;
if (arg1) (arg1)->revents = arg2;
}
SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_waitlist_t_revents_get(void * jarg1) {
unsigned long jresult ;
switch_waitlist_s *arg1 = (switch_waitlist_s *) 0 ;
uint32_t result;
arg1 = (switch_waitlist_s *)jarg1;
result = (uint32_t) ((arg1)->revents);
jresult = (unsigned long)result;
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_waitlist_t() {
void * jresult ;
switch_waitlist_s *result = 0 ;
result = (switch_waitlist_s *)new switch_waitlist_s();
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_waitlist_t(void * jarg1) {
switch_waitlist_s *arg1 = (switch_waitlist_s *) 0 ;
arg1 = (switch_waitlist_s *)jarg1;
delete arg1;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_close(void * jarg1) {
int jresult ;
switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
@ -18102,6 +18226,18 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_find_end_paren(char * jarg1, char ja
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_separate_file_params(char * jarg1, void * jarg2, void * jarg3) {
char *arg1 = (char *) 0 ;
char **arg2 = (char **) 0 ;
char **arg3 = (char **) 0 ;
arg1 = (char *)jarg1;
arg2 = (char **)jarg2;
arg3 = (char **)jarg3;
switch_separate_file_params((char const *)arg1,arg2,arg3);
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_file_path(char * jarg1) {
int jresult ;
char *arg1 = (char *) 0 ;
@ -18426,6 +18562,611 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strerror_r(int jarg1, char * jarg2,
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_wait_sock(int jarg1, unsigned long jarg2, int jarg3) {
int jresult ;
switch_os_socket_t arg1 ;
uint32_t arg2 ;
switch_poll_t arg3 ;
int result;
arg1 = (switch_os_socket_t)jarg1;
arg2 = (uint32_t)jarg2;
arg3 = (switch_poll_t)jarg3;
result = (int)switch_wait_sock(arg1,arg2,arg3);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_wait_socklist(void * jarg1, unsigned long jarg2, unsigned long jarg3) {
int jresult ;
switch_waitlist_t *arg1 = (switch_waitlist_t *) 0 ;
uint32_t arg2 ;
uint32_t arg3 ;
int result;
arg1 = (switch_waitlist_t *)jarg1;
arg2 = (uint32_t)jarg2;
arg3 = (uint32_t)jarg3;
result = (int)switch_wait_socklist(arg1,arg2,arg3);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_method_set(void * jarg1, char * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_s *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->method = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->method, (const char *)arg2);
} else {
arg1->method = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_method_get(void * jarg1) {
char * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_s *)jarg1;
result = (char *) ((arg1)->method);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_uri_set(void * jarg1, char * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_s *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->uri = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->uri, (const char *)arg2);
} else {
arg1->uri = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_uri_get(void * jarg1) {
char * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_s *)jarg1;
result = (char *) ((arg1)->uri);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_qs_set(void * jarg1, char * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_s *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->qs = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->qs, (const char *)arg2);
} else {
arg1->qs = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_qs_get(void * jarg1) {
char * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_s *)jarg1;
result = (char *) ((arg1)->qs);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_host_set(void * jarg1, char * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_s *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->host = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->host, (const char *)arg2);
} else {
arg1->host = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_host_get(void * jarg1) {
char * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_s *)jarg1;
result = (char *) ((arg1)->host);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_port_set(void * jarg1, unsigned short jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_port_t arg2 ;
arg1 = (switch_http_request_s *)jarg1;
arg2 = (switch_port_t)jarg2;
if (arg1) (arg1)->port = arg2;
}
SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_http_request_t_port_get(void * jarg1) {
unsigned short jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_port_t result;
arg1 = (switch_http_request_s *)jarg1;
result = (switch_port_t) ((arg1)->port);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_from_set(void * jarg1, char * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_s *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->from = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->from, (const char *)arg2);
} else {
arg1->from = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_from_get(void * jarg1) {
char * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_s *)jarg1;
result = (char *) ((arg1)->from);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_user_agent_set(void * jarg1, char * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_s *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->user_agent = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->user_agent, (const char *)arg2);
} else {
arg1->user_agent = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_user_agent_get(void * jarg1) {
char * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_s *)jarg1;
result = (char *) ((arg1)->user_agent);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_referer_set(void * jarg1, char * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_s *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->referer = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->referer, (const char *)arg2);
} else {
arg1->referer = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_referer_get(void * jarg1) {
char * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_s *)jarg1;
result = (char *) ((arg1)->referer);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_user_set(void * jarg1, char * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_s *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->user = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->user, (const char *)arg2);
} else {
arg1->user = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_user_get(void * jarg1) {
char * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_s *)jarg1;
result = (char *) ((arg1)->user);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_keepalive_set(void * jarg1, int jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_bool_t arg2 ;
arg1 = (switch_http_request_s *)jarg1;
arg2 = (switch_bool_t)jarg2;
if (arg1) (arg1)->keepalive = arg2;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_http_request_t_keepalive_get(void * jarg1) {
int jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_bool_t result;
arg1 = (switch_http_request_s *)jarg1;
result = (switch_bool_t) ((arg1)->keepalive);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_content_type_set(void * jarg1, char * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_s *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->content_type = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->content_type, (const char *)arg2);
} else {
arg1->content_type = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t_content_type_get(void * jarg1) {
char * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_s *)jarg1;
result = (char *) ((arg1)->content_type);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_content_length_set(void * jarg1, void * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_size_t arg2 ;
switch_size_t *argp2 ;
arg1 = (switch_http_request_s *)jarg1;
argp2 = (switch_size_t *)jarg2;
if (!argp2) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
return ;
}
arg2 = *argp2;
if (arg1) (arg1)->content_length = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_http_request_t_content_length_get(void * jarg1) {
void * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_size_t result;
arg1 = (switch_http_request_s *)jarg1;
result = ((arg1)->content_length);
jresult = new switch_size_t((const switch_size_t &)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_bytes_header_set(void * jarg1, void * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_size_t arg2 ;
switch_size_t *argp2 ;
arg1 = (switch_http_request_s *)jarg1;
argp2 = (switch_size_t *)jarg2;
if (!argp2) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
return ;
}
arg2 = *argp2;
if (arg1) (arg1)->bytes_header = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_http_request_t_bytes_header_get(void * jarg1) {
void * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_size_t result;
arg1 = (switch_http_request_s *)jarg1;
result = ((arg1)->bytes_header);
jresult = new switch_size_t((const switch_size_t &)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_bytes_read_set(void * jarg1, void * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_size_t arg2 ;
switch_size_t *argp2 ;
arg1 = (switch_http_request_s *)jarg1;
argp2 = (switch_size_t *)jarg2;
if (!argp2) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
return ;
}
arg2 = *argp2;
if (arg1) (arg1)->bytes_read = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_http_request_t_bytes_read_get(void * jarg1) {
void * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_size_t result;
arg1 = (switch_http_request_s *)jarg1;
result = ((arg1)->bytes_read);
jresult = new switch_size_t((const switch_size_t &)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_bytes_buffered_set(void * jarg1, void * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_size_t arg2 ;
switch_size_t *argp2 ;
arg1 = (switch_http_request_s *)jarg1;
argp2 = (switch_size_t *)jarg2;
if (!argp2) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
return ;
}
arg2 = *argp2;
if (arg1) (arg1)->bytes_buffered = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_http_request_t_bytes_buffered_get(void * jarg1) {
void * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_size_t result;
arg1 = (switch_http_request_s *)jarg1;
result = ((arg1)->bytes_buffered);
jresult = new switch_size_t((const switch_size_t &)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_headers_set(void * jarg1, void * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_event_t *arg2 = (switch_event_t *) 0 ;
arg1 = (switch_http_request_s *)jarg1;
arg2 = (switch_event_t *)jarg2;
if (arg1) (arg1)->headers = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_http_request_t_headers_get(void * jarg1) {
void * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_event_t *result = 0 ;
arg1 = (switch_http_request_s *)jarg1;
result = (switch_event_t *) ((arg1)->headers);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t_user_data_set(void * jarg1, void * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
void *arg2 = (void *) 0 ;
arg1 = (switch_http_request_s *)jarg1;
arg2 = (void *)jarg2;
if (arg1) (arg1)->user_data = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_http_request_t_user_data_get(void * jarg1) {
void * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
void *result = 0 ;
arg1 = (switch_http_request_s *)jarg1;
result = (void *) ((arg1)->user_data);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t__buffer_set(void * jarg1, char * jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_s *)jarg1;
arg2 = (char *)jarg2;
{
delete [] arg1->_buffer;
if (arg2) {
arg1->_buffer = (char *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->_buffer, (const char *)arg2);
} else {
arg1->_buffer = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_http_request_t__buffer_get(void * jarg1) {
char * jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
char *result = 0 ;
arg1 = (switch_http_request_s *)jarg1;
result = (char *) ((arg1)->_buffer);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_request_t__destroy_headers_set(void * jarg1, int jarg2) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_bool_t arg2 ;
arg1 = (switch_http_request_s *)jarg1;
arg2 = (switch_bool_t)jarg2;
if (arg1) (arg1)->_destroy_headers = arg2;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_http_request_t__destroy_headers_get(void * jarg1) {
int jresult ;
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
switch_bool_t result;
arg1 = (switch_http_request_s *)jarg1;
result = (switch_bool_t) ((arg1)->_destroy_headers);
jresult = result;
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_http_request_t() {
void * jresult ;
switch_http_request_s *result = 0 ;
result = (switch_http_request_s *)new switch_http_request_s();
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_http_request_t(void * jarg1) {
switch_http_request_s *arg1 = (switch_http_request_s *) 0 ;
arg1 = (switch_http_request_s *)jarg1;
delete arg1;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_http_parse_header(char * jarg1, unsigned long jarg2, void * jarg3) {
int jresult ;
char *arg1 = (char *) 0 ;
uint32_t arg2 ;
switch_http_request_t *arg3 = (switch_http_request_t *) 0 ;
switch_status_t result;
arg1 = (char *)jarg1;
arg2 = (uint32_t)jarg2;
arg3 = (switch_http_request_t *)jarg3;
result = (switch_status_t)switch_http_parse_header(arg1,arg2,arg3);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_free_request(void * jarg1) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
switch_http_free_request(arg1);
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_dump_request(void * jarg1) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
switch_http_dump_request(arg1);
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_http_parse_qs(void * jarg1, char * jarg2) {
switch_http_request_t *arg1 = (switch_http_request_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_http_request_t *)jarg1;
arg2 = (char *)jarg2;
switch_http_parse_qs(arg1,arg2);
}
SWIGEXPORT void SWIGSTDCALL CSharp_profile_node_t_var_set(void * jarg1, char * jarg2) {
profile_node_s *arg1 = (profile_node_s *) 0 ;
char *arg2 = (char *) 0 ;
@ -20859,6 +21600,28 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_state_handler_table(void * jarg
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_read_function_set(void * jarg1, void * jarg2) {
switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
switch_stream_handle_read_function_t arg2 = (switch_stream_handle_read_function_t) 0 ;
arg1 = (switch_stream_handle *)jarg1;
arg2 = (switch_stream_handle_read_function_t)jarg2;
if (arg1) (arg1)->read_function = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_read_function_get(void * jarg1) {
void * jresult ;
switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
switch_stream_handle_read_function_t result;
arg1 = (switch_stream_handle *)jarg1;
result = (switch_stream_handle_read_function_t) ((arg1)->read_function);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_write_function_set(void * jarg1, void * jarg2) {
switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
switch_stream_handle_write_function_t arg2 = (switch_stream_handle_write_function_t) 0 ;
@ -36232,6 +36995,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_force_exists(char * jarg1) {
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_is_parsing(void * jarg1) {
int jresult ;
switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ;
switch_bool_t result;
arg1 = (switch_ivr_dmachine_t *)jarg1;
result = (switch_bool_t)switch_ivr_dmachine_is_parsing(arg1);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_last_ping(void * jarg1) {
int jresult ;
switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ;
@ -42238,6 +43013,20 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_Stream(void * jarg1) {
}
SWIGEXPORT char * SWIGSTDCALL CSharp_Stream_read(void * jarg1, void * jarg2) {
char * jresult ;
Stream *arg1 = (Stream *) 0 ;
int *arg2 = (int *) 0 ;
char *result = 0 ;
arg1 = (Stream *)jarg1;
arg2 = (int *)jarg2;
result = (char *)(arg1)->read(arg2);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_Stream_Write(void * jarg1, char * jarg2) {
Stream *arg1 = (Stream *) 0 ;
char *arg2 = (char *) 0 ;
@ -42248,6 +43037,18 @@ SWIGEXPORT void SWIGSTDCALL CSharp_Stream_Write(void * jarg1, char * jarg2) {
}
SWIGEXPORT void SWIGSTDCALL CSharp_Stream_raw_write(void * jarg1, char * jarg2, int jarg3) {
Stream *arg1 = (Stream *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 ;
arg1 = (Stream *)jarg1;
arg2 = (char *)jarg2;
arg3 = (int)jarg3;
(arg1)->raw_write((char const *)arg2,arg3);
}
SWIGEXPORT char * SWIGSTDCALL CSharp_Stream_get_data(void * jarg1) {
char * jresult ;
Stream *arg1 = (Stream *) 0 ;

View File

@ -3948,6 +3948,10 @@ public class freeswitch {
return ret;
}
public static void switch_separate_file_params(string file, ref string file_portion, ref string params_portion) {
freeswitchPINVOKE.switch_separate_file_params(file, ref file_portion, ref params_portion);
}
public static switch_bool_t switch_is_file_path(string file) {
switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_file_path(file);
return ret;
@ -4054,6 +4058,33 @@ public class freeswitch {
return ret;
}
public static int switch_wait_sock(int sock, uint ms, switch_poll_t flags) {
int ret = freeswitchPINVOKE.switch_wait_sock(sock, ms, (int)flags);
return ret;
}
public static int switch_wait_socklist(switch_waitlist_t waitlist, uint len, uint ms) {
int ret = freeswitchPINVOKE.switch_wait_socklist(switch_waitlist_t.getCPtr(waitlist), len, ms);
return ret;
}
public static switch_status_t switch_http_parse_header(string buffer, uint datalen, switch_http_request_t request) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_http_parse_header(buffer, datalen, switch_http_request_t.getCPtr(request));
return ret;
}
public static void switch_http_free_request(switch_http_request_t request) {
freeswitchPINVOKE.switch_http_free_request(switch_http_request_t.getCPtr(request));
}
public static void switch_http_dump_request(switch_http_request_t request) {
freeswitchPINVOKE.switch_http_dump_request(switch_http_request_t.getCPtr(request));
}
public static void switch_http_parse_qs(switch_http_request_t request, string qs) {
freeswitchPINVOKE.switch_http_parse_qs(switch_http_request_t.getCPtr(request), qs);
}
public static switch_caller_extension switch_caller_extension_new(SWIGTYPE_p_switch_core_session session, string extension_name, string extension_number) {
IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_new(SWIGTYPE_p_switch_core_session.getCPtr(session), extension_name, extension_number);
switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false);
@ -5894,6 +5925,11 @@ public class freeswitch {
return ret;
}
public static switch_bool_t switch_ivr_dmachine_is_parsing(SWIGTYPE_p_switch_ivr_dmachine dmachine) {
switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_ivr_dmachine_is_parsing(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine));
return ret;
}
public static switch_status_t switch_ivr_dmachine_last_ping(SWIGTYPE_p_switch_ivr_dmachine dmachine) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_last_ping(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine));
return ret;
@ -7093,6 +7129,7 @@ public class freeswitch {
public static readonly int SWITCH_MAX_MANAGEMENT_BUFFER_LEN = freeswitchPINVOKE.SWITCH_MAX_MANAGEMENT_BUFFER_LEN_get();
public static readonly int SWITCH_RTP_CNG_PAYLOAD = freeswitchPINVOKE.SWITCH_RTP_CNG_PAYLOAD_get();
public static readonly int SWITCH_MEDIA_TYPE_TOTAL = freeswitchPINVOKE.SWITCH_MEDIA_TYPE_TOTAL_get();
public static readonly int SWITCH_SOCK_INVALID = freeswitchPINVOKE.SWITCH_SOCK_INVALID_get();
public static readonly int DMACHINE_MAX_DIGIT_LEN = freeswitchPINVOKE.DMACHINE_MAX_DIGIT_LEN_get();
public static readonly int MAX_ARG_RECURSION = freeswitchPINVOKE.MAX_ARG_RECURSION_get();
public static readonly int SWITCH_API_VERSION = freeswitchPINVOKE.SWITCH_API_VERSION_get();
@ -8021,6 +8058,12 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_directories_storage_dir_get")]
public static extern string switch_directories_storage_dir_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_directories_cache_dir_set")]
public static extern void switch_directories_cache_dir_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_directories_cache_dir_get")]
public static extern string switch_directories_cache_dir_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_directories_recordings_dir_set")]
public static extern void switch_directories_recordings_dir_set(HandleRef jarg1, string jarg2);
@ -8585,6 +8628,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MEDIA_TYPE_TOTAL_get")]
public static extern int SWITCH_MEDIA_TYPE_TOTAL_get();
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SOCK_INVALID_get")]
public static extern int SWITCH_SOCK_INVALID_get();
[DllImport("mod_managed", EntryPoint="CSharp_switch_console_callback_match_node_val_set")]
public static extern void switch_console_callback_match_node_val_set(HandleRef jarg1, string jarg2);
@ -8942,6 +8988,30 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_delete_payload_map_t")]
public static extern void delete_payload_map_t(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_waitlist_t_sock_set")]
public static extern void switch_waitlist_t_sock_set(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_waitlist_t_sock_get")]
public static extern int switch_waitlist_t_sock_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_waitlist_t_events_set")]
public static extern void switch_waitlist_t_events_set(HandleRef jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_waitlist_t_events_get")]
public static extern uint switch_waitlist_t_events_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_waitlist_t_revents_set")]
public static extern void switch_waitlist_t_revents_set(HandleRef jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_waitlist_t_revents_get")]
public static extern uint switch_waitlist_t_revents_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_new_switch_waitlist_t")]
public static extern IntPtr new_switch_waitlist_t();
[DllImport("mod_managed", EntryPoint="CSharp_delete_switch_waitlist_t")]
public static extern void delete_switch_waitlist_t(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_close")]
public static extern int switch_core_db_close(HandleRef jarg1);
@ -11711,6 +11781,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_find_end_paren")]
public static extern string switch_find_end_paren(string jarg1, char jarg2, char jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_separate_file_params")]
public static extern void switch_separate_file_params(string jarg1, ref string jarg2, ref string jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_is_file_path")]
public static extern int switch_is_file_path(string jarg1);
@ -11774,6 +11847,144 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_strerror_r")]
public static extern string switch_strerror_r(int jarg1, string jarg2, HandleRef jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_wait_sock")]
public static extern int switch_wait_sock(int jarg1, uint jarg2, int jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_wait_socklist")]
public static extern int switch_wait_socklist(HandleRef jarg1, uint jarg2, uint jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_method_set")]
public static extern void switch_http_request_t_method_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_method_get")]
public static extern string switch_http_request_t_method_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_uri_set")]
public static extern void switch_http_request_t_uri_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_uri_get")]
public static extern string switch_http_request_t_uri_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_qs_set")]
public static extern void switch_http_request_t_qs_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_qs_get")]
public static extern string switch_http_request_t_qs_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_host_set")]
public static extern void switch_http_request_t_host_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_host_get")]
public static extern string switch_http_request_t_host_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_port_set")]
public static extern void switch_http_request_t_port_set(HandleRef jarg1, ushort jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_port_get")]
public static extern ushort switch_http_request_t_port_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_from_set")]
public static extern void switch_http_request_t_from_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_from_get")]
public static extern string switch_http_request_t_from_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_user_agent_set")]
public static extern void switch_http_request_t_user_agent_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_user_agent_get")]
public static extern string switch_http_request_t_user_agent_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_referer_set")]
public static extern void switch_http_request_t_referer_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_referer_get")]
public static extern string switch_http_request_t_referer_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_user_set")]
public static extern void switch_http_request_t_user_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_user_get")]
public static extern string switch_http_request_t_user_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_keepalive_set")]
public static extern void switch_http_request_t_keepalive_set(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_keepalive_get")]
public static extern int switch_http_request_t_keepalive_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_content_type_set")]
public static extern void switch_http_request_t_content_type_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_content_type_get")]
public static extern string switch_http_request_t_content_type_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_content_length_set")]
public static extern void switch_http_request_t_content_length_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_content_length_get")]
public static extern IntPtr switch_http_request_t_content_length_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_bytes_header_set")]
public static extern void switch_http_request_t_bytes_header_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_bytes_header_get")]
public static extern IntPtr switch_http_request_t_bytes_header_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_bytes_read_set")]
public static extern void switch_http_request_t_bytes_read_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_bytes_read_get")]
public static extern IntPtr switch_http_request_t_bytes_read_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_bytes_buffered_set")]
public static extern void switch_http_request_t_bytes_buffered_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_bytes_buffered_get")]
public static extern IntPtr switch_http_request_t_bytes_buffered_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_headers_set")]
public static extern void switch_http_request_t_headers_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_headers_get")]
public static extern IntPtr switch_http_request_t_headers_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_user_data_set")]
public static extern void switch_http_request_t_user_data_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t_user_data_get")]
public static extern IntPtr switch_http_request_t_user_data_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t__buffer_set")]
public static extern void switch_http_request_t__buffer_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t__buffer_get")]
public static extern string switch_http_request_t__buffer_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t__destroy_headers_set")]
public static extern void switch_http_request_t__destroy_headers_set(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_request_t__destroy_headers_get")]
public static extern int switch_http_request_t__destroy_headers_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_new_switch_http_request_t")]
public static extern IntPtr new_switch_http_request_t();
[DllImport("mod_managed", EntryPoint="CSharp_delete_switch_http_request_t")]
public static extern void delete_switch_http_request_t(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_parse_header")]
public static extern int switch_http_parse_header(string jarg1, uint jarg2, HandleRef jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_free_request")]
public static extern void switch_http_free_request(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_dump_request")]
public static extern void switch_http_dump_request(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_http_parse_qs")]
public static extern void switch_http_parse_qs(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_profile_node_t_var_set")]
public static extern void profile_node_t_var_set(HandleRef jarg1, string jarg2);
@ -12371,6 +12582,12 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_delete_switch_state_handler_table")]
public static extern void delete_switch_state_handler_table(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_read_function_set")]
public static extern void switch_stream_handle_read_function_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_read_function_get")]
public static extern IntPtr switch_stream_handle_read_function_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_write_function_set")]
public static extern void switch_stream_handle_write_function_set(HandleRef jarg1, HandleRef jarg2);
@ -16070,6 +16287,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_uuid_force_exists")]
public static extern int switch_ivr_uuid_force_exists(string jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_is_parsing")]
public static extern int switch_ivr_dmachine_is_parsing(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_last_ping")]
public static extern int switch_ivr_dmachine_last_ping(HandleRef jarg1);
@ -17504,9 +17724,15 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_delete_Stream")]
public static extern void delete_Stream(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_Stream_read")]
public static extern string Stream_read(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_Stream_Write")]
public static extern void Stream_Write(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_Stream_raw_write")]
public static extern void Stream_raw_write(HandleRef jarg1, string jarg2, int jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_Stream_get_data")]
public static extern string Stream_get_data(HandleRef jarg1);
@ -18865,10 +19091,19 @@ public partial class Stream : IDisposable {
public Stream(switch_stream_handle arg0) : this(freeswitchPINVOKE.new_Stream__SWIG_1(switch_stream_handle.getCPtr(arg0)), true) {
}
public string read(SWIGTYPE_p_int len) {
string ret = freeswitchPINVOKE.Stream_read(swigCPtr, SWIGTYPE_p_int.getCPtr(len));
return ret;
}
public void Write(string data) {
freeswitchPINVOKE.Stream_Write(swigCPtr, data);
}
public void raw_write(string data, int len) {
freeswitchPINVOKE.Stream_raw_write(swigCPtr, data, len);
}
public string get_data() {
string ret = freeswitchPINVOKE.Stream_get_data(swigCPtr);
return ret;
@ -21440,6 +21675,36 @@ namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char {
private HandleRef swigCPtr;
internal SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char(IntPtr cPtr, bool futureUse) {
swigCPtr = new HandleRef(this, cPtr);
}
protected SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char() {
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.1
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t {
private HandleRef swigCPtr;
@ -30726,6 +30991,16 @@ public class switch_directories : IDisposable {
}
}
public string cache_dir {
set {
freeswitchPINVOKE.switch_directories_cache_dir_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_directories_cache_dir_get(swigCPtr);
return ret;
}
}
public string recordings_dir {
set {
freeswitchPINVOKE.switch_directories_recordings_dir_set(swigCPtr, value);
@ -32963,6 +33238,255 @@ public class switch_hold_record_t : IDisposable {
namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class switch_http_request_t : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal switch_http_request_t(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(switch_http_request_t obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~switch_http_request_t() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
freeswitchPINVOKE.delete_switch_http_request_t(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public string method {
set {
freeswitchPINVOKE.switch_http_request_t_method_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_http_request_t_method_get(swigCPtr);
return ret;
}
}
public string uri {
set {
freeswitchPINVOKE.switch_http_request_t_uri_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_http_request_t_uri_get(swigCPtr);
return ret;
}
}
public string qs {
set {
freeswitchPINVOKE.switch_http_request_t_qs_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_http_request_t_qs_get(swigCPtr);
return ret;
}
}
public string host {
set {
freeswitchPINVOKE.switch_http_request_t_host_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_http_request_t_host_get(swigCPtr);
return ret;
}
}
public ushort port {
set {
freeswitchPINVOKE.switch_http_request_t_port_set(swigCPtr, value);
}
get {
ushort ret = freeswitchPINVOKE.switch_http_request_t_port_get(swigCPtr);
return ret;
}
}
public string from {
set {
freeswitchPINVOKE.switch_http_request_t_from_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_http_request_t_from_get(swigCPtr);
return ret;
}
}
public string user_agent {
set {
freeswitchPINVOKE.switch_http_request_t_user_agent_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_http_request_t_user_agent_get(swigCPtr);
return ret;
}
}
public string referer {
set {
freeswitchPINVOKE.switch_http_request_t_referer_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_http_request_t_referer_get(swigCPtr);
return ret;
}
}
public string user {
set {
freeswitchPINVOKE.switch_http_request_t_user_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_http_request_t_user_get(swigCPtr);
return ret;
}
}
public switch_bool_t keepalive {
set {
freeswitchPINVOKE.switch_http_request_t_keepalive_set(swigCPtr, (int)value);
}
get {
switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_http_request_t_keepalive_get(swigCPtr);
return ret;
}
}
public string content_type {
set {
freeswitchPINVOKE.switch_http_request_t_content_type_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_http_request_t_content_type_get(swigCPtr);
return ret;
}
}
public SWIGTYPE_p_switch_size_t content_length {
set {
freeswitchPINVOKE.switch_http_request_t_content_length_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
}
get {
SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_http_request_t_content_length_get(swigCPtr), true);
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
public SWIGTYPE_p_switch_size_t bytes_header {
set {
freeswitchPINVOKE.switch_http_request_t_bytes_header_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
}
get {
SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_http_request_t_bytes_header_get(swigCPtr), true);
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
public SWIGTYPE_p_switch_size_t bytes_read {
set {
freeswitchPINVOKE.switch_http_request_t_bytes_read_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
}
get {
SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_http_request_t_bytes_read_get(swigCPtr), true);
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
public SWIGTYPE_p_switch_size_t bytes_buffered {
set {
freeswitchPINVOKE.switch_http_request_t_bytes_buffered_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
}
get {
SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_http_request_t_bytes_buffered_get(swigCPtr), true);
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
public switch_event headers {
set {
freeswitchPINVOKE.switch_http_request_t_headers_set(swigCPtr, switch_event.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_http_request_t_headers_get(swigCPtr);
switch_event ret = (cPtr == IntPtr.Zero) ? null : new switch_event(cPtr, false);
return ret;
}
}
public SWIGTYPE_p_void user_data {
set {
freeswitchPINVOKE.switch_http_request_t_user_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_http_request_t_user_data_get(swigCPtr);
SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
return ret;
}
}
public string _buffer {
set {
freeswitchPINVOKE.switch_http_request_t__buffer_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_http_request_t__buffer_get(swigCPtr);
return ret;
}
}
public switch_bool_t _destroy_headers {
set {
freeswitchPINVOKE.switch_http_request_t__destroy_headers_set(swigCPtr, (int)value);
}
get {
switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_http_request_t__destroy_headers_get(swigCPtr);
return ret;
}
}
public switch_http_request_t() : this(freeswitchPINVOKE.new_switch_http_request_t(), true) {
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.1
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
public enum switch_hup_type_t {
SHT_NONE = 0,
SHT_UNANSWERED = (1 << 0),
@ -35701,6 +36225,28 @@ namespace FreeSWITCH.Native {
namespace FreeSWITCH.Native {
public enum switch_poll_t {
SWITCH_POLL_READ = (1 << 0),
SWITCH_POLL_WRITE = (1 << 1),
SWITCH_POLL_ERROR = (1 << 2),
SWITCH_POLL_HUP = (1 << 3),
SWITCH_POLL_RDNORM = (1 << 4),
SWITCH_POLL_RDBAND = (1 << 5),
SWITCH_POLL_PRI = (1 << 6),
SWITCH_POLL_INVALID = (1 << 7)
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.1
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
[System.Flags] public enum switch_port_flag_enum_t {
SPF_NONE = 0,
SPF_ODD = (1 << 0),
@ -38554,6 +39100,17 @@ public class switch_stream_handle : IDisposable {
}
}
public SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char read_function {
set {
freeswitchPINVOKE.switch_stream_handle_read_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_stream_handle_read_function_get(swigCPtr);
SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char(cPtr, false);
return ret;
}
}
public SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t write_function {
set {
freeswitchPINVOKE.switch_stream_handle_write_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t.getCPtr(value));
@ -39634,6 +40191,85 @@ namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class switch_waitlist_t : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal switch_waitlist_t(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(switch_waitlist_t obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~switch_waitlist_t() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
freeswitchPINVOKE.delete_switch_waitlist_t(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public int sock {
set {
freeswitchPINVOKE.switch_waitlist_t_sock_set(swigCPtr, value);
}
get {
int ret = freeswitchPINVOKE.switch_waitlist_t_sock_get(swigCPtr);
return ret;
}
}
public uint events {
set {
freeswitchPINVOKE.switch_waitlist_t_events_set(swigCPtr, value);
}
get {
uint ret = freeswitchPINVOKE.switch_waitlist_t_events_get(swigCPtr);
return ret;
}
}
public uint revents {
set {
freeswitchPINVOKE.switch_waitlist_t_revents_set(swigCPtr, value);
}
get {
uint ret = freeswitchPINVOKE.switch_waitlist_t_revents_get(swigCPtr);
return ret;
}
}
public switch_waitlist_t() : this(freeswitchPINVOKE.new_switch_waitlist_t(), true) {
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.1
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class switch_xml : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;

File diff suppressed because it is too large Load Diff

View File

@ -306,7 +306,12 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="freeswitch_managed.cpp" />
<ClCompile Include="freeswitch_wrap.2010.cxx" />
<ClCompile Include="freeswitch_wrap.2010.cxx">
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug_CLR|x64'">4505;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release_CLR|x64'">4505;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release_CLR|Win32'">4505;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug_CLR|Win32'">4505;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<ClCompile Include="mod_managed.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -322,7 +322,12 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="freeswitch_managed.cpp" />
<ClCompile Include="freeswitch_wrap.2010.cxx" />
<ClCompile Include="freeswitch_wrap.2010.cxx">
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug_CLR|x64'">4505;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release_CLR|x64'">4505;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release_CLR|Win32'">4505;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug_CLR|Win32'">4505;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<ClCompile Include="mod_managed.cpp" />
</ItemGroup>
<ItemGroup>
@ -343,4 +348,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -1 +1,2 @@
mod_perl_wrap.cpp -diff
freeswitch.pm -diff

View File

@ -252,7 +252,9 @@ sub DESTROY {
}
}
*read = *freeswitchc::Stream_read;
*write = *freeswitchc::Stream_write;
*raw_write = *freeswitchc::Stream_raw_write;
*get_data = *freeswitchc::Stream_get_data;
sub DISOWN {
my $self = shift;

View File

@ -1457,25 +1457,26 @@ SWIG_Perl_SetModule(swig_module_info *module) {
#define SWIGTYPE_p_Stream swig_types[8]
#define SWIGTYPE_p_char swig_types[9]
#define SWIGTYPE_p_input_callback_state swig_types[10]
#define SWIGTYPE_p_p_switch_event_node_t swig_types[11]
#define SWIGTYPE_p_session_flag_t swig_types[12]
#define SWIGTYPE_p_switch_call_cause_t swig_types[13]
#define SWIGTYPE_p_switch_channel_state_t swig_types[14]
#define SWIGTYPE_p_switch_channel_t swig_types[15]
#define SWIGTYPE_p_switch_core_session_t swig_types[16]
#define SWIGTYPE_p_switch_event_t swig_types[17]
#define SWIGTYPE_p_switch_event_types_t swig_types[18]
#define SWIGTYPE_p_switch_input_args_t swig_types[19]
#define SWIGTYPE_p_switch_input_type_t swig_types[20]
#define SWIGTYPE_p_switch_priority_t swig_types[21]
#define SWIGTYPE_p_switch_queue_t swig_types[22]
#define SWIGTYPE_p_switch_state_handler_table_t swig_types[23]
#define SWIGTYPE_p_switch_status_t swig_types[24]
#define SWIGTYPE_p_switch_stream_handle_t swig_types[25]
#define SWIGTYPE_p_uint32_t swig_types[26]
#define SWIGTYPE_p_void swig_types[27]
static swig_type_info *swig_types[29];
static swig_module_info swig_module = {swig_types, 28, 0, 0, 0, 0};
#define SWIGTYPE_p_int swig_types[11]
#define SWIGTYPE_p_p_switch_event_node_t swig_types[12]
#define SWIGTYPE_p_session_flag_t swig_types[13]
#define SWIGTYPE_p_switch_call_cause_t swig_types[14]
#define SWIGTYPE_p_switch_channel_state_t swig_types[15]
#define SWIGTYPE_p_switch_channel_t swig_types[16]
#define SWIGTYPE_p_switch_core_session_t swig_types[17]
#define SWIGTYPE_p_switch_event_t swig_types[18]
#define SWIGTYPE_p_switch_event_types_t swig_types[19]
#define SWIGTYPE_p_switch_input_args_t swig_types[20]
#define SWIGTYPE_p_switch_input_type_t swig_types[21]
#define SWIGTYPE_p_switch_priority_t swig_types[22]
#define SWIGTYPE_p_switch_queue_t swig_types[23]
#define SWIGTYPE_p_switch_state_handler_table_t swig_types[24]
#define SWIGTYPE_p_switch_status_t swig_types[25]
#define SWIGTYPE_p_switch_stream_handle_t swig_types[26]
#define SWIGTYPE_p_uint32_t swig_types[27]
#define SWIGTYPE_p_void swig_types[28]
static swig_type_info *swig_types[30];
static swig_module_info swig_module = {swig_types, 29, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@ -3399,6 +3400,44 @@ XS(_wrap_delete_Stream) {
}
XS(_wrap_Stream_read) {
{
Stream *arg1 = (Stream *) 0 ;
int *arg2 = (int *) 0 ;
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 2) || (items > 2)) {
SWIG_croak("Usage: Stream_read(self,len);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Stream, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_read" "', argument " "1"" of type '" "Stream *""'");
}
arg1 = reinterpret_cast< Stream * >(argp1);
res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_int, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_read" "', argument " "2"" of type '" "int *""'");
}
arg2 = reinterpret_cast< int * >(argp2);
result = (char *)(arg1)->read(arg2);
ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_Stream_write) {
{
Stream *arg1 = (Stream *) 0 ;
@ -3437,6 +3476,54 @@ XS(_wrap_Stream_write) {
}
XS(_wrap_Stream_raw_write) {
{
Stream *arg1 = (Stream *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int val3 ;
int ecode3 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 3) || (items > 3)) {
SWIG_croak("Usage: Stream_raw_write(self,data,len);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Stream, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_raw_write" "', argument " "1"" of type '" "Stream *""'");
}
arg1 = reinterpret_cast< Stream * >(argp1);
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_raw_write" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Stream_raw_write" "', argument " "3"" of type '" "int""'");
}
arg3 = static_cast< int >(val3);
(arg1)->raw_write((char const *)arg2,arg3);
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
XSRETURN(argvi);
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
SWIG_croak_null();
}
}
XS(_wrap_Stream_get_data) {
{
Stream *arg1 = (Stream *) 0 ;
@ -9907,6 +9994,7 @@ static swig_type_info _swigt__p_PerlInterpreter = {"_p_PerlInterpreter", "PerlIn
static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)"freeswitch::Stream", 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)"freeswitch::input_callback_state_t", 0};
static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_switch_event_node_t = {"_p_p_switch_event_node_t", "switch_event_node_t **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_call_cause_t = {"_p_switch_call_cause_t", "switch_call_cause_t *", 0, 0, (void*)0, 0};
@ -9937,6 +10025,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_Stream,
&_swigt__p_char,
&_swigt__p_input_callback_state,
&_swigt__p_int,
&_swigt__p_p_switch_event_node_t,
&_swigt__p_session_flag_t,
&_swigt__p_switch_call_cause_t,
@ -9967,6 +10056,7 @@ static swig_cast_info _swigc__p_PerlInterpreter[] = { {&_swigt__p_PerlInterpret
static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_switch_event_node_t[] = { {&_swigt__p_p_switch_event_node_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_call_cause_t[] = { {&_swigt__p_switch_call_cause_t, 0, 0, 0},{0, 0, 0, 0}};
@ -9997,6 +10087,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_Stream,
_swigc__p_char,
_swigc__p_input_callback_state,
_swigc__p_int,
_swigc__p_p_switch_event_node_t,
_swigc__p_session_flag_t,
_swigc__p_switch_call_cause_t,
@ -10063,7 +10154,9 @@ static swig_command_info swig_commands[] = {
{"freeswitchc::delete_DTMF", _wrap_delete_DTMF},
{"freeswitchc::new_Stream", _wrap_new_Stream},
{"freeswitchc::delete_Stream", _wrap_delete_Stream},
{"freeswitchc::Stream_read", _wrap_Stream_read},
{"freeswitchc::Stream_write", _wrap_Stream_write},
{"freeswitchc::Stream_raw_write", _wrap_Stream_raw_write},
{"freeswitchc::Stream_get_data", _wrap_Stream_get_data},
{"freeswitchc::Event_event_set", _wrap_Event_event_set},
{"freeswitchc::Event_event_get", _wrap_Event_event_get},
@ -10500,17 +10593,17 @@ XS(SWIG_init) {
SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu");
SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API");
SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t");
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG://share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG://share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG://share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK)));
SvREADONLY_on(sv);

View File

@ -1 +1,2 @@
mod_python_wrap.cpp -diff
freeswitch.py -diff

View File

@ -153,7 +153,9 @@ class Stream(_object):
except: self.this = this
__swig_destroy__ = _freeswitch.delete_Stream
__del__ = lambda self : None;
def read(*args): return _freeswitch.Stream_read(*args)
def write(*args): return _freeswitch.Stream_write(*args)
def raw_write(*args): return _freeswitch.Stream_raw_write(*args)
def get_data(*args): return _freeswitch.Stream_get_data(*args)
Stream_swigregister = _freeswitch.Stream_swigregister
Stream_swigregister(Stream)

View File

@ -2505,25 +2505,26 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
#define SWIGTYPE_p_Stream swig_types[7]
#define SWIGTYPE_p_char swig_types[8]
#define SWIGTYPE_p_input_callback_state swig_types[9]
#define SWIGTYPE_p_p_switch_event_node_t swig_types[10]
#define SWIGTYPE_p_session_flag_t swig_types[11]
#define SWIGTYPE_p_switch_call_cause_t swig_types[12]
#define SWIGTYPE_p_switch_channel_state_t swig_types[13]
#define SWIGTYPE_p_switch_channel_t swig_types[14]
#define SWIGTYPE_p_switch_core_session_t swig_types[15]
#define SWIGTYPE_p_switch_event_t swig_types[16]
#define SWIGTYPE_p_switch_event_types_t swig_types[17]
#define SWIGTYPE_p_switch_input_args_t swig_types[18]
#define SWIGTYPE_p_switch_input_type_t swig_types[19]
#define SWIGTYPE_p_switch_priority_t swig_types[20]
#define SWIGTYPE_p_switch_queue_t swig_types[21]
#define SWIGTYPE_p_switch_state_handler_table_t swig_types[22]
#define SWIGTYPE_p_switch_status_t swig_types[23]
#define SWIGTYPE_p_switch_stream_handle_t swig_types[24]
#define SWIGTYPE_p_uint32_t swig_types[25]
#define SWIGTYPE_p_void swig_types[26]
static swig_type_info *swig_types[28];
static swig_module_info swig_module = {swig_types, 27, 0, 0, 0, 0};
#define SWIGTYPE_p_int swig_types[10]
#define SWIGTYPE_p_p_switch_event_node_t swig_types[11]
#define SWIGTYPE_p_session_flag_t swig_types[12]
#define SWIGTYPE_p_switch_call_cause_t swig_types[13]
#define SWIGTYPE_p_switch_channel_state_t swig_types[14]
#define SWIGTYPE_p_switch_channel_t swig_types[15]
#define SWIGTYPE_p_switch_core_session_t swig_types[16]
#define SWIGTYPE_p_switch_event_t swig_types[17]
#define SWIGTYPE_p_switch_event_types_t swig_types[18]
#define SWIGTYPE_p_switch_input_args_t swig_types[19]
#define SWIGTYPE_p_switch_input_type_t swig_types[20]
#define SWIGTYPE_p_switch_priority_t swig_types[21]
#define SWIGTYPE_p_switch_queue_t swig_types[22]
#define SWIGTYPE_p_switch_state_handler_table_t swig_types[23]
#define SWIGTYPE_p_switch_status_t swig_types[24]
#define SWIGTYPE_p_switch_stream_handle_t swig_types[25]
#define SWIGTYPE_p_uint32_t swig_types[26]
#define SWIGTYPE_p_void swig_types[27]
static swig_type_info *swig_types[29];
static swig_module_info swig_module = {swig_types, 28, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@ -4332,6 +4333,37 @@ fail:
}
SWIGINTERN PyObject *_wrap_Stream_read(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
Stream *arg1 = (Stream *) 0 ;
int *arg2 = (int *) 0 ;
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:Stream_read",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_read" "', argument " "1"" of type '" "Stream *""'");
}
arg1 = reinterpret_cast< Stream * >(argp1);
res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_int, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_read" "', argument " "2"" of type '" "int *""'");
}
arg2 = reinterpret_cast< int * >(argp2);
result = (char *)(arg1)->read(arg2);
resultobj = SWIG_FromCharPtr((const char *)result);
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_Stream_write(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
Stream *arg1 = (Stream *) 0 ;
@ -4365,6 +4397,48 @@ fail:
}
SWIGINTERN PyObject *_wrap_Stream_raw_write(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
Stream *arg1 = (Stream *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int val3 ;
int ecode3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OOO:Stream_raw_write",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_raw_write" "', argument " "1"" of type '" "Stream *""'");
}
arg1 = reinterpret_cast< Stream * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_raw_write" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
ecode3 = SWIG_AsVal_int(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Stream_raw_write" "', argument " "3"" of type '" "int""'");
}
arg3 = static_cast< int >(val3);
(arg1)->raw_write((char const *)arg2,arg3);
resultobj = SWIG_Py_Void();
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return NULL;
}
SWIGINTERN PyObject *_wrap_Stream_get_data(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
Stream *arg1 = (Stream *) 0 ;
@ -9568,7 +9642,9 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"DTMF_swigregister", DTMF_swigregister, METH_VARARGS, NULL},
{ (char *)"new_Stream", _wrap_new_Stream, METH_VARARGS, NULL},
{ (char *)"delete_Stream", _wrap_delete_Stream, METH_VARARGS, NULL},
{ (char *)"Stream_read", _wrap_Stream_read, METH_VARARGS, NULL},
{ (char *)"Stream_write", _wrap_Stream_write, METH_VARARGS, NULL},
{ (char *)"Stream_raw_write", _wrap_Stream_raw_write, METH_VARARGS, NULL},
{ (char *)"Stream_get_data", _wrap_Stream_get_data, METH_VARARGS, NULL},
{ (char *)"Stream_swigregister", Stream_swigregister, METH_VARARGS, NULL},
{ (char *)"Event_event_set", _wrap_Event_event_set, METH_VARARGS, NULL},
@ -9730,6 +9806,7 @@ static swig_type_info _swigt__p_PYTHON__Session = {"_p_PYTHON__Session", "PYTHON
static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_switch_event_node_t = {"_p_p_switch_event_node_t", "switch_event_node_t **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_call_cause_t = {"_p_switch_call_cause_t", "switch_call_cause_t *", 0, 0, (void*)0, 0};
@ -9759,6 +9836,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_Stream,
&_swigt__p_char,
&_swigt__p_input_callback_state,
&_swigt__p_int,
&_swigt__p_p_switch_event_node_t,
&_swigt__p_session_flag_t,
&_swigt__p_switch_call_cause_t,
@ -9788,6 +9866,7 @@ static swig_cast_info _swigc__p_PYTHON__Session[] = { {&_swigt__p_PYTHON__Sessi
static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_switch_event_node_t[] = { {&_swigt__p_p_switch_event_node_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_call_cause_t[] = { {&_swigt__p_switch_call_cause_t, 0, 0, 0},{0, 0, 0, 0}};
@ -9817,6 +9896,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_Stream,
_swigc__p_char,
_swigc__p_input_callback_state,
_swigc__p_int,
_swigc__p_p_switch_event_node_t,
_swigc__p_session_flag_t,
_swigc__p_switch_call_cause_t,

View File

@ -0,0 +1 @@
mod_lua_wrap.cpp -diff

View File

@ -1495,26 +1495,27 @@ SWIG_Lua_dostring(lua_State *L, const char* str) {
#define SWIGTYPE_p_SWIGLUA_FN swig_types[8]
#define SWIGTYPE_p_Stream swig_types[9]
#define SWIGTYPE_p_input_callback_state swig_types[10]
#define SWIGTYPE_p_lua_State swig_types[11]
#define SWIGTYPE_p_p_switch_event_node_t swig_types[12]
#define SWIGTYPE_p_session_flag_t swig_types[13]
#define SWIGTYPE_p_switch_call_cause_t swig_types[14]
#define SWIGTYPE_p_switch_channel_state_t swig_types[15]
#define SWIGTYPE_p_switch_channel_t swig_types[16]
#define SWIGTYPE_p_switch_core_session_t swig_types[17]
#define SWIGTYPE_p_switch_event_t swig_types[18]
#define SWIGTYPE_p_switch_event_types_t swig_types[19]
#define SWIGTYPE_p_switch_input_args_t swig_types[20]
#define SWIGTYPE_p_switch_input_type_t swig_types[21]
#define SWIGTYPE_p_switch_priority_t swig_types[22]
#define SWIGTYPE_p_switch_queue_t swig_types[23]
#define SWIGTYPE_p_switch_state_handler_table_t swig_types[24]
#define SWIGTYPE_p_switch_status_t swig_types[25]
#define SWIGTYPE_p_switch_stream_handle_t swig_types[26]
#define SWIGTYPE_p_uint32_t swig_types[27]
#define SWIGTYPE_p_void swig_types[28]
static swig_type_info *swig_types[30];
static swig_module_info swig_module = {swig_types, 29, 0, 0, 0, 0};
#define SWIGTYPE_p_int swig_types[11]
#define SWIGTYPE_p_lua_State swig_types[12]
#define SWIGTYPE_p_p_switch_event_node_t swig_types[13]
#define SWIGTYPE_p_session_flag_t swig_types[14]
#define SWIGTYPE_p_switch_call_cause_t swig_types[15]
#define SWIGTYPE_p_switch_channel_state_t swig_types[16]
#define SWIGTYPE_p_switch_channel_t swig_types[17]
#define SWIGTYPE_p_switch_core_session_t swig_types[18]
#define SWIGTYPE_p_switch_event_t swig_types[19]
#define SWIGTYPE_p_switch_event_types_t swig_types[20]
#define SWIGTYPE_p_switch_input_args_t swig_types[21]
#define SWIGTYPE_p_switch_input_type_t swig_types[22]
#define SWIGTYPE_p_switch_priority_t swig_types[23]
#define SWIGTYPE_p_switch_queue_t swig_types[24]
#define SWIGTYPE_p_switch_state_handler_table_t swig_types[25]
#define SWIGTYPE_p_switch_status_t swig_types[26]
#define SWIGTYPE_p_switch_stream_handle_t swig_types[27]
#define SWIGTYPE_p_uint32_t swig_types[28]
#define SWIGTYPE_p_void swig_types[29]
static swig_type_info *swig_types[31];
static swig_module_info swig_module = {swig_types, 30, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@ -2626,6 +2627,38 @@ fail:
}
static int _wrap_Stream_read(lua_State* L) {
int SWIG_arg = -1;
Stream *arg1 = (Stream *) 0 ;
int *arg2 = (int *) 0 ;
char *result = 0 ;
SWIG_check_num_args("read",2,2)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("read",1,"Stream *");
if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("read",2,"int *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,0))){
SWIG_fail_ptr("Stream_read",1,SWIGTYPE_p_Stream);
}
if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_int,0))){
SWIG_fail_ptr("Stream_read",2,SWIGTYPE_p_int);
}
result = (char *)(arg1)->read(arg2);
SWIG_arg=0;
lua_pushstring(L,(const char*)result); SWIG_arg++;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_Stream_write(lua_State* L) {
int SWIG_arg = -1;
Stream *arg1 = (Stream *) 0 ;
@ -2653,6 +2686,36 @@ fail:
}
static int _wrap_Stream_raw_write(lua_State* L) {
int SWIG_arg = -1;
Stream *arg1 = (Stream *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 ;
SWIG_check_num_args("raw_write",3,3)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("raw_write",1,"Stream *");
if(!lua_isstring(L,2)) SWIG_fail_arg("raw_write",2,"char const *");
if(!lua_isnumber(L,3)) SWIG_fail_arg("raw_write",3,"int");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,0))){
SWIG_fail_ptr("Stream_raw_write",1,SWIGTYPE_p_Stream);
}
arg2 = (char *)lua_tostring(L, 2);
arg3 = (int)lua_tonumber(L, 3);
(arg1)->raw_write((char const *)arg2,arg3);
SWIG_arg=0;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_Stream_get_data(lua_State* L) {
int SWIG_arg = -1;
Stream *arg1 = (Stream *) 0 ;
@ -2683,7 +2746,9 @@ Stream *arg1 = (Stream *) obj;
delete arg1;
}
static swig_lua_method swig_Stream_methods[] = {
{"read", _wrap_Stream_read},
{"write", _wrap_Stream_write},
{"raw_write", _wrap_Stream_raw_write},
{"get_data", _wrap_Stream_get_data},
{0,0}
};
@ -8064,6 +8129,7 @@ static swig_type_info _swigt__p_LUA__Session = {"_p_LUA__Session", "LUA::Session
static swig_type_info _swigt__p_SWIGLUA_FN = {"_p_SWIGLUA_FN", "SWIGLUA_FN *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)&_wrap_class_Stream, 0};
static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)&_wrap_class_input_callback_state_t, 0};
static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_lua_State = {"_p_lua_State", "lua_State *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_switch_event_node_t = {"_p_p_switch_event_node_t", "switch_event_node_t **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
@ -8095,6 +8161,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_SWIGLUA_FN,
&_swigt__p_Stream,
&_swigt__p_input_callback_state,
&_swigt__p_int,
&_swigt__p_lua_State,
&_swigt__p_p_switch_event_node_t,
&_swigt__p_session_flag_t,
@ -8126,6 +8193,7 @@ static swig_cast_info _swigc__p_LUA__Session[] = { {&_swigt__p_LUA__Session, 0,
static swig_cast_info _swigc__p_SWIGLUA_FN[] = { {&_swigt__p_SWIGLUA_FN, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_lua_State[] = { {&_swigt__p_lua_State, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_switch_event_node_t[] = { {&_swigt__p_p_switch_event_node_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0},{0, 0, 0, 0}};
@ -8157,6 +8225,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_SWIGLUA_FN,
_swigc__p_Stream,
_swigc__p_input_callback_state,
_swigc__p_int,
_swigc__p_lua_State,
_swigc__p_p_switch_event_node_t,
_swigc__p_session_flag_t,

View File

@ -544,7 +544,12 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
goto err;
}
} else if ( attribute->type == 1 ) {
int number = atoi(switch_channel_get_variable(channel, variable));
const char *data = switch_channel_get_variable(channel, variable);
int number = 0;
if ( data ) {
number = atoi(data);
}
if (rc_avpair_add(handle, send, attr_num, &number, -1, vend_num) == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
@ -990,7 +995,7 @@ switch_status_t mod_xml_radius_accounting_end(switch_core_session_t *session){
}
/* If there are conditions defined, and none of them pass, then skip this accounting */
if ((conditions = switch_xml_child(globals.acct_start_configs, "conditions")) != NULL &&
if ((conditions = switch_xml_child(globals.acct_end_configs, "conditions")) != NULL &&
mod_xml_radius_check_conditions(channel, conditions) != SWITCH_STATUS_SUCCESS ) {
goto end;
}

View File

@ -478,6 +478,7 @@ static const char usage[] =
"\t-certs [directory] -- alternate directory for certificates\n"
"\t-recordings [directory] -- alternate directory for recordings\n"
"\t-storage [directory] -- alternate directory for voicemail storage\n"
"\t-cache [directory] -- alternate directory for cache files\n"
"\t-sounds [directory] -- alternate directory for sound files\n";
@ -929,6 +930,21 @@ int main(int argc, char *argv[])
strcpy(SWITCH_GLOBAL_dirs.storage_dir, local_argv[x]);
}
else if (!strcmp(local_argv[x], "-cache")) {
x++;
if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) {
fprintf(stderr, "When using -cache you must specify a cache directory\n");
return 255;
}
SWITCH_GLOBAL_dirs.cache_dir = (char *) malloc(strlen(local_argv[x]) + 1);
if (!SWITCH_GLOBAL_dirs.cache_dir) {
fprintf(stderr, "Allocation error\n");
return 255;
}
strcpy(SWITCH_GLOBAL_dirs.cache_dir, local_argv[x]);
}
else if (!strcmp(local_argv[x], "-recordings")) {
x++;
if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) {

View File

@ -726,6 +726,17 @@ SWITCH_DECLARE(void) switch_core_set_globals(void)
#endif
}
if (!SWITCH_GLOBAL_dirs.cache_dir && (SWITCH_GLOBAL_dirs.cache_dir = (char *) malloc(BUFSIZE))) {
if (SWITCH_GLOBAL_dirs.base_dir)
switch_snprintf(SWITCH_GLOBAL_dirs.cache_dir, BUFSIZE, "%s%scache", SWITCH_GLOBAL_dirs.base_dir, SWITCH_PATH_SEPARATOR);
else
#ifdef SWITCH_CACHE_DIR
switch_snprintf(SWITCH_GLOBAL_dirs.cache_dir, BUFSIZE, "%s", SWITCH_CACHE_DIR);
#else
switch_snprintf(SWITCH_GLOBAL_dirs.cache_dir, BUFSIZE, "%s%scache", base_dir, SWITCH_PATH_SEPARATOR);
#endif
}
if (!SWITCH_GLOBAL_dirs.db_dir && (SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(BUFSIZE))) {
if (SWITCH_GLOBAL_dirs.base_dir)
switch_snprintf(SWITCH_GLOBAL_dirs.db_dir, BUFSIZE, "%s%sdb", SWITCH_GLOBAL_dirs.base_dir, SWITCH_PATH_SEPARATOR);
@ -1717,6 +1728,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
switch_core_set_variable("recordings_dir", SWITCH_GLOBAL_dirs.recordings_dir);
switch_core_set_variable("sound_prefix", SWITCH_GLOBAL_dirs.sounds_dir);
switch_core_set_variable("sounds_dir", SWITCH_GLOBAL_dirs.sounds_dir);
switch_core_set_variable("conf_dir", SWITCH_GLOBAL_dirs.conf_dir);
switch_core_set_variable("log_dir", SWITCH_GLOBAL_dirs.log_dir);
switch_core_set_variable("run_dir", SWITCH_GLOBAL_dirs.run_dir);
switch_core_set_variable("db_dir", SWITCH_GLOBAL_dirs.db_dir);
switch_core_set_variable("mod_dir", SWITCH_GLOBAL_dirs.mod_dir);
switch_core_set_variable("htdocs_dir", SWITCH_GLOBAL_dirs.htdocs_dir);
switch_core_set_variable("script_dir", SWITCH_GLOBAL_dirs.script_dir);
switch_core_set_variable("temp_dir", SWITCH_GLOBAL_dirs.temp_dir);
switch_core_set_variable("grammar_dir", SWITCH_GLOBAL_dirs.grammar_dir);
switch_core_set_variable("certs_dir", SWITCH_GLOBAL_dirs.certs_dir);
switch_core_set_variable("storage_dir", SWITCH_GLOBAL_dirs.storage_dir);
switch_core_set_variable("cache_dir", SWITCH_GLOBAL_dirs.cache_dir);
switch_core_set_serial();
switch_console_init(runtime.memory_pool);
@ -2702,6 +2725,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
switch_safe_free(SWITCH_GLOBAL_dirs.htdocs_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.grammar_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.storage_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.cache_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.recordings_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.sounds_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.run_dir);

View File

@ -516,6 +516,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_process_t38_passthru(switch_co
SWITCH_DECLARE(switch_status_t) switch_core_session_get_payload_code(switch_core_session_t *session,
switch_media_type_t type,
const char *iananame,
uint32_t rate,
switch_payload_t *ptP,
switch_payload_t *recv_ptP,
char **fmtpP)
@ -540,7 +541,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_payload_code(switch_core
if (!pmap->allocated) continue;
if (!strcasecmp(pmap->iananame, iananame)) {
if (!strcasecmp(pmap->iananame, iananame) && (!rate || (rate == pmap->rate))) {
pt = pmap->pt;
recv_pt = pmap->recv_pt;
fmtp = pmap->rm_fmtp;
@ -6229,7 +6230,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
if (orig_session &&
switch_core_session_get_payload_code(orig_session,
imp->codec_type == SWITCH_CODEC_TYPE_AUDIO ? SWITCH_MEDIA_TYPE_AUDIO : SWITCH_MEDIA_TYPE_VIDEO,
imp->iananame, &orig_pt, NULL, &orig_fmtp) == SWITCH_STATUS_SUCCESS) {
imp->iananame, imp->samples_per_second, &orig_pt, NULL, &orig_fmtp) == SWITCH_STATUS_SUCCESS) {
smh->ianacodes[i] = orig_pt;
if (orig_fmtp) {

View File

@ -531,12 +531,37 @@ SWITCH_DECLARE_CONSTRUCTOR Stream::~Stream()
}
}
/* WARNING!! you are not encouraged to use this unless you understand the risk!!! */
SWITCH_DECLARE(const char *) Stream::read(int *len)
{
uint8_t *buff;
this_check(NULL);
if (!stream_p->read_function) return NULL;
buff = stream_p->read_function(stream_p, len);
if (!buff || *len <= 0) {
*len = 0;
return NULL;
}
return (const char *)buff;
}
SWITCH_DECLARE(void) Stream::write(const char *data)
{
this_check_void();
stream_p->write_function(stream_p, "%s", data);
}
SWITCH_DECLARE(void) Stream::raw_write(const char *data, int len)
{
this_check_void();
stream_p->raw_write_function(stream_p, (uint8_t *)data, len);
}
SWITCH_DECLARE(const char *)Stream::get_data()
{
this_check("");

View File

@ -56,6 +56,7 @@ struct switch_odbc_handle {
switch_odbc_state_t state;
char odbc_driver[256];
BOOL is_firebird;
BOOL is_oracle;
int affected_rows;
int num_retries;
};
@ -220,7 +221,9 @@ static int db_is_up(switch_odbc_handle_t *handle)
goto done;
}
if (handle->is_firebird) {
if (handle->is_oracle) {
strcpy((char *) sql, "select 1 from dual");
} else if (handle->is_firebird) {
strcpy((char *) sql, "select first 1 * from RDB$RELATIONS");
} else {
strcpy((char *) sql, "select 1");
@ -380,10 +383,15 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_connect(switch_odbc_hand
handle->odbc_driver[i] = (char) toupper(handle->odbc_driver[i]);
}
if (strstr(handle->odbc_driver, "FIREBIRD") != 0 || strstr(handle->odbc_driver, "FB32") != 0 || strstr(handle->odbc_driver, "FB64") != 0) {
if (strstr(handle->odbc_driver, "SQORA32.DLL") != 0 || strstr(handle->odbc_driver, "SQORA64.DLL") != 0) {
handle->is_firebird = FALSE;
handle->is_oracle = TRUE;
} else if (strstr(handle->odbc_driver, "FIREBIRD") != 0 || strstr(handle->odbc_driver, "FB32") != 0 || strstr(handle->odbc_driver, "FB64") != 0) {
handle->is_firebird = TRUE;
handle->is_oracle = FALSE;
} else {
handle->is_firebird = FALSE;
handle->is_oracle = FALSE;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Connected to [%s]\n", handle->dsn);

View File

@ -1127,7 +1127,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
if (!strcmp(ice->ice_params->cands[i][ice->proto].con_addr, host) &&
!strcmp(ice->ice_params->cands[i][ice->proto].cand_type, "relay")) {
if (elapsed != 0 && elapsed < 5000) {
if (rtp_session->last_stun && elapsed < 5000) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING,
"Skiping RELAY stun/%s/dtls port change from %s:%u to %s:%u\n", is_rtcp ? "rtcp" : "rtp",
host2, port2,
@ -3585,13 +3585,15 @@ static void jb_callback(stfu_instance_t *i, void *udata)
stfu_n_report(i, &r);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG8,
"%s JB REPORT:\nlen: %u\nin: %u\nclean: %u\ngood: %u\nbad: %u\n",
"%s JB REPORT:\nlen: %u\nin: %u\nclean: %u\ngood: %u\nbad: %u\njitter percent %0.2f\nmissing percent %0.2f\n\n",
switch_core_session_get_name(session),
r.qlen,
r.packet_in_count,
r.clean_count,
r.consecutive_good_count,
r.consecutive_bad_count
r.consecutive_bad_count,
r.period_jitter_percent,
r.period_missing_percent
);
}
@ -3646,7 +3648,7 @@ static void jb_logger(const char *file, const char *func, int line, int level, c
va_start(ap, fmt);
ret = switch_vasprintf(&data, fmt, ap);
if (ret != -1) {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%s", data);
switch_log_printf(SWITCH_CHANNEL_ID_LOG_CLEAN, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%d: %s", line, data);
free(data);
}

View File

@ -48,6 +48,9 @@
#define least1(_z) (_z ? _z : 1)
#define PERIOD_SECONDS 20
#define PERIOD_JITTER_TOLERANCE 5.0f
static int stfu_log_level = 7;
struct stfu_queue {
@ -74,6 +77,7 @@ struct stfu_instance {
uint16_t cur_seq;
uint32_t last_wr_ts;
uint32_t last_rd_ts;
uint32_t ms_per_packet;
uint32_t samples_per_packet;
uint32_t samples_per_second;
uint32_t miss_count;
@ -93,7 +97,9 @@ struct stfu_instance {
uint32_t period_need_range;
uint32_t period_need_range_avg;
uint32_t period_clean_count;
uint32_t period_jitter_count;
double period_jitter_percent;
double period_missing_percent;
uint32_t session_clean_count;
uint32_t session_missing_count;
@ -114,7 +120,6 @@ struct stfu_instance {
int32_t same_ts;
uint32_t period_time;
uint32_t decrement_time;
uint32_t plc_len;
uint32_t plc_pt;
@ -123,6 +128,8 @@ struct stfu_instance {
uint8_t ready;
uint8_t debug;
switch_time_t last_clock_ts;
char *name;
stfu_n_call_me_t callback;
void *udata;
@ -239,6 +246,8 @@ void stfu_n_report(stfu_instance_t *i, stfu_report_t *r)
r->clean_count = i->period_clean_count;
r->consecutive_good_count = i->consecutive_good_count;
r->consecutive_bad_count = i->consecutive_bad_count;
r->period_jitter_percent = i->period_jitter_percent;
r->period_missing_percent = i->period_missing_percent;
}
stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen)
@ -248,7 +257,7 @@ stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen)
if (i->qlen == i->max_qlen) {
return STFU_IT_FAILED;
}
if (i->max_qlen && qlen > i->max_qlen) {
if (i->qlen < i->max_qlen) {
qlen = i->max_qlen;
@ -304,8 +313,7 @@ stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_
i->samples_per_second = samples_per_second ? samples_per_second : 8000;
i->period_time = ((i->samples_per_second * 20) / i->samples_per_packet);
i->decrement_time = ((i->samples_per_second * 15) / i->samples_per_packet);
i->period_time = ((i->samples_per_second * PERIOD_SECONDS) / i->samples_per_packet);
return i;
}
@ -316,6 +324,8 @@ static void stfu_n_reset_counters(stfu_instance_t *i)
stfu_log(STFU_LOG_EMERG, "%s COUNTER RESET........\n", i->name);
}
if (i->callback) {
i->callback(i, i->udata);
}
@ -328,6 +338,7 @@ static void stfu_n_reset_counters(stfu_instance_t *i)
i->period_packet_in_count = 0;
i->period_packet_out_count = 0;
i->period_missing_count = 0;
i->period_jitter_count = 0;
i->period_need_range = 0;
i->period_need_range_avg = 0;
@ -408,6 +419,9 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint16_t seq, uin
stfu_frame_t *frame;
size_t cplen = 0;
int good_ts = 0;
int32_t diff;
switch_time_t now;
if (!i->samples_per_packet && ts && i->last_rd_ts) {
i->ts_diff = ts - i->last_rd_ts;
@ -430,7 +444,25 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint16_t seq, uin
return STFU_IT_FAILED;
}
}
if (!i->ms_per_packet) {
i->ms_per_packet = 1000 / (i->samples_per_second / i->samples_per_packet);
}
now = switch_micro_time_now();
if (i->last_clock_ts) {
diff = (uint32_t) ((now - i->last_clock_ts) / 1000);
} else {
diff = 0;
}
i->last_clock_ts = now;
if (abs(diff - i->ms_per_packet) > 1) {
i->period_jitter_count++;
}
if (timer_ts) {
if (ts && !i->ts_offset) {
i->ts_offset = timer_ts - ts;
@ -448,7 +480,8 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint16_t seq, uin
if (i->ts_drift < i->max_drift) {
if (++i->drift_dropped_packets < i->drift_max_dropped) {
stfu_log(STFU_LOG_EMERG, "%s TOO LATE !!! %u \n\n\n", i->name, ts);
stfu_n_sync(i, 1);
stfu_n_reset(i);
//stfu_n_sync(i, 1);
//return STFU_ITS_TOO_LATE;
}
} else {
@ -489,16 +522,10 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint16_t seq, uin
if (i->period_missing_count > i->qlen * 2) {
if (stfu_log != null_logger && i->debug) {
stfu_log(STFU_LOG_EMERG, "%s resize %u %u\n", i->name, i->qlen, i->qlen + 1);
stfu_log(STFU_LOG_EMERG, "%s resize up %u %u\n", i->name, i->qlen, i->qlen + 1);
}
stfu_n_resize(i, i->qlen + 1);
stfu_n_reset_counters(i);
} else {
if (i->qlen > i->orig_qlen && (i->consecutive_good_count > i->decrement_time || i->period_clean_count > i->decrement_time)) {
stfu_n_resize(i, i->qlen - 1);
stfu_n_reset_counters(i);
stfu_n_sync(i, i->qlen);
}
}
@ -514,10 +541,20 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint16_t seq, uin
i->diff_total += i->diff;
if ((i->period_packet_in_count > i->period_time)) {
if ((i->period_packet_in_count >= i->period_time)) {
i->period_jitter_percent = (double)(((double)i->period_jitter_count / (double)i->period_time) * 100.0f);
i->period_missing_percent = (double)(((double)i->period_missing_count / (double)i->period_time) * 100.0f);
i->period_packet_in_count = 0;
if (i->period_missing_count == 0 && i->qlen > i->orig_qlen) {
if (stfu_log != null_logger && i->debug) {
stfu_log(STFU_LOG_EMERG, "PERIOD %f jitter missing:%f q:%d/%d\n", i->period_jitter_percent, i->period_missing_percent, i->qlen, i->orig_qlen);
}
if (i->qlen > i->orig_qlen && i->period_jitter_percent < PERIOD_JITTER_TOLERANCE && i->period_missing_percent < PERIOD_JITTER_TOLERANCE) {
if (stfu_log != null_logger && i->debug) {
stfu_log(STFU_LOG_EMERG, "%s resize down %u %u\n", i->name, i->qlen, i->qlen - 1);
}
stfu_n_resize(i, i->qlen - 1);
stfu_n_sync(i, i->qlen);
}
@ -526,12 +563,22 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint16_t seq, uin
}
if (stfu_log != null_logger && i->debug) {
stfu_log(STFU_LOG_EMERG, "I: %s %u/%u i=%u/%u - g:%u/%u c:%u/%u b:%u - %u:%u - %u %d %u %u %d %d %d/%d\n", i->name,
i->qlen, i->max_qlen, i->period_packet_in_count, i->period_time, i->consecutive_good_count,
i->decrement_time, i->period_clean_count, i->decrement_time, i->consecutive_bad_count,
double jitter_percent = (double)(((double)i->period_jitter_count / (double)i->period_packet_in_count) * 100.0f);
double missing_percent = (double)(((double)i->period_missing_count / (double)i->period_packet_in_count) * 100.0f);
stfu_log(STFU_LOG_EMERG, "I: %s len:%u/%u i=%u/%u - g:%u c:%u b:%u - ts:%u/%u/%u - m:%u(%f%%) j:%f%% dr:%d/%d\n",
i->name,
i->qlen, i->max_qlen,
i->period_packet_in_count, i->period_time,
i->consecutive_good_count,
i->period_clean_count,
i->consecutive_bad_count,
ts, ts / i->samples_per_packet,
i->period_missing_count, i->period_need_range_avg,
i->last_wr_ts, ts, i->diff, i->diff_total / least1(i->period_packet_in_count), i->ts_drift, i->max_drift);
i->last_wr_ts,
i->period_missing_count,
missing_percent,
jitter_percent,
i->ts_drift, i->max_drift);
}
if (last || i->in_queue->array_len == i->in_queue->array_size) {
@ -763,7 +810,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)
if (stfu_log != null_logger && i->debug) {
if (found) {
stfu_log(STFU_LOG_EMERG, "%s O: %u:%u %u\n", i->name, rframe->ts, rframe->ts / i->samples_per_packet, rframe->plc);
stfu_log(STFU_LOG_EMERG, "%s OUT: %u:%u %u\n", i->name, rframe->ts, rframe->ts / i->samples_per_packet, rframe->plc);
}
}

View File

@ -25,6 +25,7 @@
*
* Anthony Minessale II <anthm@freeswitch.org>
* Juan Jose Comellas <juanjo@comellas.org>
* Seven Du <dujinfang@gmail.com>
*
*
* switch_utils.c -- Compatibility and Helper Code
@ -3603,6 +3604,261 @@ SWITCH_DECLARE(char *) switch_strerror_r(int errnum, char *buf, switch_size_t bu
#endif
}
SWITCH_DECLARE(void) switch_http_parse_qs(switch_http_request_t *request, char *qs)
{
char *q;
char *next;
char *name, *val;
if (qs) {
q = qs;
} else { /*parse our own qs, dup to avoid modify the original string */
q = strdup(request->qs);
}
switch_assert(q);
next = q;
do {
char *p;
if ((next = strchr(next, '&'))) {
*next++ = '\0';
}
for (p = q; p && *p; p++) {
if (*p == '+') *p = ' ';
}
switch_url_decode(q);
name = q;
if ((val = strchr(name, '='))) {
*val++ = '\0';
switch_event_add_header_string(request->headers, SWITCH_STACK_BOTTOM, name, val);
}
q = next;
} while (q);
if (!qs) {
switch_safe_free(q);
}
}
/* clean the uri to protect us from vulnerability attack */
switch_status_t clean_uri(char *uri)
{
int argc;
char *argv[64];
int last, i, len, uri_len = 0;
argc = switch_separate_string(uri, '/', argv, sizeof(argv) / sizeof(argv[0]));
if (argc == sizeof(argv)) { /* too deep */
return SWITCH_STATUS_FALSE;
}
last = 1;
for(i = 1; i < argc; i++) {
if (*argv[i] == '\0' || !strcmp(argv[i], ".")) {
/* ignore //// or /././././ */
} else if (!strcmp(argv[i], "..")) {
/* got /../, go up one level */
if (last > 1) last--;
} else {
argv[last++] = argv[i];
}
}
for(i = 1; i < last; i++) {
len = strlen(argv[i]);
sprintf(uri + uri_len, "/%s", argv[i]);
uri_len += (len + 1);
}
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_status_t) switch_http_parse_header(char *buffer, uint32_t datalen, switch_http_request_t *request)
{
switch_status_t status = SWITCH_STATUS_FALSE;
char *p = buffer;
int i = 10;
char *http = NULL;
int header_count;
char *headers[64] = { 0 };
int argc;
char *argv[2] = { 0 };
char *body = NULL;
if (datalen < 16) return status; /* minimum GET / HTTP/1.1\r\n */
while(i--) { // sanity check
if (*p++ == ' ') break;
}
if (i == 0) return status;
if ((body = strstr(buffer, "\r\n\r\n"))) {
*body = '\0';
body += 4;
} else if (( body = strstr(buffer, "\n\n"))) {
*body = '\0';
body += 2;
} else {
return status;
}
request->_buffer = strdup(buffer);
request->method = request->_buffer;
request->bytes_buffered = datalen;
if (body) {
request->bytes_header = body - buffer;
request->bytes_read = body - buffer;
}
p = strchr(request->method, ' ');
if (!p) goto err;
*p++ = '\0';
if (*p != '/') goto err; /* must start from '/' */
request->uri = p;
p = strchr(request->uri, ' ');
if (!p) goto err;
*p++ = '\0';
http = p;
p = strchr(request->uri, '?');
if (p) {
*p++ = '\0';
request->qs = p;
}
if (clean_uri((char *)request->uri) != SWITCH_STATUS_SUCCESS) {
goto err;
}
if (!strncmp(http, "HTTP/1.1", 8)) {
request->keepalive = SWITCH_TRUE;
} else if (strncmp(http, "HTTP/1.0", 8)) {
goto err;
}
if (!request->headers) {
if (switch_event_create(&request->headers, SWITCH_EVENT_CHANNEL_DATA) != SWITCH_STATUS_SUCCESS) {
goto err;
}
request->_destroy_headers = SWITCH_TRUE;
}
p = strchr(http, '\n');
if (p) {
*p++ = '\0'; // now the first header
} else {
goto noheader;
}
header_count = switch_separate_string(p, '\n', headers, sizeof(headers)/ sizeof(headers[0]));
if (header_count < 1) goto err;
for (i = 0; i < header_count; i++) {
char *header, *value;
int len;
argc = switch_separate_string(headers[i], ':', argv, 2);
if (argc != 2) goto err;
header = argv[0];
value = argv[1];
if (*value == ' ') value++;
len = strlen(value);
if (len && *(value + len - 1) == '\r') *(value + len - 1) = '\0';
switch_event_add_header_string(request->headers, SWITCH_STACK_BOTTOM, header, value);
if (!strncasecmp(header, "User-Agent", 10)) {
request->user_agent = value;
} else if (!strncasecmp(header, "Host", 4)) {
request->host = value;
p = strchr(value, ':');
if (p) {
*p++ = '\0';
if (*p) request->port = (switch_port_t)atoi(p);
}
} else if (!strncasecmp(header, "Content-Type", 12)) {
request->content_type = value;
} else if (!strncasecmp(header, "Content-Length", 14)) {
request->content_length = atoi(value);
} else if (!strncasecmp(header, "Referer", 7)) {
request->referer = value;
}
}
noheader:
if (request->qs) {
switch_http_parse_qs(request, NULL);
}
return SWITCH_STATUS_SUCCESS;
err:
switch_http_free_request(request);
return status;
}
SWITCH_DECLARE(void) switch_http_free_request(switch_http_request_t *request)
{
if (request->_buffer) free(request->_buffer);
if (request->_destroy_headers && request->headers) {
switch_event_destroy(&request->headers);
}
}
/* for debugging only */
SWITCH_DECLARE(void) switch_http_dump_request(switch_http_request_t *request)
{
switch_assert(request->method);
printf("method: %s\n", request->method);
if (request->uri) printf("uri: %s\n", request->uri);
if (request->qs) printf("qs: %s\n", request->qs);
if (request->host) printf("host: %s\n", request->host);
if (request->port) printf("port: %d\n", request->port);
if (request->from) printf("from: %s\n", request->from);
if (request->user_agent) printf("user_agent: %s\n", request->user_agent);
if (request->referer) printf("referer: %s\n", request->referer);
if (request->user) printf("user: %s\n", request->user);
if (request->keepalive) printf("uri: %d\n", request->keepalive);
if (request->content_type) printf("uri: %s\n", request->content_type);
if (request->content_length) printf("uri: %" SWITCH_SIZE_T_FMT "\n", request->content_length);
{
switch_event_header_t *header = request->headers->headers;
printf("headers:\n-------------------------\n");
while(header) {
printf("%s: %s\n", header->name, header->value);
header = header->next;
}
}
}
/* For Emacs:
* Local Variables:

View File

@ -64,4 +64,6 @@ alias fstop='top -p `cat /usr/local/freeswitch/run/freeswitch.pid`'
alias fsgdb='gdb /usr/local/freeswitch/bin/freeswitch `cat /usr/local/freeswitch/run/freeswitch.pid`'
alias fscore='gdb /usr/local/freeswitch/bin/freeswitch `ls -rt core.* | tail -n1`'
alias emacs='emacs -nw'
alias jitteron='tc qdisc add dev eth0 root handle 1: netem delay 40ms 20ms ; tc qdisc add dev eth0 parent 1:1 pfifo limit 1000'
alias jitteroff='tc qdisc del dev eth0 root netem'
# End of file