cleanup of extras
git-svn-id: svn://192.168.202.10@17 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
Õ8z*½PScOȪP,ór)" ×␍‰¼+àEÓ<7‘Ôøj2ýîÕhØÕÑ#8誙éBØ,ƒ65ŸÂCb�(ÔøRºý¡aá.4³ Áµ‘•™âáäWFR2¹Á) ±‰Õ8z.ý¿¤hÜÍK]…º%Mq]¤œ°Í·M]ƒ%tñ•Ôøyî½\ƒá‘,Yµc:â•SÄÏd<,ióŸ£UäôÔøK:ô»B.e©Z%¢�Vn*àóä¡�Q´Eã!tä+DìÔùC5Ñ�WETÁbíÁ´øo‡k]¡ŽbÉŸ�›”c�ÔøCz´ãÁÕ”ª.”ãÂ4û6±£_ÂM¬è]]�¸æDóÔøbv¼]áÅ–)`]¢kéÊœ_�uYª®©]ÁUU2FòÔør.½]á·Mt÷…ÃZÇlöd]£C]6¦ø]‚Y[Ê.jÔøR÷=_aëº_ ‚ÜÊÜâÁ1©Z…šâÁÌ]…æßÔør2ýÕ¢)6A›]âÉ]¢(,Qáœ]�™”\gSÕ4Âaõ‹¦&¬Q2cÊ>”¬vø\ud’I$P`ë®ÚÝu
|
||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
ÕxZ²ýP4e5cU\#n7#¤¸ŽHVŽêcØÍŒÉÕxC»=æâ¸�Ö¹A`ø‘a肹�¹µBÁ+3+Õx;ÿ4ÍQ‘ªÓ‡Á¨x‹¸å¡7␍TÖÞ_¡ª°’› ÕxJöüÍB<]ÁÚ%]á‡Ð¸�
|
||||
]ât×1ã]"0s Õwb2ý¡"Ù�hÏÏ£&ñ� 0_CÚ%‚Ø,Ï#ÁdAœÕxZ·=a#^TI¿XV¥ØÕ¡±s6©IsBt—IrŸÕx%~´¶Â— Žb�!aÏ8s‡ËaÓÍ8cFå )“8ëÕxZvý�¢E„XÝÌ]#yMÓ…¥02•¨Ï":#ƒ8tÕxZvü�"%Ñ|©ƒ_âÓ,äϢø“)·YŒè×ÕxJúôåA¥Ú}’·¡¼m¡Ìe·�Ñ+6µj_¡Æ-gF|ÕxK>üaâ-
|
||||
ì®ØwCY␍Œè—¡J,ƒFsÏÁÍ®ZÕx<>ô_"q-³£µ )²‹ Ÿ¡*Ƭså ÷␍Ps‹Õv‘æµ_åÃc•Ûã„íÓg‹Î²rG$R 埗Yµ
|
||||
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
Υχ;ϋ=PW1W#Xυ[r)ΆdΡ[K±δ%7®
|
||||
�Υψ$ώτ£c±#2¤κ΅+)U…�΅BV4FΒ¬£Α›S΄½ΥχC{4[γH�npή¥¤κ•·”£βΨbΒ��Οƒ`εgΈβΥχC?=εγW␍n(*ΉΆEΝn,©ΉΒΖ{Qα–εΑαΞ6¦qΥχR·=Ή!ηΖ®\Οb#΅V‰)Ή�«°Λ£ΐ…h~ ΥχR»=£ �²΄Ρ“£΅η␍�\%�Ά.ΜΠkε‚nΝΜ\–ΥχR»=εΑ—pzΫΟαµr’δ>���ά™=£΅$uΘμΥχR»=Ο�fξG…Ο ΘµjΥ&Οa·ΣyΟΰΧΥχCΏ<ΟΒ·+61γ�‚�aΝΧΟ£pτK¦σΉΆβιηΥχ;ΎτWCΡlR�΅™ƒLΤΙJΧε$�Έ=R£Αf¤‡�¶Υψ%>³γ##xw…bΆ�ΙLMδα“Ω}‰�Οbj&‡V¤ΥψϊμΉΰΉκ:3 ¥αΤέk¶Ί�α+[µ? ΅ΰ®k�SΥψ%vσ£A¥bY—ΨΝ��•9‹‰λ7q·©ΰέ‘Ψε
|
||||
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
Õ8‚®ýPRáW¸é\-Ñ�¸£¬eŒ•lñìG'„XVÔÔùbúýî¤Õ,‹µbÓ*V èÂÔrK"“bTÕJ¤°Ôú5~³ÕaÈ‹fÅ9áZÚÉTŽÈ�¥`Í•ááI”ŒZ^Õ8‚nýYäÃZ2�!QÄhzã˜äk¥Ì*Š·‘ƒ›"xS�Õ8‚nô“£ªâ漓‚Ƹ®�‘ÃÓ*Ž‹"“‚fs�ŒãÔùSzó‘CdÖƒHÝΡµQTëÎÁº�mqÓÂZ•£sÔùbû=iB
|
||||
ª‘·V“bc« #“�meTQ¢ÅJeÔùS;4‘¡Š²ŽU�Q¡\ÔÆH'k‚JéXž»á+˜ÊÓÕ8‚2¼U"àê#ÒçÃØ9е�kÃÚ:�'œQ„"‘IÔø‚.ü‘�S”Ìc§"7ÊоÏRërŒâ“Á%ÚœÎÄÔúD~óÕV΢Ée’¢�VãÒÁ¸Õqräã!±�·EÔùK¾üáÁ¡i}9EiÁšë™UEã¡Lyª¥ê“áXz«9#Õ3âáõ—ȰržQ¨ Y”ÍsÌq[‘HܘaMòí2
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
Õxj·=P3cWc•T qFÜš$·D�V•ìD%C�H�ÕxS<UÖkoà“Â6±RˆÙU¢t¤.5\U¾”¡Æ+Õxj·=§B¾”ÅÄd§�‰`ɼTUÁ 9D§!ÂòR‰YÕwrw=Ï�RQÅSÂq�9aÖUÂ:²Žšè‘‚c›xIÕxS?=UàÇË�7!Tá¹mfžÌ‚B¤¥šåaâ²*ÕxK¾óS¡l£¶¸U¡,•jd¹U€‹MÉt¯U�“íZfÕxCþ²y"£0•œÓ‘Á›YñLËUÁ#Ùœ;SÁÊr§¸Õx<¾óUÁa\=GÆåáE*U·OUádÞÅhUá>&‡T»ÕxD?4åAáœ9EŒ©Á'Ú¸½UÁÅ2r[S�ªyÇqÕxb·<©ÂH×maQb␍ÅZ%ãB#h�S¢H;K)Õxbû=mAâ¹K&²«¡µÊÐ^WW¡›CÈjg“¡¦ú’ŠäÕxbû=§¡óu¹UÁ5q^ƒå�ŠÓ©ÆÝSÂ;LfŸÕw’.ýåÂÙ�PÞS¡Ó¥ÊÜ��Fär6zœA[´»M
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
уВD;3Pв2FЙXL╓Qе▌EFфFFyДD╛ Аж÷уВ-~╙Ц└╖(я;Em╕3з╣<\ёт╛K≈i╧da1s␍уЬ5~ЙЕyjX╝W╖Q▄╪Wбб≥┼хлД╒╓ЬV┐уЬ=?4ЕBрЦ2%XW╒j▌fRyUB·]iПМ╔б┴▒пн²уЬD=Еб'╒╣:еWB╔ax╫Г"tМ≈)Г║╨,Nа уВS<обьжNH9W└ыF┴ХsЦ╓*╚▒еF▐Ц╥(н/уВZШ<Wд+!ИJ²о┌*╠nEфЦ╒c√6BПоаБЭvs3уВb╩=ЕаФэБ:╓mbй]Jя-ЕЙV≈┐╧┌f535aуВZШ=о║Hl╤║зоБbСO╘Е│kJZ╦WбХu.а╒уВS=WcX°ё8j≥ц≥XПлгW╓ЗZ'кcёZ√fж╨уЬ<Ъ=WB╛$jdКД┌S╛X]на▀JяZ√ЦбРoSуЬ.>УЕ║W╓╡XW│ТlK%aЕ║.у▄ТЯ╧бл╘ь╜ж4╧Й╬Ел+MЛv_dх≈к╠.┘кЯ#╣IZAьЪ⌡Y╣
|
||||
Binary file not shown.
@@ -0,0 +1,115 @@
|
||||
# $Id: Makefile,v 1.9 2005/10/27 17:53:35 stevek Exp $
|
||||
|
||||
#
|
||||
# Makefile, based on the Asterisk Makefile, Coypright (C) 1999, Mark Spencer
|
||||
#
|
||||
# Copyright (C) 2002,2003 Junghanns.NET GmbH
|
||||
#
|
||||
# Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
#
|
||||
# This program is free software and may be modified and
|
||||
# distributed under the terms of the GNU Public License.
|
||||
#
|
||||
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
|
||||
#
|
||||
# app_conference defines which can be passed on the command-line
|
||||
#
|
||||
|
||||
DESTDIR :=
|
||||
INSTALL_MODULES_DIR := /usr/lib/asterisk/modules
|
||||
INSTALL_CONFIG_DIR := /etc/asterisk
|
||||
|
||||
ASTERISK_INCLUDE_DIR := /usr/include/asterisk
|
||||
|
||||
# turn app_conference debugging on or off ( 0 == OFF, 1 == ON )
|
||||
APP_CONFERENCE_DEBUG := 1
|
||||
|
||||
# 0 = OFF 1 = astdsp 2 = speex
|
||||
SILDET := 2
|
||||
|
||||
#
|
||||
# app_conference objects to build
|
||||
#
|
||||
|
||||
OBJS = app_conference.o conference.o member.o frame.o cli.o
|
||||
SHAREDOS = app_conference.so
|
||||
|
||||
#
|
||||
# standard compile settings
|
||||
#
|
||||
|
||||
PROC = $(shell uname -m)
|
||||
INSTALL = install
|
||||
CC = gcc
|
||||
|
||||
# skip asterisk includes if they are in /usr/include/asterisk
|
||||
ifneq ($(shell dirname $(ASTERISK_INCLUDE_DIR)), /usr/include)
|
||||
INCLUDE = -I$(ASTERISK_INCLUDE_DIR)
|
||||
endif
|
||||
|
||||
LIBS = -ldl -lpthread -lm
|
||||
DEBUG := -g
|
||||
|
||||
CFLAGS += -pipe -fPIC -Wall -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE
|
||||
|
||||
CFLAGS += $(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
|
||||
CFLAGS += -DCRYPTO
|
||||
|
||||
ifeq ($(APP_CONFERENCE_DEBUG), 1)
|
||||
CFLAGS += -DAPP_CONFERENCE_DEBUG
|
||||
endif
|
||||
|
||||
#
|
||||
# additional flag values for silence detection
|
||||
#
|
||||
|
||||
ifeq ($(SILDET), 2)
|
||||
OBJS += libspeex/preprocess.o libspeex/misc.o libspeex/smallft.o
|
||||
CFLAGS += -Ilibspeex -DSILDET=2
|
||||
endif
|
||||
|
||||
ifeq ($(SILDET), 1)
|
||||
CFLAGS += -DSILDET=1
|
||||
endif
|
||||
|
||||
OSARCH=$(shell uname -s)
|
||||
ifeq (${OSARCH},Darwin)
|
||||
SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
|
||||
else
|
||||
SOLINK=-shared -Xlinker -x
|
||||
endif
|
||||
|
||||
#
|
||||
# targets
|
||||
#
|
||||
|
||||
all: $(SHAREDOS)
|
||||
|
||||
clean:
|
||||
rm -f *.so *.o $(OBJS)
|
||||
|
||||
app_conference.so : $(OBJS)
|
||||
$(CC) -shared -Xlinker -x -o $@ $(OBJS)
|
||||
|
||||
vad_test: vad_test.o libspeex/preprocess.o libspeex/misc.o libspeex/smallft.o
|
||||
$(CC) $(PROFILE) -o $@ $^ -lm
|
||||
|
||||
install: all
|
||||
if [ ! -d ${DESTDIR}${INSTALL_MODULES_DIR} ]; then \
|
||||
$(INSTALL) -m 755 -d ${DESTDIR}${INSTALL_MODULES_DIR} ; \
|
||||
fi
|
||||
for x in $(SHAREDOS); do \
|
||||
$(INSTALL) -m 755 $$x ${DESTDIR}$(INSTALL_MODULES_DIR) ; \
|
||||
done
|
||||
cp -f *.gsm /var/lib/asterisk/sounds
|
||||
cp -f *.wav /var/lib/asterisk/sounds
|
||||
|
||||
|
||||
#config: all
|
||||
# if [ ! -d ${DESTDIR}${INSTALL_CONFIG_DIR} ]; then \
|
||||
# $(INSTALL) -m 755 -d ${DESTDIR}${INSTALL_CONFIG_DIR} ; \
|
||||
# fi
|
||||
# $(INSTALL) -m 640 conf.conf ${DESTDIR}${INSTALL_CONFIG_DIR}
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
# $Id: Makefile,v 1.9 2005/10/27 17:53:35 stevek Exp $
|
||||
|
||||
#
|
||||
# Makefile, based on the Asterisk Makefile, Coypright (C) 1999, Mark Spencer
|
||||
#
|
||||
# Copyright (C) 2002,2003 Junghanns.NET GmbH
|
||||
#
|
||||
# Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
#
|
||||
# This program is free software and may be modified and
|
||||
# distributed under the terms of the GNU Public License.
|
||||
#
|
||||
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
|
||||
#
|
||||
# app_conference defines which can be passed on the command-line
|
||||
#
|
||||
|
||||
DESTDIR :=
|
||||
INSTALL_MODULES_DIR := /usr/lib/asterisk/modules
|
||||
INSTALL_CONFIG_DIR := /etc/asterisk
|
||||
|
||||
ASTERISK_INCLUDE_DIR := /usr/include/asterisk
|
||||
|
||||
# turn app_conference debugging on or off ( 0 == OFF, 1 == ON )
|
||||
APP_CONFERENCE_DEBUG := 1
|
||||
|
||||
# 0 = OFF 1 = astdsp 2 = speex
|
||||
SILDET := 2
|
||||
|
||||
#
|
||||
# app_conference objects to build
|
||||
#
|
||||
|
||||
OBJS = app_conference.o conference.o member.o frame.o cli.o
|
||||
SHAREDOS = app_conference.so
|
||||
|
||||
#
|
||||
# standard compile settings
|
||||
#
|
||||
|
||||
PROC = $(shell uname -m)
|
||||
INSTALL = install
|
||||
CC = gcc
|
||||
|
||||
# skip asterisk includes if they are in /usr/include/asterisk
|
||||
ifneq ($(shell dirname $(ASTERISK_INCLUDE_DIR)), /usr/include)
|
||||
INCLUDE = -I$(ASTERISK_INCLUDE_DIR)
|
||||
endif
|
||||
|
||||
LIBS = -ldl -lpthread -lm
|
||||
DEBUG := -g
|
||||
|
||||
CFLAGS += -pipe -fPIC -Wall -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE
|
||||
|
||||
CFLAGS += $(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
|
||||
CFLAGS += -DCRYPTO
|
||||
|
||||
ifeq ($(APP_CONFERENCE_DEBUG), 1)
|
||||
CFLAGS += -DAPP_CONFERENCE_DEBUG
|
||||
endif
|
||||
|
||||
#
|
||||
# additional flag values for silence detection
|
||||
#
|
||||
|
||||
ifeq ($(SILDET), 2)
|
||||
OBJS += libspeex/preprocess.o libspeex/misc.o libspeex/smallft.o
|
||||
CFLAGS += -Ilibspeex -DSILDET=2
|
||||
endif
|
||||
|
||||
ifeq ($(SILDET), 1)
|
||||
CFLAGS += -DSILDET=1
|
||||
endif
|
||||
|
||||
OSARCH=$(shell uname -s)
|
||||
ifeq (${OSARCH},Darwin)
|
||||
SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
|
||||
else
|
||||
SOLINK=-shared -Xlinker -x
|
||||
endif
|
||||
|
||||
#
|
||||
# targets
|
||||
#
|
||||
|
||||
all: $(SHAREDOS)
|
||||
|
||||
clean:
|
||||
rm -f *.so *.o $(OBJS)
|
||||
|
||||
app_conference.so : $(OBJS)
|
||||
$(CC) -shared -Xlinker -x -o $@ $(OBJS)
|
||||
|
||||
vad_test: vad_test.o libspeex/preprocess.o libspeex/misc.o libspeex/smallft.o
|
||||
$(CC) $(PROFILE) -o $@ $^ -lm
|
||||
|
||||
install: all
|
||||
if [ ! -d ${DESTDIR}${INSTALL_MODULES_DIR} ]; then \
|
||||
$(INSTALL) -m 755 -d ${DESTDIR}${INSTALL_MODULES_DIR} ; \
|
||||
fi
|
||||
for x in $(SHAREDOS); do \
|
||||
$(INSTALL) -m 755 $$x ${DESTDIR}$(INSTALL_MODULES_DIR) ; \
|
||||
done
|
||||
|
||||
#config: all
|
||||
# if [ ! -d ${DESTDIR}${INSTALL_CONFIG_DIR} ]; then \
|
||||
# $(INSTALL) -m 755 -d ${DESTDIR}${INSTALL_CONFIG_DIR} ; \
|
||||
# fi
|
||||
# $(INSTALL) -m 640 conf.conf ${DESTDIR}${INSTALL_CONFIG_DIR}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Õ8šê½PRá•=:¢^
|
||||
àÜr(Ûžf�MÑ[àE8‡Á‘Õ8¢®½áƒv†G—(QE!”fÝ…ã¢Q[…¢¬O*Ö©Ôúrû<ÓHWSœ€áw“tÖ8ÜÁµDÅÆxí"IGDèÔüL4Ÿ�Ô:RŠÄ«ÁU�X¹…¢Éj¸£]‚H䋨êÔûL~ü¹âãrœãA�␍fa¡»áÖ®2·…_Á(º®9FÔù‚·<Qñ*1‚A$ŽHä_¡Ÿ+ŽUT»¡œ.Š5›Õ8¢n½a#6©y>Ü—ã�‰áL]ëRQh_¢¹ÃÓÔø‚²³…7#uG©B.Vƒ³i]‚žM†cj…¢E2•šÅÔù[vª…A¥ÑåDy«œ”Âac]ÂÖloŒÛá‚HtR©FÔùzöô‡�—ÃæHy!ÕŠ¦ð«AqŽ8¨ã!Q‡È¤Ôûc=á¡á6�áB)S�dÞU9Æáñ"<55ÅÔûc¿=ÕÁŒÛ‰ømábÛÂSc_�žÜ©äëáÂH¬UÉDÔù{7=_!1˜Ö¥•!‰S©Ô왩¸ãn:5P!kuÚëæ
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,341 @@
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
@@ -0,0 +1,121 @@
|
||||
# $Id: Makefile,v 1.9 2005/10/27 17:53:35 stevek Exp $
|
||||
|
||||
#
|
||||
# Makefile, based on the Asterisk Makefile, Coypright (C) 1999, Mark Spencer
|
||||
#
|
||||
# Copyright (C) 2002,2003 Junghanns.NET GmbH
|
||||
#
|
||||
# Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
#
|
||||
# This program is free software and may be modified and
|
||||
# distributed under the terms of the GNU Public License.
|
||||
#
|
||||
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
|
||||
#
|
||||
# app_conference defines which can be passed on the command-line
|
||||
#
|
||||
|
||||
INSTALL_PREFIX := /usr
|
||||
INSTALL_MODULES_DIR := $(INSTALL_PREFIX)/lib/asterisk/modules
|
||||
|
||||
ASTERISK_INCLUDE_DIR := $(HOME)/local/asterisk/asterisk/include
|
||||
|
||||
# turn app_conference debugging on or off ( 0 == OFF, 1 == ON )
|
||||
APP_CONFERENCE_DEBUG := 1
|
||||
|
||||
# 0 = OFF 1 = astdsp 2 = speex
|
||||
SILDET := 2
|
||||
|
||||
#
|
||||
# app_conference objects to build
|
||||
#
|
||||
|
||||
OBJS = app_conference.o conference.o member.o frame.o cli.o
|
||||
SHAREDOS = app_conference.so
|
||||
|
||||
#
|
||||
# standard compile settings
|
||||
#
|
||||
|
||||
PROC = $(shell uname -m)
|
||||
INSTALL = install
|
||||
CC = gcc
|
||||
|
||||
INCLUDE = -I$(ASTERISK_INCLUDE_DIR)
|
||||
LIBS = -ldl -lpthread -lm
|
||||
DEBUG := -g
|
||||
|
||||
CFLAGS = -pipe -fPIC -Wall -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE
|
||||
#CFLAGS += -O2
|
||||
#CFLAGS += -O3 -march=pentium3 -msse -mfpmath=sse,387 -ffast-math
|
||||
# PERF: below is 10% faster than -O2 or -O3 alone.
|
||||
#CFLAGS += -O3 -ffast-math -funroll-loops
|
||||
# below is another 5% faster or so.
|
||||
CFLAGS += -O3 -ffast-math -funroll-all-loops -fprefetch-loop-arrays -fsingle-precision-constant
|
||||
|
||||
# this is fun for PPC
|
||||
#CFLAGS += -mcpu=7450 -faltivec -mabi=altivec -mdynamic-no-pic
|
||||
|
||||
# this is fun for x86
|
||||
CFLAGS += -march=pentium3 -msse -mfpmath=sse,387
|
||||
|
||||
|
||||
# adding -msse -mfpmath=sse has little effect.
|
||||
#CFLAGS += -O3 -msse -mfpmath=sse
|
||||
#CFLAGS += $(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
|
||||
CFLAGS += $(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
|
||||
CFLAGS += -DCRYPTO
|
||||
|
||||
ifeq ($(APP_CONFERENCE_DEBUG), 1)
|
||||
CFLAGS += -DAPP_CONFERENCE_DEBUG
|
||||
endif
|
||||
|
||||
#
|
||||
# additional flag values for silence detection
|
||||
#
|
||||
|
||||
ifeq ($(SILDET), 2)
|
||||
OBJS += libspeex/preprocess.o libspeex/misc.o libspeex/smallft.o
|
||||
CFLAGS += -Ilibspeex -DSILDET=2
|
||||
endif
|
||||
|
||||
ifeq ($(SILDET), 1)
|
||||
CFLAGS += -DSILDET=1
|
||||
endif
|
||||
|
||||
OSARCH=$(shell uname -s)
|
||||
ifeq (${OSARCH},Darwin)
|
||||
SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
|
||||
else
|
||||
SOLINK=-shared -Xlinker -x
|
||||
endif
|
||||
|
||||
#
|
||||
# targets
|
||||
#
|
||||
|
||||
all: $(SHAREDOS)
|
||||
|
||||
clean:
|
||||
rm -f *.so *.o $(OBJS)
|
||||
|
||||
app_conference.so : $(OBJS)
|
||||
$(CC) -pg -shared -Xlinker -x -o $@ $(OBJS)
|
||||
|
||||
vad_test: vad_test.o libspeex/preprocess.o libspeex/misc.o libspeex/smallft.o
|
||||
$(CC) $(PROFILE) -o $@ $^ -lm
|
||||
|
||||
install: all
|
||||
for x in $(SHAREDOS); do $(INSTALL) -m 755 $$x $(INSTALL_MODULES_DIR) ; done
|
||||
cp -f *.gsm /var/lib/asterisk/sounds
|
||||
cp -f *.wav /var/lib/asterisk/sounds
|
||||
|
||||
# /var/horizon/mojo/lib/horizoncmd restart asterisk
|
||||
# make sure you restart asterisk after make install
|
||||
|
||||
# config: all
|
||||
# cp conf.conf /etc/asterisk/
|
||||
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
# $Id: Makefile,v 1.9 2005/10/27 17:53:35 stevek Exp $
|
||||
|
||||
#
|
||||
# Makefile, based on the Asterisk Makefile, Coypright (C) 1999, Mark Spencer
|
||||
#
|
||||
# Copyright (C) 2002,2003 Junghanns.NET GmbH
|
||||
#
|
||||
# Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
#
|
||||
# This program is free software and may be modified and
|
||||
# distributed under the terms of the GNU Public License.
|
||||
#
|
||||
|
||||
.EXPORT_ALL_VARIABLES:
|
||||
|
||||
#
|
||||
# app_conference defines which can be passed on the command-line
|
||||
#
|
||||
|
||||
INSTALL_PREFIX := /usr
|
||||
INSTALL_MODULES_DIR := $(INSTALL_PREFIX)/lib/asterisk/modules
|
||||
|
||||
ASTERISK_INCLUDE_DIR := $(HOME)/local/asterisk/asterisk/include
|
||||
|
||||
# turn app_conference debugging on or off ( 0 == OFF, 1 == ON )
|
||||
APP_CONFERENCE_DEBUG := 1
|
||||
|
||||
# 0 = OFF 1 = astdsp 2 = speex
|
||||
SILDET := 2
|
||||
|
||||
#
|
||||
# app_conference objects to build
|
||||
#
|
||||
|
||||
OBJS = app_conference.o conference.o member.o frame.o cli.o
|
||||
SHAREDOS = app_conference.so
|
||||
|
||||
#
|
||||
# standard compile settings
|
||||
#
|
||||
|
||||
PROC = $(shell uname -m)
|
||||
INSTALL = install
|
||||
CC = gcc
|
||||
|
||||
INCLUDE = -I$(ASTERISK_INCLUDE_DIR)
|
||||
LIBS = -ldl -lpthread -lm
|
||||
DEBUG := -g
|
||||
|
||||
CFLAGS = -pipe -Wall -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE
|
||||
#CFLAGS += -O2
|
||||
#CFLAGS += -O3 -march=pentium3 -msse -mfpmath=sse,387 -ffast-math
|
||||
# PERF: below is 10% faster than -O2 or -O3 alone.
|
||||
#CFLAGS += -O3 -ffast-math -funroll-loops
|
||||
# below is another 5% faster or so.
|
||||
CFLAGS += -O3 -ffast-math -funroll-all-loops -fprefetch-loop-arrays -fsingle-precision-constant
|
||||
|
||||
# this is fun for PPC
|
||||
#CFLAGS += -mcpu=7450 -faltivec -mabi=altivec -mdynamic-no-pic
|
||||
|
||||
# this is fun for x86
|
||||
CFLAGS += -march=pentium3 -msse -mfpmath=sse,387
|
||||
|
||||
|
||||
# adding -msse -mfpmath=sse has little effect.
|
||||
#CFLAGS += -O3 -msse -mfpmath=sse
|
||||
#CFLAGS += $(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
|
||||
CFLAGS += $(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
|
||||
CFLAGS += -DCRYPTO
|
||||
|
||||
ifeq ($(APP_CONFERENCE_DEBUG), 1)
|
||||
CFLAGS += -DAPP_CONFERENCE_DEBUG
|
||||
endif
|
||||
|
||||
#
|
||||
# additional flag values for silence detection
|
||||
#
|
||||
|
||||
ifeq ($(SILDET), 2)
|
||||
OBJS += libspeex/preprocess.o libspeex/misc.o libspeex/smallft.o
|
||||
CFLAGS += -Ilibspeex -DSILDET=2
|
||||
endif
|
||||
|
||||
ifeq ($(SILDET), 1)
|
||||
CFLAGS += -DSILDET=1
|
||||
endif
|
||||
|
||||
OSARCH=$(shell uname -s)
|
||||
ifeq (${OSARCH},Darwin)
|
||||
SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
|
||||
else
|
||||
SOLINK=-shared -Xlinker -x
|
||||
endif
|
||||
|
||||
#
|
||||
# targets
|
||||
#
|
||||
|
||||
all: $(SHAREDOS)
|
||||
|
||||
clean:
|
||||
rm -f *.so *.o $(OBJS)
|
||||
|
||||
app_conference.so : $(OBJS)
|
||||
$(CC) -pg -shared -Xlinker -x -o $@ $(OBJS)
|
||||
|
||||
vad_test: vad_test.o libspeex/preprocess.o libspeex/misc.o libspeex/smallft.o
|
||||
$(CC) $(PROFILE) -o $@ $^ -lm
|
||||
|
||||
install: all
|
||||
for x in $(SHAREDOS); do $(INSTALL) -m 755 $$x $(INSTALL_MODULES_DIR) ; done
|
||||
cp -f *.gsm /var/lib/asterisk/sounds
|
||||
cp -f *.wav /var/lib/asterisk/sounds
|
||||
|
||||
# /var/horizon/mojo/lib/horizoncmd restart asterisk
|
||||
# make sure you restart asterisk after make install
|
||||
|
||||
# config: all
|
||||
# cp conf.conf /etc/asterisk/
|
||||
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
app_conference is a channel-independent conference application.
|
||||
|
||||
Design goals
|
||||
It has several design goals which are different than meetme:
|
||||
|
||||
* It does not require a zap channel for timing.
|
||||
* It is very efficient when used with channels which support DTX (silence
|
||||
detection/discontinuous transmission).
|
||||
|
||||
* It can do VAD on channels which do not support DTX (although this
|
||||
is more expensive than just mixing them, but less expensive then
|
||||
encoding; therefore it might still be a win).
|
||||
* It presents messages on the Monitor interface for determine which
|
||||
speakers are active.
|
||||
|
||||
|
||||
I believe that people other than myself are using this, but my environment is
|
||||
pretty rigid, and cases outside of this aren't tested:
|
||||
|
||||
* Some callers come from the PSTN via IAX2 from a box with Zaptel cards,
|
||||
via uLaw.
|
||||
* Other callers come from iaxclient based softphones using speex
|
||||
(was GSM) via IAX2 (with DTX).
|
||||
* Some conferences have a single SIP channel which listens in GSM.
|
||||
|
||||
|
||||
Mixing design
|
||||
|
||||
* Minimize encoding/decoding, minimize mixing.
|
||||
* Minimize generational loss from trancoding.
|
||||
* Usual cases are handled very efficiently:
|
||||
o One speaker: That speaker's frame is sent directly to each
|
||||
participant which uses the same codec. It is trancoded
|
||||
_once_ for each additional codec type used by participants.
|
||||
o Two speakers: Each speaker gets the other speaker's frames.
|
||||
The two speaker's frames are decoded and mixed, and then
|
||||
encoded _once_ for each codec type used by participants.
|
||||
|
||||
|
||||
License
|
||||
Naturally, app_conference is GPL. The CVS also includes parts of libspeex,
|
||||
which is distributed under it's a BSD-style license.
|
||||
|
||||
Getting app_conference
|
||||
app_conference is available from the 'iaxclient' project on sourceforge:
|
||||
|
||||
* CVS browse: http://iaxclient.cvs.sourceforge.net/iaxclient/app_conference/
|
||||
* Project page: http://sourceforge.net/projects/iaxclient/
|
||||
|
||||
|
||||
Compiling app_conference
|
||||
|
||||
* just like any other asterisk application.
|
||||
* Some makefile fiddling may be necessary
|
||||
|
||||
|
||||
Using app_conference
|
||||
There is no configuration file. Conferences are created on-the-fly.
|
||||
|
||||
Dialplan syntax: Conference(ConferenceName|Flags|Priority[|VADSTART|VADCONTINUE])
|
||||
|
||||
* ConferenceName: Whatever you want to name the conference
|
||||
* Flags one of more of the following:
|
||||
o M: Moderator (presently same as speaker)
|
||||
o S: Speaker
|
||||
o L: Listener
|
||||
o T: "Telephone caller" (just for stats?).
|
||||
o V: Do VAD on this caller
|
||||
o D: Use Denoise filter on this caller.
|
||||
o d: Send manager events when DTMF is received.
|
||||
o q: Do not play enter or exit sounds.
|
||||
o i: use inband dtmf broadcast.
|
||||
o t: use rfc dtmf signal broadcast.
|
||||
* Priority: Currently ignored; was to be a "speaking priority" so a
|
||||
higher priority caller could "override" others.
|
||||
* VADSTART: Optional: "probability" to use to detect start of speech.
|
||||
* VADCONTINUE: Optional: "probability" to use to detect continuation
|
||||
of speech.
|
||||
|
||||
|
||||
Features / CLI/Manager Commands
|
||||
|
||||
* conference debug <conference_name> [ on | off ]
|
||||
enable debugging for a conference
|
||||
|
||||
* conference show stats show conference stats
|
||||
|
||||
* conference play sound <channel-id> <sound-file> [mute]
|
||||
play a sound to a conference member, optionally muting them.
|
||||
|
||||
Manager Events
|
||||
app_conference generates several detailed manager events so that applications
|
||||
interfacing with the manager API can monitor conferences:
|
||||
|
||||
* ConferenceState: sent as members begin/end speaking.
|
||||
Channel: The channel
|
||||
State: "speaking" or "silent"
|
||||
|
||||
* ConferenceDTMF: sent when conference members send DTMF to the conference
|
||||
Channel: The channel
|
||||
Key: The DTMF key send [0-9*#]
|
||||
|
||||
* ConferenceSoundComplete: send when the conference has finished playing
|
||||
a sound to a user
|
||||
Channel: The channel
|
||||
Sound: The first 255 bytes of the file requested in conference play
|
||||
sound CLI/Mgr command.
|
||||
|
||||
|
||||
Benchmarking
|
||||
It would be nice to have solid benchmarks to present, but a good size
|
||||
machine should be able to handle many callers when either (a) they are
|
||||
using DTX, or (b) they are listen-only. It's used often with hundreds of
|
||||
simultaneous callers.
|
||||
|
||||
Discussion
|
||||
The iaxclient-devel mailing list is probably as good a place as any to discuss.
|
||||
|
||||
|
||||
---
|
||||
|
||||
app_conference is brought to you by the letter q, and the number e
|
||||
|
||||
|
||||
Matt Florell Changes for VD_app_conference tarball version. In order to use this
|
||||
as seemlessly as possible for VICIDIAL it was necessary to modify the code. This
|
||||
module can now be used in place of using meetme for VICIDIAL. This is
|
||||
experimental, please test thoroughly before putting it in production.
|
||||
|
||||
CHANGES MADE FOR VICIDIAL:
|
||||
|
||||
- Default to member type of S instead of L
|
||||
- Commented out many repetative NOTICEs and ERRORs
|
||||
- Added entry and exit sounds except for Local/786 and Local/8500998 (VDsilent and DTMFapp)
|
||||
- Added conf-onlyperson mesage to first conference participant
|
||||
- Included enter.gsm and leave.gsm files as well as DTMF wav and gsm sounds
|
||||
- Removed restart from "make install" and added audio file copying
|
||||
- If no 'd' option is set and DTMF frames are detected, the DTMF audio will be played to the member
|
||||
- Added 'q' flag to prevent playing of entry/exit sounds
|
||||
- Added 'i' flag to enable playing of DTMF sounds inband to all members
|
||||
- Added 't' flag to enable sending of RFC DTMF signals to all members
|
||||
- Changed delimiter to pipe | from slash / to be more compliant with meetme standards
|
||||
|
||||
|
||||
NOTE TO 64-BIT LINUX USERS:
|
||||
If you have problems with 64-bit Linux please use the included 64_Makefile instead of the default one.
|
||||
|
||||
COMPILE NOTES:
|
||||
|
||||
Some Makefile alterations may be necessary for your system:
|
||||
|
||||
From Alek Barkley:
|
||||
I am running FC4 with latest updates ( 2.6.16 kernel )
|
||||
My CPU is AMD K6 and GCC 4.0.2.
|
||||
|
||||
I edited Makefile in app_conference distribution.
|
||||
To enter CPU architecture in my case -march=k6
|
||||
========================================================
|
||||
PROC = k6
|
||||
# this is fun for x86
|
||||
#CFLAGS += -march=pentium3 -msse -mfpmath=sse,387
|
||||
CFLAGS += -march=k6
|
||||
===========================================================
|
||||
|
||||
|
||||
VD_app_conference CHANGELOG
|
||||
- Release 0.4 - First VICIDIAL-centric release
|
||||
- Release 0.5 - Fixed the dtmf broadcast logic and a star/hash bug
|
||||
- Added 64-bit makefile thanks to Jon Hood
|
||||
- Release 0.6 - Added Makefile notes and changed some Makefile flags
|
||||
@@ -0,0 +1,86 @@
|
||||
VICIDIAL and app_conference
|
||||
(1.2 tree) EXPERIMENTAL!!!
|
||||
|
||||
app_conference offers the plusses of being able to do conferencing
|
||||
without any zaptel hardware or timers as well as doing native codec
|
||||
streaming, meaning no manditory downsampling to slin like meetme.
|
||||
These two features alone mean a rather significant performance boost
|
||||
to companies who only use VOIP for agents and trunks as well as not
|
||||
requiring the cost of zaptel hardware or the nightmare of getting
|
||||
ztdummy to work on some systems.
|
||||
|
||||
As of right now, I have a test system fully up and running using
|
||||
app_conference with VICIDIAL on Asterisk 1.2.8. I have made several
|
||||
modifications to the app_conference code to make it more of a drop-in
|
||||
replacement for meetme so that it does not require any changes to the
|
||||
VICIDIAL codebase. I have added entry and exit sounds(slightly
|
||||
different from meetme's) as well as "only one in this conference"
|
||||
message in addition to changing the default member type to speaker(S).
|
||||
So far I have tested with IAX and SIP channels only and everything
|
||||
works just like on meetme but I have not done any capacity testing or
|
||||
tested it in production yet.
|
||||
|
||||
If you want to use app_conference instead of meetme for VICIDIAL then follow these instructions:
|
||||
|
||||
cd /usr/src/asterisk
|
||||
wget http://www.eflo.net/files/VD_app_conference_0.6.zip
|
||||
unzip VD_app_conference_0.6.zip
|
||||
cd app_conference
|
||||
make clean
|
||||
make
|
||||
make install
|
||||
|
||||
|
||||
In your extensions.conf file you would replace these lines:
|
||||
exten => 8600051,1,Meetme,8600051
|
||||
exten => 8600052,1,Meetme,8600052
|
||||
...continue through 8600100...
|
||||
exten => 78600051,1,Meetme,8600051|q
|
||||
exten => 78600052,1,Meetme,8600052|q
|
||||
...continue through 78600100...
|
||||
exten => 68600051,1,Meetme,8600051|mq
|
||||
exten => 68600052,1,Meetme,8600052|mq
|
||||
...continue through 68600100...
|
||||
|
||||
|
||||
with these lines:
|
||||
exten => 8600051,1,Conference(8600051)
|
||||
exten => 8600052,1,Conference(8600052)
|
||||
...continue through 8600100...
|
||||
exten => 78600051,1,Conference(8600051|q)
|
||||
exten => 78600052,1,Conference(8600052|q)
|
||||
...continue through 78600100...
|
||||
exten => 68600051,1,Conference(8600051|Lq)
|
||||
exten => 68600052,1,Conference(8600052|Lq)
|
||||
...continue through 68600100...
|
||||
|
||||
NOTES:
|
||||
Here are the possible feature flags for this version of app_conference:
|
||||
o M: Moderator (presently same as speaker) [default]
|
||||
o S: Speaker
|
||||
o L: Listener
|
||||
o T: "Telephone caller" (just for stats?).
|
||||
o V: Do VAD on this caller
|
||||
o D: Use Denoise filter on this caller.
|
||||
o d: Send manager events when DTMF is received.
|
||||
o q: Do not play enter or exit sounds.
|
||||
o i: use inband dtmf broadcast.
|
||||
o t: use rfc dtmf signal broadcast.
|
||||
|
||||
COMPILE NOTES:
|
||||
|
||||
Some Makefile alterations may be necessary for your system:
|
||||
|
||||
From Alek Barkley:
|
||||
I am running FC4 with latest updates ( 2.6.16 kernel )
|
||||
My CPU is AMD K6 and GCC 4.0.2.
|
||||
|
||||
I edited Makefile in app_conference distribution.
|
||||
To enter CPU architecture in my case -march=k6
|
||||
========================================================
|
||||
PROC = k6
|
||||
# this is fun for x86
|
||||
#CFLAGS += -march=pentium3 -msse -mfpmath=sse,387
|
||||
CFLAGS += -march=k6
|
||||
===========================================================
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
|
||||
// $Id: app_conference.c,v 1.22 2005/10/26 21:02:07 stevek Exp $
|
||||
|
||||
/*
|
||||
* app_conference
|
||||
*
|
||||
* A channel independent conference application for Asterisk
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Junghanns.NET GmbH
|
||||
* Copyright (C) 2003, 2004 HorizonLive.com, Inc.
|
||||
*
|
||||
* Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
*
|
||||
* This program may be modified and distributed under the
|
||||
* terms of the GNU Public License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "app_conference.h"
|
||||
#include "common.h"
|
||||
|
||||
/*
|
||||
|
||||
a conference has n + 1 threads, where n is the number of
|
||||
members and 1 is a conference thread which sends audio
|
||||
back to the members.
|
||||
|
||||
each member thread reads frames from the channel and
|
||||
add's them to the member's frame queue.
|
||||
|
||||
the conference thread reads frames from each speaking members
|
||||
queue, mixes them, and then re-queues them for the member thread
|
||||
to send back to the user.
|
||||
|
||||
*/
|
||||
|
||||
//
|
||||
// app_conference text descriptions
|
||||
//
|
||||
|
||||
static char *tdesc = "Channel Independent Conference Application" ;
|
||||
static char *app = "Conference" ;
|
||||
static char *synopsis = "Channel Independent Conference" ;
|
||||
static char *descrip = " Conference(): returns 0\n"
|
||||
"if the user exits with the '#' key, or -1 if the user hangs up.\n" ;
|
||||
|
||||
//
|
||||
// functions defined in asterisk/module.h
|
||||
//
|
||||
|
||||
STANDARD_LOCAL_USER ;
|
||||
LOCAL_USER_DECL;
|
||||
|
||||
int unload_module( void )
|
||||
{
|
||||
ast_log( LOG_NOTICE, "unloading app_conference module\n" ) ;
|
||||
|
||||
STANDARD_HANGUP_LOCALUSERS ; // defined in asterisk/module.h
|
||||
|
||||
// register conference cli functions
|
||||
unregister_conference_cli() ;
|
||||
|
||||
return ast_unregister_application( app ) ;
|
||||
}
|
||||
|
||||
int load_module( void )
|
||||
{
|
||||
ast_log( LOG_NOTICE, "loading app_conference module [ $Revision: 1.22 $ ]\n" ) ;
|
||||
|
||||
// intialize conference
|
||||
init_conference() ;
|
||||
|
||||
// register conference cli functions
|
||||
register_conference_cli() ;
|
||||
|
||||
return ast_register_application( app, app_conference_main, synopsis, descrip ) ;
|
||||
}
|
||||
|
||||
char *description( void )
|
||||
{
|
||||
return tdesc ;
|
||||
}
|
||||
|
||||
int usecount( void )
|
||||
{
|
||||
int res;
|
||||
STANDARD_USECOUNT( res ) ; // defined in asterisk/module.h
|
||||
return res;
|
||||
}
|
||||
|
||||
char *key()
|
||||
{
|
||||
return ASTERISK_GPL_KEY ;
|
||||
}
|
||||
|
||||
//
|
||||
// main app_conference function
|
||||
//
|
||||
|
||||
int app_conference_main( struct ast_channel* chan, void* data )
|
||||
{
|
||||
int res = 0 ;
|
||||
struct localuser *u ;
|
||||
|
||||
// defined in asterisk/module.h
|
||||
LOCAL_USER_ADD( u ) ;
|
||||
|
||||
// call member thread function
|
||||
res = member_exec( chan, data ) ;
|
||||
|
||||
// defined in asterisk/module.h
|
||||
LOCAL_USER_REMOVE( u ) ;
|
||||
|
||||
return res ;
|
||||
}
|
||||
|
||||
//
|
||||
// utility functions
|
||||
//
|
||||
|
||||
// now returns milliseconds
|
||||
long usecdiff( struct timeval* timeA, struct timeval* timeB )
|
||||
{
|
||||
long a_secs = timeA->tv_sec - timeB->tv_sec ;
|
||||
long b_secs = (long)( timeA->tv_usec / 1000 ) - (long)( timeB->tv_usec / 1000 ) ;
|
||||
long u_secs = ( a_secs * 1000 ) + b_secs ;
|
||||
return u_secs ;
|
||||
}
|
||||
|
||||
// increment a timeval by ms milliseconds
|
||||
void add_milliseconds( struct timeval* tv, long ms )
|
||||
{
|
||||
// add the microseconds to the microseconds field
|
||||
tv->tv_usec += ( ms * 1000 ) ;
|
||||
|
||||
// calculate the number of seconds to increment
|
||||
long s = ( tv->tv_usec / 1000000 ) ;
|
||||
|
||||
// adjust the microsends field
|
||||
if ( s > 0 ) tv->tv_usec -= ( s * 1000000 ) ;
|
||||
|
||||
// increment the seconds field
|
||||
tv->tv_sec += s ;
|
||||
|
||||
return ;
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
|
||||
// $Id: app_conference.h,v 1.11 2005/12/16 22:31:58 stevek Exp $
|
||||
|
||||
/*
|
||||
* app_conference
|
||||
*
|
||||
* A channel independent conference application for Asterisk
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Junghanns.NET GmbH
|
||||
* Copyright (C) 2003, 2004 HorizonLive.com, Inc.
|
||||
*
|
||||
* Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
*
|
||||
* This program may be modified and distributed under the
|
||||
* terms of the GNU Public License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ASTERISK_CONF_H
|
||||
#define _ASTERISK_CONF_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* asterisk includes */
|
||||
#include <asterisk/pbx.h>
|
||||
#include <asterisk/module.h>
|
||||
#include <asterisk/logger.h>
|
||||
#include <asterisk/lock.h>
|
||||
#include <asterisk/frame.h>
|
||||
#include <asterisk/manager.h>
|
||||
#include <asterisk/dsp.h>
|
||||
#include <asterisk/translate.h>
|
||||
#include <asterisk/channel.h>
|
||||
#include <asterisk/file.h>
|
||||
#include <asterisk/cli.h>
|
||||
|
||||
/* standard includes */
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#if (SILDET == 2)
|
||||
#include "libspeex/speex_preprocess.h"
|
||||
#endif
|
||||
|
||||
//
|
||||
// app_conference defines
|
||||
//
|
||||
|
||||
// debug logging level
|
||||
|
||||
// LOG_NOTICE for debugging, LOG_DEBUG for production
|
||||
#ifdef APP_CONFERENCE_DEBUG
|
||||
#define AST_CONF_DEBUG LOG_NOTICE
|
||||
#else
|
||||
#define AST_CONF_DEBUG LOG_DEBUG
|
||||
#endif
|
||||
|
||||
//
|
||||
// feature defines
|
||||
//
|
||||
|
||||
// number of times the last non-silent frame should be
|
||||
// repeated after silence starts
|
||||
//#define AST_CONF_CACHE_LAST_FRAME 1
|
||||
|
||||
//
|
||||
// debug defines
|
||||
//
|
||||
|
||||
#define DEBUG_USE_TIMELOG
|
||||
|
||||
#define DEBUG_FRAME_TIMESTAMPS
|
||||
|
||||
// #define DEBUG_OUTPUT_PCM
|
||||
|
||||
//
|
||||
// !!! THESE CONSTANTS SHOULD BE CLEANED UP AND CLARIFIED !!!
|
||||
//
|
||||
|
||||
//
|
||||
// sample information for AST_FORMAT_SLINEAR format
|
||||
//
|
||||
|
||||
#define AST_CONF_SAMPLE_RATE 8000
|
||||
#define AST_CONF_SAMPLE_SIZE 16
|
||||
#define AST_CONF_FRAME_INTERVAL 20
|
||||
|
||||
//
|
||||
// so, since we cycle approximately every 20ms,
|
||||
// we can compute the following values:
|
||||
//
|
||||
// 160 samples per 20 ms frame -or-
|
||||
// ( 8000 samples-per-second * ( 20 ms / 1000 ms-per-second ) ) = 160 samples
|
||||
//
|
||||
// 320 bytes ( 2560 bits ) of data 20 ms frame -or-
|
||||
// ( 160 samples * 16 bits-per-sample / 8 bits-per-byte ) = 320 bytes
|
||||
//
|
||||
|
||||
// 160 samples 16-bit signed linear
|
||||
#define AST_CONF_BLOCK_SAMPLES 160
|
||||
|
||||
// 2 bytes per sample ( i.e. 16-bit )
|
||||
#define AST_CONF_BYTES_PER_SAMPLE 2
|
||||
|
||||
// 320 bytes for each 160 sample frame of 16-bit audio
|
||||
#define AST_CONF_FRAME_DATA_SIZE 320
|
||||
|
||||
// 1000 ms-per-second / 20 ms-per-frame = 50 frames-per-second
|
||||
#define AST_CONF_FRAMES_PER_SECOND ( 1000 / AST_CONF_FRAME_INTERVAL )
|
||||
|
||||
|
||||
//
|
||||
// buffer and queue values
|
||||
//
|
||||
|
||||
// account for friendly offset when allocating buffer for frame
|
||||
#define AST_CONF_BUFFER_SIZE ( AST_CONF_FRAME_DATA_SIZE + AST_FRIENDLY_OFFSET )
|
||||
|
||||
// maximum number of frames queued per member
|
||||
#define AST_CONF_MAX_QUEUE 100
|
||||
|
||||
// minimum number of frames queued per member
|
||||
#define AST_CONF_MIN_QUEUE 0
|
||||
|
||||
// number of queued frames before we start dropping
|
||||
#define AST_CONF_QUEUE_DROP_THRESHOLD 4
|
||||
|
||||
// number of milliseconds between frame drops
|
||||
#define AST_CONF_QUEUE_DROP_TIME_LIMIT 750
|
||||
|
||||
//
|
||||
// timer and sleep values
|
||||
//
|
||||
|
||||
// milliseconds we're willing to wait for a channel
|
||||
// event before we check for outgoing frames
|
||||
#define AST_CONF_WAITFOR_LATENCY 40
|
||||
|
||||
// milliseconds to sleep before trying to process frames
|
||||
#define AST_CONF_CONFERENCE_SLEEP 40
|
||||
|
||||
// milliseconds to wait between state notification updates
|
||||
#define AST_CONF_NOTIFICATION_SLEEP 500
|
||||
|
||||
//
|
||||
// warning threshold values
|
||||
//
|
||||
|
||||
// number of frames behind before warning
|
||||
#define AST_CONF_OUTGOING_FRAMES_WARN 50
|
||||
|
||||
// number of milliseconds off AST_CONF_FRAME_INTERVAL before warning
|
||||
#define AST_CONF_INTERVAL_WARNING 1000
|
||||
|
||||
//
|
||||
// silence detection values
|
||||
//
|
||||
|
||||
// toggle silence detection
|
||||
#define ENABLE_SILENCE_DETECTION 1
|
||||
|
||||
// silence threshold
|
||||
#define AST_CONF_SILENCE_THRESHOLD 128
|
||||
|
||||
// speech tail (delay before dropping silent frames, in ms.
|
||||
// #define AST_CONF_SPEECH_TAIL 180
|
||||
|
||||
// number of frames to ignore speex_preprocess() after speech detected
|
||||
#define AST_CONF_SKIP_SPEEX_PREPROCESS 20
|
||||
|
||||
// our speex probability values
|
||||
#define AST_CONF_PROB_START 0.05
|
||||
#define AST_CONF_PROB_CONTINUE 0.02
|
||||
|
||||
//
|
||||
// format translation values
|
||||
//
|
||||
|
||||
// AST_FORMAT_MAX_AUDIO is 1 << 15, so we support 0..15
|
||||
#define AC_SUPPORTED_FORMATS 16
|
||||
#define AC_SLINEAR_INDEX 6
|
||||
|
||||
//
|
||||
// app_conference functions
|
||||
//
|
||||
|
||||
// main module function
|
||||
int app_conference_main( struct ast_channel* chan, void* data ) ;
|
||||
|
||||
// utility functions
|
||||
long usecdiff( struct timeval* timeA, struct timeval* timeB ) ;
|
||||
void add_milliseconds( struct timeval* tv, long ms ) ;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,332 @@
|
||||
|
||||
// $Id: cli.c,v 1.6 2005/12/21 21:34:50 stevek Exp $
|
||||
|
||||
/*
|
||||
* app_conference
|
||||
*
|
||||
* A channel independent conference application for Asterisk
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Junghanns.NET GmbH
|
||||
* Copyright (C) 2003, 2004 HorizonLive.com, Inc.
|
||||
*
|
||||
* Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
*
|
||||
* This program may be modified and distributed under the
|
||||
* terms of the GNU Public License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "cli.h"
|
||||
|
||||
//
|
||||
// debug functions
|
||||
//
|
||||
|
||||
static char conference_debug_usage[] =
|
||||
"usage: conference debug <conference_name> [ on | off ]\n"
|
||||
" enable debugging for a conference\n"
|
||||
;
|
||||
|
||||
static struct ast_cli_entry cli_debug = {
|
||||
{ "conference", "debug", NULL },
|
||||
conference_debug,
|
||||
"enable debugging for a conference",
|
||||
conference_debug_usage
|
||||
} ;
|
||||
|
||||
|
||||
int conference_debug( int fd, int argc, char *argv[] )
|
||||
{
|
||||
if ( argc < 3 )
|
||||
return RESULT_SHOWUSAGE ;
|
||||
|
||||
// get the conference name
|
||||
const char* name = argv[2] ;
|
||||
|
||||
// get the new state
|
||||
int state = 0 ;
|
||||
|
||||
if ( argc == 3 )
|
||||
{
|
||||
// no state specified, so toggle it
|
||||
state = -1 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( strncasecmp( name, "YES", 4 ) == 0 )
|
||||
state = 1 ;
|
||||
else if ( strncasecmp( name, "NO", 3 ) == 0 )
|
||||
state = 0 ;
|
||||
else
|
||||
return RESULT_SHOWUSAGE ;
|
||||
}
|
||||
|
||||
int new_state = set_conference_debugging( name, state ) ;
|
||||
|
||||
if ( new_state == 1 )
|
||||
{
|
||||
ast_cli( fd, "enabled conference debugging, name => %s, new_state => %d\n",
|
||||
name, new_state ) ;
|
||||
}
|
||||
else if ( new_state == 0 )
|
||||
{
|
||||
ast_cli( fd, "disabled conference debugging, name => %s, new_state => %d\n",
|
||||
name, new_state ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// error setting state
|
||||
ast_cli( fd, "\nunable to set debugging state, name => %s\n\n", name ) ;
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS ;
|
||||
}
|
||||
|
||||
//
|
||||
// stats functions
|
||||
//
|
||||
|
||||
static char conference_show_stats_usage[] =
|
||||
"usage: conference show stats\n"
|
||||
" display stats for active conferences.\n"
|
||||
;
|
||||
|
||||
static struct ast_cli_entry cli_show_stats = {
|
||||
{ "conference", "show", "stats", NULL },
|
||||
conference_show_stats,
|
||||
"show conference stats",
|
||||
conference_show_stats_usage
|
||||
} ;
|
||||
|
||||
int conference_show_stats( int fd, int argc, char *argv[] )
|
||||
{
|
||||
if ( argc < 3 )
|
||||
return RESULT_SHOWUSAGE ;
|
||||
|
||||
// get count of active conferences
|
||||
int count = get_conference_count() ;
|
||||
|
||||
ast_cli( fd, "\n\nCONFERENCE STATS, ACTIVE( %d )\n\n", count ) ;
|
||||
|
||||
// if zero, go no further
|
||||
if ( count <= 0 )
|
||||
return RESULT_SUCCESS ;
|
||||
|
||||
//
|
||||
// get the conference stats
|
||||
//
|
||||
|
||||
// array of stats structs
|
||||
ast_conference_stats stats[ count ] ;
|
||||
|
||||
// get stats structs
|
||||
count = get_conference_stats( stats, count ) ;
|
||||
|
||||
// make sure we were able to fetch some
|
||||
if ( count <= 0 )
|
||||
{
|
||||
ast_cli( fd, "!!! error fetching conference stats, available => %d !!!\n", count ) ;
|
||||
return RESULT_SUCCESS ;
|
||||
}
|
||||
|
||||
//
|
||||
// output the conference stats
|
||||
//
|
||||
|
||||
// output header
|
||||
ast_cli( fd, "%-20.20s %-40.40s %-40.40s\n", "Name", "Connection Type", "Member Type" ) ;
|
||||
ast_cli( fd, "%-20.20s %-40.40s %-40.40s\n", "----", "---------------", "-----------" ) ;
|
||||
|
||||
ast_conference_stats* s = NULL ;
|
||||
|
||||
char ct[64] ;
|
||||
char mt[64] ;
|
||||
|
||||
int i;
|
||||
for ( i = 0 ; i < count ; ++i )
|
||||
{
|
||||
s = &(stats[i]) ;
|
||||
|
||||
// format connection type
|
||||
snprintf( ct, 40, "phone( %d ), iax( %d ), sip( %d )",
|
||||
s->phone, s->iaxclient, s->sip ) ;
|
||||
|
||||
// format memeber type
|
||||
snprintf( mt, 40, "moderators( %d ), listeners( %d )",
|
||||
s->moderators, s->listeners ) ;
|
||||
|
||||
// output this conferences stats
|
||||
ast_cli( fd, "%-20.20s %-40.40s %-40.40s\n", (char*)( &(s->name) ), ct, mt ) ;
|
||||
}
|
||||
|
||||
ast_cli( fd, "\n" ) ;
|
||||
|
||||
//
|
||||
// drill down to specific stats
|
||||
//
|
||||
|
||||
if ( argc == 4 )
|
||||
{
|
||||
// show stats for a particular conference
|
||||
conference_show_stats_name( fd, argv[3] ) ;
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS ;
|
||||
}
|
||||
|
||||
int conference_show_stats_name( int fd, const char* name )
|
||||
{
|
||||
// not implemented yet
|
||||
return RESULT_SUCCESS ;
|
||||
}
|
||||
|
||||
//
|
||||
// play sound
|
||||
//
|
||||
|
||||
static char conference_play_sound_usage[] =
|
||||
"usage: conference play sound <channel-id> <sound-file> [mute]\n"
|
||||
" play sound <sound-file> to conference member <channel-id>.\n"
|
||||
" mute the channel if 'mute' is present.\n"
|
||||
;
|
||||
|
||||
static struct ast_cli_entry cli_play_sound = {
|
||||
{ "conference", "play", "sound", NULL },
|
||||
conference_play_sound,
|
||||
"play a sound to a conference member",
|
||||
conference_play_sound_usage
|
||||
} ;
|
||||
|
||||
int conference_play_sound( int fd, int argc, char *argv[] )
|
||||
{
|
||||
char *channel, *file;
|
||||
int mute = 0;
|
||||
struct ast_conf_member *member;
|
||||
struct ast_conf_soundq *newsound;
|
||||
struct ast_conf_soundq **q;
|
||||
|
||||
if ( argc < 5 )
|
||||
return RESULT_SHOWUSAGE ;
|
||||
|
||||
channel = argv[3];
|
||||
file = argv[4];
|
||||
|
||||
if(argc > 5 && !strcmp(argv[5], "mute"))
|
||||
mute = 1;
|
||||
|
||||
|
||||
member = find_member(channel, 1);
|
||||
if(!member) {
|
||||
ast_cli(fd, "Member %s not found\n", channel);
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
|
||||
newsound = calloc(1,sizeof(struct ast_conf_soundq));
|
||||
newsound->stream = ast_openstream(member->chan, file, NULL);
|
||||
if(!newsound->stream) {
|
||||
ast_cli(fd, "Sound %s not found\n", file);
|
||||
free(newsound);
|
||||
ast_mutex_unlock(&member->lock);
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
member->chan->stream = NULL;
|
||||
|
||||
newsound->muted = mute;
|
||||
ast_copy_string(newsound->name, file, sizeof(newsound->name));
|
||||
|
||||
// append sound to the end of the list.
|
||||
for(q=&member->soundq; *q; q = &((*q)->next)) ;;
|
||||
|
||||
*q = newsound;
|
||||
|
||||
ast_mutex_unlock(&member->lock);
|
||||
|
||||
ast_cli( fd, "Playing sound %s to member %s %s\n",
|
||||
file, channel, mute ? "with mute" : "");
|
||||
|
||||
|
||||
return RESULT_SUCCESS ;
|
||||
}
|
||||
|
||||
//
|
||||
// stop sounds
|
||||
//
|
||||
|
||||
static char conference_stop_sounds_usage[] =
|
||||
"usage: conference stop sounds <channel-id>\n"
|
||||
" stop sounds for conference member <channel-id>.\n"
|
||||
;
|
||||
|
||||
static struct ast_cli_entry cli_stop_sounds = {
|
||||
{ "conference", "stop", "sounds", NULL },
|
||||
conference_stop_sounds,
|
||||
"stop sounds for a conference member",
|
||||
conference_stop_sounds_usage
|
||||
} ;
|
||||
|
||||
int conference_stop_sounds( int fd, int argc, char *argv[] )
|
||||
{
|
||||
char *channel;
|
||||
struct ast_conf_member *member;
|
||||
struct ast_conf_soundq *sound;
|
||||
struct ast_conf_soundq *next;
|
||||
|
||||
if ( argc < 4 )
|
||||
return RESULT_SHOWUSAGE ;
|
||||
|
||||
channel = argv[3];
|
||||
|
||||
member = find_member(channel, 1);
|
||||
if(!member) {
|
||||
ast_cli(fd, "Member %s not found\n", channel);
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// clear all sounds
|
||||
sound = member->soundq;
|
||||
member->soundq = NULL;
|
||||
|
||||
while(sound) {
|
||||
next = sound->next;
|
||||
ast_closestream(sound->stream);
|
||||
free(sound);
|
||||
sound = next;
|
||||
}
|
||||
|
||||
// reset write format, since we're done playing the sound
|
||||
if ( ast_set_write_format( member->chan, member->write_format ) < 0 )
|
||||
{
|
||||
ast_log( LOG_ERROR, "unable to set write format to %d\n",
|
||||
member->write_format ) ;
|
||||
}
|
||||
|
||||
ast_mutex_unlock(&member->lock);
|
||||
|
||||
ast_cli( fd, "Stopped sounds to member %s\n", channel);
|
||||
|
||||
|
||||
return RESULT_SUCCESS ;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// cli initialization function
|
||||
//
|
||||
|
||||
void register_conference_cli( void )
|
||||
{
|
||||
ast_cli_register( &cli_debug ) ;
|
||||
ast_cli_register( &cli_show_stats ) ;
|
||||
ast_cli_register( &cli_play_sound ) ;
|
||||
ast_cli_register( &cli_stop_sounds ) ;
|
||||
}
|
||||
|
||||
void unregister_conference_cli( void )
|
||||
{
|
||||
ast_cli_unregister( &cli_debug ) ;
|
||||
ast_cli_unregister( &cli_show_stats ) ;
|
||||
ast_cli_unregister( &cli_play_sound ) ;
|
||||
ast_cli_unregister( &cli_stop_sounds ) ;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
// $Id: cli.h,v 1.3 2005/10/26 21:02:07 stevek Exp $
|
||||
|
||||
/*
|
||||
* app_conference
|
||||
*
|
||||
* A channel independent conference application for Asterisk
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Junghanns.NET GmbH
|
||||
* Copyright (C) 2003, 2004 HorizonLive.com, Inc.
|
||||
*
|
||||
* Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
*
|
||||
* This program may be modified and distributed under the
|
||||
* terms of the GNU Public License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _APP_CONF_CLI_H
|
||||
#define _APP_CONF_CLI_H
|
||||
|
||||
//
|
||||
// includes
|
||||
//
|
||||
|
||||
#include "app_conference.h"
|
||||
#include "common.h"
|
||||
|
||||
//
|
||||
// function declarations
|
||||
//
|
||||
|
||||
int conference_show_stats( int fd, int argc, char *argv[] ) ;
|
||||
int conference_show_stats_name( int fd, const char* name ) ;
|
||||
|
||||
|
||||
int conference_debug( int fd, int argc, char *argv[] ) ;
|
||||
int conference_no_debug( int fd, int argc, char *argv[] ) ;
|
||||
|
||||
int conference_play_sound( int fd, int argc, char *argv[] ) ;
|
||||
int conference_stop_sounds( int fd, int argc, char *argv[] ) ;
|
||||
|
||||
void register_conference_cli( void ) ;
|
||||
void unregister_conference_cli( void ) ;
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
// $Id: common.h,v 1.3 2005/10/26 21:02:07 stevek Exp $
|
||||
|
||||
/*
|
||||
* app_conference
|
||||
*
|
||||
* A channel independent conference application for Asterisk
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Junghanns.NET GmbH
|
||||
* Copyright (C) 2003, 2004 HorizonLive.com, Inc.
|
||||
*
|
||||
* Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
*
|
||||
* This program may be modified and distributed under the
|
||||
* terms of the GNU Public License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _APP_CONF_COMMON_H
|
||||
#define _APP_CONF_COMMON_H
|
||||
|
||||
// typedef includes
|
||||
#include "conf_frame.h"
|
||||
|
||||
// function includesee
|
||||
#include "conference.h"
|
||||
#include "member.h"
|
||||
#include "frame.h"
|
||||
#include "cli.h"
|
||||
|
||||
|
||||
/* Utility functions */
|
||||
|
||||
/* LOG the time taken to execute a function (like lock acquisition */
|
||||
#if 1
|
||||
#define TIMELOG(func,min,message) \
|
||||
do { \
|
||||
struct timeval t1, t2; \
|
||||
int diff; \
|
||||
gettimeofday(&t1,NULL); \
|
||||
func; \
|
||||
gettimeofday(&t2,NULL); \
|
||||
if((diff = usecdiff(&t2, &t1)) > min) \
|
||||
ast_log( AST_CONF_DEBUG, "TimeLog: %s: %d ms\n", message, diff); \
|
||||
} while (0)
|
||||
#else
|
||||
#define TIMELOG(func,min,message) func
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,61 @@
|
||||
|
||||
// $Id: conf_frame.h,v 1.3 2005/10/26 21:02:07 stevek Exp $
|
||||
|
||||
/*
|
||||
* app_conference
|
||||
*
|
||||
* A channel independent conference application for Asterisk
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Junghanns.NET GmbH
|
||||
* Copyright (C) 2003, 2004 HorizonLive.com, Inc.
|
||||
*
|
||||
* Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
*
|
||||
* This program may be modified and distributed under the
|
||||
* terms of the GNU Public License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _APP_CONF_STRUCTS_H
|
||||
#define _APP_CONF_STRUCTS_H
|
||||
|
||||
//
|
||||
// includes
|
||||
//
|
||||
|
||||
#include "app_conference.h"
|
||||
#include "common.h"
|
||||
|
||||
//
|
||||
// struct declarations
|
||||
//
|
||||
|
||||
typedef struct conf_frame
|
||||
{
|
||||
// frame audio data
|
||||
struct ast_frame* fr ;
|
||||
|
||||
// array of converted versions for listeners
|
||||
struct ast_frame* converted[ AC_SUPPORTED_FORMATS ] ;
|
||||
|
||||
// pointer to the frame's owner
|
||||
struct ast_conf_member* member ; // who sent this frame
|
||||
|
||||
// frame meta data
|
||||
// struct timeval timestamp ;
|
||||
// unsigned long cycleid ;
|
||||
// int priority ;
|
||||
|
||||
// linked-list pointers
|
||||
struct conf_frame* next ;
|
||||
struct conf_frame* prev ;
|
||||
|
||||
// should this frame be preserved
|
||||
short static_frame ;
|
||||
|
||||
// pointer to mixing buffer
|
||||
char* mixed_buffer ;
|
||||
} conf_frame ;
|
||||
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,121 @@
|
||||
|
||||
// $Id: conference.h,v 1.6 2005/10/26 21:02:07 stevek Exp $
|
||||
|
||||
/*
|
||||
* app_conference
|
||||
*
|
||||
* A channel independent conference application for Asterisk
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Junghanns.NET GmbH
|
||||
* Copyright (C) 2003, 2004 HorizonLive.com, Inc.
|
||||
*
|
||||
* Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
*
|
||||
* This program may be modified and distributed under the
|
||||
* terms of the GNU Public License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _APP_CONF_CONFERENCE_H
|
||||
#define _APP_CONF_CONFERENCE_H
|
||||
|
||||
//
|
||||
// includes
|
||||
//
|
||||
|
||||
#include "app_conference.h"
|
||||
#include "common.h"
|
||||
|
||||
//
|
||||
// struct declarations
|
||||
//
|
||||
|
||||
typedef struct ast_conference_stats
|
||||
{
|
||||
// conference name ( copied for ease of use )
|
||||
char name[128] ;
|
||||
|
||||
// type of connection
|
||||
unsigned short phone ;
|
||||
unsigned short iaxclient ;
|
||||
unsigned short sip ;
|
||||
|
||||
// type of users
|
||||
unsigned short moderators ;
|
||||
unsigned short listeners ;
|
||||
|
||||
// accounting data
|
||||
unsigned long frames_in ;
|
||||
unsigned long frames_out ;
|
||||
unsigned long frames_mixed ;
|
||||
|
||||
struct timeval time_entered ;
|
||||
|
||||
} ast_conference_stats ;
|
||||
|
||||
|
||||
struct ast_conference
|
||||
{
|
||||
// conference name
|
||||
char name[128] ;
|
||||
|
||||
// single-linked list of members in conference
|
||||
struct ast_conf_member* memberlist ;
|
||||
int membercount ;
|
||||
|
||||
// conference thread id
|
||||
pthread_t conference_thread ;
|
||||
|
||||
// conference data mutex
|
||||
ast_mutex_t lock ;
|
||||
|
||||
// pointer to next conference in single-linked list
|
||||
struct ast_conference* next ;
|
||||
|
||||
// pointer to translation paths
|
||||
struct ast_trans_pvt* from_slinear_paths[ AC_SUPPORTED_FORMATS ] ;
|
||||
|
||||
// conference stats
|
||||
ast_conference_stats stats ;
|
||||
|
||||
// keep track of current delivery time
|
||||
struct timeval delivery_time ;
|
||||
|
||||
// 1 => on, 0 => off
|
||||
short debug_flag ;
|
||||
} ;
|
||||
|
||||
//
|
||||
// function declarations
|
||||
//
|
||||
|
||||
struct ast_conference* start_conference( struct ast_conf_member* member ) ;
|
||||
|
||||
void conference_exec( struct ast_conference* conf ) ;
|
||||
|
||||
struct ast_conference* find_conf( const char* name ) ;
|
||||
struct ast_conference* create_conf( char* name, struct ast_conf_member* member ) ;
|
||||
void remove_conf( struct ast_conference* conf ) ;
|
||||
|
||||
// find a particular member, locking if requested.
|
||||
struct ast_conf_member *find_member ( char *chan, int lock) ;
|
||||
|
||||
|
||||
int queue_frame_for_listener( struct ast_conference* conf, struct ast_conf_member* member, conf_frame* frame ) ;
|
||||
int queue_frame_for_speaker( struct ast_conference* conf, struct ast_conf_member* member, conf_frame* frame ) ;
|
||||
int queue_silent_frame( struct ast_conference* conf, struct ast_conf_member* member ) ;
|
||||
|
||||
void add_member( struct ast_conf_member* member, struct ast_conference* conf ) ;
|
||||
int remove_member( struct ast_conf_member* member, struct ast_conference* conf ) ;
|
||||
int count_member( struct ast_conf_member* member, struct ast_conference* conf, short add_member ) ;
|
||||
|
||||
// called by app_confernce.c:load_module()
|
||||
void init_conference( void ) ;
|
||||
|
||||
int get_conference_count( void ) ;
|
||||
int get_conference_stats( ast_conference_stats* stats, int requested ) ;
|
||||
int get_conference_stats_by_name( ast_conference_stats* stats, const char* name ) ;
|
||||
|
||||
int set_conference_debugging( const char* name, int state ) ;
|
||||
|
||||
#endif
|
||||
Binary file not shown.
@@ -0,0 +1,614 @@
|
||||
|
||||
// $Id: frame.c,v 1.7 2005/10/27 17:53:35 stevek Exp $
|
||||
|
||||
/*
|
||||
* app_conference
|
||||
*
|
||||
* A channel independent conference application for Asterisk
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Junghanns.NET GmbH
|
||||
* Copyright (C) 2003, 2004 HorizonLive.com, Inc.
|
||||
*
|
||||
* Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
*
|
||||
* This program may be modified and distributed under the
|
||||
* terms of the GNU Public License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "frame.h"
|
||||
|
||||
conf_frame* mix_frames( conf_frame* frames_in, int speaker_count, int listener_count )
|
||||
{
|
||||
if ( frames_in == NULL )
|
||||
return NULL ;
|
||||
|
||||
conf_frame* frames_out = NULL ;
|
||||
|
||||
if ( speaker_count > 1 )
|
||||
{
|
||||
if ( speaker_count == 2 && listener_count == 0 )
|
||||
{
|
||||
// optimize here also?
|
||||
frames_out = mix_multiple_speakers( frames_in, speaker_count, listener_count ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// mix spoken frames for sending
|
||||
// ( note: this call also releases us from free'ing spoken_frames )
|
||||
frames_out = mix_multiple_speakers( frames_in, speaker_count, listener_count ) ;
|
||||
}
|
||||
}
|
||||
else if ( speaker_count == 1 )
|
||||
{
|
||||
// pass-through frames
|
||||
frames_out = mix_single_speaker( frames_in ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no frames to send, leave frames_out null
|
||||
}
|
||||
|
||||
return frames_out ;
|
||||
}
|
||||
|
||||
conf_frame* mix_single_speaker( conf_frame* frames_in )
|
||||
{
|
||||
#ifdef APP_CONFERENCE_DEBUG
|
||||
// ast_log( AST_CONF_DEBUG, "returning single spoken frame\n" ) ;
|
||||
|
||||
//
|
||||
// check input
|
||||
//
|
||||
|
||||
if ( frames_in == NULL )
|
||||
{
|
||||
ast_log( AST_CONF_DEBUG, "unable to mix single spoken frame with null frame\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
if ( frames_in->fr == NULL )
|
||||
{
|
||||
ast_log( AST_CONF_DEBUG, "unable to mix single spoken frame with null data\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
if ( frames_in->member == NULL )
|
||||
{
|
||||
ast_log( AST_CONF_DEBUG, "unable to mix single spoken frame with null member\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
#endif // APP_CONFERENCE_DEBUG
|
||||
|
||||
//
|
||||
// 'mix' the frame
|
||||
//
|
||||
|
||||
// copy orignal frame to converted array so listeners don't need to re-encode it
|
||||
frames_in->converted[ frames_in->member->read_format_index ] = ast_frdup( frames_in->fr ) ;
|
||||
|
||||
// convert frame to slinear, if we have a path
|
||||
frames_in->fr = convert_frame_to_slinear(
|
||||
frames_in->member->to_slinear,
|
||||
frames_in->fr
|
||||
) ;
|
||||
|
||||
// set the frame's member to null ( i.e. all listeners )
|
||||
frames_in->member = NULL ;
|
||||
|
||||
return frames_in ;
|
||||
}
|
||||
|
||||
// {
|
||||
//
|
||||
// a little optimization for testing only:
|
||||
// when two speakers ( of the same type ) and no listeners
|
||||
// are in a conference, we just swamp the frame's member pointers
|
||||
//
|
||||
/*
|
||||
if (
|
||||
listeners == 0
|
||||
&& speakers == 2
|
||||
&& cf_spokenFrames->member->read_format == cf_spokenFrames->next->member->write_format
|
||||
&& cf_spokenFrames->member->write_format == cf_spokenFrames->next->member->read_format
|
||||
)
|
||||
{
|
||||
struct ast_conf_member* m = NULL ;
|
||||
m = cf_spokenFrames->member ;
|
||||
cf_spokenFrames->member = cf_spokenFrames->next->member ;
|
||||
cf_spokenFrames->next->member = m ;
|
||||
return cf_spokenFrames ;
|
||||
}
|
||||
*/
|
||||
// }
|
||||
|
||||
void set_conf_frame_delivery( conf_frame* frame, struct timeval time )
|
||||
{
|
||||
for ( ; frame != NULL ; frame = frame->next )
|
||||
{
|
||||
if ( frame->fr != NULL )
|
||||
{
|
||||
// copy passed timeval to frame's delivery timeval
|
||||
frame->fr->delivery = time ;
|
||||
}
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
conf_frame* mix_multiple_speakers(
|
||||
conf_frame* frames_in,
|
||||
int speakers,
|
||||
int listeners
|
||||
)
|
||||
{
|
||||
#ifdef APP_CONFERENCE_DEBUG
|
||||
//
|
||||
// check input
|
||||
//
|
||||
|
||||
// no frames to mix
|
||||
if ( ( frames_in == NULL ) || ( frames_in->fr == NULL ) )
|
||||
{
|
||||
ast_log( AST_CONF_DEBUG, "passed spoken frame list was NULL\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
// if less than two speakers, then no frames to mix
|
||||
if ( speakers < 2 )
|
||||
{
|
||||
ast_log( AST_CONF_DEBUG, "mix_multiple_speakers() called with less than two speakers\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
#endif // APP_CONFERENCE_DEBUG
|
||||
|
||||
//
|
||||
// at this point we know that there is more than one frame,
|
||||
// and that the frames need to be converted to pcm to be mixed
|
||||
//
|
||||
// now, if there are only two frames and two members,
|
||||
// we can swap them. ( but we'll get to that later. )
|
||||
//
|
||||
|
||||
//
|
||||
// loop through the spoken frames, making a list of spoken members,
|
||||
// and converting gsm frames to slinear frames so we can mix them.
|
||||
//
|
||||
|
||||
// pointer to the spoken frames list
|
||||
conf_frame* cf_spoken = frames_in ;
|
||||
|
||||
// pointer to the new list of mixed frames
|
||||
conf_frame* cf_sendFrames = NULL ;
|
||||
|
||||
while ( cf_spoken != NULL )
|
||||
{
|
||||
//
|
||||
// while we're looping through the spoken frames, we'll
|
||||
// convert the frame to a format suitable for mixing
|
||||
//
|
||||
// if the frame fails to convert, drop it and treat
|
||||
// the speaking member like a listener by not adding
|
||||
// them to the cf_sendFrames list
|
||||
//
|
||||
|
||||
if ( cf_spoken->member == NULL )
|
||||
{
|
||||
ast_log( LOG_WARNING, "unable to determine frame member\n" ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ast_log( AST_CONF_DEBUG, "converting frame to slinear, channel => %s\n", cf_spoken->member->channel_name ) ;
|
||||
cf_spoken->fr = convert_frame_to_slinear(
|
||||
cf_spoken->member->to_slinear,
|
||||
cf_spoken->fr
|
||||
) ;
|
||||
|
||||
if ( cf_spoken->fr == NULL )
|
||||
{
|
||||
ast_log( LOG_WARNING, "unable to convert frame to slinear\n" ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// create new conf frame with last frame as 'next'
|
||||
cf_sendFrames = create_conf_frame( cf_spoken->member, cf_sendFrames, NULL ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// point to the next spoken frame
|
||||
cf_spoken = cf_spoken->next ;
|
||||
}
|
||||
|
||||
// if necessary, add a frame with a null member pointer.
|
||||
// this frame will hold the audio mixed for all listeners
|
||||
if ( listeners > 0 )
|
||||
{
|
||||
cf_sendFrames = create_conf_frame( NULL, cf_sendFrames, NULL ) ;
|
||||
}
|
||||
|
||||
//
|
||||
// mix the audio
|
||||
//
|
||||
|
||||
// convenience pointer that skips over the friendly offset
|
||||
char* cp_listenerData ;
|
||||
|
||||
// pointer to the send frames list
|
||||
conf_frame* cf_send = NULL ;
|
||||
|
||||
for ( cf_send = cf_sendFrames ; cf_send != NULL ; cf_send = cf_send->next )
|
||||
{
|
||||
// allocate a mix buffer which fill large enough memory to
|
||||
// hold a frame, and reset it's memory so we don't get noise
|
||||
char* cp_listenerBuffer = malloc( AST_CONF_BUFFER_SIZE ) ;
|
||||
memset( cp_listenerBuffer, 0x0, AST_CONF_BUFFER_SIZE ) ;
|
||||
|
||||
// point past the friendly offset right to the data
|
||||
cp_listenerData = cp_listenerBuffer + AST_FRIENDLY_OFFSET ;
|
||||
|
||||
// reset the spoken list pointer
|
||||
cf_spoken = frames_in ;
|
||||
|
||||
// really mix the audio
|
||||
for ( ; cf_spoken != NULL ; cf_spoken = cf_spoken->next )
|
||||
{
|
||||
//
|
||||
// if the members are equal, and they
|
||||
// are not null, do not mix them.
|
||||
//
|
||||
if (
|
||||
( cf_send->member == cf_spoken->member )
|
||||
&& ( cf_send->member != NULL )
|
||||
)
|
||||
{
|
||||
// don't mix this frame
|
||||
}
|
||||
else if ( cf_spoken->fr == NULL )
|
||||
{
|
||||
ast_log( LOG_WARNING, "unable to mix conf_frame with null ast_frame\n" ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// mix the new frame in with the existing buffer
|
||||
mix_slinear_frames( cp_listenerData, (char*)( cf_spoken->fr->data ), cf_spoken->fr->samples ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// copy a pointer to the frame data to the conf_frame
|
||||
cf_send->mixed_buffer = cp_listenerData ;
|
||||
}
|
||||
|
||||
//
|
||||
// copy the mixed buffer to a new frame
|
||||
//
|
||||
|
||||
// reset the send list pointer
|
||||
cf_send = cf_sendFrames ;
|
||||
|
||||
while ( cf_send != NULL )
|
||||
{
|
||||
cf_send->fr = create_slinear_frame( cf_send->mixed_buffer ) ;
|
||||
cf_send = cf_send->next ;
|
||||
}
|
||||
|
||||
//
|
||||
// clean up the spoken frames we were passed
|
||||
// ( caller will only be responsible for free'ing returns frames )
|
||||
//
|
||||
|
||||
// reset the spoken list pointer
|
||||
cf_spoken = frames_in ;
|
||||
|
||||
while ( cf_spoken != NULL )
|
||||
{
|
||||
// delete the frame
|
||||
cf_spoken = delete_conf_frame( cf_spoken ) ;
|
||||
}
|
||||
|
||||
// return the list of frames for sending
|
||||
return cf_sendFrames ;
|
||||
}
|
||||
|
||||
|
||||
struct ast_frame* convert_frame_to_slinear( struct ast_trans_pvt* trans, struct ast_frame* fr )
|
||||
{
|
||||
// check for null frame
|
||||
if ( fr == NULL )
|
||||
{
|
||||
ast_log( LOG_ERROR, "unable to translate null frame to slinear\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
// we don't need to duplicate this frame since
|
||||
// the normal translation would free it anyway, so
|
||||
// we'll just pretend we free'd and malloc'd a new one.
|
||||
if ( fr->subclass == AST_FORMAT_SLINEAR )
|
||||
return fr ;
|
||||
|
||||
// check for null translator ( after we've checked that we need to translate )
|
||||
if ( trans == NULL )
|
||||
{
|
||||
// ast_log( LOG_ERROR, "unable to translate frame with null translation path\n" ) ;
|
||||
return fr ;
|
||||
}
|
||||
|
||||
// return the converted frame
|
||||
return convert_frame( trans, fr ) ;
|
||||
}
|
||||
|
||||
struct ast_frame* convert_frame_from_slinear( struct ast_trans_pvt* trans, struct ast_frame* fr )
|
||||
{
|
||||
// check for null translator ( after we've checked that we need to translate )
|
||||
if ( trans == NULL )
|
||||
{
|
||||
// ast_log( LOG_ERROR, "unable to translate frame with null translation path\n" ) ;
|
||||
return fr ;
|
||||
}
|
||||
|
||||
// check for null frame
|
||||
if ( fr == NULL )
|
||||
{
|
||||
ast_log( LOG_ERROR, "unable to translate null slinear frame\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
// if the frame is not slinear, return an error
|
||||
if ( fr->subclass != AST_FORMAT_SLINEAR )
|
||||
{
|
||||
ast_log( LOG_ERROR, "unable to translate non-slinear frame\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
// return the converted frame
|
||||
return convert_frame( trans, fr ) ;
|
||||
}
|
||||
|
||||
struct ast_frame* convert_frame( struct ast_trans_pvt* trans, struct ast_frame* fr )
|
||||
{
|
||||
if ( trans == NULL )
|
||||
{
|
||||
ast_log( LOG_WARNING, "unable to convert frame with null translator\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
if ( fr == NULL )
|
||||
{
|
||||
ast_log( LOG_WARNING, "unable to convert null frame\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
// convert the frame
|
||||
struct ast_frame* translated_frame = ast_translate( trans, fr, 1 ) ;
|
||||
|
||||
// check for errors
|
||||
if ( translated_frame == NULL )
|
||||
{
|
||||
ast_log( LOG_ERROR, "unable to translate frame\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
// return the translated frame
|
||||
return translated_frame ;
|
||||
}
|
||||
|
||||
conf_frame* delete_conf_frame( conf_frame* cf )
|
||||
{
|
||||
// check for null frames
|
||||
if ( cf == NULL )
|
||||
{
|
||||
ast_log( AST_CONF_DEBUG, "unable to delete null conf frame\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
// check for frame marked as static
|
||||
if ( cf->static_frame == 1 )
|
||||
return NULL ;
|
||||
|
||||
if ( cf->fr != NULL )
|
||||
{
|
||||
ast_frfree( cf->fr ) ;
|
||||
cf->fr = NULL ;
|
||||
}
|
||||
|
||||
// make sure converted frames are set to null
|
||||
int c;
|
||||
for ( c = 0 ; c < AC_SUPPORTED_FORMATS ; ++c )
|
||||
{
|
||||
if ( cf->converted[ c ] != NULL )
|
||||
{
|
||||
ast_frfree( cf->converted[ c ] ) ;
|
||||
cf->converted[ c ] = NULL ;
|
||||
}
|
||||
}
|
||||
|
||||
// get a pointer to the next frame
|
||||
// in the list so we can return it
|
||||
conf_frame* nf = cf->next ;
|
||||
|
||||
free( cf ) ;
|
||||
cf = NULL ;
|
||||
|
||||
return nf ;
|
||||
}
|
||||
|
||||
conf_frame* create_conf_frame( struct ast_conf_member* member, conf_frame* next, const struct ast_frame* fr )
|
||||
{
|
||||
// pointer to list of mixed frames
|
||||
conf_frame* cf = malloc( sizeof( struct conf_frame ) ) ;
|
||||
|
||||
if ( cf == NULL )
|
||||
{
|
||||
ast_log( LOG_ERROR, "unable to allocate memory for conf frame\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
//
|
||||
// init with some defaults
|
||||
//
|
||||
|
||||
// make sure converted frames are set to null
|
||||
// for ( int c = 0 ; c < AC_SUPPORTED_FORMATS ; ++c )
|
||||
// {
|
||||
// cf->converted[ c ] = NULL ;
|
||||
// }
|
||||
|
||||
memset( (struct ast_frame*)( cf->converted ), 0x0, ( sizeof( struct ast_frame* ) * AC_SUPPORTED_FORMATS ) ) ;
|
||||
|
||||
cf->member = member ;
|
||||
// cf->priority = 0 ;
|
||||
|
||||
cf->prev = NULL ;
|
||||
cf->next = next ;
|
||||
|
||||
cf->static_frame = 0 ;
|
||||
|
||||
// establish relationship to 'next'
|
||||
if ( next != NULL ) next->prev = cf ;
|
||||
|
||||
// this holds the ast_frame pointer
|
||||
cf->fr = ( fr == NULL ) ? NULL : ast_frdup( ( struct ast_frame* )( fr ) ) ;
|
||||
|
||||
// this holds the temporu mix buffer
|
||||
cf->mixed_buffer = NULL ;
|
||||
|
||||
return cf ;
|
||||
}
|
||||
|
||||
conf_frame* copy_conf_frame( conf_frame* src )
|
||||
{
|
||||
//
|
||||
// check inputs
|
||||
//
|
||||
|
||||
if ( src == NULL )
|
||||
{
|
||||
ast_log( AST_CONF_DEBUG, "unable to copy null conf frame\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
//
|
||||
// copy the frame
|
||||
//
|
||||
|
||||
struct conf_frame *cfr = NULL ;
|
||||
|
||||
// create a new conf frame
|
||||
cfr = create_conf_frame( src->member, NULL, src->fr ) ;
|
||||
|
||||
if ( cfr == NULL )
|
||||
{
|
||||
ast_log( AST_CONF_DEBUG, "unable to create new conf frame for copy\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
return cfr ;
|
||||
}
|
||||
|
||||
//
|
||||
// slinear frame functions
|
||||
//
|
||||
|
||||
struct ast_frame* create_slinear_frame( char* data )
|
||||
{
|
||||
struct ast_frame* f ;
|
||||
|
||||
f = calloc( 1, sizeof( struct ast_frame ) ) ;
|
||||
if ( f == NULL )
|
||||
{
|
||||
ast_log( LOG_ERROR, "unable to allocate memory for slinear frame\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
f->frametype = AST_FRAME_VOICE ;
|
||||
f->subclass = AST_FORMAT_SLINEAR ;
|
||||
f->samples = AST_CONF_BLOCK_SAMPLES ;
|
||||
f->offset = AST_FRIENDLY_OFFSET ;
|
||||
f->mallocd = AST_MALLOCD_HDR | AST_MALLOCD_DATA ;
|
||||
|
||||
f->datalen = AST_CONF_FRAME_DATA_SIZE ;
|
||||
f->data = data ;
|
||||
|
||||
f->src = NULL ;
|
||||
|
||||
return f ;
|
||||
}
|
||||
|
||||
void mix_slinear_frames( char *dst, const char *src, int samples )
|
||||
{
|
||||
if ( dst == NULL ) return ;
|
||||
if ( src == NULL ) return ;
|
||||
|
||||
int i, val ;
|
||||
|
||||
for ( i = 0 ; i < samples ; ++i )
|
||||
{
|
||||
val = ( (short*)dst )[i] + ( (short*)src )[i] ;
|
||||
|
||||
if ( val > 0x7fff )
|
||||
{
|
||||
( (short*)dst )[i] = 0x7fff - 1 ;
|
||||
continue ;
|
||||
}
|
||||
else if ( val < -0x7fff )
|
||||
{
|
||||
( (short*)dst )[i] = -0x7fff + 1 ;
|
||||
continue ;
|
||||
}
|
||||
else
|
||||
{
|
||||
( (short*)dst )[i] = val ;
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
//
|
||||
// silent frame functions
|
||||
//
|
||||
|
||||
conf_frame* get_silent_frame( void )
|
||||
{
|
||||
static conf_frame* static_silent_frame = NULL ;
|
||||
|
||||
// we'll let this leak until the application terminates
|
||||
if ( static_silent_frame == NULL )
|
||||
{
|
||||
// ast_log( AST_CONF_DEBUG, "creating cached silent frame\n" ) ;
|
||||
struct ast_frame* fr = get_silent_slinear_frame() ;
|
||||
|
||||
static_silent_frame = create_conf_frame( NULL, NULL, fr ) ;
|
||||
|
||||
if ( static_silent_frame == NULL )
|
||||
{
|
||||
ast_log( LOG_WARNING, "unable to create cached silent frame\n" ) ;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
// init the 'converted' slinear silent frame
|
||||
static_silent_frame->converted[ AC_SLINEAR_INDEX ] = get_silent_slinear_frame() ;
|
||||
|
||||
// mark frame as static so it's not deleted
|
||||
static_silent_frame->static_frame = 1 ;
|
||||
}
|
||||
|
||||
return static_silent_frame ;
|
||||
}
|
||||
|
||||
struct ast_frame* get_silent_slinear_frame( void )
|
||||
{
|
||||
static struct ast_frame* f = NULL ;
|
||||
|
||||
// we'll let this leak until the application terminates
|
||||
if ( f == NULL )
|
||||
{
|
||||
char* data = malloc( AST_CONF_BUFFER_SIZE ) ;
|
||||
memset( data, 0x0, AST_CONF_BUFFER_SIZE ) ;
|
||||
f = create_slinear_frame( data ) ;
|
||||
}
|
||||
|
||||
return ast_frdup( f ) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
// $Id: frame.h,v 1.6 2005/10/26 21:02:07 stevek Exp $
|
||||
|
||||
/*
|
||||
* app_conference
|
||||
*
|
||||
* A channel independent conference application for Asterisk
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Junghanns.NET GmbH
|
||||
* Copyright (C) 2003, 2004 HorizonLive.com, Inc.
|
||||
*
|
||||
* Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
*
|
||||
* This program may be modified and distributed under the
|
||||
* terms of the GNU Public License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _APP_CONF_FRAME_H
|
||||
#define _APP_CONF_FRAME_H
|
||||
|
||||
//
|
||||
// includes
|
||||
//
|
||||
|
||||
#include "app_conference.h"
|
||||
#include "common.h"
|
||||
|
||||
//
|
||||
// function declarations
|
||||
//
|
||||
|
||||
// mixing
|
||||
conf_frame* mix_frames( conf_frame* frames_in, int speaker_count, int listener_count ) ;
|
||||
|
||||
conf_frame* mix_multiple_speakers( conf_frame* frames_in, int speakers, int listeners ) ;
|
||||
conf_frame* mix_single_speaker( conf_frame* frames_in ) ;
|
||||
|
||||
// frame creation and deletion
|
||||
conf_frame* create_conf_frame( struct ast_conf_member* member, conf_frame* next, const struct ast_frame* fr ) ;
|
||||
conf_frame* delete_conf_frame( conf_frame* cf ) ;
|
||||
conf_frame* copy_conf_frame( conf_frame* src ) ;
|
||||
|
||||
// convert frame functions
|
||||
struct ast_frame* convert_frame_to_slinear( struct ast_trans_pvt* trans, struct ast_frame* fr ) ;
|
||||
struct ast_frame* convert_frame_from_slinear( struct ast_trans_pvt* trans, struct ast_frame* fr ) ;
|
||||
struct ast_frame* convert_frame( struct ast_trans_pvt* trans, struct ast_frame* fr ) ;
|
||||
|
||||
// slinear frame functions
|
||||
struct ast_frame* create_slinear_frame( char* data ) ;
|
||||
void mix_slinear_frames( char* dst, const char* src, int samples ) ;
|
||||
|
||||
// silent frame functions
|
||||
conf_frame* get_silent_frame( void ) ;
|
||||
struct ast_frame* get_silent_slinear_frame( void ) ;
|
||||
|
||||
// set delivery timestamp for frames
|
||||
void set_conf_frame_delivery( conf_frame* frame, struct timeval time ) ;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,2 @@
|
||||
Õø\}PcÈ£P tÛ†§¬D#E)¤™î#àÑi(*ÕøEÿ3yÂBãF:W£Ì×2›w¢ÓÔWâåÔ¢6èÕøTþéyÁªu–ÃÆW¢I+‘sdWÁ󣩿øy¢®su»Õ÷k¿2yƒ©©áËc„tä9,,WÂÌk|UTWãu#’.1Õøcÿ}yQÒÅã(î é¬d£Úº\2Åï!•␍‚£QÕø\?;wÁÃaÔòñW‚nf�y¢.–7©FW‚•š©ó)Õ÷{?<y�踥¾:y‚ŒkmņWÃYk‹™¢,s�ņոk¿3WávÛ§'“WA«k5ËÍAó0”u*ï!¼eS␍ÕøM¾êy¡«ªcÍyâJ㫉Šw�qÇk
|
||||
°wÂ9uáÓÕø\3y¡C†§£Ò»"Xy�Ö�™¡wr:ªïA¬Ýk‹MÕøT¾©™ÁᜑVxï¡ä꙾,WâHr\ʧw¢6é°ó]Õ¸>úYW!àíµQënµSíB*ÜqU—U¡ºy˜×Õö²³>ÓÇX¦ŸWQŽDâ¿íÇmÈÊ!ï÷ûýö
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
/misc.c/1.1/Thu Mar 25 15:10:17 2004//
|
||||
/misc.h/1.1/Thu Mar 25 15:10:17 2004//
|
||||
/preprocess.c/1.4/Fri Mar 25 20:26:26 2005//
|
||||
/smallft.c/1.3/Fri Mar 25 20:26:26 2005//
|
||||
/smallft.h/1.2/Wed Jul 7 13:39:42 2004//
|
||||
/speex_preprocess.h/1.1/Thu Mar 25 15:10:17 2004//
|
||||
D
|
||||
@@ -0,0 +1 @@
|
||||
app_conference/libspeex
|
||||
@@ -0,0 +1 @@
|
||||
:pserver:anonymous@iaxclient.cvs.sourceforge.net:/cvsroot/iaxclient
|
||||
@@ -0,0 +1,145 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: mics.c
|
||||
Various utility routines for Speex
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "misc.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef RELEASE
|
||||
void print_vec(float *vec, int len, char *name)
|
||||
{
|
||||
int i;
|
||||
printf ("%s ", name);
|
||||
for (i=0;i<len;i++)
|
||||
printf (" %f", vec[i]);
|
||||
printf ("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned int be_int(unsigned int i)
|
||||
{
|
||||
unsigned int ret=i;
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
ret = i>>24;
|
||||
ret += (i>>8)&0x0000ff00;
|
||||
ret += (i<<8)&0x00ff0000;
|
||||
ret += (i<<24);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned int le_int(unsigned int i)
|
||||
{
|
||||
unsigned int ret=i;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
ret = i>>24;
|
||||
ret += (i>>8)&0x0000ff00;
|
||||
ret += (i<<8)&0x00ff0000;
|
||||
ret += (i<<24);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned short be_short(unsigned short s)
|
||||
{
|
||||
unsigned short ret=s;
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
ret = s>>8;
|
||||
ret += s<<8;
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned short le_short(unsigned short s)
|
||||
{
|
||||
unsigned short ret=s;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
ret = s>>8;
|
||||
ret += s<<8;
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
void *speex_alloc (int size)
|
||||
{
|
||||
return calloc(size,1);
|
||||
}
|
||||
|
||||
void *speex_realloc (void *ptr, int size)
|
||||
{
|
||||
return realloc(ptr, size);
|
||||
}
|
||||
|
||||
void speex_free (void *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void *speex_move (void *dest, void *src, int n)
|
||||
{
|
||||
return memmove(dest,src,n);
|
||||
}
|
||||
|
||||
void speex_error(char *str)
|
||||
{
|
||||
fprintf (stderr, "Fatal error: %s\n", str);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void speex_warning(char *str)
|
||||
{
|
||||
fprintf (stderr, "warning: %s\n", str);
|
||||
}
|
||||
|
||||
void speex_warning_int(char *str, int val)
|
||||
{
|
||||
fprintf (stderr, "warning: %s %d\n", str, val);
|
||||
}
|
||||
|
||||
void speex_rand_vec(float std, spx_sig_t *data, int len)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<len;i++)
|
||||
data[i]+=SIG_SCALING*3*std*((((float)rand())/RAND_MAX)-.5);
|
||||
}
|
||||
|
||||
float speex_rand(float std)
|
||||
{
|
||||
return 3*std*((((float)rand())/RAND_MAX)-.5);
|
||||
}
|
||||
|
||||
void _speex_putc(int ch, void *file)
|
||||
{
|
||||
FILE *f = (FILE *)file;
|
||||
fputc(ch, f);
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin */
|
||||
/**
|
||||
@file misc.h
|
||||
@brief Various compatibility routines for Speex
|
||||
*/
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef MISC_H
|
||||
#define MISC_H
|
||||
|
||||
#ifndef VERSION
|
||||
#define VERSION "speex-1.1"
|
||||
#endif
|
||||
|
||||
#ifdef FIXED_POINT
|
||||
|
||||
typedef signed short spx_word16_t;
|
||||
typedef signed int spx_word32_t;
|
||||
typedef spx_word32_t spx_mem_t;
|
||||
typedef spx_word16_t spx_coef_t;
|
||||
typedef spx_word16_t spx_lsp_t;
|
||||
typedef spx_word32_t spx_sig_t;
|
||||
|
||||
#define LPC_SCALING 8192.
|
||||
#define SIG_SCALING 16384
|
||||
#define LSP_SCALING 8192.
|
||||
|
||||
#define LPC_SHIFT 13
|
||||
#define SIG_SHIFT 14
|
||||
|
||||
#define PSHR(a,shift) (((a)+(1<<((shift)-1))) >> (shift))
|
||||
#define SHR(a,shift) ((a) >> (shift))
|
||||
#define SHL(a,shift) ((a) << (shift))
|
||||
|
||||
/* result fits in 16 bits */
|
||||
#define MULT16_16_16(a,b) (((short)(a))*(b))
|
||||
|
||||
#define MULT16_16(a,b) (((signed int)(a))*(b))
|
||||
#define MULT16_32_Q13(a,b) (((a)*((b)>>13)) + ((a)*((signed int)((b)&0x00001fff))>>13))
|
||||
#define MULT16_32_Q14(a,b) (((a)*((b)>>14)) + ((a)*((signed int)((b)&0x00003fff))>>14))
|
||||
#define MULT16_32_Q15(a,b) (((a)*((b)>>15)) + ((a)*((signed int)((b)&0x00007fff))>>15))
|
||||
|
||||
#define MULT16_16_Q13(a,b) (((signed int)(a))*(b)>>13)
|
||||
#define MULT16_16_Q14(a,b) (((signed int)(a))*(b)>>14)
|
||||
#define MULT16_16_Q15(a,b) (((signed int)(a))*(b)>>15)
|
||||
|
||||
#define MULT16_16_P14(a,b) ((8192+((signed int)(a))*(b))>>14)
|
||||
|
||||
|
||||
#define DIV32_16(a,b) (((signed int)(a))/(b))
|
||||
|
||||
#else
|
||||
|
||||
typedef float spx_mem_t;
|
||||
typedef float spx_coef_t;
|
||||
typedef float spx_lsp_t;
|
||||
typedef float spx_sig_t;
|
||||
typedef float spx_word16_t;
|
||||
typedef float spx_word32_t;
|
||||
|
||||
#define LPC_SCALING 1.
|
||||
#define SIG_SCALING 1.
|
||||
#define LSP_SCALING 1.
|
||||
|
||||
#define LPC_SHIFT 0
|
||||
#define SIG_SHIFT 0
|
||||
|
||||
#define PSHR(a,shift) (a)
|
||||
#define SHR(a,shift) (a)
|
||||
#define SHL(a,shift) (a)
|
||||
#define MULT16_16_16(a,b) ((a)*(b))
|
||||
#define MULT16_16(a,b) ((a)*(b))
|
||||
|
||||
#define MULT16_32_Q13(a,b) ((a)*(b))
|
||||
#define MULT16_32_Q14(a,b) ((a)*(b))
|
||||
#define MULT16_32_Q15(a,b) ((a)*(b))
|
||||
|
||||
#define MULT16_16_Q13(a,b) ((a)*(b))
|
||||
#define MULT16_16_Q14(a,b) ((a)*(b))
|
||||
#define MULT16_16_Q15(a,b) ((a)*(b))
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef RELEASE
|
||||
void print_vec(float *vec, int len, char *name);
|
||||
#endif
|
||||
|
||||
unsigned int be_int(unsigned int i);
|
||||
unsigned int le_int(unsigned int i);
|
||||
|
||||
|
||||
unsigned short be_short(unsigned short s);
|
||||
unsigned short le_short(unsigned short s);
|
||||
|
||||
/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free */
|
||||
void *speex_alloc (int size);
|
||||
|
||||
/** Speex wrapper for realloc. To do your own dynamic allocation, all you need to do is replace this function, speex_alloc and speex_free */
|
||||
void *speex_realloc (void *ptr, int size);
|
||||
|
||||
/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_alloc */
|
||||
void speex_free (void *ptr);
|
||||
|
||||
/** Speex wrapper for mem_move */
|
||||
void *speex_move (void *dest, void *src, int n);
|
||||
|
||||
void speex_error(char *str);
|
||||
|
||||
void speex_warning(char *str);
|
||||
|
||||
void speex_warning_int(char *str, int val);
|
||||
|
||||
void speex_rand_vec(float std, spx_sig_t *data, int len);
|
||||
|
||||
float speex_rand(float std);
|
||||
|
||||
void _speex_putc(int ch, void *file);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
|
||||
* by the XIPHOPHORUS Company http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: fft transform
|
||||
last mod: $Id: smallft.h,v 1.2 2004/07/07 13:39:42 stevek Exp $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#ifndef _V_SMFT_H_
|
||||
#define _V_SMFT_H_
|
||||
|
||||
/*#include "vorbis/codec.h"*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct drft_lookup{
|
||||
int n;
|
||||
float *trigcache;
|
||||
int *splitcache;
|
||||
};
|
||||
|
||||
extern void drft_forward(struct drft_lookup *l,float *data);
|
||||
extern void drft_backward(struct drft_lookup *l,float *data);
|
||||
extern void drft_init(struct drft_lookup *l,int n);
|
||||
extern void drft_clear(struct drft_lookup *l);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,139 @@
|
||||
/* Copyright (C) 2003 Epic Games
|
||||
Written by Jean-Marc Valin
|
||||
|
||||
File: speex_preprocess.h
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct drft_lookup;
|
||||
|
||||
typedef struct SpeexPreprocessState {
|
||||
int frame_size; /**< Number of samples processed each time */
|
||||
int ps_size; /**< Number of points in the power spectrum */
|
||||
int sampling_rate; /**< Sampling rate of the input/output */
|
||||
|
||||
/* parameters */
|
||||
int denoise_enabled;
|
||||
int agc_enabled;
|
||||
float agc_level;
|
||||
int vad_enabled;
|
||||
|
||||
// probabilities to check speech_prob against
|
||||
float speech_prob_start ;
|
||||
float speech_prob_continue ;
|
||||
|
||||
float *frame; /**< Processing frame (2*ps_size) */
|
||||
float *ps; /**< Current power spectrum */
|
||||
float *gain2; /**< Adjusted gains */
|
||||
float *window; /**< Analysis/Synthesis window */
|
||||
float *noise; /**< Noise estimate */
|
||||
float *old_ps; /**< Power spectrum for last frame */
|
||||
float *gain; /**< Ephraim Malah gain */
|
||||
float *prior; /**< A-priori SNR */
|
||||
float *post; /**< A-posteriori SNR */
|
||||
|
||||
float *S; /**< Smoothed power spectrum */
|
||||
float *Smin; /**< See Cohen paper */
|
||||
float *Stmp; /**< See Cohen paper */
|
||||
float *update_prob; /**< Propability of speech presence for noise update */
|
||||
|
||||
float *zeta; /**< Smoothed a priori SNR */
|
||||
float Zpeak;
|
||||
float Zlast;
|
||||
|
||||
float *loudness_weight; /**< Perceptual loudness curve */
|
||||
|
||||
float *echo_noise;
|
||||
|
||||
float *noise_bands;
|
||||
float *noise_bands2;
|
||||
int noise_bandsN;
|
||||
float *speech_bands;
|
||||
float *speech_bands2;
|
||||
int speech_bandsN;
|
||||
|
||||
float *inbuf; /**< Input buffer (overlapped analysis) */
|
||||
float *outbuf; /**< Output buffer (for overlap and add) */
|
||||
|
||||
float speech_prob;
|
||||
int last_speech;
|
||||
float loudness; /**< loudness estimate */
|
||||
float loudness2; /**< loudness estimate */
|
||||
int nb_adapt; /**< Number of frames used for adaptation so far */
|
||||
int nb_loudness_adapt; /**< Number of frames used for loudness adaptation so far */
|
||||
int consec_noise; /**< Number of consecutive noise frames */
|
||||
int nb_preprocess; /**< Number of frames processed so far */
|
||||
struct drft_lookup *fft_lookup; /**< Lookup table for the FFT */
|
||||
|
||||
} SpeexPreprocessState;
|
||||
|
||||
/** Creates a new preprocessing state */
|
||||
SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate);
|
||||
|
||||
/** Destroys a denoising state */
|
||||
void speex_preprocess_state_destroy(SpeexPreprocessState *st);
|
||||
|
||||
/** Preprocess a frame */
|
||||
int speex_preprocess(SpeexPreprocessState *st, short *x, float *noise);
|
||||
|
||||
/** Preprocess a frame */
|
||||
void speex_preprocess_estimate_update(SpeexPreprocessState *st, short *x, float *noise);
|
||||
|
||||
/** Used like the ioctl function to control the preprocessor parameters */
|
||||
int speex_preprocess_ctl(SpeexPreprocessState *st, int request, void *ptr);
|
||||
|
||||
#define SPEEX_PROB_START 0.35
|
||||
#define SPEEX_PROB_CONTINUE 0.1
|
||||
|
||||
#define SPEEX_PREPROCESS_SET_DENOISE 0
|
||||
#define SPEEX_PREPROCESS_GET_DENOISE 1
|
||||
|
||||
#define SPEEX_PREPROCESS_SET_AGC 2
|
||||
#define SPEEX_PREPROCESS_GET_AGC 3
|
||||
|
||||
#define SPEEX_PREPROCESS_SET_VAD 4
|
||||
#define SPEEX_PREPROCESS_GET_VAD 5
|
||||
|
||||
#define SPEEX_PREPROCESS_SET_AGC_LEVEL 6
|
||||
#define SPEEX_PREPROCESS_GET_AGC_LEVEL 7
|
||||
|
||||
#define SPEEX_PREPROCESS_SET_PROB_START 8
|
||||
#define SPEEX_PREPROCESS_GET_PROB_START 9
|
||||
|
||||
#define SPEEX_PREPROCESS_SET_PROB_CONTINUE 10
|
||||
#define SPEEX_PREPROCESS_GET_PROB_CONTINUE 11
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,212 @@
|
||||
|
||||
// $Id: member.h,v 1.7 2005/11/02 22:42:42 stevek Exp $
|
||||
|
||||
/*
|
||||
* app_conference
|
||||
*
|
||||
* A channel independent conference application for Asterisk
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Junghanns.NET GmbH
|
||||
* Copyright (C) 2003-2005 HorizonLive.com, Inc.
|
||||
*
|
||||
* Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
* Steve Kann <stevek@stevek.com>
|
||||
*
|
||||
* This program may be modified and distributed under the
|
||||
* terms of the GNU Public License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _APP_CONF_MEMBER_H
|
||||
#define _APP_CONF_MEMBER_H
|
||||
|
||||
//
|
||||
// includes
|
||||
//
|
||||
|
||||
#include "app_conference.h"
|
||||
#include "common.h"
|
||||
#include "asterisk/app.h"
|
||||
|
||||
|
||||
//
|
||||
// struct declarations
|
||||
//
|
||||
|
||||
struct ast_conf_soundq
|
||||
{
|
||||
char name[256];
|
||||
struct ast_filestream *stream; // the stream
|
||||
int muted; // should incoming audio be muted while we play?
|
||||
struct ast_conf_soundq *next;
|
||||
};
|
||||
|
||||
struct ast_conf_member
|
||||
{
|
||||
ast_mutex_t lock ; // member data mutex
|
||||
|
||||
struct ast_channel* chan ; // member's channel
|
||||
char* channel_name ; // member's channel name
|
||||
|
||||
// values passed to create_member () via *data
|
||||
int priority ; // highest priority gets the channel
|
||||
char* flags ; // raw member-type flags
|
||||
char type ; // L = ListenOnly, M = Moderator, S = Standard (Listen/Talk)
|
||||
char* id ; // member id
|
||||
|
||||
// determine by flags and channel name
|
||||
char connection_type ; // T = telephone, X = iaxclient, S = sip
|
||||
|
||||
// vad voice probability thresholds
|
||||
float vad_prob_start ;
|
||||
float vad_prob_continue ;
|
||||
|
||||
// ready flag
|
||||
short ready_for_outgoing ;
|
||||
|
||||
// input frame queue
|
||||
conf_frame* inFrames ;
|
||||
conf_frame* inFramesTail ;
|
||||
unsigned int inFramesCount ;
|
||||
|
||||
// input/output smoother
|
||||
struct ast_smoother *inSmoother;
|
||||
struct ast_packer *outPacker;
|
||||
int smooth_size_in;
|
||||
int smooth_size_out;
|
||||
int smooth_multiple;
|
||||
|
||||
// frames needed by conference_exec
|
||||
unsigned int inFramesNeeded ;
|
||||
|
||||
// used when caching last frame
|
||||
conf_frame* inFramesLast ;
|
||||
unsigned int inFramesRepeatLast ;
|
||||
unsigned short okayToCacheLast ;
|
||||
|
||||
// output frame queue
|
||||
conf_frame* outFrames ;
|
||||
conf_frame* outFramesTail ;
|
||||
unsigned int outFramesCount ;
|
||||
|
||||
// time we last dropped a frame
|
||||
struct timeval last_in_dropped ;
|
||||
struct timeval last_out_dropped ;
|
||||
|
||||
// ( not currently used )
|
||||
// int samplesperframe ;
|
||||
|
||||
// used for determining need to mix frames
|
||||
// and for management interface notification
|
||||
short speaking_state_prev ;
|
||||
short speaking_state_notify ;
|
||||
short speaking_state ;
|
||||
|
||||
// pointer to next member in single-linked list
|
||||
struct ast_conf_member* next ;
|
||||
|
||||
// accounting values
|
||||
unsigned long frames_in ;
|
||||
unsigned long frames_in_dropped ;
|
||||
unsigned long frames_out ;
|
||||
unsigned long frames_out_dropped ;
|
||||
|
||||
// for counting sequentially dropped frames
|
||||
unsigned int sequential_drops ;
|
||||
unsigned long since_dropped ;
|
||||
|
||||
// start time
|
||||
struct timeval time_entered ;
|
||||
struct timeval lastsent_timeval ;
|
||||
|
||||
// flag indicating we should remove this member
|
||||
short remove_flag ;
|
||||
|
||||
#if ( SILDET == 2 )
|
||||
// pointer to speex preprocessor dsp
|
||||
SpeexPreprocessState *dsp ;
|
||||
// number of frames to ignore speex_preprocess()
|
||||
int ignore_speex_count;
|
||||
#else
|
||||
// placeholder when preprocessing is not enabled
|
||||
void* dsp ;
|
||||
#endif
|
||||
|
||||
// audio format this member is using
|
||||
int write_format ;
|
||||
int read_format ;
|
||||
|
||||
int write_format_index ;
|
||||
int read_format_index ;
|
||||
|
||||
// member frame translators
|
||||
struct ast_trans_pvt* to_slinear ;
|
||||
struct ast_trans_pvt* from_slinear ;
|
||||
|
||||
// For playing sounds
|
||||
struct ast_conf_soundq *soundq;
|
||||
|
||||
#ifdef DEBUG_OUTPUT_PCM
|
||||
FILE *incoming_fh;
|
||||
#endif
|
||||
|
||||
int send_dtmf:1;
|
||||
int quiet_entry_exit:1;
|
||||
int inband_dtmf:1;
|
||||
int rfc_dtmf:1;
|
||||
} ;
|
||||
|
||||
struct conf_member
|
||||
{
|
||||
struct ast_conf_member* realmember ;
|
||||
struct conf_member* next ;
|
||||
} ;
|
||||
|
||||
//
|
||||
// function declarations
|
||||
//
|
||||
|
||||
int member_exec( struct ast_channel* chan, void* data ) ;
|
||||
|
||||
int basic_play_sound ( char *channel, char *file ) ;
|
||||
|
||||
struct ast_conf_member* create_member( struct ast_channel* chan, const char* data ) ;
|
||||
struct ast_conf_member* delete_member( struct ast_conf_member* member ) ;
|
||||
|
||||
// incoming queue
|
||||
int queue_incoming_frame( struct ast_conf_member* member, struct ast_frame* fr ) ;
|
||||
conf_frame* get_incoming_frame( struct ast_conf_member* member ) ;
|
||||
|
||||
// outgoing queue
|
||||
int queue_outgoing_frame( struct ast_conf_member* member, const struct ast_frame* fr, struct timeval delivery ) ;
|
||||
int __queue_outgoing_frame( struct ast_conf_member* member, const struct ast_frame* fr, struct timeval delivery ) ;
|
||||
conf_frame* get_outgoing_frame( struct ast_conf_member* member ) ;
|
||||
|
||||
void send_state_change_notifications( struct ast_conf_member* member ) ;
|
||||
|
||||
//
|
||||
// meta-info accessors functions
|
||||
//
|
||||
|
||||
short memberIsPhoneClient( struct ast_conf_member* member ) ;
|
||||
short memberIsIaxClient( struct ast_conf_member* member ) ;
|
||||
short memberIsSIPClient( struct ast_conf_member* member ) ;
|
||||
|
||||
short memberIsModerator( struct ast_conf_member* member ) ;
|
||||
short memberIsListener( struct ast_conf_member* member ) ;
|
||||
|
||||
//
|
||||
// packer functions
|
||||
//
|
||||
|
||||
struct ast_packer;
|
||||
|
||||
extern struct ast_packer *ast_packer_new(int bytes);
|
||||
extern void ast_packer_set_flags(struct ast_packer *packer, int flags);
|
||||
extern int ast_packer_get_flags(struct ast_packer *packer);
|
||||
extern void ast_packer_free(struct ast_packer *s);
|
||||
extern void ast_packer_reset(struct ast_packer *s, int bytes);
|
||||
extern int ast_packer_feed(struct ast_packer *s, const struct ast_frame *f);
|
||||
extern struct ast_frame *ast_packer_read(struct ast_packer *s);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,211 @@
|
||||
|
||||
// $Id: member.h,v 1.7 2005/11/02 22:42:42 stevek Exp $
|
||||
|
||||
/*
|
||||
* app_conference
|
||||
*
|
||||
* A channel independent conference application for Asterisk
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Junghanns.NET GmbH
|
||||
* Copyright (C) 2003-2005 HorizonLive.com, Inc.
|
||||
*
|
||||
* Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
* Steve Kann <stevek@stevek.com>
|
||||
*
|
||||
* This program may be modified and distributed under the
|
||||
* terms of the GNU Public License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _APP_CONF_MEMBER_H
|
||||
#define _APP_CONF_MEMBER_H
|
||||
|
||||
//
|
||||
// includes
|
||||
//
|
||||
|
||||
#include "app_conference.h"
|
||||
#include "common.h"
|
||||
|
||||
|
||||
//
|
||||
// struct declarations
|
||||
//
|
||||
|
||||
struct ast_conf_soundq
|
||||
{
|
||||
char name[256];
|
||||
struct ast_filestream *stream; // the stream
|
||||
int muted; // should incoming audio be muted while we play?
|
||||
struct ast_conf_soundq *next;
|
||||
};
|
||||
|
||||
struct ast_conf_member
|
||||
{
|
||||
ast_mutex_t lock ; // member data mutex
|
||||
|
||||
struct ast_channel* chan ; // member's channel
|
||||
char* channel_name ; // member's channel name
|
||||
|
||||
// values passed to create_member () via *data
|
||||
int priority ; // highest priority gets the channel
|
||||
char* flags ; // raw member-type flags
|
||||
char type ; // L = ListenOnly, M = Moderator, S = Standard (Listen/Talk)
|
||||
char* id ; // member id
|
||||
|
||||
// determine by flags and channel name
|
||||
char connection_type ; // T = telephone, X = iaxclient, S = sip
|
||||
|
||||
// vad voice probability thresholds
|
||||
float vad_prob_start ;
|
||||
float vad_prob_continue ;
|
||||
|
||||
// ready flag
|
||||
short ready_for_outgoing ;
|
||||
|
||||
// input frame queue
|
||||
conf_frame* inFrames ;
|
||||
conf_frame* inFramesTail ;
|
||||
unsigned int inFramesCount ;
|
||||
|
||||
// input/output smoother
|
||||
struct ast_smoother *inSmoother;
|
||||
struct ast_packer *outPacker;
|
||||
int smooth_size_in;
|
||||
int smooth_size_out;
|
||||
int smooth_multiple;
|
||||
|
||||
// frames needed by conference_exec
|
||||
unsigned int inFramesNeeded ;
|
||||
|
||||
// used when caching last frame
|
||||
conf_frame* inFramesLast ;
|
||||
unsigned int inFramesRepeatLast ;
|
||||
unsigned short okayToCacheLast ;
|
||||
|
||||
// output frame queue
|
||||
conf_frame* outFrames ;
|
||||
conf_frame* outFramesTail ;
|
||||
unsigned int outFramesCount ;
|
||||
|
||||
// time we last dropped a frame
|
||||
struct timeval last_in_dropped ;
|
||||
struct timeval last_out_dropped ;
|
||||
|
||||
// ( not currently used )
|
||||
// int samplesperframe ;
|
||||
|
||||
// used for determining need to mix frames
|
||||
// and for management interface notification
|
||||
short speaking_state_prev ;
|
||||
short speaking_state_notify ;
|
||||
short speaking_state ;
|
||||
|
||||
// pointer to next member in single-linked list
|
||||
struct ast_conf_member* next ;
|
||||
|
||||
// accounting values
|
||||
unsigned long frames_in ;
|
||||
unsigned long frames_in_dropped ;
|
||||
unsigned long frames_out ;
|
||||
unsigned long frames_out_dropped ;
|
||||
|
||||
// for counting sequentially dropped frames
|
||||
unsigned int sequential_drops ;
|
||||
unsigned long since_dropped ;
|
||||
|
||||
// start time
|
||||
struct timeval time_entered ;
|
||||
struct timeval lastsent_timeval ;
|
||||
|
||||
// flag indicating we should remove this member
|
||||
short remove_flag ;
|
||||
|
||||
#if ( SILDET == 2 )
|
||||
// pointer to speex preprocessor dsp
|
||||
SpeexPreprocessState *dsp ;
|
||||
// number of frames to ignore speex_preprocess()
|
||||
int ignore_speex_count;
|
||||
#else
|
||||
// placeholder when preprocessing is not enabled
|
||||
void* dsp ;
|
||||
#endif
|
||||
|
||||
// audio format this member is using
|
||||
int write_format ;
|
||||
int read_format ;
|
||||
|
||||
int write_format_index ;
|
||||
int read_format_index ;
|
||||
|
||||
// member frame translators
|
||||
struct ast_trans_pvt* to_slinear ;
|
||||
struct ast_trans_pvt* from_slinear ;
|
||||
|
||||
// For playing sounds
|
||||
struct ast_conf_soundq *soundq;
|
||||
|
||||
#ifdef DEBUG_OUTPUT_PCM
|
||||
FILE *incoming_fh;
|
||||
#endif
|
||||
|
||||
int send_dtmf:1;
|
||||
int quiet_entry_exit:1;
|
||||
int inband_dtmf:1;
|
||||
int rfc_dtmf:1;
|
||||
} ;
|
||||
|
||||
struct conf_member
|
||||
{
|
||||
struct ast_conf_member* realmember ;
|
||||
struct conf_member* next ;
|
||||
} ;
|
||||
|
||||
//
|
||||
// function declarations
|
||||
//
|
||||
|
||||
int member_exec( struct ast_channel* chan, void* data ) ;
|
||||
|
||||
int basic_play_sound ( char *channel, char *file ) ;
|
||||
|
||||
struct ast_conf_member* create_member( struct ast_channel* chan, const char* data ) ;
|
||||
struct ast_conf_member* delete_member( struct ast_conf_member* member ) ;
|
||||
|
||||
// incoming queue
|
||||
int queue_incoming_frame( struct ast_conf_member* member, struct ast_frame* fr ) ;
|
||||
conf_frame* get_incoming_frame( struct ast_conf_member* member ) ;
|
||||
|
||||
// outgoing queue
|
||||
int queue_outgoing_frame( struct ast_conf_member* member, const struct ast_frame* fr, struct timeval delivery ) ;
|
||||
int __queue_outgoing_frame( struct ast_conf_member* member, const struct ast_frame* fr, struct timeval delivery ) ;
|
||||
conf_frame* get_outgoing_frame( struct ast_conf_member* member ) ;
|
||||
|
||||
void send_state_change_notifications( struct ast_conf_member* member ) ;
|
||||
|
||||
//
|
||||
// meta-info accessors functions
|
||||
//
|
||||
|
||||
short memberIsPhoneClient( struct ast_conf_member* member ) ;
|
||||
short memberIsIaxClient( struct ast_conf_member* member ) ;
|
||||
short memberIsSIPClient( struct ast_conf_member* member ) ;
|
||||
|
||||
short memberIsModerator( struct ast_conf_member* member ) ;
|
||||
short memberIsListener( struct ast_conf_member* member ) ;
|
||||
|
||||
//
|
||||
// packer functions
|
||||
//
|
||||
|
||||
struct ast_packer;
|
||||
|
||||
extern struct ast_packer *ast_packer_new(int bytes);
|
||||
extern void ast_packer_set_flags(struct ast_packer *packer, int flags);
|
||||
extern int ast_packer_get_flags(struct ast_packer *packer);
|
||||
extern void ast_packer_free(struct ast_packer *s);
|
||||
extern void ast_packer_reset(struct ast_packer *s, int bytes);
|
||||
extern int ast_packer_feed(struct ast_packer *s, const struct ast_frame *f);
|
||||
extern struct ast_frame *ast_packer_read(struct ast_packer *s);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,2 @@
|
||||
Õ:“nôPSaÌtÖªj*PÕR6ÛžD ␍IÁ‰àDCtbëÕ<kºêáCÈk<¸Ö»Â¬£ª5†¹#BâtdêíB¸1xVÕÔûk¶©…#Ì‹'ŒÝbgMKŒ©yâÃÅiµ)ï¢èåO¤Ôû{6ªw!·Sã§(ï¢ñœ‰È«»¢VÕ6Ž\yB8×7Õ<cú©Á›K£êñ�¾©Ž©ˆÃFÖ¬£»‚V¸±È£ÔûkviïB³[�Q\›C6êxfæßB¾,6)‡»"˜ã°ñZÕ;{:ª½Âäèh¤½Â—5ÓÃw£QœtÖ²»¡ÌmÉÔü\:¢íâž,R)ía×VN©ÝaES¦¬=ïÁÑÆVI#Ôûkv©»Á·†Oi‚aÅÑ”y¡Ñ[�özïÁJ•VÝÕ<szª½‚„Ž4¢½¢V±Y,ׇ+£¥S«#7"â·"Ôücú¡ï¡6åIw!¶Ý׫A(s5Y␍íTâ\Ê;Ôûs6ª»�ª×8ÖÜïÂÈyu8ÞwÁŽÜÊCÅ«â:ªã·•Õ4ë©õ{ÃH±<i†¿Ç
|
||||
ÜnCŒWí8âª:˜!]®×yì
|
||||
Binary file not shown.
Reference in New Issue
Block a user