Merge branch 'master' of git.freeswitch.org:freeswitch

This commit is contained in:
Anthony Minessale 2010-04-02 13:52:35 -05:00
commit 0922b53ace
52 changed files with 2850 additions and 1973 deletions

25
.gitignore vendored
View File

@ -8,6 +8,28 @@
.deps
.\#*
\#*
Debug/
Release/
All/
bin/
*.user
*.suo
*.ncb
*.pdb
*.map
*.lib
*.obj
*.idb
*.res
*.exp
*.exe
*.manifest
*.dep
*.dll
BuildLog.htm
Path
w32/Library/lastversion
w32/Library/tmpVersion.Bat
.version
AUTHORS
COPYING
@ -17,6 +39,7 @@ Makefile.in
NEWS
README
aclocal.m4
autom4te.cache
build/Makefile
build/Makefile.in
build/config/compile
@ -29,9 +52,11 @@ build/freeswitch.pc
build/getlib.sh
build/getsounds.sh
build/modmake.rules
config.cache
config.log
config.status
configure
configure.lineno
freeswitch
fs_cli
fs_ivrd

View File

@ -348,8 +348,22 @@ src/include/switch_version.h: src/include/switch_version.h.in .version $(libfree
if test $$have_version = 1 ; then \
cat src/include/switch_version.h.in > src/include/switch_version.h ; \
touch .version ; \
else \
if [ -d .git ] ; then \
version=`git log --format="%h %ci" -1 HEAD | head -1 || echo hacked` ; \
if [ "x$$version" == "xhacked" ] ; then \
version="hacked-`date -u +%Y%m%dT%H%M%SZ`" ; \
else \
version="git-$$version" ; \
fi ;\
else \
version=`svnversion . -n || echo hacked` ; \
if [ "x$$version" == "xhacked" ] ; then \
version="hacked-`date -u +%Y%m%dT%H%M%SZ`" ; \
else \
version="svn-$$version" ; \
fi ;\
fi ; \
oldversion=`cat .version 2>/dev/null || echo "0"` ; \
if test "$$oldversion" != "$$version" || test $$force = 1 ; then \
cat src/include/switch_version.h.in | sed "s/@SWITCH_VERSION_REVISION@/$$version/g" > src/include/switch_version.h ; \
@ -437,23 +451,30 @@ install-data-local:
test -d $(DESTDIR)$(sysconfdir) || $(MAKE) samples-conf
test -d $(DESTDIR)$(htdocsdir) || $(MAKE) samples-htdocs
is-svn:
@if [ ! -d .svn ] ; then \
is-scm:
@if [ ! -d .svn -a ! -d .git ] ; then \
echo ; echo ; \
echo "**************************************************************************************************" ; \
echo "You can not update a release tarball or without a svn working copy, please checkout fresh from svn" ; \
echo "**************************************************************************************************" ; \
echo "*****************************************************************************************************" ; \
echo "You can not update a release tarball or without a git or svn working copy please clone our git tree: " ; \
echo "git clone git://git.freeswitch.org/freeswitch.git " ; \
echo "or check out our read only svn mirror: " ; \
echo "svn checkout http://svn.freeswitch.org/svn/freeswitch/trunk " ; \
echo "*****************************************************************************************************" ; \
echo ; echo ; \
exit 1; \
fi
update: is-svn
update: is-scm
@if test -d .svn ; then \
test ! -f .version || rm -f .version ; \
echo Updating... ; \
svn update ; \
elif test -d .git ; then \
test ! -f .version || rm -f .version ; \
echo "Pulling updates..." ; \
git pull ; \
else \
echo "This source directory is not an svn working copy" ; \
echo "This source directory is not a git tree or svn working copy" ; \
fi
.nodepends:
@ -483,18 +504,18 @@ core_install: install_core
everything: install
up: is-svn clean
svn update
up: is-scm clean
$(MAKE) update
$(MAKE) -j core
$(MAKE) -j modules
$(MAKE) install
sync: is-svn
svn update
sync: is-scm
$(MAKE) update
$(MAKE) install
speedy-sync: is-svn
svn update
speedy-sync: is-scm
$(MAKE) update
$(MAKE) -j install
libs/openzap/Makefile:
@ -570,15 +591,15 @@ cluecon:
@echo
@echo http://www.cluecon.com
@sleep 5
current: cluecon is-svn update-clean
svn update
current: cluecon update-clean is-scm
$(MAKE) update
$(MAKE) all
$(MAKE) install
installall: current
speedy-current: is-svn update-clean
svn update
speedy-current: update-clean is-scm
$(MAKE) update
$(MAKE) speedy-sure
$(MAKE) install

View File

@ -1,6 +1,6 @@
cd src/mod/languages/mod_lua
make swigclean
make mod_lua_wrap.cpp
make lua_wrap
cd ../../../..
cd src/mod/languages/mod_perl

View File

@ -3,11 +3,11 @@
# Must change all of the below together
# For a release, set revision for that tagged release as well and uncomment
AC_INIT([freeswitch], [1.0.trunk], BUG-REPORT-ADDRESS)
AC_INIT([freeswitch], [1.0.head], BUG-REPORT-ADDRESS)
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
AC_SUBST(SWITCH_VERSION_MINOR, [0])
AC_SUBST(SWITCH_VERSION_MICRO, [trunk])
#AC_SUBST(SWITCH_VERSION_REVISION, [svn-revision-here])
AC_SUBST(SWITCH_VERSION_MICRO, [head])
#AC_SUBST(SWITCH_VERSION_REVISION, [])
AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template])
AC_CONFIG_FILES([.version:.version.in])

74
libs/.gitignore vendored
View File

@ -189,6 +189,9 @@ ilbc/src/ilbc.h
ilbc/src/stamp-h1
ilbc/tests/Makefile
ilbc/tests/Makefile.in
js/nsprpub/lib/ds/libplds4.so.1
js/nsprpub/lib/libc/src/libplc4.so.1
js/nsprpub/pr/src/libnspr4.so.1
js/Makefile
js/aclocal.m4
js/config.guess
@ -990,3 +993,74 @@ unimrcp/build/acmacros/ltoptions.m4
unimrcp/build/acmacros/ltsugar.m4
unimrcp/build/acmacros/ltversion.m4
unimrcp/build/acmacros/lt~obsolete.m4
*.tar.gz
celt-0.7.1/
flite-1.3.99/
freeradius-client-1.1.6/
iksemel/test/tst-dom
iksemel/test/tst-filter
iksemel/test/tst-iks
iksemel/test/tst-ikstack
iksemel/test/tst-jid
iksemel/test/tst-md5
iksemel/test/tst-sax
iksemel/test/tst-sha
iksemel/tools/ikslint
iksemel/tools/iksperf
iksemel/tools/iksroster
json-c-0.9/
lame-3.97/
libmemcached-0.32/
libshout-2.2.2/
mpg123/
openldap-2.4.19/
pocketsphinx-0.5.99/
portaudio/bin-stamp
portaudio/bin/
portaudio/lib-stamp
silk/Decoder
silk/Encoder
silk/signalCompare
soundtouch-1.3.1/
sphinxbase-0.4.99/
unimrcp/platforms/asr-client/asrclient
unimrcp/platforms/umc/umc
unimrcp/platforms/unimrcp-client/unimrcpclient
unimrcp/platforms/unimrcp-server/unimrcpserver
yaml/config.h
yaml/stamp-h1
yaml/tests/example-deconstructor
yaml/tests/example-deconstructor-alt
yaml/tests/example-reformatter
yaml/tests/example-reformatter-alt
yaml/tests/run-dumper
yaml/tests/run-emitter
yaml/tests/run-loader
yaml/tests/run-parser
yaml/tests/run-scanner
Communicator_semi_40.cd_semi_6000/
libogg-1.1.3/
pthreads-w32-2-7-0-release/
sounds/
sphinxbase-0.4.99/
sofia-sip/libsofia-sip-ua/http/http_tag_dll.c
sofia-sip/libsofia-sip-ua/iptsec/auth_tag_dll.c
sofia-sip/libsofia-sip-ua/msg/msg_tag_dll.c
sofia-sip/libsofia-sip-ua/msg/msg_tag_ref.c
sofia-sip/libsofia-sip-ua/nea/nea_tag_dll.c
sofia-sip/libsofia-sip-ua/nta/nta_tag_dll.c
sofia-sip/libsofia-sip-ua/nth/nth_tag_dll.c
sofia-sip/libsofia-sip-ua/nua/nua_tag_dll.c
sofia-sip/libsofia-sip-ua/sdp/sdp_tag_dll.c
sofia-sip/libsofia-sip-ua/sip/sip_tag_dll.c
sofia-sip/libsofia-sip-ua/soa/soa_tag_dll.c
sofia-sip/libsofia-sip-ua/stun/stun_tag_dll.c
sofia-sip/libsofia-sip-ua/su/su_tag_dll.c
sofia-sip/libsofia-sip-ua/tport/tport_tag_dll.c
sofia-sip/libsofia-sip-ua/url/url_tag_dll.c
win32/pcre/pcre_chartables.c
apr-util/include/apu_config.h
apr-util/include/apu_select_dbm.h
include/
js/nsprpub/pr/include/prcpucfg.h
apr-util/xml/expat/lib/config.h

View File

View File

View File

@ -105,7 +105,7 @@ core-install: install-libLTLIBRARIES
#
# tools & test programs
#
noinst_PROGRAMS = testtones detect_tones detect_dtmf testisdn testpri testr2 testanalog testapp testcid
noinst_PROGRAMS = testtones detect_tones detect_dtmf testpri testr2 testanalog testapp testcid #testisdn
if HAVE_SCTP
noinst_PROGRAMS += testboost
endif
@ -131,9 +131,9 @@ detect_dtmf_SOURCES = $(SRC)/detect_dtmf.c
detect_dtmf_LDADD = libfreetdm.la
detect_dtmf_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
testisdn_SOURCES = $(SRC)/testisdn.c
testisdn_LDADD = libfreetdm.la
testisdn_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
#testisdn_SOURCES = $(SRC)/testisdn.c
#testisdn_LDADD = libfreetdm.la
#testisdn_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
testpri_SOURCES = $(SRC)/testpri.c
testpri_LDADD = libfreetdm.la
@ -160,7 +160,7 @@ testanalog_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
#
# ftmod modules
#
mod_LTLIBRARIES = ftmod_zt.la ftmod_skel.la ftmod_isdn.la ftmod_analog.la ftmod_analog_em.la
mod_LTLIBRARIES = ftmod_zt.la ftmod_skel.la ftmod_analog.la ftmod_analog_em.la #ftmod_isdn.la
if HAVE_SCTP
@ -196,32 +196,32 @@ ftmod_wanpipe_la_LDFLAGS = -module -avoid-version -lsangoma
ftmod_wanpipe_la_LIBADD = $(MYLIB)
endif
ftmod_isdn_la_SOURCES = \
$(SRC)/isdn/EuroISDNStateNT.c \
$(SRC)/isdn/EuroISDNStateTE.c \
$(SRC)/isdn/mfifo.c \
$(SRC)/isdn/Q921.c \
$(SRC)/isdn/Q931api.c \
$(SRC)/isdn/Q931.c \
$(SRC)/isdn/Q931ie.c \
$(SRC)/isdn/Q931mes.c \
$(SRC)/isdn/Q931StateNT.c \
$(SRC)/isdn/Q931StateTE.c \
$(SRC)/isdn/nationalmes.c \
$(SRC)/isdn/nationalStateNT.c \
$(SRC)/isdn/nationalStateTE.c \
$(SRC)/isdn/DMSmes.c \
$(SRC)/isdn/DMSStateNT.c \
$(SRC)/isdn/DMSStateTE.c \
$(SRC)/isdn/5ESSmes.c \
$(SRC)/isdn/5ESSStateNT.c \
$(SRC)/isdn/5ESSStateTE.c \
$(SRC)/isdn/Q932mes.c \
$(SRC)/ftmod/ftmod_isdn/ftmod_isdn.c
#ftmod_isdn_la_SOURCES = \
#$(SRC)/isdn/EuroISDNStateNT.c \
#$(SRC)/isdn/EuroISDNStateTE.c \
#$(SRC)/isdn/mfifo.c \
#$(SRC)/isdn/Q921.c \
#$(SRC)/isdn/Q931api.c \
#$(SRC)/isdn/Q931.c \
#$(SRC)/isdn/Q931ie.c \
#$(SRC)/isdn/Q931mes.c \
#$(SRC)/isdn/Q931StateNT.c \
#$(SRC)/isdn/Q931StateTE.c \
#$(SRC)/isdn/nationalmes.c \
#$(SRC)/isdn/nationalStateNT.c \
#$(SRC)/isdn/nationalStateTE.c \
#$(SRC)/isdn/DMSmes.c \
#$(SRC)/isdn/DMSStateNT.c \
#$(SRC)/isdn/DMSStateTE.c \
#$(SRC)/isdn/5ESSmes.c \
#$(SRC)/isdn/5ESSStateNT.c \
#$(SRC)/isdn/5ESSStateTE.c \
#$(SRC)/isdn/Q932mes.c \
#$(SRC)/ftmod/ftmod_isdn/ftmod_isdn.c
ftmod_isdn_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D_GNU_SOURCE
ftmod_isdn_la_LDFLAGS = $(PCAP_LIB_FLAGS) -module -avoid-version
ftmod_isdn_la_LIBADD = $(MYLIB)
#ftmod_isdn_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D_GNU_SOURCE
#ftmod_isdn_la_LDFLAGS = $(PCAP_LIB_FLAGS) -module -avoid-version
#ftmod_isdn_la_LIBADD = $(MYLIB)
ftmod_analog_la_SOURCES = $(SRC)/ftmod/ftmod_analog/ftmod_analog.c
ftmod_analog_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)

View File

View File

View File

View File

View File

View File

@ -100,13 +100,16 @@ if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
fi
fi
SOFIA_PLAT_CFLAGS=
# openbsd seems to not define NULL as a void pointer, I blame standards by committee for this.
# This is a dirty hack, but shuts up all the warnings
case "$host" in
*-openbsd*) SOFIA_CFLAGS="$SOFIA_CFLAGS -DNULL='(void *) 0L'";;
*-openbsd*) SOFIA_PLAT_CFLAGS="-DNULL='(void *) 0L'";;
*) ;;
esac
AC_SUBST(SOFIA_PLAT_CFLAGS, $SOFIA_PLAT_CFLAGS)
### checks for header files
### -----------------------

View File

@ -1,7 +1,7 @@
# common Makefile targets for libsofia-sip-ua modules
# ---------------------------------------------------
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS) $(SOFIA_COVERAGE)
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS) $(SOFIA_COVERAGE) $(SOFIA_PLAT_CFLAGS)
# Use with --enable-ndebug
if NDEBUG

View File

@ -4,7 +4,7 @@
sofiasrcdir = ${top_srcdir}/libsofia-sip-ua
sofiabuilddir = ${top_builddir}/libsofia-sip-ua
AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) $(openssl_CFLAGS)
AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) $(openssl_CFLAGS) $(SOFIA_PLAT_CFLAGS)
SOFIA_COVERAGE = $(COVERAGE_FLAGS)

View File

0
libs/sqlite/notes/.empty Normal file
View File

View File

View File

@ -35,11 +35,12 @@ fi
sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \
-e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \
-e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \
-e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \
-e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$major.$minor.$micro\2|" \
-i configure.in
if [ -n "$rev" ]; then
sed -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \
sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \
-e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \
-i configure.in
fi
@ -61,16 +62,17 @@ rm -f docs/COPYING
rm -f docs/ChangeLog
rm -rf .git
cd ..
tar -czvf $dst_name.tar.gz $dst_dir
tar -cjvf $dst_name.tar.bz2 $dst_dir
tar -cJvf $dst_name.tar.xz $dst_dir
rm -rf $dst_dir
tar -cvf $dst_name.tar $dst_dir
gzip -9 -c $dst_name.tar > $dst_name.tar.gz || echo "gzip not available"
bzip2 -z -k $dst_name.tar || echo "bzip2 not available"
xz -z -9 -k $dst_name.tar || echo "xz / xz-utils not available"
rm -rf $dst_name.tar $dst_dir
cat 1>&2 <<EOF
----------------------------------------------------------------------
The v$ver tag has been committed locally, but it will not be
globally visible until you 'git push' this repository up to the server
(I didn't do that for you).
globally visible until you 'git push --tags' this repository up to the
server (I didn't do that for you, as you might want to review first).
----------------------------------------------------------------------
EOF

View File

@ -245,6 +245,11 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_
#define switch_channel_set_variable(_channel, _var, _val) switch_channel_set_variable_var_check(_channel, _var, _val, SWITCH_TRUE)
#define switch_channel_set_variable_partner(_channel, _var, _val) switch_channel_set_variable_partner_var_check(_channel, _var, _val, SWITCH_TRUE)
SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check, switch_bool_t nolocal);
#define switch_channel_export_variable(_channel, _varname, _value, _nolocal) switch_channel_export_variable_var_check(_channel, _varname, _value, SWITCH_TRUE, _nolocal)
/*!
\brief Retrieve a variable from a given channel
\param channel channel to retrieve variable from

7
src/mod/.gitignore vendored
View File

@ -50,3 +50,10 @@ loggers/mod_logfile/Makefile
loggers/mod_syslog/Makefile
say/mod_say_en/Makefile
say/mod_say_ru/Makefile
applications/mod_stress/mod_stress.log
asr_tts/mod_unimrcp/mod_unimrcp.log
endpoints/mod_portaudio/mod_portaudio.log
endpoints/mod_skypopen/mod_skypopen.log
formats/mod_portaudio_stream/mod_portaudio_stream.log
languages/mod_java/freeswitch.jar
languages/mod_managed/freeswitch_wrap.cpp

View File

@ -25,7 +25,7 @@
*
* Rupa Schomaker <rupa@rupa.com>
*
* mod_cidlookup.c -- API for querying cid->name services
* mod_cidlookup.c -- API for querying cid->name services and local data
*
*/

View File

@ -2,13 +2,12 @@ include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_enum
UDNS_DIR=$(switch_srcdir)/libs/udns
AM_CFLAGS += -I$(UDNS_DIR) -DHAVE_POLL
mod_enum_la_CFLAGS = -I$(UDNS_DIR) -DHAVE_POLL $(AM_CFLAGS)
mod_LTLIBRARIES = mod_enum.la
mod_enum_la_SOURCES = mod_enum.c
mod_enum_la_SOURCES += $(UDNS_DIR)/udns_dn.c $(UDNS_DIR)/udns_dntosp.c $(UDNS_DIR)/udns_parse.c $(UDNS_DIR)/udns_misc.c
mod_enum_la_SOURCES += $(UDNS_DIR)/udns_rr_a.c $(UDNS_DIR)/udns_rr_ptr.c $(UDNS_DIR)/udns_rr_mx.c $(UDNS_DIR)/udns_rr_txt.c $(UDNS_DIR)/udns_bl.c
mod_enum_la_SOURCES += $(UDNS_DIR)/udns_rr_srv.c $(UDNS_DIR)/udns_rr_naptr.c $(UDNS_DIR)/udns_codes.c $(UDNS_DIR)/udns_resolver.c
mod_enum_la_CFLAGS = $(AM_CFLAGS)
mod_enum_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_enum_la_LDFLAGS = -avoid-version -module -no-undefined -shared

View File

@ -6,8 +6,7 @@ PALA=$(switch_builddir)/libs/portaudio/lib/libportaudio.la
mod_LTLIBRARIES = mod_portaudio.la
mod_portaudio_la_SOURCES = mod_portaudio.c pablio.c pa_ringbuffer.c
mod_portaudio_la_CFLAGS = $(AM_CFLAGS)
mod_portaudio_la_CFLAGS += -I. -I$(PA_DIR)/include -D__EXTENSION__=1
mod_portaudio_la_CFLAGS = -I. -I$(PA_DIR)/include -D__EXTENSION__=1 $(AM_CFLAGS)
mod_portaudio_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(PALA)
mod_portaudio_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(PA_LIBS)

View File

@ -3,7 +3,7 @@ include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_skinny
mod_LTLIBRARIES = mod_skinny.la
mod_skinny_la_SOURCES = mod_skinny.c skinny_protocol.c skinny_tables.c
mod_skinny_la_CFLAGS = $(AM_CFLAGS) -DSKINNY_SVN_VERSION=\"`cat $(switch_builddir)/.version`\"
mod_skinny_la_SOURCES = mod_skinny.c skinny_protocol.c skinny_tables.c skinny_api.c
mod_skinny_la_CFLAGS = $(AM_CFLAGS)
mod_skinny_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_skinny_la_LDFLAGS = -avoid-version -module -no-undefined -shared

View File

@ -49,7 +49,9 @@ sub send {
$parsed_count++;
}
if($parsed_count != scalar(keys %{$self->{'data'}})) {
printf "Incomplete message: %d out of %d\n", $parsed_count, scalar(keys %{$self->{'data'}});
printf "Incomplete message (type=%s (%X)) %d out of %d\n", Net::Skinny::Protocol::skinny_message_type2str($self->{'type'}), $self->{'type'},
$parsed_count, scalar(keys %{$self->{'data'}});
print Dumper(@$struct);
return;
}
$self->{'socket'}->send_data($self->{'type'}, $raw);

File diff suppressed because it is too large Load Diff

View File

@ -42,14 +42,15 @@
#define SKINNY_EVENT_UNREGISTER "skinny::unregister"
#define SKINNY_EVENT_EXPIRE "skinny::expire"
#define SKINNY_EVENT_ALARM "skinny::alarm"
#define SKINNY_EVENT_CALL_STATE "skinny::call_state"
struct skinny_globals {
/* data */
int calls;
switch_mutex_t *calls_mutex;
int running;
switch_memory_pool_t *pool;
switch_mutex_t *mutex;
switch_hash_t *profile_hash;
switch_event_node_t *heartbeat_node;
int running;
switch_event_node_t *call_state_node;
};
typedef struct skinny_globals skinny_globals_t;
@ -72,6 +73,7 @@ struct skinny_profile {
char *odbc_user;
char *odbc_pass;
switch_odbc_handle_t *master_odbc;
switch_mutex_t *sql_mutex;
/* stats */
uint32_t ib_calls;
uint32_t ob_calls;
@ -86,6 +88,8 @@ struct skinny_profile {
uint8_t listener_ready;
/* call id */
uint32_t next_call_id;
/* others */
switch_memory_pool_t *pool;
};
typedef struct skinny_profile skinny_profile_t;
@ -103,8 +107,6 @@ struct listener {
skinny_profile_t *profile;
char device_name[16];
uint32_t device_instance;
switch_core_session_t *session[SKINNY_MAX_LINES];
uint32_t line_state[SKINNY_MAX_LINES]; /* See enum skinny_key_set */
switch_socket_t *sock;
switch_memory_pool_t *pool;
@ -153,14 +155,11 @@ struct private_object {
switch_mutex_t *mutex;
switch_mutex_t *flag_mutex;
/* identification */
struct listener *listener;
uint32_t line;
uint32_t call_id;
uint32_t party_id;
char *line_name;
char *line_shortname;
char *line_displayname;
char dest[10];
skinny_profile_t *profile;
/* codec */
char *iananame;
switch_codec_t read_codec;
@ -182,6 +181,17 @@ struct private_object {
typedef struct private_object private_t;
/*****************************************************************************/
/* PROFILES FUNCTIONS */
/*****************************************************************************/
skinny_profile_t *skinny_find_profile(const char *profile_name);
switch_status_t skinny_profile_dump(const skinny_profile_t *profile, switch_stream_handle_t *stream);
switch_status_t skinny_profile_find_listener_by_device_name(skinny_profile_t *profile, const char *device_name, listener_t **listener);
switch_status_t skinny_profile_find_listener_by_device_name_and_instance(skinny_profile_t *profile, const char *device_name, uint32_t device_instance, listener_t **listener);
char * skinny_profile_find_session_uuid(skinny_profile_t *profile, listener_t *listener, uint32_t *line_instance_p, uint32_t call_id);
switch_core_session_t * skinny_profile_find_session(skinny_profile_t *profile, listener_t *listener, uint32_t *line_instance_p, uint32_t call_id);
switch_status_t dump_device(skinny_profile_t *profile, const char *device_name, switch_stream_handle_t *stream);
/*****************************************************************************/
/* SQL FUNCTIONS */
/*****************************************************************************/
@ -192,18 +202,19 @@ switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile,
/*****************************************************************************/
/* LISTENER FUNCTIONS */
/*****************************************************************************/
uint8_t listener_is_ready(listener_t *listener);
switch_status_t keepalive_listener(listener_t *listener, void *pvt);
/*****************************************************************************/
/* CHANNEL FUNCTIONS */
/*****************************************************************************/
uint32_t skinny_line_perform_set_state(listener_t *listener, const char *file, const char *func, int line, uint32_t instance, uint32_t state, uint32_t call_id);
#define skinny_line_set_state(listener, instance, state, call_id) skinny_line_perform_set_state(listener, __FILE__, __SWITCH_FUNC__, __LINE__, instance, state, call_id)
void skinny_line_perform_set_state(const char *file, const char *func, int line, listener_t *listener, uint32_t line_instance, uint32_t call_id, uint32_t call_state);
#define skinny_line_set_state(listener, line_instance, call_id, call_state) skinny_line_perform_set_state(__FILE__, __SWITCH_FUNC__, __LINE__, listener, line_instance, call_id, call_state)
uint32_t skinny_line_get_state(listener_t *listener, uint32_t instance);
uint32_t skinny_line_get_state(listener_t *listener, uint32_t line_instance, uint32_t call_id);
switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force);
void tech_init(private_t *tech_pvt, switch_core_session_t *session, listener_t *listener, uint32_t line);
void tech_init(private_t *tech_pvt, skinny_profile_t *profile, switch_core_session_t *session);
switch_status_t channel_on_init(switch_core_session_t *session);
switch_status_t channel_on_hangup(switch_core_session_t *session);
switch_status_t channel_on_destroy(switch_core_session_t *session);
@ -224,3 +235,14 @@ switch_endpoint_interface_t *skinny_get_endpoint_interface();
#endif /* _MOD_SKINNY_H */
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/

View File

@ -0,0 +1,473 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2010, Mathieu Parent <math.parent@gmail.com>
*
* 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 / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Mathieu Parent <math.parent@gmail.com>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Mathieu Parent <math.parent@gmail.com>
*
*
* skinny_api.c -- Skinny Call Control Protocol (SCCP) Endpoint Module
*
*/
#include <switch.h>
#include "mod_skinny.h"
#include "skinny_protocol.h"
#include "skinny_tables.h"
/*****************************************************************************/
/* skinny_api_list_* */
/*****************************************************************************/
static switch_status_t skinny_api_list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_console_callback_match_t *my_matches = NULL;
switch_status_t status = SWITCH_STATUS_FALSE;
switch_hash_index_t *hi;
void *val;
skinny_profile_t *profile;
/* walk profiles */
switch_mutex_lock(globals.mutex);
for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
profile = (skinny_profile_t *) val;
switch_console_push_match(&my_matches, profile->name);
}
switch_mutex_unlock(globals.mutex);
if (my_matches) {
*matches = my_matches;
status = SWITCH_STATUS_SUCCESS;
}
return status;
}
struct match_helper {
switch_console_callback_match_t *my_matches;
};
static int skinny_api_list_devices_callback(void *pArg, int argc, char **argv, char **columnNames)
{
struct match_helper *h = (struct match_helper *) pArg;
char *device_name = argv[0];
switch_console_push_match(&h->my_matches, device_name);
return 0;
}
static switch_status_t skinny_api_list_devices(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
struct match_helper h = { 0 };
switch_status_t status = SWITCH_STATUS_FALSE;
skinny_profile_t *profile = NULL;
char *sql;
char *myline;
char *argv[1024] = { 0 };
int argc = 0;
if (!(myline = strdup(line))) {
status = SWITCH_STATUS_MEMERR;
return status;
}
if (!(argc = switch_separate_string(myline, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || argc != 5) {
return status;
}
if(!strcasecmp(argv[1], "profile")) {/* skinny profile <profile_name> ... */
profile = skinny_find_profile(argv[2]);
} else if(!strcasecmp(argv[2], "profile")) {/* skinny status profile <profile_name> ... */
profile = skinny_find_profile(argv[3]);
}
if(profile) {
if ((sql = switch_mprintf("SELECT name FROM skinny_devices"))) {
skinny_execute_sql_callback(profile, profile->sql_mutex, sql, skinny_api_list_devices_callback, &h);
switch_safe_free(sql);
}
}
if (h.my_matches) {
*matches = h.my_matches;
status = SWITCH_STATUS_SUCCESS;
}
return status;
}
static switch_status_t skinny_api_list_reset_types(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_DEVICE_RESET_TYPES
return status;
}
static switch_status_t skinny_api_list_stimuli(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_STIMULI
return status;
}
static switch_status_t skinny_api_list_ring_types(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_RING_TYPES
return status;
}
static switch_status_t skinny_api_list_ring_modes(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_RING_MODES
return status;
}
static switch_status_t skinny_api_list_stimulus_instances(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
switch_console_callback_match_t *my_matches = NULL;
switch_console_push_match(&my_matches, "<stimulus_instance>");
switch_console_push_match(&my_matches, "0");
if (my_matches) {
*matches = my_matches;
status = SWITCH_STATUS_SUCCESS;
}
return status;
}
static switch_status_t skinny_api_list_stimulus_modes(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_LAMP_MODES
return status;
}
static switch_status_t skinny_api_list_speaker_modes(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_SPEAKER_MODES
return status;
}
static switch_status_t skinny_api_list_call_states(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_CALL_STATES
return status;
}
static switch_status_t skinny_api_list_line_instances(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
switch_console_callback_match_t *my_matches = NULL;
/* TODO */
switch_console_push_match(&my_matches, "1");
switch_console_push_match(&my_matches, "<line_instance>");
if (my_matches) {
*matches = my_matches;
status = SWITCH_STATUS_SUCCESS;
}
return status;
}
static switch_status_t skinny_api_list_call_ids(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
switch_console_callback_match_t *my_matches = NULL;
/* TODO */
switch_console_push_match(&my_matches, "1345");
switch_console_push_match(&my_matches, "<call_id>");
if (my_matches) {
*matches = my_matches;
status = SWITCH_STATUS_SUCCESS;
}
return status;
}
/*****************************************************************************/
/* skinny_api_cmd_* */
/*****************************************************************************/
static switch_status_t skinny_api_cmd_status_profile(const char *profile_name, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
skinny_profile_dump(profile, stream);
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_status_profile_device(const char *profile_name, const char *device_name, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
dump_device(profile, device_name, stream);
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_device_send_ringer_message(const char *profile_name, const char *device_name, const char *ring_type, const char *ring_mode, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
send_set_ringer(listener, skinny_str2ring_type(ring_type), skinny_str2ring_mode(ring_mode), 0, 0);
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_device_send_lamp_message(const char *profile_name, const char *device_name, const char *stimulus, const char *instance, const char *lamp_mode, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
send_set_lamp(listener, skinny_str2button(stimulus), atoi(instance), skinny_str2lamp_mode(lamp_mode));
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_device_send_speaker_mode_message(const char *profile_name, const char *device_name, const char *speaker_mode, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
send_set_speaker_mode(listener, skinny_str2speaker_mode(speaker_mode));
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_device_send_call_state_message(const char *profile_name, const char *device_name, const char *call_state, const char *line_instance, const char *call_id, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
send_call_state(listener, skinny_str2call_state(call_state), atoi(line_instance), atoi(call_id));
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_device_send_reset_message(const char *profile_name, const char *device_name, const char *reset_type, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
send_reset(listener, skinny_str2device_reset_type(reset_type));
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
}
/*****************************************************************************/
/* API */
/*****************************************************************************/
SWITCH_STANDARD_API(skinny_function)
{
char *argv[1024] = { 0 };
int argc = 0;
char *mycmd = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS;
const char *usage_string = "USAGE:\n"
"--------------------------------------------------------------------------------\n"
"skinny help\n"
"skinny status profile <profile_name>\n"
"skinny status profile <profile_name> device <device_name>\n"
"skinny profile <profile_name> device <device_name> send ResetMessage [DeviceReset|DeviceRestart]\n"
"skinny profile <profile_name> device <device_name> send SetRingerMessage <ring_type> <ring_mode>\n"
"skinny profile <profile_name> device <device_name> send SetLampMessage <stimulus> <instance> <lamp_mode>\n"
"skinny profile <profile_name> device <device_name> send SetSpeakerModeMessage <speaker_mode>\n"
"skinny profile <profile_name> device <device_name> send CallStateMessage <call_state> <line_instance> <call_id>\n"
"--------------------------------------------------------------------------------\n";
if (session) {
return SWITCH_STATUS_FALSE;
}
if (zstr(cmd)) {
stream->write_function(stream, "%s", usage_string);
goto done;
}
if (!(mycmd = strdup(cmd))) {
status = SWITCH_STATUS_MEMERR;
goto done;
}
if (!(argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || !argv[0]) {
stream->write_function(stream, "%s", usage_string);
goto done;
}
if (!strcasecmp(argv[0], "help")) {/* skinny help */
stream->write_function(stream, "%s", usage_string);
goto done;
} else if (argc == 3 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile")) {
/* skinny status profile <profile_name> */
status = skinny_api_cmd_status_profile(argv[2], stream);
} else if (argc == 5 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile") && !strcasecmp(argv[3], "device")) {
/* skinny status profile <profile_name> device <device_name> */
status = skinny_api_cmd_status_profile_device(argv[2], argv[4], stream);
} else if (argc >= 6 && !strcasecmp(argv[0], "profile") && !strcasecmp(argv[2], "device") && !strcasecmp(argv[4], "send")) {
/* skinny profile <profile_name> device <device_name> send ... */
switch(skinny_str2message_type(argv[5])) {
case SET_RINGER_MESSAGE:
if(argc == 8) {
/* SetRingerMessage <ring_type> <ring_mode> */
status = skinny_api_cmd_profile_device_send_ringer_message(argv[1], argv[3], argv[6], argv[7], stream);
}
break;
case SET_LAMP_MESSAGE:
if (argc == 9) {
/* SetLampMessage <stimulus> <instance> <lamp_mode> */
status = skinny_api_cmd_profile_device_send_lamp_message(argv[1], argv[3], argv[6], argv[7], argv[8], stream);
}
break;
case SET_SPEAKER_MODE_MESSAGE:
if (argc == 7) {
/* SetSpeakerModeMessage <speaker_mode> */
status = skinny_api_cmd_profile_device_send_speaker_mode_message(argv[1], argv[3], argv[6], stream);
}
break;
case CALL_STATE_MESSAGE:
if (argc == 9) {
/* CallStateMessage <call_state> <line_instance> <call_id> */
status = skinny_api_cmd_profile_device_send_call_state_message(argv[1], argv[3], argv[6], argv[7], argv[8], stream);
}
break;
case RESET_MESSAGE:
if (argc == 7) {
/* ResetMessage <reset_type> */
status = skinny_api_cmd_profile_device_send_reset_message(argv[1], argv[3], argv[6], stream);
}
break;
default:
stream->write_function(stream, "Unhandled message %s\n", argv[5]);
}
} else {
stream->write_function(stream, "Unknown Command [%s]\n", argv[0]);
}
done:
switch_safe_free(mycmd);
return status;
}
switch_status_t skinny_api_register(switch_loadable_module_interface_t **module_interface)
{
switch_api_interface_t *api_interface;
SWITCH_ADD_API(api_interface, "skinny", "Skinny Controls", skinny_function, "<cmd> <args>");
switch_console_set_complete("add skinny help");
switch_console_set_complete("add skinny status profile ::skinny::list_profiles");
switch_console_set_complete("add skinny status profile ::skinny::list_profiles device ::skinny::list_devices");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send ResetMessage ::skinny::list_reset_types");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetRingerMessage ::skinny::list_ring_types ::skinny::list_ring_modes");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetLampMessage ::skinny::list_stimuli ::skinny::list_stimulus_instances ::skinny::list_stimulus_modes");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetSpeakerModeMessage ::skinny::list_speaker_modes");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send CallStateMessage ::skinny::list_call_states ::skinny::list_line_instances ::skinny::list_call_ids");
switch_console_add_complete_func("::skinny::list_profiles", skinny_api_list_profiles);
switch_console_add_complete_func("::skinny::list_devices", skinny_api_list_devices);
switch_console_add_complete_func("::skinny::list_reset_types", skinny_api_list_reset_types);
switch_console_add_complete_func("::skinny::list_ring_types", skinny_api_list_ring_types);
switch_console_add_complete_func("::skinny::list_ring_modes", skinny_api_list_ring_modes);
switch_console_add_complete_func("::skinny::list_stimuli", skinny_api_list_stimuli);
switch_console_add_complete_func("::skinny::list_stimulus_instances", skinny_api_list_stimulus_instances);
switch_console_add_complete_func("::skinny::list_stimulus_modes", skinny_api_list_stimulus_modes);
switch_console_add_complete_func("::skinny::list_speaker_modes", skinny_api_list_speaker_modes);
switch_console_add_complete_func("::skinny::list_call_states", skinny_api_list_call_states);
switch_console_add_complete_func("::skinny::list_line_instances", skinny_api_list_line_instances);
switch_console_add_complete_func("::skinny::list_call_ids", skinny_api_list_call_ids);
return SWITCH_STATUS_SUCCESS;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/

View File

@ -0,0 +1,50 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2010, Mathieu Parent <math.parent@gmail.com>
*
* 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 / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Mathieu Parent <math.parent@gmail.com>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Mathieu Parent <math.parent@gmail.com>
*
*
* skinny_api.h -- Skinny Call Control Protocol (SCCP) Endpoint Module
*
*/
#ifndef _SKINNY_API_H
#define _SKINNY_API_H
switch_status_t skinny_api_register(switch_loadable_module_interface_t **module_interface);
#endif /* _SKINNY_API_H */
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,9 @@ struct register_message {
/* PortMessage */
#define PORT_MESSAGE 0x0002
struct port_message {
uint16_t port;
};
/* KeypadButtonMessage */
#define KEYPAD_BUTTON_MESSAGE 0x0003
@ -73,14 +76,14 @@ struct keypad_button_message {
struct stimulus_message {
uint32_t instance_type; /* See enum skinny_button_definition */
uint32_t instance;
/* uint32_t call_reference; */
uint32_t call_id;
};
/* OffHookMessage */
#define OFF_HOOK_MESSAGE 0x0006
struct off_hook_message {
uint32_t line_instance;
/* uint32_t call_id; */
uint32_t call_id;
};
/* OnHookMessage */
@ -150,7 +153,7 @@ struct open_receive_channel_ack_message {
struct soft_key_event_message {
uint32_t event;
uint32_t line_instance;
uint32_t callreference;
uint32_t call_id;
};
/* UnregisterMessage */
@ -186,10 +189,10 @@ struct register_available_lines_message {
/* RegisterAckMessage */
#define REGISTER_ACK_MESSAGE 0x0081
struct register_ack_message {
uint32_t keepAlive;
char dateFormat[6];
uint32_t keep_alive;
char date_format[6];
char reserved[2];
uint32_t secondaryKeepAlive;
uint32_t secondary_keep_alive;
char reserved2[4];
};
@ -214,7 +217,8 @@ struct stop_tone_message {
struct set_ringer_message {
uint32_t ring_type; /* See enum skinny_ring_type */
uint32_t ring_mode; /* See enum skinny_ring_mode */
uint32_t unknown; /* ?? */
uint32_t line_instance;
uint32_t call_id;
};
/* SetLampMessage */
@ -343,8 +347,8 @@ struct button_template_message {
#define CAPABILITIES_REQ_MESSAGE 0x009B
/* RegisterRejectMessage */
#define REGISTER_REJ_MESSAGE 0x009D
struct register_rej_message {
#define REGISTER_REJECT_MESSAGE 0x009D
struct register_reject_message {
char error[33];
};
@ -470,6 +474,14 @@ struct feature_stat_res_message {
uint32_t status;
};
/* DisplayPriNotifyMessage */
#define DISPLAY_PRI_NOTIFY_MESSAGE 0x0120
struct display_pri_notify_message {
uint32_t message_timeout;
uint32_t priority;
char notify[32];
};
/* ServiceUrlStatMessage */
#define SERVICE_URL_STAT_RES_MESSAGE 0x012F
struct service_url_stat_res_message {
@ -487,6 +499,7 @@ struct service_url_stat_res_message {
union skinny_data {
struct register_message reg;
struct port_message port;
struct keypad_button_message keypad_button;
struct stimulus_message stimulus;
struct off_hook_message off_hook;
@ -515,7 +528,7 @@ union skinny_data {
struct config_stat_res_message config_res;
struct define_time_date_message define_time_date;
struct button_template_message button_template;
struct register_rej_message reg_rej;
struct register_reject_message reg_rej;
struct reset_message reset;
struct open_receive_channel_message open_receive_channel;
struct close_receive_channel_message close_receive_channel;
@ -529,6 +542,7 @@ union skinny_data {
struct unregister_ack_message unregister_ack;
struct dialed_number_message dialed_number;
struct feature_stat_res_message feature_res;
struct display_pri_notify_message display_pri_notify;
struct service_url_stat_res_message service_url_res;
uint16_t as_uint16;
@ -598,16 +612,24 @@ typedef switch_status_t (*skinny_command_t) (char **argv, int argc, switch_strea
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received Too Short Skinny Message (Expected %" SWITCH_SIZE_T_FMT ", got %d).\n", len+4, message->length);\
return SWITCH_STATUS_FALSE;\
}
#define skinny_check_data_length_soft(message, len) \
(message->length >= len+4)
switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req);
switch_status_t skinny_device_event(listener_t *listener, switch_event_t **ev, switch_event_types_t event_id, const char *subclass_name);
switch_status_t skinny_send_call_info(switch_core_session_t *session);
switch_status_t skinny_send_call_info(switch_core_session_t *session, listener_t *listener, uint32_t line_instance);
switch_status_t skinny_session_walk_lines(skinny_profile_t *profile, char *channel_uuid, switch_core_db_callback_func_t callback, void *data);
switch_call_cause_t skinny_ring_lines(private_t *tech_pvt);
switch_status_t skinny_create_session(listener_t *listener, uint32_t line, uint32_t to_state);
switch_status_t skinny_process_dest(listener_t *listener, uint32_t line);
switch_status_t skinny_answer(switch_core_session_t *session);
switch_status_t skinny_create_ingoing_session(listener_t *listener, uint32_t *line_instance, switch_core_session_t **session);
switch_status_t skinny_session_process_dest(switch_core_session_t *session, listener_t *listener, uint32_t line_instance, char *dest, char append_dest, uint32_t backspace);
switch_status_t skinny_session_ring_out(switch_core_session_t *session, listener_t *listener, uint32_t line_instance);
switch_status_t skinny_session_answer(switch_core_session_t *session, listener_t *listener, uint32_t line_instance);
switch_status_t skinny_session_start_media(switch_core_session_t *session, listener_t *listener, uint32_t line_instance);
switch_status_t skinny_session_hold_line(switch_core_session_t *session, listener_t *listener, uint32_t line_instance);
switch_status_t skinny_session_unhold_line(switch_core_session_t *session, listener_t *listener, uint32_t line_instance);
void skinny_line_get(listener_t *listener, uint32_t instance, struct line_stat_res_message **button);
void skinny_speed_dial_get(listener_t *listener, uint32_t instance, struct speed_dial_stat_res_message **button);
@ -620,25 +642,32 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re
/*****************************************************************************/
/* SKINNY MESSAGE HELPER */
/*****************************************************************************/
switch_status_t start_tone(listener_t *listener,
switch_status_t send_register_ack(listener_t *listener,
uint32_t keep_alive,
char *date_format,
char *reserved,
uint32_t secondary_keep_alive,
char *reserved2);
switch_status_t send_start_tone(listener_t *listener,
uint32_t tone,
uint32_t reserved,
uint32_t line_instance,
uint32_t call_id);
switch_status_t stop_tone(listener_t *listener,
switch_status_t send_stop_tone(listener_t *listener,
uint32_t line_instance,
uint32_t call_id);
switch_status_t set_ringer(listener_t *listener,
switch_status_t send_set_ringer(listener_t *listener,
uint32_t ring_type,
uint32_t ring_mode,
uint32_t unknown);
switch_status_t set_lamp(listener_t *listener,
uint32_t line_instance,
uint32_t call_id);
switch_status_t send_set_lamp(listener_t *listener,
uint32_t stimulus,
uint32_t stimulus_instance,
uint32_t mode);
switch_status_t set_speaker_mode(listener_t *listener,
switch_status_t send_set_speaker_mode(listener_t *listener,
uint32_t mode);
switch_status_t start_media_transmission(listener_t *listener,
switch_status_t send_start_media_transmission(listener_t *listener,
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t remote_ip,
@ -649,7 +678,7 @@ switch_status_t start_media_transmission(listener_t *listener,
uint32_t silence_suppression,
uint16_t max_frames_per_packet,
uint32_t g723_bitrate);
switch_status_t stop_media_transmission(listener_t *listener,
switch_status_t send_stop_media_transmission(listener_t *listener,
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t conference_id2);
@ -674,7 +703,18 @@ switch_status_t send_call_info(listener_t *listener,
uint32_t call_instance,
uint32_t call_security_status,
uint32_t party_pi_restriction_bits);
switch_status_t open_receive_channel(listener_t *listener,
switch_status_t send_define_time_date(listener_t *listener,
uint32_t year,
uint32_t month,
uint32_t day_of_week, /* monday = 1 */
uint32_t day,
uint32_t hour,
uint32_t minute,
uint32_t seconds,
uint32_t milliseconds,
uint32_t timestamp);
switch_status_t send_define_current_time_date(listener_t *listener);
switch_status_t send_open_receive_channel(listener_t *listener,
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t packets,
@ -683,7 +723,7 @@ switch_status_t open_receive_channel(listener_t *listener,
uint32_t g723_bitrate,
uint32_t conference_id2,
uint32_t reserved[10]);
switch_status_t close_receive_channel(listener_t *listener,
switch_status_t send_close_receive_channel(listener_t *listener,
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t conference_id2);
@ -696,22 +736,37 @@ switch_status_t send_call_state(listener_t *listener,
uint32_t call_state,
uint32_t line_instance,
uint32_t call_id);
switch_status_t display_prompt_status(listener_t *listener,
switch_status_t send_display_prompt_status(listener_t *listener,
uint32_t timeout,
char display[32],
uint32_t line_instance,
uint32_t call_id);
switch_status_t clear_prompt_status(listener_t *listener,
switch_status_t send_clear_prompt_status(listener_t *listener,
uint32_t line_instance,
uint32_t call_id);
switch_status_t activate_call_plane(listener_t *listener,
switch_status_t send_activate_call_plane(listener_t *listener,
uint32_t line_instance);
switch_status_t send_dialed_number(listener_t *listener,
char called_party[24],
uint32_t line_instance,
uint32_t call_id);
switch_status_t send_display_pri_notify(listener_t *listener,
uint32_t message_timeout,
uint32_t priority,
char *notify);
switch_status_t send_reset(listener_t *listener,
uint32_t reset_type);
#endif /* _SKINNY_PROTOCOL_H */
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/

View File

@ -73,11 +73,11 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = {
{"DefineTimeDateMessage", DEFINE_TIME_DATE_MESSAGE},
{"ButtonTemplateResMessage", BUTTON_TEMPLATE_RES_MESSAGE},
{"CapabilitiesReqMessage", CAPABILITIES_REQ_MESSAGE},
{"RegisterRejMessage", REGISTER_REJ_MESSAGE},
{"RegisterRejectMessage", REGISTER_REJECT_MESSAGE},
{"ResetMessage", RESET_MESSAGE},
{"KeepAliveAckMessage", KEEP_ALIVE_ACK_MESSAGE},
{"OpenReceiveChannelMessage", OPEN_RECEIVE_CHANNEL_MESSAGE},
{"OCloseReceiveChannelMessage", CLOSE_RECEIVE_CHANNEL_MESSAGE},
{"CloseReceiveChannelMessage", CLOSE_RECEIVE_CHANNEL_MESSAGE},
{"SoftKeyTemplateResMessage", SOFT_KEY_TEMPLATE_RES_MESSAGE},
{"SoftKeySetResMessage", SOFT_KEY_SET_RES_MESSAGE},
{"SelectSoftKeysMessage", SELECT_SOFT_KEYS_MESSAGE},
@ -88,6 +88,7 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = {
{"UnregisterAckMessage", UNREGISTER_ACK_MESSAGE},
{"DialedNumberMessage", DIALED_NUMBER_MESSAGE},
{"FeatureResMessage", FEATURE_STAT_RES_MESSAGE},
{"DisplayPriNotifyMessage", DISPLAY_PRI_NOTIFY_MESSAGE},
{"ServiceUrlStatMessage", SERVICE_URL_STAT_RES_MESSAGE},
{NULL, 0}
};
@ -168,13 +169,13 @@ struct skinny_table SKINNY_CALL_STATES[] = {
{"RingIn", SKINNY_RING_IN},
{"Connected", SKINNY_CONNECTED},
{"Busy", SKINNY_BUSY},
{"Congestion", SKINNY_CONGESTION},
{"LineInUse", SKINNY_LINE_IN_USE},
{"Hold", SKINNY_HOLD},
{"CallWaiting", SKINNY_CALL_WAITING},
{"CallTransfer", SKINNY_CALL_TRANSFER},
{"CallPark", SKINNY_CALL_PARK},
{"Proceed", SKINNY_PROCEED},
{"CallRemoteMultiline", SKINNY_CALL_REMOTE_MULTILINE},
{"InUseRemotely", SKINNY_IN_USE_REMOTELY},
{"InvalidNumber", SKINNY_INVALID_NUMBER},
{NULL, 0}
};
@ -189,3 +190,14 @@ struct skinny_table SKINNY_DEVICE_RESET_TYPES[] = {
SKINNY_DECLARE_ID2STR(skinny_device_reset_type2str, SKINNY_DEVICE_RESET_TYPES, "DeviceResetTypeUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2device_reset_type, SKINNY_DEVICE_RESET_TYPES, -1)
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/

View File

@ -84,7 +84,7 @@ uint32_t func(const char *str)\
}
struct skinny_table SKINNY_MESSAGE_TYPES[55];
struct skinny_table SKINNY_MESSAGE_TYPES[56];
const char *skinny_message_type2str(uint32_t id);
uint32_t skinny_str2message_type(const char *str);
#define SKINNY_PUSH_MESSAGE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_MESSAGE_TYPES)
@ -210,13 +210,13 @@ enum skinny_call_state {
SKINNY_RING_IN = 4,
SKINNY_CONNECTED = 5,
SKINNY_BUSY = 6,
SKINNY_CONGESTION = 7,
SKINNY_LINE_IN_USE = 7,
SKINNY_HOLD = 8,
SKINNY_CALL_WAITING = 9,
SKINNY_CALL_TRANSFER = 10,
SKINNY_CALL_PARK = 11,
SKINNY_PROCEED = 12,
SKINNY_CALL_REMOTE_MULTILINE = 13,
SKINNY_IN_USE_REMOTELY = 13,
SKINNY_INVALID_NUMBER = 14
};
struct skinny_table SKINNY_CALL_STATES[15];
@ -235,3 +235,14 @@ uint32_t skinny_str2device_reset_type(const char *str);
#endif /* _SKINNY_TABLES_H */
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/

View File

@ -11,12 +11,13 @@ BEGIN {
use strict;
use warnings;
use Sys::Hostname;
use Net::Skinny;
use Net::Skinny::Protocol qw/:all/;
use Net::Skinny::Message;
#Config
my $skinny_server = '127.0.0.1';
my $skinny_server = hostname;
my $device_name = "SEP001120AABBCC";
my $device_ip = 10+256*(11+256*(12+256*13)); # 10.11.12.13
#======
@ -70,6 +71,7 @@ $socket->receive_message(); # SoftKeyTemplateRes
$socket->send_message(SOFT_KEY_SET_REQ_MESSAGE);
$socket->receive_message(); # SoftKeySetRes
$socket->receive_message(); # SelectSoftKeys
$socket->send_message(
LINE_STAT_REQ_MESSAGE,
@ -82,8 +84,68 @@ $socket->send_message(
count => 2
);
while(1) {
$socket->sleep(20);
for(my $i = 0; $i < 1; $i++) {
$socket->sleep(5);
$socket->send_message(KEEP_ALIVE_MESSAGE);
$socket->receive_message(); # keepaliveack
}
$socket->sleep(5);
#NewCall
$socket->send_message(
SOFT_KEY_EVENT_MESSAGE,
event => 2, #NewCall
line_instance => 2,
call_id => 0
);
$socket->receive_message(); # SetRinger
$socket->receive_message(); # SetSpeakerMode
$socket->receive_message(); # SetLamp
$socket->receive_message(); # SelectSoftKeys
$socket->receive_message(); # DisplayPromptStatus
$socket->receive_message(); # ActivateCallPlane
$socket->receive_message(); # StartTone
$socket->sleep(5);
#VoiceMail
$socket->send_message(
STIMULUS_MESSAGE,
instance_type => 0xf, #VoiceMail
instance => 0,
);
$socket->receive_message(); #
$socket->receive_message(); #
$socket->receive_message(); #
$socket->receive_message(); #
$socket->receive_message(); #
$socket->receive_message(); #
$socket->receive_message(); #
$socket->receive_message(); #
$socket->receive_message(); #
$socket->receive_message(); #
#
$socket->send_message(
OPEN_RECEIVE_CHANNEL_ACK_MESSAGE,
status => 1,
ip => $device_ip,
port => 12,
pass_thru_party_id => 0,
);
$socket->receive_message(); # StartMediaTransmission
$socket->sleep(20);
#EndCall
$socket->send_message(
SOFT_KEY_EVENT_MESSAGE,
event => 0x09, #NewCall
line_instance => 1,
call_id => 0
);
while(1) {
$socket->receive_message();
}

View File

@ -2,6 +2,6 @@ include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_skypopen
mod_LTLIBRARIES = mod_skypopen.la
mod_skypopen_la_SOURCES = mod_skypopen.c skypopen_protocol.c
mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -DSKYPOPEN_SVN_VERSION=\"`cat $(switch_builddir)/.version`\" -I../../../../libs/spandsp/src -I../../../..//libs/tiff-3.8.2/libtiff
mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -DSKYPOPEN_SVN_VERSION=\"`git describe`\" -I../../../../libs/spandsp/src -I../../../..//libs/tiff-3.8.2/libtiff
mod_skypopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_skypopen_la_LDFLAGS = -L../../../../libs/spandsp/src -avoid-version -module -no-undefined -shared -lX11 -lspandsp

View File

@ -7,8 +7,7 @@ MODPA_DIR=$(switch_srcdir)/src/mod/endpoints/mod_portaudio
mod_LTLIBRARIES = mod_portaudio_stream.la
mod_portaudio_stream_la_SOURCES = mod_portaudio_stream.c $(MODPA_DIR)/pablio.c $(MODPA_DIR)/pa_ringbuffer.c
mod_portaudio_stream_la_CFLAGS = $(AM_CFLAGS)
mod_portaudio_stream_la_CFLAGS += -I. -I$(PA_DIR)/include -D__EXTENSION__=1 -I$(MODPA_DIR)
mod_portaudio_stream_la_CFLAGS = -I. -I$(PA_DIR)/include -D__EXTENSION__=1 -I$(MODPA_DIR) $(AM_CFLAGS)
mod_portaudio_stream_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(PALA)
mod_portaudio_stream_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(PA_LIBS)

View File

@ -21403,6 +21403,26 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_variable_partner(void *
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_var_check(void * jarg1, char * jarg2, char * jarg3, int jarg4, int jarg5) {
int jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
switch_bool_t arg4 ;
switch_bool_t arg5 ;
switch_status_t result;
arg1 = (switch_channel_t *)jarg1;
arg2 = (char *)jarg2;
arg3 = (char *)jarg3;
arg4 = (switch_bool_t)jarg4;
arg5 = (switch_bool_t)jarg5;
result = (switch_status_t)switch_channel_export_variable_var_check(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5);
jresult = result;
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_variable_dup(void * jarg1, char * jarg2, int jarg3) {
char * jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;

View File

@ -2904,6 +2904,11 @@ public class freeswitch {
return ret;
}
public static switch_status_t switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel channel, string varname, string value, switch_bool_t var_check, switch_bool_t nolocal) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, value, (int)var_check, (int)nolocal);
return ret;
}
public static string switch_channel_get_variable_dup(SWIGTYPE_p_switch_channel channel, string varname, switch_bool_t dup) {
string ret = freeswitchPINVOKE.switch_channel_get_variable_dup(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, (int)dup);
return ret;
@ -10209,6 +10214,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_variable_partner")]
public static extern string switch_channel_get_variable_partner(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_export_variable_var_check")]
public static extern int switch_channel_export_variable_var_check(HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_variable_dup")]
public static extern string switch_channel_get_variable_dup(HandleRef jarg1, string jarg2, int jarg3);

0
src/mod/timers/.empty Normal file
View File

View File

@ -737,6 +737,37 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t
return status;
}
SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check, switch_bool_t nolocal)
{
const char *exports, *exports_varname = varname;
switch_status_t status;
exports = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE);
if (nolocal) {
exports_varname = switch_mprintf("nolocal:%s", varname);
}
if ((status = switch_channel_set_variable_var_check(channel, exports_varname, value, var_check)) != SWITCH_STATUS_SUCCESS) {
goto done;
}
if (varname && value) {
if (exports) {
switch_channel_set_variable_printf(channel, SWITCH_EXPORT_VARS_VARIABLE, "%s,%s", exports, exports_varname);
} else {
switch_channel_set_variable(channel, SWITCH_EXPORT_VARS_VARIABLE, exports_varname);
}
}
done:
if (exports_varname != varname) {
free((char*)exports_varname);
}
return status;
}
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_var_check(switch_channel_t *channel,
const char *varname, const char *value, switch_bool_t var_check)
{

0
web/etc/.empty Normal file
View File

0
web/planet/.empty Normal file
View File