mirror of
https://github.com/asterisk/asterisk.git
synced 2025-08-24 14:13:53 +00:00
Compare commits
490 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d162e4ae3f | ||
|
15871a9b18 | ||
|
b9e5f3fd99 | ||
|
f43b8a655d | ||
|
c882c82377 | ||
|
a6a17f1789 | ||
|
a94248e7dc | ||
|
f1744d3e31 | ||
|
9ef31203c9 | ||
|
5e266283e9 | ||
|
ce4e323638 | ||
|
547a070805 | ||
|
b2e084ae6d | ||
|
6b101367b8 | ||
|
5ecca96df5 | ||
|
3e830d9a85 | ||
|
42e50f7eae | ||
|
63ffcdfda2 | ||
|
e9d164d468 | ||
|
f5765a22fc | ||
|
84790a577b | ||
|
76066c2b74 | ||
|
9739139287 | ||
|
6d3d5e1649 | ||
|
d6873875cc | ||
|
f84891dfbb | ||
|
75ca02dbaa | ||
|
f1c97e7df8 | ||
|
919e8741b4 | ||
|
7018a80e91 | ||
|
f0e022bbad | ||
|
6691ebf59f | ||
|
d5a7d2e170 | ||
|
1795ff12cd | ||
|
ee808b6187 | ||
|
e0989958cc | ||
|
9123735599 | ||
|
4eef3ef785 | ||
|
0c4cc3b0ce | ||
|
a0c5fed6e8 | ||
|
8506e078c5 | ||
|
dda49ce86b | ||
|
63c91a899e | ||
|
892d98aca0 | ||
|
14285e5b2b | ||
|
89da276678 | ||
|
53a0b36973 | ||
|
bfbf66aec6 | ||
|
2ef43a770b | ||
|
25d2c99737 | ||
|
3c8d8caca1 | ||
|
a6d8b31956 | ||
|
9911943d3d | ||
|
3361be7b6e | ||
|
8b96daf53e | ||
|
968d069242 | ||
|
bc3570ac0f | ||
|
d5d56f98c3 | ||
|
728e1d9a31 | ||
|
961bcfe98c | ||
|
e6254eeb34 | ||
|
f08e7df7a8 | ||
|
8638d73b91 | ||
|
ee46d2d92e | ||
|
dd260ec707 | ||
|
bb0812be95 | ||
|
78986fe938 | ||
|
adbfc9d3c7 | ||
|
b2e48e3c22 | ||
|
6b93396fb9 | ||
|
6af35712ef | ||
|
249760b951 | ||
|
d46fa7e825 | ||
|
41210a37d6 | ||
|
72fe69919c | ||
|
b3d0a54a6b | ||
|
053f005508 | ||
|
a7987a4d36 | ||
|
960ad9e350 | ||
|
eb19888db5 | ||
|
0f643c18be | ||
|
3bc1111ea8 | ||
|
d27c901fa2 | ||
|
9d0eead218 | ||
|
c7ee76b69f | ||
|
092055c3a5 | ||
|
1b107baf37 | ||
|
83dc76b389 | ||
|
87d78ee383 | ||
|
316e536e5c | ||
|
49aa847408 | ||
|
00c0af845d | ||
|
822ea9615a | ||
|
b7f8ee4a6d | ||
|
d3d73f3499 | ||
|
9426da88b7 | ||
|
3e1ca33f4e | ||
|
37e9f9a15c | ||
|
a7961494bd | ||
|
5d04193649 | ||
|
4397e6dd42 | ||
|
e5c7e5df97 | ||
|
8ecd579aec | ||
|
d762abaf3b | ||
|
d0aef28b0e | ||
|
cecda9a947 | ||
|
d9b9996a59 | ||
|
891c6d599e | ||
|
f2dc4f491d | ||
|
089900af32 | ||
|
95bdc91eaf | ||
|
9d5f3974d3 | ||
|
e6b64adab2 | ||
|
6abf8e5e92 | ||
|
0c108cb1ec | ||
|
2939ab99bd | ||
|
4bea5adcbf | ||
|
bd9026f975 | ||
|
9a13dc9d99 | ||
|
829bf52765 | ||
|
b224ed93ca | ||
|
c3d195a2b3 | ||
|
aea2d73afa | ||
|
5bc6b3b6fd | ||
|
58c3bdc8f1 | ||
|
6f7efa99d5 | ||
|
fb912bc629 | ||
|
95dc3bba01 | ||
|
83b525e2cb | ||
|
4a40420978 | ||
|
08cc142495 | ||
|
48d13f84a5 | ||
|
7b12d67e50 | ||
|
d98317c7ad | ||
|
ce8275960e | ||
|
a6e5c98723 | ||
|
60df6b45d2 | ||
|
235212182e | ||
|
831a96aac1 | ||
|
bdea273046 | ||
|
f08096e951 | ||
|
d5a3b59ccf | ||
|
457bdd22bb | ||
|
43fde6acce | ||
|
adf51ade80 | ||
|
65f95fee51 | ||
|
bca4868578 | ||
|
9a729f7aff | ||
|
d125a1a278 | ||
|
6c0ac0721e | ||
|
65acfca5af | ||
|
3585625b40 | ||
|
c43f01c211 | ||
|
52aa07e2b2 | ||
|
b97c1529fc | ||
|
0a48c19845 | ||
|
8aa27f2c5c | ||
|
0bb7b71572 | ||
|
ac1e4d72dd | ||
|
ecf158b51e | ||
|
8d417967ce | ||
|
8d1c316519 | ||
|
70bd3bebc5 | ||
|
8c63eaec22 | ||
|
35ea822831 | ||
|
420f3d12aa | ||
|
469e6d539a | ||
|
09bf0c3032 | ||
|
3db3883d3d | ||
|
b85f9ea8fb | ||
|
84b4d40f79 | ||
|
ea4baa91d0 | ||
|
eb76fca6a3 | ||
|
677ed9a31a | ||
|
dea7edda6b | ||
|
da3df5ec26 | ||
|
0a0470ad00 | ||
|
b89b296584 | ||
|
41feb1c7ff | ||
|
9884c9637a | ||
|
b0f4874196 | ||
|
3667b25224 | ||
|
dcccda229d | ||
|
d31a0d9e7b | ||
|
674425a343 | ||
|
efd60d1d1f | ||
|
0cfcb22bbc | ||
|
9925080ca6 | ||
|
e34983cde0 | ||
|
17187101f6 | ||
|
747495fc0e | ||
|
d564b81083 | ||
|
50249c732b | ||
|
108275cf6c | ||
|
13b57f8255 | ||
|
6b8f2a96f1 | ||
|
b21dc2c0c2 | ||
|
f096152b20 | ||
|
3b776cdfdc | ||
|
9593aa0aa1 | ||
|
4edd97a713 | ||
|
eb1b6f313e | ||
|
38ca23948d | ||
|
e6ae8990bc | ||
|
14e8c4c5a3 | ||
|
b2bd6c27db | ||
|
d3080cc1ae | ||
|
023a312f65 | ||
|
89995395d9 | ||
|
fbe6931218 | ||
|
8545a6d4c0 | ||
|
3388661f38 | ||
|
1d58eff4a7 | ||
|
cc4595f85e | ||
|
ac9f562712 | ||
|
b3af62dc4f | ||
|
a70900ccd0 | ||
|
782eb432ab | ||
|
4e3b9d6389 | ||
|
dbc0f5d2e2 | ||
|
ea27f3c186 | ||
|
2dc23188a2 | ||
|
a4725e9c73 | ||
|
575c2bccd5 | ||
|
2d5cc8be5c | ||
|
10191fe126 | ||
|
4a391da1bd | ||
|
86406e8ba0 | ||
|
536dcc2058 | ||
|
c4c44af8e3 | ||
|
b26f150b75 | ||
|
271ccecaf2 | ||
|
0742e08800 | ||
|
34a135da3b | ||
|
39139b2802 | ||
|
799247b4d5 | ||
|
677a22c209 | ||
|
973a1dec88 | ||
|
dfc0e65f4b | ||
|
1e94621214 | ||
|
5fbe407b98 | ||
|
a3ce65e5cd | ||
|
fcf8040825 | ||
|
842e9246a6 | ||
|
6b682d34ff | ||
|
1ef0003131 | ||
|
4e884dbd28 | ||
|
0a1d8918d8 | ||
|
3da520e492 | ||
|
0a0cf51877 | ||
|
cab988b595 | ||
|
507c47ffa4 | ||
|
7c92ffe150 | ||
|
f522e07cbd | ||
|
df18b234b1 | ||
|
7652fdda20 | ||
|
bab77bbab1 | ||
|
ce008d40a1 | ||
|
710445b5b1 | ||
|
ba001a7d15 | ||
|
4f144aa5e3 | ||
|
8d66f50877 | ||
|
e0db36550e | ||
|
13f4e66b14 | ||
|
ae8fe3738b | ||
|
b5111fb985 | ||
|
671cde62de | ||
|
0ea76a52a9 | ||
|
db467378b4 | ||
|
e27d844918 | ||
|
3b0edd5cfe | ||
|
74eef60486 | ||
|
b3a8fbf495 | ||
|
bae6e7b617 | ||
|
cf015dbefc | ||
|
32cc1bedc1 | ||
|
a96ecb64a6 | ||
|
d1757b3b49 | ||
|
917259bcd3 | ||
|
eb177856db | ||
|
9849ad993d | ||
|
bb886dd488 | ||
|
48fb967c05 | ||
|
e74a7116e5 | ||
|
fd25b81993 | ||
|
dcd9d8d58f | ||
|
1d9b2a9df1 | ||
|
659da47b95 | ||
|
e83bfee678 | ||
|
ab209c7d92 | ||
|
dc08bd8501 | ||
|
aca3c1f79d | ||
|
e07c977f18 | ||
|
2ae21cc5c3 | ||
|
05fed23d06 | ||
|
2f43722570 | ||
|
7ea315539c | ||
|
10d527906a | ||
|
2f1d118537 | ||
|
696922defe | ||
|
cea50c9247 | ||
|
636f956bf0 | ||
|
64b1d91701 | ||
|
ff83f7c6ed | ||
|
87c0cd2667 | ||
|
366c8a99ef | ||
|
30f2aff526 | ||
|
962cffffc7 | ||
|
f196484187 | ||
|
c40fe2f71a | ||
|
74c149e891 | ||
|
57c82eb66f | ||
|
5460606cff | ||
|
1a509417a4 | ||
|
898cd20ceb | ||
|
792b78b317 | ||
|
4efe647169 | ||
|
4fbba55f14 | ||
|
2efc5a9e83 | ||
|
57144d5102 | ||
|
555bbffec3 | ||
|
e22510658b | ||
|
cb08e49303 | ||
|
dee03d2b80 | ||
|
b5ec3e47fa | ||
|
ffb11fb950 | ||
|
fbee1f0ed7 | ||
|
131ada1116 | ||
|
b0609b29aa | ||
|
bbb59b8c5e | ||
|
72deed0c37 | ||
|
b9f8c60fa7 | ||
|
87b36e1ff1 | ||
|
d8c5d338cb | ||
|
417438fea0 | ||
|
5488ffb6d4 | ||
|
e8725ce940 | ||
|
0e734920e8 | ||
|
ad598a2060 | ||
|
bb47f95262 | ||
|
a7a2115b9c | ||
|
18429f2a69 | ||
|
7e6430787c | ||
|
dc3ba8c223 | ||
|
2fd6520a7e | ||
|
7a61b36104 | ||
|
2f4783a770 | ||
|
6056391a78 | ||
|
213b3575ce | ||
|
3821e18d08 | ||
|
224c6e3f7c | ||
|
18ab6f429c | ||
|
07f8542ce7 | ||
|
cf293c224d | ||
|
e234ad0011 | ||
|
229b778b0b | ||
|
66f484defe | ||
|
ed523e248a | ||
|
3c49f27bf4 | ||
|
226d146b25 | ||
|
1892289329 | ||
|
5529fc0355 | ||
|
73ef559240 | ||
|
b59a63c8cd | ||
|
c36927137f | ||
|
649aaad100 | ||
|
ea4c262482 | ||
|
89de6c9df6 | ||
|
4578bc3b0c | ||
|
8df1e4866a | ||
|
9f92220a9c | ||
|
09a9e7bcb7 | ||
|
a434f8877a | ||
|
ef891dc0a7 | ||
|
3ebe29c983 | ||
|
1028e43464 | ||
|
4979f66f28 | ||
|
a5e9fe97c8 | ||
|
2293cfaf84 | ||
|
d252dde933 | ||
|
37a49a5992 | ||
|
2783801610 | ||
|
82f19c9a91 | ||
|
71d9531e45 | ||
|
3bbeaefa57 | ||
|
4611be805a | ||
|
587493fdfc | ||
|
50079144e3 | ||
|
2ca80e76a0 | ||
|
68e6502484 | ||
|
1e91dfa5df | ||
|
e4e5f7c65b | ||
|
8ef66261f1 | ||
|
90812b536c | ||
|
2b880d3ef8 | ||
|
6ab729aeb3 | ||
|
c9f97f49c5 | ||
|
8b352fcb94 | ||
|
5a06af4d57 | ||
|
2ede900bfd | ||
|
fb0ffc7784 | ||
|
e69171dc06 | ||
|
8452f6b494 | ||
|
f9bc6f8afc | ||
|
f9f44d7d9b | ||
|
86bb1472cc | ||
|
ef09c506c8 | ||
|
af7b3b420e | ||
|
3b80a35a66 | ||
|
f59b27258c | ||
|
d38fff38f9 | ||
|
91c5b12f25 | ||
|
894bdd5cda | ||
|
d8c58ca6c8 | ||
|
43f7956422 | ||
|
96fcc02900 | ||
|
2e8b6e7f20 | ||
|
3ed93398e9 | ||
|
d84e0caea8 | ||
|
5c1da58b90 | ||
|
018c617199 | ||
|
a49f954f6a | ||
|
03a8791440 | ||
|
78ad17381e | ||
|
5b03803e2f | ||
|
ee1e461a57 | ||
|
a543725311 | ||
|
8c701a0861 | ||
|
5fbe566524 | ||
|
e14cf31bc9 | ||
|
0042c03c7e | ||
|
41023ecb9c | ||
|
fb8d0a544d | ||
|
acaf8c9cc9 | ||
|
0d3fc8d103 | ||
|
9bbfbacacc | ||
|
8e301c629f | ||
|
9576d8a081 | ||
|
7db96672bf | ||
|
0d8f099ca2 | ||
|
0a4d7e5068 | ||
|
a32f75b800 | ||
|
78f37c51ef | ||
|
d6e5eb75ee | ||
|
6f433a7e7b | ||
|
ce2ecb5582 | ||
|
45c15e8561 | ||
|
5e3f4186da | ||
|
d03694df19 | ||
|
d52e8fa7d2 | ||
|
77c6cd0bff | ||
|
463ebe8b4b | ||
|
a563eab49a | ||
|
bf9d4b103d | ||
|
7dc2449f3a | ||
|
27cc20db11 | ||
|
4e04f5f731 | ||
|
5ec3844077 | ||
|
f641c7cd0d | ||
|
49aa54cafc | ||
|
e3b81e66a1 | ||
|
7bb6b928b5 | ||
|
ad4dc7c4a9 | ||
|
feb9764721 | ||
|
8c74501001 | ||
|
5861d3fd64 | ||
|
08acdc6a86 | ||
|
3b50570c9b | ||
|
00d7e962a7 | ||
|
192f7413c2 | ||
|
5bdb8074aa | ||
|
6abe5e1b23 | ||
|
4612b4ccca | ||
|
3245bf61a1 | ||
|
9ee13167bb | ||
|
ca9633ca9b | ||
|
e04884545c | ||
|
aa2239a050 | ||
|
40a1b60cbd | ||
|
cccb11916f | ||
|
49641825eb | ||
|
c14c078405 | ||
|
f2af073588 | ||
|
b9a5eddb6d | ||
|
bffc815375 | ||
|
5c3f322364 | ||
|
3a6fae817c | ||
|
d8f74ecb94 | ||
|
f7f2b1b033 | ||
|
601ab7ff82 |
0
.cleancount
Executable file → Normal file
0
.cleancount
Executable file → Normal file
16
.cvsignore
16
.cvsignore
@@ -1,16 +0,0 @@
|
|||||||
asterisk
|
|
||||||
defaults.h
|
|
||||||
ast_expr2.output
|
|
||||||
.version
|
|
||||||
.depend
|
|
||||||
.applied
|
|
||||||
mpg123-0.59r
|
|
||||||
mpg123-0.59r.tar.gz
|
|
||||||
update.out
|
|
||||||
.lastclean
|
|
||||||
.cleancount
|
|
||||||
.tags-depend
|
|
||||||
.tags-sources
|
|
||||||
tags
|
|
||||||
TAGS
|
|
||||||
testexpr2
|
|
1
.lastclean
Normal file
1
.lastclean
Normal file
@@ -0,0 +1 @@
|
|||||||
|
8
|
4
CREDITS
Executable file → Normal file
4
CREDITS
Executable file → Normal file
@@ -13,6 +13,8 @@ Telesthetic - for supporting SIP development
|
|||||||
|
|
||||||
Christos Ricudis - for substantial code contributions
|
Christos Ricudis - for substantial code contributions
|
||||||
|
|
||||||
|
nic.at - ENUM support in Asterisk
|
||||||
|
|
||||||
Paul Bagyenda, Digital Solutions - for initial Voicetronix driver development
|
Paul Bagyenda, Digital Solutions - for initial Voicetronix driver development
|
||||||
|
|
||||||
=== WISHLIST CONTRIBUTERS ===
|
=== WISHLIST CONTRIBUTERS ===
|
||||||
@@ -85,7 +87,7 @@ Leif Madsen, Jared Smith and Jim van Meggelen - the Asterisk book
|
|||||||
available under a Creative Commons License at http://www.asteriskdocs.org
|
available under a Creative Commons License at http://www.asteriskdocs.org
|
||||||
|
|
||||||
=== HOLD MUSIC ===
|
=== HOLD MUSIC ===
|
||||||
Music provided by www.freeplaymusic.com
|
Music provided by www.opsound.org
|
||||||
|
|
||||||
=== OTHER SOURCE CODE IN ASTERISK ===
|
=== OTHER SOURCE CODE IN ASTERISK ===
|
||||||
|
|
||||||
|
177
Makefile
Executable file → Normal file
177
Makefile
Executable file → Normal file
@@ -36,6 +36,8 @@ endif
|
|||||||
# Remember the MAKELEVEL at the top
|
# Remember the MAKELEVEL at the top
|
||||||
MAKETOPLEVEL?=$(MAKELEVEL)
|
MAKETOPLEVEL?=$(MAKELEVEL)
|
||||||
|
|
||||||
|
PWD=$(shell pwd)
|
||||||
|
|
||||||
ifneq ($(findstring dont-optimize,$(MAKECMDGOALS)),dont-optimize)
|
ifneq ($(findstring dont-optimize,$(MAKECMDGOALS)),dont-optimize)
|
||||||
######### More GSM codec optimization
|
######### More GSM codec optimization
|
||||||
######### Uncomment to enable MMXTM optimizations for x86 architecture CPU's
|
######### Uncomment to enable MMXTM optimizations for x86 architecture CPU's
|
||||||
@@ -179,7 +181,6 @@ ifeq ($(OSARCH),Linux)
|
|||||||
# You must have GCC 3.4 to use k8, otherwise use athlon
|
# You must have GCC 3.4 to use k8, otherwise use athlon
|
||||||
PROC=k8
|
PROC=k8
|
||||||
#PROC=athlon
|
#PROC=athlon
|
||||||
OPTIONS+=-m64
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PROC),sparc64)
|
ifeq ($(PROC),sparc64)
|
||||||
@@ -200,21 +201,22 @@ ifeq ($(OSARCH),Linux)
|
|||||||
OPTIONS+=-fsigned-char -mcpu=ep9312
|
OPTIONS+=-fsigned-char -mcpu=ep9312
|
||||||
else
|
else
|
||||||
ifeq ($(SUB_PROC),xscale)
|
ifeq ($(SUB_PROC),xscale)
|
||||||
OPTIONS+=-fsigned-char -msoft-float -mcpu=xscale
|
OPTIONS+=-fsigned-char -mcpu=xscale
|
||||||
else
|
else
|
||||||
OPTIONS+=-fsigned-char -msoft-float
|
OPTIONS+=-fsigned-char
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
MPG123TARG=linux
|
MPG123TARG=linux
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PWD=$(shell pwd)
|
|
||||||
GREP=grep
|
GREP=grep
|
||||||
|
ID=id
|
||||||
|
|
||||||
ifeq ($(OSARCH),SunOS)
|
ifeq ($(OSARCH),SunOS)
|
||||||
GREP=/usr/xpg4/bin/grep
|
GREP=/usr/xpg4/bin/grep
|
||||||
M4=/usr/local/bin/m4
|
M4=/usr/local/bin/m4
|
||||||
|
ID=/usr/xpg4/bin/id
|
||||||
endif
|
endif
|
||||||
|
|
||||||
INCLUDE+=-Iinclude -I../include
|
INCLUDE+=-Iinclude -I../include
|
||||||
@@ -305,22 +307,24 @@ endif # WITHOUT_ZAPTEL
|
|||||||
LIBEDIT=editline/libedit.a
|
LIBEDIT=editline/libedit.a
|
||||||
|
|
||||||
ifneq ($(wildcard .version),)
|
ifneq ($(wildcard .version),)
|
||||||
ASTERISKVERSION=$(shell cat .version)
|
ASTERISKVERSION:=$(shell cat .version)
|
||||||
ASTERISKVERSIONNUM=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
|
ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
|
||||||
RPMVERSION=$(shell sed 's/[-\/:]/_/g' .version)
|
RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
|
||||||
else
|
else
|
||||||
RPMVERSION=unknown
|
RPMVERSION=unknown
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(wildcard CVS),)
|
# CVS mirrors of SVN have .svnrevision files showing
|
||||||
|
# which SVN revision they are based on, and .svnbranch
|
||||||
|
# showing the branch they are made from
|
||||||
|
ifneq ($(wildcard .svnrevision),)
|
||||||
ASTERISKVERSIONNUM=999999
|
ASTERISKVERSIONNUM=999999
|
||||||
ifneq ($(wildcard CVS/Tag),)
|
ASTERISKVERSION:=SVN-$(shell cat .svnbranch)-r$(shell cat .svnrevision)
|
||||||
ASTERISKVERSION=$(shell echo "CVS-`sed 's/^T//g' CVS/Tag`-`date +"%D-%T"`")
|
|
||||||
else
|
|
||||||
ASTERISKVERSION=CVS HEAD
|
|
||||||
endif
|
|
||||||
else
|
else
|
||||||
ASTERISKVERSIONNUM=000000
|
ifneq ($(wildcard .svn),)
|
||||||
|
ASTERISKVERSIONNUM=999999
|
||||||
|
ASTERISKVERSION=SVN-$(shell build_tools/make_svn_branch_name)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ASTCFLAGS+= $(DEBUG_THREADS)
|
ASTCFLAGS+= $(DEBUG_THREADS)
|
||||||
@@ -328,7 +332,9 @@ ASTCFLAGS+= $(TRACE_FRAMES)
|
|||||||
ASTCFLAGS+= $(MALLOC_DEBUG)
|
ASTCFLAGS+= $(MALLOC_DEBUG)
|
||||||
ASTCFLAGS+= $(BUSYDETECT)
|
ASTCFLAGS+= $(BUSYDETECT)
|
||||||
ASTCFLAGS+= $(OPTIONS)
|
ASTCFLAGS+= $(OPTIONS)
|
||||||
|
ifneq ($(findstring dont-optimize,$(MAKECMDGOALS)),dont-optimize)
|
||||||
ASTCFLAGS+= -fomit-frame-pointer
|
ASTCFLAGS+= -fomit-frame-pointer
|
||||||
|
endif
|
||||||
SUBDIRS=res channels pbx apps codecs formats agi cdr funcs utils stdtime
|
SUBDIRS=res channels pbx apps codecs formats agi cdr funcs utils stdtime
|
||||||
|
|
||||||
OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
|
OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
|
||||||
@@ -363,7 +369,7 @@ ifeq ($(OSARCH),Darwin)
|
|||||||
AUDIO_LIBS=-framework CoreAudio
|
AUDIO_LIBS=-framework CoreAudio
|
||||||
ASTLINK=-Wl,-dynamic
|
ASTLINK=-Wl,-dynamic
|
||||||
SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
|
SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
|
||||||
OBJS+=poll.o
|
OBJS+= poll.o
|
||||||
ASTCFLAGS+=-DPOLLCOMPAT
|
ASTCFLAGS+=-DPOLLCOMPAT
|
||||||
else
|
else
|
||||||
#These are used for all but Darwin
|
#These are used for all but Darwin
|
||||||
@@ -427,10 +433,10 @@ endif
|
|||||||
noclean: depend asterisk subdirs
|
noclean: depend asterisk subdirs
|
||||||
|
|
||||||
editline/config.h:
|
editline/config.h:
|
||||||
cd editline && unset CFLAGS LIBS && ./configure ; \
|
cd editline && unset CFLAGS LIBS && CFLAGS="$(OPTIMIZE)" ./configure ; \
|
||||||
|
|
||||||
editline/libedit.a: FORCE
|
editline/libedit.a: FORCE
|
||||||
cd editline && unset CFLAGS LIBS && test -f config.h || ./configure
|
cd editline && unset CFLAGS LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure
|
||||||
$(MAKE) -C editline libedit.a
|
$(MAKE) -C editline libedit.a
|
||||||
|
|
||||||
db1-ast/libdb1.a: FORCE
|
db1-ast/libdb1.a: FORCE
|
||||||
@@ -534,7 +540,7 @@ clean:
|
|||||||
$(MAKE) -C stdtime clean
|
$(MAKE) -C stdtime clean
|
||||||
|
|
||||||
datafiles: all
|
datafiles: all
|
||||||
if test $$(id -u) = 0; then sh mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
|
if [ x`$(ID) -un` = xroot ]; then sh mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
|
||||||
mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
|
mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
|
||||||
mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/priv-callerintros
|
mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/priv-callerintros
|
||||||
for x in sounds/digits/*.gsm; do \
|
for x in sounds/digits/*.gsm; do \
|
||||||
@@ -588,17 +594,16 @@ datafiles: all
|
|||||||
mkdir -p $(DESTDIR)$(AGI_DIR)
|
mkdir -p $(DESTDIR)$(AGI_DIR)
|
||||||
|
|
||||||
update:
|
update:
|
||||||
@if [ -d CVS ]; then \
|
@if [ -d .svn ]; then \
|
||||||
if [ -f patches/.applied ]; then \
|
echo "Updating from Subversion..." ; \
|
||||||
patches=`cat patches/.applied`; \
|
svn update | tee update.out; \
|
||||||
fi; \
|
rm -f .version; \
|
||||||
if [ ! -z "$$patches" ]; then \
|
if [ `grep -c ^C update.out` -gt 0 ]; then \
|
||||||
for x in $$patches; do \
|
echo ; echo "The following files have conflicts:" ; \
|
||||||
echo "Unapplying $$x..."; \
|
grep ^C update.out | cut -b4- ; \
|
||||||
patch -R -p0 < patches/$$x; \
|
|
||||||
done; \
|
|
||||||
rm -f patches/.applied; \
|
|
||||||
fi ; \
|
fi ; \
|
||||||
|
rm -f update.out; \
|
||||||
|
elif [ -d CVS ]; then \
|
||||||
echo "Updating from CVS..." ; \
|
echo "Updating from CVS..." ; \
|
||||||
cvs -q -z3 update -Pd | tee update.out; \
|
cvs -q -z3 update -Pd | tee update.out; \
|
||||||
rm -f .version; \
|
rm -f .version; \
|
||||||
@@ -607,19 +612,8 @@ update:
|
|||||||
grep ^C update.out | cut -d' ' -f2- ; \
|
grep ^C update.out | cut -d' ' -f2- ; \
|
||||||
fi ; \
|
fi ; \
|
||||||
rm -f update.out; \
|
rm -f update.out; \
|
||||||
if [ ! -z "$$patches" ]; then \
|
|
||||||
for x in $$patches; do \
|
|
||||||
if [ -f patches/$$x ]; then \
|
|
||||||
echo "Applying patch $$x..."; \
|
|
||||||
patch -p0 < patches/$$x; \
|
|
||||||
echo $$x >> patches/.applied; \
|
|
||||||
else \
|
|
||||||
echo "Patch $$x no longer relevant"; \
|
|
||||||
fi; \
|
|
||||||
done; \
|
|
||||||
fi; \
|
|
||||||
else \
|
else \
|
||||||
echo "Not CVS"; \
|
echo "Not under version control"; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
|
NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
|
||||||
@@ -636,6 +630,7 @@ bininstall: all
|
|||||||
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
|
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
|
||||||
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
|
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
|
||||||
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
|
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
|
||||||
|
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
|
||||||
if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
|
if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
|
||||||
if [ -f cygwin/asterisk.exe ]; then $(INSTALL) -m 755 cygwin/asterisk.exe $(DESTDIR)$(ASTSBINDIR)/; fi
|
if [ -f cygwin/asterisk.exe ]; then $(INSTALL) -m 755 cygwin/asterisk.exe $(DESTDIR)$(ASTSBINDIR)/; fi
|
||||||
if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
|
if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
|
||||||
@@ -646,13 +641,11 @@ bininstall: all
|
|||||||
cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
|
cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
|
||||||
chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
|
chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
|
||||||
fi
|
fi
|
||||||
for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
|
|
||||||
$(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
|
$(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
|
||||||
$(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
|
$(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
|
||||||
if [ -n "$(OLDHEADERS)" ]; then \
|
if [ -n "$(OLDHEADERS)" ]; then \
|
||||||
rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
|
rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
|
||||||
fi
|
fi
|
||||||
rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail
|
|
||||||
mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds
|
mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds
|
||||||
mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
|
mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
|
||||||
mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
|
mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
|
||||||
@@ -671,30 +664,10 @@ bininstall: all
|
|||||||
else \
|
else \
|
||||||
echo "You need to do cvs update -d not just cvs update" ; \
|
echo "You need to do cvs update -d not just cvs update" ; \
|
||||||
fi
|
fi
|
||||||
( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds ; ln -s $(ASTSPOOLDIR)/voicemail . )
|
|
||||||
if [ -f mpg123-0.59r/mpg123 ]; then $(MAKE) -C mpg123-0.59r install; fi
|
if [ -f mpg123-0.59r/mpg123 ]; then $(MAKE) -C mpg123-0.59r install; fi
|
||||||
@echo " +---- Asterisk Installation Complete -------+"
|
|
||||||
@echo " + +"
|
install-subdirs:
|
||||||
@echo " + YOU MUST READ THE SECURITY DOCUMENT +"
|
for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
|
||||||
@echo " + +"
|
|
||||||
@echo " + Asterisk has successfully been installed. +"
|
|
||||||
@echo " + If you would like to install the sample +"
|
|
||||||
@echo " + configuration files (overwriting any +"
|
|
||||||
@echo " + existing config files), run: +"
|
|
||||||
@echo " + +"
|
|
||||||
@echo " + $(MAKE) samples +"
|
|
||||||
@echo " + +"
|
|
||||||
@echo " +----------------- or ---------------------+"
|
|
||||||
@echo " + +"
|
|
||||||
@echo " + You can go ahead and install the asterisk +"
|
|
||||||
@echo " + program documentation now or later run: +"
|
|
||||||
@echo " + +"
|
|
||||||
@echo " + $(MAKE) progdocs +"
|
|
||||||
@echo " + +"
|
|
||||||
@echo " + **Note** This requires that you have +"
|
|
||||||
@echo " + doxygen installed on your local system +"
|
|
||||||
@echo " +-------------------------------------------+"
|
|
||||||
@$(MAKE) -s oldmodcheck
|
|
||||||
|
|
||||||
NEWMODS=$(notdir $(wildcard */*.so))
|
NEWMODS=$(notdir $(wildcard */*.so))
|
||||||
OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
|
OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
|
||||||
@@ -717,10 +690,32 @@ oldmodcheck:
|
|||||||
echo " WARNING WARNING WARNING" ;\
|
echo " WARNING WARNING WARNING" ;\
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install: all datafiles bininstall
|
install: all datafiles bininstall install-subdirs
|
||||||
@if [ -x /usr/sbin/asterisk-post-install ]; then \
|
@if [ -x /usr/sbin/asterisk-post-install ]; then \
|
||||||
/usr/sbin/asterisk-post-install $(DESTDIR) . ; \
|
/usr/sbin/asterisk-post-install $(DESTDIR) . ; \
|
||||||
fi
|
fi
|
||||||
|
@echo " +---- Asterisk Installation Complete -------+"
|
||||||
|
@echo " + +"
|
||||||
|
@echo " + YOU MUST READ THE SECURITY DOCUMENT +"
|
||||||
|
@echo " + +"
|
||||||
|
@echo " + Asterisk has successfully been installed. +"
|
||||||
|
@echo " + If you would like to install the sample +"
|
||||||
|
@echo " + configuration files (overwriting any +"
|
||||||
|
@echo " + existing config files), run: +"
|
||||||
|
@echo " + +"
|
||||||
|
@echo " + $(MAKE) samples +"
|
||||||
|
@echo " + +"
|
||||||
|
@echo " +----------------- or ---------------------+"
|
||||||
|
@echo " + +"
|
||||||
|
@echo " + You can go ahead and install the asterisk +"
|
||||||
|
@echo " + program documentation now or later run: +"
|
||||||
|
@echo " + +"
|
||||||
|
@echo " + $(MAKE) progdocs +"
|
||||||
|
@echo " + +"
|
||||||
|
@echo " + **Note** This requires that you have +"
|
||||||
|
@echo " + doxygen installed on your local system +"
|
||||||
|
@echo " +-------------------------------------------+"
|
||||||
|
@$(MAKE) -s oldmodcheck
|
||||||
|
|
||||||
upgrade: all bininstall
|
upgrade: all bininstall
|
||||||
|
|
||||||
@@ -831,12 +826,12 @@ __rpm: include/asterisk/version.h spec
|
|||||||
$(MAKE) DESTDIR=/tmp/asterisk install ; \
|
$(MAKE) DESTDIR=/tmp/asterisk install ; \
|
||||||
$(MAKE) DESTDIR=/tmp/asterisk samples ; \
|
$(MAKE) DESTDIR=/tmp/asterisk samples ; \
|
||||||
mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
|
mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
|
||||||
cp -f redhat/asterisk /tmp/asterisk/etc/rc.d/init.d/ ; \
|
cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \
|
||||||
rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
|
rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
|
||||||
|
|
||||||
progdocs:
|
progdocs:
|
||||||
(cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT) \
|
(cat contrib/asterisk-ng-doxygen; echo "HAVE_DOT=$(HAVEDOT)"; \
|
||||||
PROJECT_NUMBER=$(ASTERISKVERSION) - $(ASTERISKVERSIONNUM)") | doxygen -
|
echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
|
||||||
|
|
||||||
mpg123:
|
mpg123:
|
||||||
@wget -V >/dev/null || (echo "You need wget" ; false )
|
@wget -V >/dev/null || (echo "You need wget" ; false )
|
||||||
@@ -906,47 +901,3 @@ cleantest:
|
|||||||
if cmp -s .cleancount .lastclean ; then echo ; else \
|
if cmp -s .cleancount .lastclean ; then echo ; else \
|
||||||
$(MAKE) clean; cp -f .cleancount .lastclean;\
|
$(MAKE) clean; cp -f .cleancount .lastclean;\
|
||||||
fi
|
fi
|
||||||
|
|
||||||
patchlist:
|
|
||||||
@echo "Experimental Patches:"
|
|
||||||
@for x in patches/*; do \
|
|
||||||
patch=`basename $$x`; \
|
|
||||||
if [ "$$patch" = "CVS" ]; then \
|
|
||||||
continue; \
|
|
||||||
fi; \
|
|
||||||
if grep -q ^$$patch$$ patches/.applied; then \
|
|
||||||
echo "$$patch (applied)"; \
|
|
||||||
else \
|
|
||||||
echo "$$patch (available)"; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
|
|
||||||
apply:
|
|
||||||
@if [ -z "$(PATCH)" ]; then \
|
|
||||||
echo "Usage: make PATCH=<patchname> apply"; \
|
|
||||||
elif grep -q ^$(PATCH)$$ patches/.applied 2>/dev/null; then \
|
|
||||||
echo "Patch $(PATCH) is already applied"; \
|
|
||||||
elif [ -f "patches/$(PATCH)" ]; then \
|
|
||||||
echo "Applying patch $(PATCH)"; \
|
|
||||||
patch -p0 < patches/$(PATCH); \
|
|
||||||
echo "$(PATCH)" >> patches/.applied; \
|
|
||||||
else \
|
|
||||||
echo "No such patch $(PATCH) in patches directory"; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
unapply:
|
|
||||||
@if [ -z "$(PATCH)" ]; then \
|
|
||||||
echo "Usage: make PATCH=<patchname> unapply"; \
|
|
||||||
elif grep -v -q ^$(PATCH)$$ patches/.applied 2>/dev/null; then \
|
|
||||||
echo "Patch $(PATCH) is not applied"; \
|
|
||||||
elif [ -f "patches/$(PATCH)" ]; then \
|
|
||||||
echo "Un-applying patch $(PATCH)"; \
|
|
||||||
patch -p0 -R < patches/$(PATCH); \
|
|
||||||
rm -f patches/.tmpapplied || :; \
|
|
||||||
mv patches/.applied patches/.tmpapplied; \
|
|
||||||
cat patches/.tmpapplied | grep -v ^$(PATCH)$$ > patches/.applied; \
|
|
||||||
rm -f patches/.tmpapplied; \
|
|
||||||
else \
|
|
||||||
echo "No such patch $(PATCH) in patches directory"; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
2
README
Executable file → Normal file
2
README
Executable file → Normal file
@@ -67,7 +67,7 @@ made every effort possible to maintain backwards compatibility.
|
|||||||
In order to discover new features to use, please check the configuration
|
In order to discover new features to use, please check the configuration
|
||||||
examples in the /configs directory of the source code distribution.
|
examples in the /configs directory of the source code distribution.
|
||||||
To discover the major new features of Asterisk 1.2, please visit
|
To discover the major new features of Asterisk 1.2, please visit
|
||||||
http://www.astricon.net/asterisk1-2/
|
http://edvina.net/asterisk1-2/
|
||||||
|
|
||||||
* NEW INSTALLATIONS
|
* NEW INSTALLATIONS
|
||||||
|
|
||||||
|
@@ -1,8 +0,0 @@
|
|||||||
About Hold Music
|
|
||||||
================
|
|
||||||
Digium has licensed the music included with
|
|
||||||
the Asterisk distribution From FreePlayMusic
|
|
||||||
for use and distribution with Asterisk. It
|
|
||||||
is licensed ONLY for use as hold music within
|
|
||||||
an Asterisk based PBX.
|
|
||||||
|
|
22
README.opsound
Normal file
22
README.opsound
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
About Hold Music
|
||||||
|
================
|
||||||
|
These files were obtained from http://opsound.org, where the authors placed them
|
||||||
|
under the Creative Commons Attribution-Share Alike 2.5 license, a copy of which
|
||||||
|
may be found at http://creativecommons.org.
|
||||||
|
|
||||||
|
Credits
|
||||||
|
================
|
||||||
|
macroform-cold_day - Paul Shuler (Macroform)
|
||||||
|
paulshuler@gmail.com - http://macroform.bandcamp.com/
|
||||||
|
|
||||||
|
macroform-robot_dity - Paul Shuler (Macroform)
|
||||||
|
paulshuler@gmail.com - http://macroform.bandcamp.com/
|
||||||
|
|
||||||
|
macroform-the_simplicity - Paul Shuler (Macroform)
|
||||||
|
paulshuler@gmail.com - http://macroform.bandcamp.com/
|
||||||
|
|
||||||
|
manolo_camp-morning_coffee - Manolo Camp
|
||||||
|
beatbastard@gmx.net - http://ccmixter.org/people/ManoloCamp
|
||||||
|
|
||||||
|
reno_project-system - Reno Project
|
||||||
|
renoproject@hotmail.com - http://www.jamendo.com/en/album/23661
|
11
UPGRADE.txt
Executable file → Normal file
11
UPGRADE.txt
Executable file → Normal file
@@ -52,8 +52,10 @@ Dialing:
|
|||||||
|
|
||||||
IAX:
|
IAX:
|
||||||
|
|
||||||
* The naming convention for IAX channels has changed in a minor way such
|
* The naming convention for IAX channels has changed in two ways:
|
||||||
that the call number follows a "-" rather than a "/" character.
|
1. The call number follows a "-" rather than a "/" character.
|
||||||
|
2. The name of the channel has been simplified to IAX2/peer-callno,
|
||||||
|
rather than IAX2/peer@peer-callno or even IAX2/peer@peer/callno.
|
||||||
|
|
||||||
SIP:
|
SIP:
|
||||||
|
|
||||||
@@ -129,6 +131,11 @@ Applications:
|
|||||||
'mailbox options' menu, and 'change your password' option has been
|
'mailbox options' menu, and 'change your password' option has been
|
||||||
moved to option 5.
|
moved to option 5.
|
||||||
|
|
||||||
|
* The application VoiceMailMain now only matches the 'default' context if
|
||||||
|
none is specified in the arguments. (This was the previously
|
||||||
|
documented behavior, however, we didn't follow that behavior.) The old
|
||||||
|
behavior can be restored by setting searchcontexts=yes in voicemail.conf.
|
||||||
|
|
||||||
Queues:
|
Queues:
|
||||||
|
|
||||||
* A queue is now considered empty not only if there are no members but if
|
* A queue is now considered empty not only if there are no members but if
|
||||||
|
0
aescrypt.c
Executable file → Normal file
0
aescrypt.c
Executable file → Normal file
@@ -1,3 +0,0 @@
|
|||||||
eagi-test
|
|
||||||
eagi-sphinx-test
|
|
||||||
.depend
|
|
0
agi/DialAnMp3.agi
Executable file → Normal file
0
agi/DialAnMp3.agi
Executable file → Normal file
2
agi/Makefile
Executable file → Normal file
2
agi/Makefile
Executable file → Normal file
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
AGIS=agi-test.agi eagi-test eagi-sphinx-test
|
AGIS=agi-test.agi eagi-test eagi-sphinx-test
|
||||||
|
|
||||||
CFLAGS+=
|
CFLAGS+=-DNO_AST_MM
|
||||||
|
|
||||||
LIBS=
|
LIBS=
|
||||||
ifeq ($(OSARCH),SunOS)
|
ifeq ($(OSARCH),SunOS)
|
||||||
|
0
agi/agi-test.agi
Executable file → Normal file
0
agi/agi-test.agi
Executable file → Normal file
0
agi/eagi-sphinx-test.c
Executable file → Normal file
0
agi/eagi-sphinx-test.c
Executable file → Normal file
0
agi/eagi-test.c
Executable file → Normal file
0
agi/eagi-test.c
Executable file → Normal file
0
agi/fastagi-test
Executable file → Normal file
0
agi/fastagi-test
Executable file → Normal file
0
agi/numeralize
Executable file → Normal file
0
agi/numeralize
Executable file → Normal file
95
app.c
Executable file → Normal file
95
app.c
Executable file → Normal file
@@ -316,8 +316,12 @@ int ast_dtmf_stream(struct ast_channel *chan,struct ast_channel *peer,char *digi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (peer)
|
if (peer) {
|
||||||
res = ast_autoservice_stop(peer);
|
/* Stop autoservice on the peer channel, but don't overwrite any error condition
|
||||||
|
that has occurred previously while acting on the primary channel */
|
||||||
|
if (ast_autoservice_stop(peer) && !res)
|
||||||
|
res = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -430,11 +434,11 @@ int ast_control_streamfile(struct ast_channel *chan, const char *file,
|
|||||||
const char *stop, const char *pause,
|
const char *stop, const char *pause,
|
||||||
const char *restart, int skipms)
|
const char *restart, int skipms)
|
||||||
{
|
{
|
||||||
long elapsed = 0, last_elapsed = 0;
|
|
||||||
char *breaks = NULL;
|
char *breaks = NULL;
|
||||||
char *end = NULL;
|
char *end = NULL;
|
||||||
int blen = 2;
|
int blen = 2;
|
||||||
int res;
|
int res;
|
||||||
|
long pause_restart_point = 0;
|
||||||
|
|
||||||
if (stop)
|
if (stop)
|
||||||
blen += strlen(stop);
|
blen += strlen(stop);
|
||||||
@@ -456,9 +460,6 @@ int ast_control_streamfile(struct ast_channel *chan, const char *file,
|
|||||||
if (chan->_state != AST_STATE_UP)
|
if (chan->_state != AST_STATE_UP)
|
||||||
res = ast_answer(chan);
|
res = ast_answer(chan);
|
||||||
|
|
||||||
if (chan)
|
|
||||||
ast_stopstream(chan);
|
|
||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
if ((end = strchr(file,':'))) {
|
if ((end = strchr(file,':'))) {
|
||||||
if (!strcasecmp(end, ":end")) {
|
if (!strcasecmp(end, ":end")) {
|
||||||
@@ -469,25 +470,18 @@ int ast_control_streamfile(struct ast_channel *chan, const char *file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
struct timeval started = ast_tvnow();
|
ast_stopstream(chan);
|
||||||
|
|
||||||
if (chan)
|
|
||||||
ast_stopstream(chan);
|
|
||||||
res = ast_streamfile(chan, file, chan->language);
|
res = ast_streamfile(chan, file, chan->language);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
if (end) {
|
if (pause_restart_point) {
|
||||||
|
ast_seekstream(chan->stream, pause_restart_point, SEEK_SET);
|
||||||
|
pause_restart_point = 0;
|
||||||
|
}
|
||||||
|
else if (end) {
|
||||||
ast_seekstream(chan->stream, 0, SEEK_END);
|
ast_seekstream(chan->stream, 0, SEEK_END);
|
||||||
end=NULL;
|
end = NULL;
|
||||||
}
|
};
|
||||||
res = 1;
|
res = ast_waitstream_fr(chan, breaks, fwd, rev, skipms);
|
||||||
if (elapsed) {
|
|
||||||
ast_stream_fastforward(chan->stream, elapsed);
|
|
||||||
last_elapsed = elapsed - 200;
|
|
||||||
}
|
|
||||||
if (res)
|
|
||||||
res = ast_waitstream_fr(chan, breaks, fwd, rev, skipms);
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res < 1)
|
if (res < 1)
|
||||||
@@ -496,17 +490,16 @@ int ast_control_streamfile(struct ast_channel *chan, const char *file,
|
|||||||
/* We go at next loop if we got the restart char */
|
/* We go at next loop if we got the restart char */
|
||||||
if (restart && strchr(restart, res)) {
|
if (restart && strchr(restart, res)) {
|
||||||
ast_log(LOG_DEBUG, "we'll restart the stream here at next loop\n");
|
ast_log(LOG_DEBUG, "we'll restart the stream here at next loop\n");
|
||||||
elapsed=0; /* To make sure the next stream will start at beginning */
|
pause_restart_point = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pause != NULL && strchr(pause, res)) {
|
if (pause && strchr(pause, res)) {
|
||||||
elapsed = ast_tvdiff_ms(ast_tvnow(), started) + last_elapsed;
|
pause_restart_point = ast_tellstream(chan->stream);
|
||||||
for(;;) {
|
for (;;) {
|
||||||
if (chan)
|
ast_stopstream(chan);
|
||||||
ast_stopstream(chan);
|
|
||||||
res = ast_waitfordigit(chan, 1000);
|
res = ast_waitfordigit(chan, 1000);
|
||||||
if (res == 0)
|
if (!res)
|
||||||
continue;
|
continue;
|
||||||
else if (res == -1 || strchr(pause, res) || (stop && strchr(stop, res)))
|
else if (res == -1 || strchr(pause, res) || (stop && strchr(stop, res)))
|
||||||
break;
|
break;
|
||||||
@@ -516,17 +509,16 @@ int ast_control_streamfile(struct ast_channel *chan, const char *file,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res == -1)
|
if (res == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* if we get one of our stop chars, return it to the calling function */
|
/* if we get one of our stop chars, return it to the calling function */
|
||||||
if (stop && strchr(stop, res)) {
|
if (stop && strchr(stop, res))
|
||||||
/* res = 0; */
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan)
|
|
||||||
ast_stopstream(chan);
|
ast_stopstream(chan);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -545,7 +537,7 @@ int ast_play_and_wait(struct ast_channel *chan, const char *fn)
|
|||||||
static int global_silence_threshold = 128;
|
static int global_silence_threshold = 128;
|
||||||
static int global_maxsilence = 0;
|
static int global_maxsilence = 0;
|
||||||
|
|
||||||
int ast_play_and_record(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int silencethreshold, int maxsilence, const char *path)
|
int ast_play_and_record_full(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int silencethreshold, int maxsilence, const char *path, const char *acceptdtmf, const char *canceldtmf)
|
||||||
{
|
{
|
||||||
int d;
|
int d;
|
||||||
char *fmts;
|
char *fmts;
|
||||||
@@ -559,7 +551,6 @@ int ast_play_and_record(struct ast_channel *chan, const char *playfile, const ch
|
|||||||
struct ast_dsp *sildet=NULL; /* silence detector dsp */
|
struct ast_dsp *sildet=NULL; /* silence detector dsp */
|
||||||
int totalsilence = 0;
|
int totalsilence = 0;
|
||||||
int dspsilence = 0;
|
int dspsilence = 0;
|
||||||
int gotsilence = 0; /* did we timeout for silence? */
|
|
||||||
int rfmt=0;
|
int rfmt=0;
|
||||||
struct ast_silence_generator *silgen = NULL;
|
struct ast_silence_generator *silgen = NULL;
|
||||||
|
|
||||||
@@ -597,7 +588,7 @@ int ast_play_and_record(struct ast_channel *chan, const char *playfile, const ch
|
|||||||
|
|
||||||
while((fmt = strsep(&stringp, "|"))) {
|
while((fmt = strsep(&stringp, "|"))) {
|
||||||
if (fmtcnt > MAX_OTHER_FORMATS - 1) {
|
if (fmtcnt > MAX_OTHER_FORMATS - 1) {
|
||||||
ast_log(LOG_WARNING, "Please increase MAX_OTHER_FORMATS in app_voicemail.c\n");
|
ast_log(LOG_WARNING, "Please increase MAX_OTHER_FORMATS in app.c\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sfmt[fmtcnt++] = ast_strdupa(fmt);
|
sfmt[fmtcnt++] = ast_strdupa(fmt);
|
||||||
@@ -682,7 +673,7 @@ int ast_play_and_record(struct ast_channel *chan, const char *playfile, const ch
|
|||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose( VERBOSE_PREFIX_3 "Recording automatically stopped after a silence of %d seconds\n", totalsilence/1000);
|
ast_verbose( VERBOSE_PREFIX_3 "Recording automatically stopped after a silence of %d seconds\n", totalsilence/1000);
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
gotsilence = 1;
|
res = 'S';
|
||||||
outmsg=2;
|
outmsg=2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -697,19 +688,18 @@ int ast_play_and_record(struct ast_channel *chan, const char *playfile, const ch
|
|||||||
/* Write only once */
|
/* Write only once */
|
||||||
ast_writestream(others[0], f);
|
ast_writestream(others[0], f);
|
||||||
} else if (f->frametype == AST_FRAME_DTMF) {
|
} else if (f->frametype == AST_FRAME_DTMF) {
|
||||||
if (f->subclass == '#') {
|
if (strchr(acceptdtmf, f->subclass)) {
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose( VERBOSE_PREFIX_3 "User ended message by pressing %c\n", f->subclass);
|
ast_verbose(VERBOSE_PREFIX_3 "User ended message by pressing %c\n", f->subclass);
|
||||||
res = '#';
|
res = f->subclass;
|
||||||
outmsg = 2;
|
outmsg = 2;
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (f->subclass == '0') {
|
if (strchr(canceldtmf, f->subclass)) {
|
||||||
/* Check for a '0' during message recording also, in case caller wants operator */
|
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "User cancelled by pressing %c\n", f->subclass);
|
ast_verbose(VERBOSE_PREFIX_3 "User cancelled message by pressing %c\n", f->subclass);
|
||||||
res = '0';
|
res = f->subclass;
|
||||||
outmsg = 0;
|
outmsg = 0;
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
break;
|
break;
|
||||||
@@ -771,6 +761,14 @@ int ast_play_and_record(struct ast_channel *chan, const char *playfile, const ch
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char default_acceptdtmf[] = "#";
|
||||||
|
static char default_canceldtmf[] = "0";
|
||||||
|
|
||||||
|
int ast_play_and_record(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int silencethreshold, int maxsilence, const char *path)
|
||||||
|
{
|
||||||
|
return ast_play_and_record_full(chan, playfile, recordfile, maxtime, fmt, duration, silencethreshold, maxsilence, path, default_acceptdtmf, default_canceldtmf);
|
||||||
|
}
|
||||||
|
|
||||||
int ast_play_and_prepend(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime, char *fmt, int *duration, int beep, int silencethreshold, int maxsilence)
|
int ast_play_and_prepend(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime, char *fmt, int *duration, int beep, int silencethreshold, int maxsilence)
|
||||||
{
|
{
|
||||||
int d = 0;
|
int d = 0;
|
||||||
@@ -786,7 +784,6 @@ int ast_play_and_prepend(struct ast_channel *chan, char *playfile, char *recordf
|
|||||||
struct ast_dsp *sildet; /* silence detector dsp */
|
struct ast_dsp *sildet; /* silence detector dsp */
|
||||||
int totalsilence = 0;
|
int totalsilence = 0;
|
||||||
int dspsilence = 0;
|
int dspsilence = 0;
|
||||||
int gotsilence = 0; /* did we timeout for silence? */
|
|
||||||
int rfmt=0;
|
int rfmt=0;
|
||||||
char prependfile[80];
|
char prependfile[80];
|
||||||
|
|
||||||
@@ -827,7 +824,7 @@ int ast_play_and_prepend(struct ast_channel *chan, char *playfile, char *recordf
|
|||||||
|
|
||||||
while((fmt = strsep(&stringp, "|"))) {
|
while((fmt = strsep(&stringp, "|"))) {
|
||||||
if (fmtcnt > MAX_OTHER_FORMATS - 1) {
|
if (fmtcnt > MAX_OTHER_FORMATS - 1) {
|
||||||
ast_log(LOG_WARNING, "Please increase MAX_OTHER_FORMATS in app_voicemail.c\n");
|
ast_log(LOG_WARNING, "Please increase MAX_OTHER_FORMATS in app.c\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sfmt[fmtcnt++] = ast_strdupa(fmt);
|
sfmt[fmtcnt++] = ast_strdupa(fmt);
|
||||||
@@ -855,6 +852,7 @@ int ast_play_and_prepend(struct ast_channel *chan, char *playfile, char *recordf
|
|||||||
res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
|
res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
|
ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
|
||||||
|
ast_dsp_free(sildet);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -904,7 +902,7 @@ int ast_play_and_prepend(struct ast_channel *chan, char *playfile, char *recordf
|
|||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose( VERBOSE_PREFIX_3 "Recording automatically stopped after a silence of %d seconds\n", totalsilence/1000);
|
ast_verbose( VERBOSE_PREFIX_3 "Recording automatically stopped after a silence of %d seconds\n", totalsilence/1000);
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
gotsilence = 1;
|
res = 'S';
|
||||||
outmsg=2;
|
outmsg=2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -959,6 +957,7 @@ int ast_play_and_prepend(struct ast_channel *chan, char *playfile, char *recordf
|
|||||||
} else {
|
} else {
|
||||||
ast_log(LOG_WARNING, "Error creating writestream '%s', format '%s'\n", prependfile, sfmt[x]);
|
ast_log(LOG_WARNING, "Error creating writestream '%s', format '%s'\n", prependfile, sfmt[x]);
|
||||||
}
|
}
|
||||||
|
ast_dsp_free(sildet);
|
||||||
*duration = end - start;
|
*duration = end - start;
|
||||||
#if 0
|
#if 0
|
||||||
if (outmsg > 1) {
|
if (outmsg > 1) {
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
.depend
|
|
7
apps/Makefile
Executable file → Normal file
7
apps/Makefile
Executable file → Normal file
@@ -86,7 +86,7 @@ endif
|
|||||||
all: $(APPS)
|
all: $(APPS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.so *.o look .depend
|
rm -f *.so *.o .depend
|
||||||
|
|
||||||
%.so : %.o
|
%.so : %.o
|
||||||
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
|
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
|
||||||
@@ -103,7 +103,7 @@ app_curl.so: app_curl.o
|
|||||||
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(CURLLIBS)
|
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(CURLLIBS)
|
||||||
|
|
||||||
app_sql_postgres.o: app_sql_postgres.c
|
app_sql_postgres.o: app_sql_postgres.c
|
||||||
$(CC) -pipe -I/usr/local/pgsql/include $(CFLAGS) -c -o app_sql_postgres.o app_sql_postgres.c
|
$(CC) -pipe -I$(CROSS_COMPILE_TARGET)/usr/local/pgsql/include -I$(CROSS_COMPILE_TARGET)/usr/include/postgresql $(CFLAGS) -c -o app_sql_postgres.o app_sql_postgres.c
|
||||||
|
|
||||||
app_sql_postgres.so: app_sql_postgres.o
|
app_sql_postgres.so: app_sql_postgres.o
|
||||||
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -L/usr/local/pgsql/lib -lpq
|
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -L/usr/local/pgsql/lib -lpq
|
||||||
@@ -111,9 +111,6 @@ app_sql_postgres.so: app_sql_postgres.o
|
|||||||
app_sql_odbc.so: app_sql_odbc.o
|
app_sql_odbc.so: app_sql_odbc.o
|
||||||
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lodbc
|
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lodbc
|
||||||
|
|
||||||
look: look.c
|
|
||||||
$(CC) -pipe -O6 -g look.c -o look -lncurses
|
|
||||||
|
|
||||||
ifeq (SunOS,$(shell uname))
|
ifeq (SunOS,$(shell uname))
|
||||||
app_chanspy.so: app_chanspy.o
|
app_chanspy.so: app_chanspy.o
|
||||||
$(CC) $(SOLINK) -o $@ $< -lrt
|
$(CC) $(SOLINK) -o $@ $< -lrt
|
||||||
|
0
apps/app_adsiprog.c
Executable file → Normal file
0
apps/app_adsiprog.c
Executable file → Normal file
3
apps/app_alarmreceiver.c
Executable file → Normal file
3
apps/app_alarmreceiver.c
Executable file → Normal file
@@ -558,11 +558,10 @@ static int receive_ademco_contact_id( struct ast_channel *chan, void *data, int
|
|||||||
|
|
||||||
if(checksum){
|
if(checksum){
|
||||||
database_increment("checksum-errors");
|
database_increment("checksum-errors");
|
||||||
if(option_verbose >= 2){
|
if(option_verbose >= 2)
|
||||||
ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: Nonzero checksum\n");
|
ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: Nonzero checksum\n");
|
||||||
ast_log(LOG_DEBUG, "AlarmReceiver: Nonzero checksum\n");
|
ast_log(LOG_DEBUG, "AlarmReceiver: Nonzero checksum\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check the message type for correctness */
|
/* Check the message type for correctness */
|
||||||
|
0
apps/app_authenticate.c
Executable file → Normal file
0
apps/app_authenticate.c
Executable file → Normal file
0
apps/app_cdr.c
Executable file → Normal file
0
apps/app_cdr.c
Executable file → Normal file
0
apps/app_chanisavail.c
Executable file → Normal file
0
apps/app_chanisavail.c
Executable file → Normal file
10
apps/app_chanspy.c
Executable file → Normal file
10
apps/app_chanspy.c
Executable file → Normal file
@@ -208,9 +208,9 @@ static int start_spying(struct ast_channel *chan, struct ast_channel *spychan, s
|
|||||||
|
|
||||||
static void stop_spying(struct ast_channel *chan, struct ast_channel_spy *spy)
|
static void stop_spying(struct ast_channel *chan, struct ast_channel_spy *spy)
|
||||||
{
|
{
|
||||||
/* If our status has changed, then the channel we're spying on is gone....
|
/* If our status has changed to DONE, then the channel we're spying on is gone....
|
||||||
DON'T TOUCH IT!!! RUN AWAY!!! */
|
DON'T TOUCH IT!!! RUN AWAY!!! */
|
||||||
if (spy->status != CHANSPY_RUNNING)
|
if (spy->status == CHANSPY_DONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!chan)
|
if (!chan)
|
||||||
@@ -439,8 +439,8 @@ static int chanspy_exec(struct ast_channel *chan, void *data)
|
|||||||
|
|
||||||
if (recbase) {
|
if (recbase) {
|
||||||
char filename[512];
|
char filename[512];
|
||||||
snprintf(filename,sizeof(filename),"%s/%s.%ld.raw",ast_config_AST_MONITOR_DIR, recbase, time(NULL));
|
snprintf(filename,sizeof(filename),"%s/%s.%d.raw",ast_config_AST_MONITOR_DIR, recbase, (int)time(NULL));
|
||||||
if ((fd = open(filename, O_CREAT | O_WRONLY, O_TRUNC)) <= 0) {
|
if ((fd = open(filename, O_CREAT | O_WRONLY, O_TRUNC, 0644)) <= 0) {
|
||||||
ast_log(LOG_WARNING, "Cannot open %s for recording\n", filename);
|
ast_log(LOG_WARNING, "Cannot open %s for recording\n", filename);
|
||||||
fd = 0;
|
fd = 0;
|
||||||
}
|
}
|
||||||
@@ -482,7 +482,7 @@ static int chanspy_exec(struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (igrp && (!spec || ((strlen(spec) < strlen(peer->name) &&
|
if (igrp && (!spec || ((strlen(spec) <= strlen(peer->name) &&
|
||||||
!strncasecmp(peer->name, spec, strlen(spec)))))) {
|
!strncasecmp(peer->name, spec, strlen(spec)))))) {
|
||||||
if (peer && (!bronly || ast_bridged_channel(peer)) &&
|
if (peer && (!bronly || ast_bridged_channel(peer)) &&
|
||||||
!ast_check_hangup(peer) && !ast_test_flag(peer, AST_FLAG_SPYING)) {
|
!ast_check_hangup(peer) && !ast_test_flag(peer, AST_FLAG_SPYING)) {
|
||||||
|
2
apps/app_controlplayback.c
Executable file → Normal file
2
apps/app_controlplayback.c
Executable file → Normal file
@@ -140,7 +140,7 @@ static int controlplayback_exec(struct ast_channel *chan, void *data)
|
|||||||
} else {
|
} else {
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
if (priority_jump || option_priority_jumping) {
|
if (priority_jump || option_priority_jumping) {
|
||||||
if (!ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
|
if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
|
||||||
ast_log(LOG_WARNING, "ControlPlayback tried to jump to priority n+101 as requested, but priority didn't exist\n");
|
ast_log(LOG_WARNING, "ControlPlayback tried to jump to priority n+101 as requested, but priority didn't exist\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
0
apps/app_curl.c
Executable file → Normal file
0
apps/app_curl.c
Executable file → Normal file
8
apps/app_cut.c
Executable file → Normal file
8
apps/app_cut.c
Executable file → Normal file
@@ -36,7 +36,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/channel.h"
|
#include "asterisk/channel.h"
|
||||||
#include "asterisk/pbx.h"
|
#include "asterisk/pbx.h"
|
||||||
#include "asterisk/module.h"
|
#include "asterisk/module.h"
|
||||||
#include "asterisk/version.h"
|
|
||||||
#include "asterisk/app.h"
|
#include "asterisk/app.h"
|
||||||
|
|
||||||
/* Maximum length of any variable */
|
/* Maximum length of any variable */
|
||||||
@@ -146,8 +145,9 @@ static int sort_internal(struct ast_channel *chan, char *data, char *buffer, siz
|
|||||||
int blen = strlen(buffer);
|
int blen = strlen(buffer);
|
||||||
if (element_count++) {
|
if (element_count++) {
|
||||||
strncat(buffer + blen, ",", buflen - blen - 1);
|
strncat(buffer + blen, ",", buflen - blen - 1);
|
||||||
|
blen++;
|
||||||
}
|
}
|
||||||
strncat(buffer + blen + 1, sortable_keys[count2].key, buflen - blen - 2);
|
strncat(buffer + blen, sortable_keys[count2].key, buflen - blen - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -253,6 +253,8 @@ static int cut_internal(struct ast_channel *chan, char *data, char *buffer, size
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return ERROR_NOARG;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -386,7 +388,7 @@ static char *acf_cut_exec(struct ast_channel *chan, char *cmd, char *data, char
|
|||||||
|
|
||||||
switch (cut_internal(chan, data, buf, len)) {
|
switch (cut_internal(chan, data, buf, len)) {
|
||||||
case ERROR_NOARG:
|
case ERROR_NOARG:
|
||||||
ast_log(LOG_ERROR, "Cut() requires an argument\n");
|
ast_log(LOG_ERROR, "CUT() requires an argument\n");
|
||||||
break;
|
break;
|
||||||
case ERROR_NOMEM:
|
case ERROR_NOMEM:
|
||||||
ast_log(LOG_ERROR, "Out of memory\n");
|
ast_log(LOG_ERROR, "Out of memory\n");
|
||||||
|
0
apps/app_datetime.c
Executable file → Normal file
0
apps/app_datetime.c
Executable file → Normal file
0
apps/app_db.c
Executable file → Normal file
0
apps/app_db.c
Executable file → Normal file
70
apps/app_dial.c
Executable file → Normal file
70
apps/app_dial.c
Executable file → Normal file
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Asterisk -- An open source telephony toolkit.
|
* Asterisk -- An open source telephony toolkit.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 - 2005, Digium, Inc.
|
* Copyright (C) 1999 - 2006, Digium, Inc.
|
||||||
*
|
*
|
||||||
* Mark Spencer <markster@digium.com>
|
* Mark Spencer <markster@digium.com>
|
||||||
*
|
*
|
||||||
@@ -75,7 +75,7 @@ static char *descrip =
|
|||||||
"continue if no requested channels can be called, or if the timeout expires.\n\n"
|
"continue if no requested channels can be called, or if the timeout expires.\n\n"
|
||||||
" This application sets the following channel variables upon completion:\n"
|
" This application sets the following channel variables upon completion:\n"
|
||||||
" DIALEDTIME - This is the time from dialing a channel until when it\n"
|
" DIALEDTIME - This is the time from dialing a channel until when it\n"
|
||||||
" answers.\n"
|
" is disconnected.\n"
|
||||||
" ANSWEREDTIME - This is the amount of time for actual call.\n"
|
" ANSWEREDTIME - This is the amount of time for actual call.\n"
|
||||||
" DIALSTATUS - This is the status of the call:\n"
|
" DIALSTATUS - This is the status of the call:\n"
|
||||||
" CHANUNAVAIL | CONGESTION | NOANSWER | BUSY | ANSWER | CANCEL\n"
|
" CHANUNAVAIL | CONGESTION | NOANSWER | BUSY | ANSWER | CANCEL\n"
|
||||||
@@ -108,9 +108,11 @@ static char *descrip =
|
|||||||
" other than the number assigned to the caller.\n"
|
" other than the number assigned to the caller.\n"
|
||||||
" g - Proceed with dialplan execution at the current extension if the\n"
|
" g - Proceed with dialplan execution at the current extension if the\n"
|
||||||
" destination channel hangs up.\n"
|
" destination channel hangs up.\n"
|
||||||
" G(context^exten^pri) - If the call is answered, transfer both parties to\n"
|
" G(context^exten^pri) - If the call is answered, transfer the calling party to\n"
|
||||||
" the specified priority. Optionally, an extension, or extension and\n"
|
" the specified priority and the called party to the specified priority+1.\n"
|
||||||
" context may be specified. Otherwise, the current extension is used.\n"
|
" Optionally, an extension, or extension and context may be specified. \n"
|
||||||
|
" Otherwise, the current extension is used. You cannot use any additional\n"
|
||||||
|
" action post answer options in conjunction with this option.\n"
|
||||||
" h - Allow the called party to hang up by sending the '*' DTMF digit.\n"
|
" h - Allow the called party to hang up by sending the '*' DTMF digit.\n"
|
||||||
" H - Allow the calling party to hang up by hitting the '*' DTMF digit.\n"
|
" H - Allow the calling party to hang up by hitting the '*' DTMF digit.\n"
|
||||||
" j - Jump to priority n+101 if all of the requested channels were busy.\n"
|
" j - Jump to priority n+101 if all of the requested channels were busy.\n"
|
||||||
@@ -143,6 +145,8 @@ static char *descrip =
|
|||||||
" * GOTO:<context>^<exten>^<priority> - Transfer the call to the\n"
|
" * GOTO:<context>^<exten>^<priority> - Transfer the call to the\n"
|
||||||
" specified priority. Optionally, an extension, or\n"
|
" specified priority. Optionally, an extension, or\n"
|
||||||
" extension and priority can be specified.\n"
|
" extension and priority can be specified.\n"
|
||||||
|
" You cannot use any additional action post answer options in conjunction\n"
|
||||||
|
" with this option.\n"
|
||||||
" n - This option is a modifier for the screen/privacy mode. It specifies\n"
|
" n - This option is a modifier for the screen/privacy mode. It specifies\n"
|
||||||
" that no introductions are to be saved in the priv-callerintros\n"
|
" that no introductions are to be saved in the priv-callerintros\n"
|
||||||
" directory.\n"
|
" directory.\n"
|
||||||
@@ -161,7 +165,7 @@ static char *descrip =
|
|||||||
" S(x) - Hang up the call after 'x' seconds *after* the called party has\n"
|
" S(x) - Hang up the call after 'x' seconds *after* the called party has\n"
|
||||||
" answered the call.\n"
|
" answered the call.\n"
|
||||||
" t - Allow the called party to transfer the calling party by sending the\n"
|
" t - Allow the called party to transfer the calling party by sending the\n"
|
||||||
" DTMF sequence defiend in features.conf.\n"
|
" DTMF sequence defined in features.conf.\n"
|
||||||
" T - Allow the calling party to transfer the called party by sending the\n"
|
" T - Allow the calling party to transfer the called party by sending the\n"
|
||||||
" DTMF sequence defined in features.conf.\n"
|
" DTMF sequence defined in features.conf.\n"
|
||||||
" w - Allow the called party to enable recording of the call by sending\n"
|
" w - Allow the called party to enable recording of the call by sending\n"
|
||||||
@@ -303,6 +307,8 @@ static void hanguptree(struct localuser *outgoing, struct ast_channel *exception
|
|||||||
ast_cdr_failed(chan->cdr); \
|
ast_cdr_failed(chan->cdr); \
|
||||||
numnochan++; \
|
numnochan++; \
|
||||||
break; \
|
break; \
|
||||||
|
case AST_CAUSE_NORMAL_CLEARING: \
|
||||||
|
break; \
|
||||||
default: \
|
default: \
|
||||||
numnochan++; \
|
numnochan++; \
|
||||||
break; \
|
break; \
|
||||||
@@ -465,6 +471,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
|||||||
o->chan = ast_request(tech, in->nativeformats, stuff, &cause);
|
o->chan = ast_request(tech, in->nativeformats, stuff, &cause);
|
||||||
if (!o->chan)
|
if (!o->chan)
|
||||||
ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
|
ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
|
||||||
|
else
|
||||||
|
ast_channel_inherit_variables(in, o->chan);
|
||||||
} else {
|
} else {
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "Too many forwards from %s\n", o->chan->name);
|
ast_verbose(VERBOSE_PREFIX_3 "Too many forwards from %s\n", o->chan->name);
|
||||||
@@ -512,10 +520,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
|||||||
if (in->cid.cid_ani) {
|
if (in->cid.cid_ani) {
|
||||||
if (o->chan->cid.cid_ani)
|
if (o->chan->cid.cid_ani)
|
||||||
free(o->chan->cid.cid_ani);
|
free(o->chan->cid.cid_ani);
|
||||||
o->chan->cid.cid_ani = malloc(strlen(in->cid.cid_ani) + 1);
|
o->chan->cid.cid_ani = strdup(in->cid.cid_ani);
|
||||||
if (o->chan->cid.cid_ani)
|
if (!o->chan->cid.cid_ani)
|
||||||
ast_copy_string(o->chan->cid.cid_ani, in->cid.cid_ani, sizeof(o->chan->cid.cid_ani));
|
|
||||||
else
|
|
||||||
ast_log(LOG_WARNING, "Out of memory\n");
|
ast_log(LOG_WARNING, "Out of memory\n");
|
||||||
}
|
}
|
||||||
if (o->chan->cid.cid_rdnis)
|
if (o->chan->cid.cid_rdnis)
|
||||||
@@ -650,6 +656,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
|||||||
ast_hangup(o->chan);
|
ast_hangup(o->chan);
|
||||||
o->chan = NULL;
|
o->chan = NULL;
|
||||||
ast_clear_flag(o, DIAL_STILLGOING);
|
ast_clear_flag(o, DIAL_STILLGOING);
|
||||||
|
HANDLE_CAUSE(in->hangupcause, in);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
o = o->next;
|
o = o->next;
|
||||||
@@ -737,6 +744,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
|||||||
char numsubst[AST_MAX_EXTENSION];
|
char numsubst[AST_MAX_EXTENSION];
|
||||||
char restofit[AST_MAX_EXTENSION];
|
char restofit[AST_MAX_EXTENSION];
|
||||||
char cidname[AST_MAX_EXTENSION];
|
char cidname[AST_MAX_EXTENSION];
|
||||||
|
char toast[80];
|
||||||
char *newnum;
|
char *newnum;
|
||||||
char *l;
|
char *l;
|
||||||
int privdb_val=0;
|
int privdb_val=0;
|
||||||
@@ -826,6 +834,21 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
|||||||
if (!timelimit) {
|
if (!timelimit) {
|
||||||
timelimit = play_to_caller = play_to_callee = play_warning = warning_freq = 0;
|
timelimit = play_to_caller = play_to_callee = play_warning = warning_freq = 0;
|
||||||
warning_sound = NULL;
|
warning_sound = NULL;
|
||||||
|
} else if (play_warning > timelimit) {
|
||||||
|
/* If the first warning is requested _after_ the entire call would end,
|
||||||
|
and no warning frequency is requested, then turn off the warning. If
|
||||||
|
a warning frequency is requested, reduce the 'first warning' time by
|
||||||
|
that frequency until it falls within the call's total time limit.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!warning_freq) {
|
||||||
|
play_warning = 0;
|
||||||
|
} else {
|
||||||
|
while (play_warning > timelimit)
|
||||||
|
play_warning -= warning_freq;
|
||||||
|
if (play_warning < 1)
|
||||||
|
play_warning = warning_freq = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var = pbx_builtin_getvar_helper(chan,"LIMIT_PLAYAUDIO_CALLER");
|
var = pbx_builtin_getvar_helper(chan,"LIMIT_PLAYAUDIO_CALLER");
|
||||||
@@ -916,20 +939,26 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( privdb_val == AST_PRIVACY_DENY ) {
|
if( privdb_val == AST_PRIVACY_DENY ) {
|
||||||
|
strcpy(status, "NOANSWER");
|
||||||
ast_verbose( VERBOSE_PREFIX_3 "Privacy DB reports PRIVACY_DENY for this callerid. Dial reports unavailable\n");
|
ast_verbose( VERBOSE_PREFIX_3 "Privacy DB reports PRIVACY_DENY for this callerid. Dial reports unavailable\n");
|
||||||
res=0;
|
res=0;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
else if( privdb_val == AST_PRIVACY_KILL ) {
|
else if( privdb_val == AST_PRIVACY_KILL ) {
|
||||||
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
|
strcpy(status, "DONTCALL");
|
||||||
|
if (option_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
|
||||||
|
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
|
||||||
|
}
|
||||||
res = 0;
|
res = 0;
|
||||||
goto out; /* Is this right? */
|
goto out; /* Is this right? */
|
||||||
}
|
}
|
||||||
else if( privdb_val == AST_PRIVACY_TORTURE ) {
|
else if( privdb_val == AST_PRIVACY_TORTURE ) {
|
||||||
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
|
strcpy(status, "TORTURE");
|
||||||
|
if (option_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
|
||||||
|
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
|
||||||
|
}
|
||||||
res = 0;
|
res = 0;
|
||||||
goto out; /* is this right??? */
|
goto out; /* is this right??? */
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( privdb_val == AST_PRIVACY_UNKNOWN ) {
|
else if( privdb_val == AST_PRIVACY_UNKNOWN ) {
|
||||||
/* Get the user's intro, store it in priv-callerintros/$CID,
|
/* Get the user's intro, store it in priv-callerintros/$CID,
|
||||||
@@ -963,7 +992,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
|||||||
/* If a channel group has been specified, get it for use when we create peer channels */
|
/* If a channel group has been specified, get it for use when we create peer channels */
|
||||||
outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
|
outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
|
||||||
|
|
||||||
ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID);
|
ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP);
|
||||||
cur = args.peers;
|
cur = args.peers;
|
||||||
do {
|
do {
|
||||||
/* Remember where to start next time */
|
/* Remember where to start next time */
|
||||||
@@ -1039,6 +1068,8 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
|||||||
tmp->chan = ast_request(tech, chan->nativeformats, stuff, &cause);
|
tmp->chan = ast_request(tech, chan->nativeformats, stuff, &cause);
|
||||||
if (!tmp->chan)
|
if (!tmp->chan)
|
||||||
ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
|
ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
|
||||||
|
else
|
||||||
|
ast_channel_inherit_variables(chan, tmp->chan);
|
||||||
} else {
|
} else {
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "Too many forwards from %s\n", tmp->chan->name);
|
ast_verbose(VERBOSE_PREFIX_3 "Too many forwards from %s\n", tmp->chan->name);
|
||||||
@@ -1285,6 +1316,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
|||||||
opt_args[OPT_ARG_PRIVACY], privcid);
|
opt_args[OPT_ARG_PRIVACY], privcid);
|
||||||
ast_privacy_set(opt_args[OPT_ARG_PRIVACY], privcid, AST_PRIVACY_DENY);
|
ast_privacy_set(opt_args[OPT_ARG_PRIVACY], privcid, AST_PRIVACY_DENY);
|
||||||
}
|
}
|
||||||
|
strcpy(status,"NOANSWER");
|
||||||
if (ast_test_flag(&opts, OPT_MUSICBACK)) {
|
if (ast_test_flag(&opts, OPT_MUSICBACK)) {
|
||||||
ast_moh_stop(chan);
|
ast_moh_stop(chan);
|
||||||
} else if (ast_test_flag(&opts, OPT_RINGBACK)) {
|
} else if (ast_test_flag(&opts, OPT_RINGBACK)) {
|
||||||
@@ -1515,8 +1547,6 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!res) {
|
if (!res) {
|
||||||
char toast[80];
|
|
||||||
|
|
||||||
memset(&config,0,sizeof(struct ast_bridge_config));
|
memset(&config,0,sizeof(struct ast_bridge_config));
|
||||||
if (play_to_caller)
|
if (play_to_caller)
|
||||||
ast_set_flag(&(config.features_caller), AST_FEATURE_PLAY_WARNING);
|
ast_set_flag(&(config.features_caller), AST_FEATURE_PLAY_WARNING);
|
||||||
@@ -1560,13 +1590,15 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
|||||||
}
|
}
|
||||||
res = ast_bridge_call(chan,peer,&config);
|
res = ast_bridge_call(chan,peer,&config);
|
||||||
time(&end_time);
|
time(&end_time);
|
||||||
snprintf(toast, sizeof(toast), "%ld", (long)(end_time - start_time));
|
|
||||||
pbx_builtin_setvar_helper(chan, "DIALEDTIME", toast);
|
|
||||||
snprintf(toast, sizeof(toast), "%ld", (long)(end_time - answer_time));
|
snprintf(toast, sizeof(toast), "%ld", (long)(end_time - answer_time));
|
||||||
pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", toast);
|
pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", toast);
|
||||||
|
|
||||||
} else
|
} else {
|
||||||
|
time(&end_time);
|
||||||
res = -1;
|
res = -1;
|
||||||
|
}
|
||||||
|
snprintf(toast, sizeof(toast), "%ld", (long)(end_time - start_time));
|
||||||
|
pbx_builtin_setvar_helper(chan, "DIALEDTIME", toast);
|
||||||
|
|
||||||
if (res != AST_PBX_NO_HANGUP_PEER) {
|
if (res != AST_PBX_NO_HANGUP_PEER) {
|
||||||
if (!chan->_softhangup)
|
if (!chan->_softhangup)
|
||||||
|
0
apps/app_dictate.c
Executable file → Normal file
0
apps/app_dictate.c
Executable file → Normal file
6
apps/app_directed_pickup.c
Executable file → Normal file
6
apps/app_directed_pickup.c
Executable file → Normal file
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 2005, Joshua Colp
|
* Copyright (C) 2005, Joshua Colp
|
||||||
*
|
*
|
||||||
* Joshua Colp <jcolp@asterlink.com>
|
* Joshua Colp <jcolp@digium.com>
|
||||||
*
|
*
|
||||||
* See http://www.asterisk.org for more information about
|
* See http://www.asterisk.org for more information about
|
||||||
* the Asterisk project. Please do not directly contact
|
* the Asterisk project. Please do not directly contact
|
||||||
@@ -77,7 +77,7 @@ static int pickup_exec(struct ast_channel *chan, void *data)
|
|||||||
|
|
||||||
/* Find a channel to pickup */
|
/* Find a channel to pickup */
|
||||||
origin = ast_get_channel_by_exten_locked(exten, context);
|
origin = ast_get_channel_by_exten_locked(exten, context);
|
||||||
if (origin) {
|
if (origin && origin->cdr) {
|
||||||
ast_cdr_getvar(origin->cdr, "dstchannel", &tmp, workspace,
|
ast_cdr_getvar(origin->cdr, "dstchannel", &tmp, workspace,
|
||||||
sizeof(workspace), 0);
|
sizeof(workspace), 0);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
@@ -89,6 +89,8 @@ static int pickup_exec(struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
ast_mutex_unlock(&origin->lock);
|
ast_mutex_unlock(&origin->lock);
|
||||||
} else {
|
} else {
|
||||||
|
if (origin)
|
||||||
|
ast_mutex_unlock(&origin->lock);
|
||||||
ast_log(LOG_DEBUG, "No originating channel found.\n");
|
ast_log(LOG_DEBUG, "No originating channel found.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
0
apps/app_directory.c
Executable file → Normal file
0
apps/app_directory.c
Executable file → Normal file
0
apps/app_disa.c
Executable file → Normal file
0
apps/app_disa.c
Executable file → Normal file
0
apps/app_dumpchan.c
Executable file → Normal file
0
apps/app_dumpchan.c
Executable file → Normal file
0
apps/app_echo.c
Executable file → Normal file
0
apps/app_echo.c
Executable file → Normal file
0
apps/app_enumlookup.c
Executable file → Normal file
0
apps/app_enumlookup.c
Executable file → Normal file
0
apps/app_eval.c
Executable file → Normal file
0
apps/app_eval.c
Executable file → Normal file
0
apps/app_exec.c
Executable file → Normal file
0
apps/app_exec.c
Executable file → Normal file
34
apps/app_externalivr.c
Executable file → Normal file
34
apps/app_externalivr.c
Executable file → Normal file
@@ -43,6 +43,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/pbx.h"
|
#include "asterisk/pbx.h"
|
||||||
#include "asterisk/module.h"
|
#include "asterisk/module.h"
|
||||||
#include "asterisk/linkedlists.h"
|
#include "asterisk/linkedlists.h"
|
||||||
|
#include "asterisk/app.h"
|
||||||
|
#include "asterisk/options.h"
|
||||||
|
|
||||||
static const char *tdesc = "External IVR Interface Application";
|
static const char *tdesc = "External IVR Interface Application";
|
||||||
|
|
||||||
@@ -93,9 +95,9 @@ static void send_child_event(FILE *handle, const char event, const char *data,
|
|||||||
char tmp[256];
|
char tmp[256];
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
snprintf(tmp, sizeof(tmp), "%c,%10ld", event, time(NULL));
|
snprintf(tmp, sizeof(tmp), "%c,%10d", event, (int)time(NULL));
|
||||||
} else {
|
} else {
|
||||||
snprintf(tmp, sizeof(tmp), "%c,%10ld,%s", event, time(NULL), data);
|
snprintf(tmp, sizeof(tmp), "%c,%10d,%s", event, (int)time(NULL), data);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(handle, "%s\n", tmp);
|
fprintf(handle, "%s\n", tmp);
|
||||||
@@ -250,10 +252,9 @@ static int app_exec(struct ast_channel *chan, void *data)
|
|||||||
int res = -1;
|
int res = -1;
|
||||||
int gen_active = 0;
|
int gen_active = 0;
|
||||||
int pid;
|
int pid;
|
||||||
char *command;
|
|
||||||
char *argv[32];
|
char *argv[32];
|
||||||
int argc = 1;
|
int argc = 1;
|
||||||
char *buf;
|
char *buf, *command;
|
||||||
FILE *child_commands = NULL;
|
FILE *child_commands = NULL;
|
||||||
FILE *child_errors = NULL;
|
FILE *child_errors = NULL;
|
||||||
FILE *child_events = NULL;
|
FILE *child_events = NULL;
|
||||||
@@ -270,11 +271,13 @@ static int app_exec(struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
buf = ast_strdupa(data);
|
buf = ast_strdupa(data);
|
||||||
command = strsep(&buf, "|");
|
if (!buf) {
|
||||||
memset(argv, 0, sizeof(argv) / sizeof(argv[0]));
|
ast_log(LOG_ERROR, "Out of memory!\n");
|
||||||
argv[0] = command;
|
LOCAL_USER_REMOVE(u);
|
||||||
while ((argc < 31) && (argv[argc++] = strsep(&buf, "|")));
|
return -1;
|
||||||
argv[argc] = NULL;
|
}
|
||||||
|
|
||||||
|
argc = ast_app_separate_args(buf, '|', argv, sizeof(argv) / sizeof(argv[0]));
|
||||||
|
|
||||||
if (pipe(child_stdin)) {
|
if (pipe(child_stdin)) {
|
||||||
ast_chan_log(LOG_WARNING, chan, "Could not create pipe for child input: %s\n", strerror(errno));
|
ast_chan_log(LOG_WARNING, chan, "Could not create pipe for child input: %s\n", strerror(errno));
|
||||||
@@ -311,13 +314,16 @@ static int app_exec(struct ast_channel *chan, void *data)
|
|||||||
/* child process */
|
/* child process */
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (option_highpriority)
|
||||||
|
ast_set_priority(0);
|
||||||
|
|
||||||
dup2(child_stdin[0], STDIN_FILENO);
|
dup2(child_stdin[0], STDIN_FILENO);
|
||||||
dup2(child_stdout[1], STDOUT_FILENO);
|
dup2(child_stdout[1], STDOUT_FILENO);
|
||||||
dup2(child_stderr[1], STDERR_FILENO);
|
dup2(child_stderr[1], STDERR_FILENO);
|
||||||
for (i = STDERR_FILENO + 1; i < 1024; i++)
|
for (i = STDERR_FILENO + 1; i < 1024; i++)
|
||||||
close(i);
|
close(i);
|
||||||
execv(command, argv);
|
execv(argv[0], argv);
|
||||||
fprintf(stderr, "Failed to execute '%s': %s\n", command, strerror(errno));
|
fprintf(stderr, "Failed to execute '%s': %s\n", argv[0], strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
/* parent process */
|
/* parent process */
|
||||||
@@ -343,8 +349,6 @@ static int app_exec(struct ast_channel *chan, void *data)
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
setvbuf(child_events, NULL, _IONBF, 0);
|
|
||||||
|
|
||||||
if (!(child_commands = fdopen(child_commands_fd, "r"))) {
|
if (!(child_commands = fdopen(child_commands_fd, "r"))) {
|
||||||
ast_chan_log(LOG_WARNING, chan, "Could not open stream for child commands\n");
|
ast_chan_log(LOG_WARNING, chan, "Could not open stream for child commands\n");
|
||||||
goto exit;
|
goto exit;
|
||||||
@@ -355,6 +359,10 @@ static int app_exec(struct ast_channel *chan, void *data)
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setvbuf(child_events, NULL, _IONBF, 0);
|
||||||
|
setvbuf(child_commands, NULL, _IONBF, 0);
|
||||||
|
setvbuf(child_errors, NULL, _IONBF, 0);
|
||||||
|
|
||||||
res = 0;
|
res = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
21
apps/app_festival.c
Executable file → Normal file
21
apps/app_festival.c
Executable file → Normal file
@@ -53,6 +53,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/config.h"
|
#include "asterisk/config.h"
|
||||||
#include "asterisk/utils.h"
|
#include "asterisk/utils.h"
|
||||||
#include "asterisk/lock.h"
|
#include "asterisk/lock.h"
|
||||||
|
#include "asterisk/options.h"
|
||||||
|
|
||||||
#define FESTIVAL_CONFIG "festival.conf"
|
#define FESTIVAL_CONFIG "festival.conf"
|
||||||
|
|
||||||
@@ -136,6 +137,9 @@ static int send_waveform_to_fd(char *waveform, int length, int fd) {
|
|||||||
if (x != fd)
|
if (x != fd)
|
||||||
close(x);
|
close(x);
|
||||||
}
|
}
|
||||||
|
if (option_highpriority)
|
||||||
|
ast_set_priority(0);
|
||||||
|
|
||||||
/*IAS */
|
/*IAS */
|
||||||
#ifdef __PPC__
|
#ifdef __PPC__
|
||||||
for( x=0; x<length; x+=2)
|
for( x=0; x<length; x+=2)
|
||||||
@@ -175,7 +179,8 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
|
|||||||
if (chan->_state != AST_STATE_UP)
|
if (chan->_state != AST_STATE_UP)
|
||||||
ast_answer(chan);
|
ast_answer(chan);
|
||||||
ast_stopstream(chan);
|
ast_stopstream(chan);
|
||||||
|
ast_indicate(chan, -1);
|
||||||
|
|
||||||
owriteformat = chan->writeformat;
|
owriteformat = chan->writeformat;
|
||||||
res = ast_set_write_format(chan, AST_FORMAT_SLINEAR);
|
res = ast_set_write_format(chan, AST_FORMAT_SLINEAR);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
@@ -455,8 +460,20 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
|
|||||||
/* This assumes only one waveform will come back, also LP is unlikely */
|
/* This assumes only one waveform will come back, also LP is unlikely */
|
||||||
wave = 0;
|
wave = 0;
|
||||||
do {
|
do {
|
||||||
|
int read_data;
|
||||||
for (n=0; n < 3; )
|
for (n=0; n < 3; )
|
||||||
n += read(fd,ack+n,3-n);
|
{
|
||||||
|
read_data = read(fd,ack+n,3-n);
|
||||||
|
/* this avoids falling in infinite loop
|
||||||
|
* in case that festival server goes down
|
||||||
|
* */
|
||||||
|
if ( read_data == -1 )
|
||||||
|
{
|
||||||
|
ast_log(LOG_WARNING,"Unable to read from cache/festival fd");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
n += read_data;
|
||||||
|
}
|
||||||
ack[3] = '\0';
|
ack[3] = '\0';
|
||||||
if (strcmp(ack,"WV\n") == 0) { /* receive a waveform */
|
if (strcmp(ack,"WV\n") == 0) { /* receive a waveform */
|
||||||
ast_log(LOG_DEBUG,"Festival WV command\n");
|
ast_log(LOG_DEBUG,"Festival WV command\n");
|
||||||
|
0
apps/app_flash.c
Executable file → Normal file
0
apps/app_flash.c
Executable file → Normal file
0
apps/app_forkcdr.c
Executable file → Normal file
0
apps/app_forkcdr.c
Executable file → Normal file
0
apps/app_getcpeid.c
Executable file → Normal file
0
apps/app_getcpeid.c
Executable file → Normal file
8
apps/app_groupcount.c
Executable file → Normal file
8
apps/app_groupcount.c
Executable file → Normal file
@@ -257,8 +257,8 @@ static char *group_count_descrip =
|
|||||||
" Calculates the group count for the specified group, or uses\n"
|
" Calculates the group count for the specified group, or uses\n"
|
||||||
"the current channel's group if not specifed (and non-empty).\n"
|
"the current channel's group if not specifed (and non-empty).\n"
|
||||||
"Stores result in GROUPCOUNT. \n"
|
"Stores result in GROUPCOUNT. \n"
|
||||||
"This application has been deprecated, please use the function\n"
|
"Note: This application has been deprecated, please use the function\n"
|
||||||
"GroupCount.\n";
|
"GROUP_COUNT.\n";
|
||||||
|
|
||||||
static char *group_set_descrip =
|
static char *group_set_descrip =
|
||||||
"Usage: SetGroup(groupname[@category])\n"
|
"Usage: SetGroup(groupname[@category])\n"
|
||||||
@@ -284,8 +284,8 @@ static char *group_match_count_descrip =
|
|||||||
" Calculates the group count for all groups that match the specified\n"
|
" Calculates the group count for all groups that match the specified\n"
|
||||||
"pattern. Uses standard regular expression matching (see regex(7)).\n"
|
"pattern. Uses standard regular expression matching (see regex(7)).\n"
|
||||||
"Stores result in GROUPCOUNT. Always returns 0.\n"
|
"Stores result in GROUPCOUNT. Always returns 0.\n"
|
||||||
"This application has been deprecated, please use the function\n"
|
"Note: This application has been deprecated, please use the function\n"
|
||||||
"GroupMatchCount.\n";
|
"GROUP_MATCH_COUNT.\n";
|
||||||
|
|
||||||
static char show_channels_usage[] =
|
static char show_channels_usage[] =
|
||||||
"Usage: group show channels [pattern]\n"
|
"Usage: group show channels [pattern]\n"
|
||||||
|
132
apps/app_hasnewvoicemail.c
Executable file → Normal file
132
apps/app_hasnewvoicemail.c
Executable file → Normal file
@@ -47,6 +47,12 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/utils.h"
|
#include "asterisk/utils.h"
|
||||||
#include "asterisk/app.h"
|
#include "asterisk/app.h"
|
||||||
#include "asterisk/options.h"
|
#include "asterisk/options.h"
|
||||||
|
#ifdef USE_ODBC_STORAGE
|
||||||
|
#include "asterisk/res_odbc.h"
|
||||||
|
|
||||||
|
static char odbc_database[80];
|
||||||
|
static char odbc_table[80];
|
||||||
|
#endif
|
||||||
|
|
||||||
static char *tdesc = "Indicator for whether a voice mailbox has messages in a given folder.";
|
static char *tdesc = "Indicator for whether a voice mailbox has messages in a given folder.";
|
||||||
static char *app_hasvoicemail = "HasVoicemail";
|
static char *app_hasvoicemail = "HasVoicemail";
|
||||||
@@ -68,7 +74,7 @@ static char *hasnewvoicemail_descrip =
|
|||||||
"Assumes folder 'INBOX' if folder is not specified. Optionally sets <varname> to the number of messages\n"
|
"Assumes folder 'INBOX' if folder is not specified. Optionally sets <varname> to the number of messages\n"
|
||||||
"in that folder.\n"
|
"in that folder.\n"
|
||||||
" The option string may contain zero of the following character:\n"
|
" The option string may contain zero of the following character:\n"
|
||||||
" 'j' -- jump to priority n+101, if there is new voicemail in tolder 'folder' or INBOX\n"
|
" 'j' -- jump to priority n+101, if there is new voicemail in folder 'folder' or INBOX\n"
|
||||||
" This application sets the following channel variable upon completion:\n"
|
" This application sets the following channel variable upon completion:\n"
|
||||||
" HASVMSTATUS The result of the new voicemail check returned as a text string as follows\n"
|
" HASVMSTATUS The result of the new voicemail check returned as a text string as follows\n"
|
||||||
" <# of messages in the folder, 0 for NONE>\n";
|
" <# of messages in the folder, 0 for NONE>\n";
|
||||||
@@ -77,26 +83,93 @@ STANDARD_LOCAL_USER;
|
|||||||
|
|
||||||
LOCAL_USER_DECL;
|
LOCAL_USER_DECL;
|
||||||
|
|
||||||
static int hasvoicemail_internal(char *context, char *box, char *folder)
|
#ifdef USE_ODBC_STORAGE
|
||||||
|
static int hasvoicemail_internal(const char *context, const char *mailbox, const char *folder)
|
||||||
{
|
{
|
||||||
char vmpath[256];
|
int nummsgs = 0;
|
||||||
DIR *vmdir;
|
int res;
|
||||||
struct dirent *vment;
|
SQLHSTMT stmt;
|
||||||
int count=0;
|
char sql[256];
|
||||||
|
char rowdata[20];
|
||||||
|
|
||||||
snprintf(vmpath,sizeof(vmpath), "%s/voicemail/%s/%s/%s", (char *)ast_config_AST_SPOOL_DIR, context, box, folder);
|
if (!folder)
|
||||||
if ((vmdir = opendir(vmpath))) {
|
folder = "INBOX";
|
||||||
/* No matter what the format of VM, there will always be a .txt file for each message. */
|
/* If no mailbox, return immediately */
|
||||||
while ((vment = readdir(vmdir))) {
|
if (ast_strlen_zero(mailbox))
|
||||||
if (!strncmp(vment->d_name + 7, ".txt", 4)) {
|
return 0;
|
||||||
count++;
|
if (ast_strlen_zero(context))
|
||||||
break;
|
context = "default";
|
||||||
}
|
|
||||||
|
odbc_obj *obj;
|
||||||
|
obj = fetch_odbc_obj(odbc_database, 0);
|
||||||
|
if (obj) {
|
||||||
|
res = SQLAllocHandle(SQL_HANDLE_STMT, obj->con, &stmt);
|
||||||
|
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
|
ast_log(LOG_WARNING, "SQL Alloc Handle failed!\n");
|
||||||
|
goto yuck;
|
||||||
}
|
}
|
||||||
closedir(vmdir);
|
snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir = '%s/voicemail/%s/%s/%s'", odbc_table, ast_config_AST_SPOOL_DIR, context, mailbox, folder);
|
||||||
|
res = SQLPrepare(stmt, sql, SQL_NTS);
|
||||||
|
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
|
ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
|
||||||
|
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
|
||||||
|
goto yuck;
|
||||||
|
}
|
||||||
|
res = odbc_smart_execute(obj, stmt);
|
||||||
|
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
|
ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
|
||||||
|
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
|
||||||
|
goto yuck;
|
||||||
|
}
|
||||||
|
res = SQLFetch(stmt);
|
||||||
|
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
|
ast_log(LOG_WARNING, "SQL Fetch error!\n[%s]\n\n", sql);
|
||||||
|
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
|
||||||
|
goto yuck;
|
||||||
|
}
|
||||||
|
res = SQLGetData(stmt, 1, SQL_CHAR, rowdata, sizeof(rowdata), NULL);
|
||||||
|
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
|
ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
|
||||||
|
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
|
||||||
|
goto yuck;
|
||||||
|
}
|
||||||
|
nummsgs = atoi(rowdata);
|
||||||
|
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
|
||||||
|
} else
|
||||||
|
ast_log(LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
|
||||||
|
|
||||||
|
yuck:
|
||||||
|
return nummsgs;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static int hasvoicemail_internal(const char *context, const char *mailbox, const char *folder)
|
||||||
|
{
|
||||||
|
DIR *dir;
|
||||||
|
struct dirent *de;
|
||||||
|
char fn[256];
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
if (ast_strlen_zero(folder))
|
||||||
|
folder = "INBOX";
|
||||||
|
if (ast_strlen_zero(context))
|
||||||
|
context = "default";
|
||||||
|
/* If no mailbox, return immediately */
|
||||||
|
if (ast_strlen_zero(mailbox))
|
||||||
|
return 0;
|
||||||
|
snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/%s", ast_config_AST_SPOOL_DIR, context, mailbox, folder);
|
||||||
|
dir = opendir(fn);
|
||||||
|
if (!dir)
|
||||||
|
return 0;
|
||||||
|
while ((de = readdir(dir))) {
|
||||||
|
if (!strncasecmp(de->d_name, "msg", 3) && !strcasecmp(de->d_name + 8, "txt"))
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
|
closedir(dir);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int hasvoicemail_exec(struct ast_channel *chan, void *data)
|
static int hasvoicemail_exec(struct ast_channel *chan, void *data)
|
||||||
{
|
{
|
||||||
@@ -163,7 +236,7 @@ static int hasvoicemail_exec(struct ast_channel *chan, void *data)
|
|||||||
if (vmcount > 0) {
|
if (vmcount > 0) {
|
||||||
/* Branch to the next extension */
|
/* Branch to the next extension */
|
||||||
if (priority_jump || option_priority_jumping) {
|
if (priority_jump || option_priority_jumping) {
|
||||||
if (!ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101))
|
if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101))
|
||||||
ast_log(LOG_WARNING, "VM box %s@%s has new voicemail, but extension %s, priority %d doesn't exist\n", vmbox, context, chan->exten, chan->priority + 101);
|
ast_log(LOG_WARNING, "VM box %s@%s has new voicemail, but extension %s, priority %d doesn't exist\n", vmbox, context, chan->exten, chan->priority + 101);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,6 +296,31 @@ struct ast_custom_function acf_vmcount = {
|
|||||||
.read = acf_vmcount_exec,
|
.read = acf_vmcount_exec,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int load_config(void)
|
||||||
|
{
|
||||||
|
#ifdef USE_ODBC_STORAGE
|
||||||
|
struct ast_config *cfg;
|
||||||
|
char *tmp;
|
||||||
|
cfg = ast_config_load("voicemail.conf");
|
||||||
|
if (cfg) {
|
||||||
|
if (! (tmp = ast_variable_retrieve(cfg, "general", "odbcstorage")))
|
||||||
|
tmp = "asterisk";
|
||||||
|
ast_copy_string(odbc_database, tmp, sizeof(odbc_database));
|
||||||
|
|
||||||
|
if (! (tmp = ast_variable_retrieve(cfg, "general", "odbctable")))
|
||||||
|
tmp = "voicemessages";
|
||||||
|
ast_copy_string(odbc_table, tmp, sizeof(odbc_table));
|
||||||
|
ast_config_destroy(cfg);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int reload(void)
|
||||||
|
{
|
||||||
|
return load_config();
|
||||||
|
}
|
||||||
|
|
||||||
int unload_module(void)
|
int unload_module(void)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
@@ -239,7 +337,7 @@ int unload_module(void)
|
|||||||
int load_module(void)
|
int load_module(void)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
load_config();
|
||||||
res = ast_custom_function_register(&acf_vmcount);
|
res = ast_custom_function_register(&acf_vmcount);
|
||||||
res |= ast_register_application(app_hasvoicemail, hasvoicemail_exec, hasvoicemail_synopsis, hasvoicemail_descrip);
|
res |= ast_register_application(app_hasvoicemail, hasvoicemail_exec, hasvoicemail_synopsis, hasvoicemail_descrip);
|
||||||
res |= ast_register_application(app_hasnewvoicemail, hasvoicemail_exec, hasnewvoicemail_synopsis, hasnewvoicemail_descrip);
|
res |= ast_register_application(app_hasnewvoicemail, hasvoicemail_exec, hasnewvoicemail_synopsis, hasnewvoicemail_descrip);
|
||||||
|
3
apps/app_ices.c
Executable file → Normal file
3
apps/app_ices.c
Executable file → Normal file
@@ -44,6 +44,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/pbx.h"
|
#include "asterisk/pbx.h"
|
||||||
#include "asterisk/module.h"
|
#include "asterisk/module.h"
|
||||||
#include "asterisk/translate.h"
|
#include "asterisk/translate.h"
|
||||||
|
#include "asterisk/options.h"
|
||||||
|
|
||||||
#define ICES "/usr/bin/ices"
|
#define ICES "/usr/bin/ices"
|
||||||
#define LOCAL_ICES "/usr/local/bin/ices"
|
#define LOCAL_ICES "/usr/local/bin/ices"
|
||||||
@@ -72,6 +73,8 @@ static int icesencode(char *filename, int fd)
|
|||||||
ast_log(LOG_WARNING, "Fork failed\n");
|
ast_log(LOG_WARNING, "Fork failed\n");
|
||||||
if (res)
|
if (res)
|
||||||
return res;
|
return res;
|
||||||
|
if (option_highpriority)
|
||||||
|
ast_set_priority(0);
|
||||||
dup2(fd, STDIN_FILENO);
|
dup2(fd, STDIN_FILENO);
|
||||||
for (x=STDERR_FILENO + 1;x<256;x++) {
|
for (x=STDERR_FILENO + 1;x<256;x++) {
|
||||||
if ((x != STDIN_FILENO) && (x != STDOUT_FILENO))
|
if ((x != STDIN_FILENO) && (x != STDOUT_FILENO))
|
||||||
|
0
apps/app_image.c
Executable file → Normal file
0
apps/app_image.c
Executable file → Normal file
0
apps/app_intercom.c
Executable file → Normal file
0
apps/app_intercom.c
Executable file → Normal file
0
apps/app_ivrdemo.c
Executable file → Normal file
0
apps/app_ivrdemo.c
Executable file → Normal file
0
apps/app_lookupblacklist.c
Executable file → Normal file
0
apps/app_lookupblacklist.c
Executable file → Normal file
0
apps/app_lookupcidname.c
Executable file → Normal file
0
apps/app_lookupcidname.c
Executable file → Normal file
39
apps/app_macro.c
Executable file → Normal file
39
apps/app_macro.c
Executable file → Normal file
@@ -104,7 +104,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||||||
char *offsets;
|
char *offsets;
|
||||||
int offset, depth;
|
int offset, depth;
|
||||||
int setmacrocontext=0;
|
int setmacrocontext=0;
|
||||||
int autoloopflag;
|
int autoloopflag, dead = 0;
|
||||||
|
|
||||||
char *save_macro_exten;
|
char *save_macro_exten;
|
||||||
char *save_macro_context;
|
char *save_macro_context;
|
||||||
@@ -216,8 +216,8 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch(res) {
|
switch(res) {
|
||||||
case MACRO_EXIT_RESULT:
|
case MACRO_EXIT_RESULT:
|
||||||
res = 0;
|
res = 0;
|
||||||
goto out;
|
goto out;
|
||||||
case AST_PBX_KEEPALIVE:
|
case AST_PBX_KEEPALIVE:
|
||||||
if (option_debug)
|
if (option_debug)
|
||||||
@@ -231,6 +231,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||||||
ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
|
ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
|
||||||
else if (option_verbose > 1)
|
else if (option_verbose > 1)
|
||||||
ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
|
ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
|
||||||
|
dead = 1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -250,37 +251,44 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||||||
out:
|
out:
|
||||||
/* Reset the depth back to what it was when the routine was entered (like if we called Macro recursively) */
|
/* Reset the depth back to what it was when the routine was entered (like if we called Macro recursively) */
|
||||||
snprintf(depthc, sizeof(depthc), "%d", depth);
|
snprintf(depthc, sizeof(depthc), "%d", depth);
|
||||||
pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
|
if (!dead) {
|
||||||
|
pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
|
||||||
|
|
||||||
ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
|
ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
|
||||||
for (x=1; x<argc; x++) {
|
}
|
||||||
|
|
||||||
|
for (x = 1; x < argc; x++) {
|
||||||
/* Restore old arguments and delete ours */
|
/* Restore old arguments and delete ours */
|
||||||
snprintf(varname, sizeof(varname), "ARG%d", x);
|
snprintf(varname, sizeof(varname), "ARG%d", x);
|
||||||
if (oldargs[x]) {
|
if (oldargs[x]) {
|
||||||
pbx_builtin_setvar_helper(chan, varname, oldargs[x]);
|
if (!dead)
|
||||||
|
pbx_builtin_setvar_helper(chan, varname, oldargs[x]);
|
||||||
free(oldargs[x]);
|
free(oldargs[x]);
|
||||||
} else {
|
} else if (!dead) {
|
||||||
pbx_builtin_setvar_helper(chan, varname, NULL);
|
pbx_builtin_setvar_helper(chan, varname, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore macro variables */
|
/* Restore macro variables */
|
||||||
pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", save_macro_exten);
|
if (!dead) {
|
||||||
|
pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", save_macro_exten);
|
||||||
|
pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", save_macro_context);
|
||||||
|
pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
|
||||||
|
}
|
||||||
if (save_macro_exten)
|
if (save_macro_exten)
|
||||||
free(save_macro_exten);
|
free(save_macro_exten);
|
||||||
pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", save_macro_context);
|
|
||||||
if (save_macro_context)
|
if (save_macro_context)
|
||||||
free(save_macro_context);
|
free(save_macro_context);
|
||||||
pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
|
|
||||||
if (save_macro_priority)
|
if (save_macro_priority)
|
||||||
free(save_macro_priority);
|
free(save_macro_priority);
|
||||||
if (setmacrocontext) {
|
|
||||||
|
if (!dead && setmacrocontext) {
|
||||||
chan->macrocontext[0] = '\0';
|
chan->macrocontext[0] = '\0';
|
||||||
chan->macroexten[0] = '\0';
|
chan->macroexten[0] = '\0';
|
||||||
chan->macropriority = 0;
|
chan->macropriority = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcasecmp(chan->context, fullmacro)) {
|
if (!dead && !strcasecmp(chan->context, fullmacro)) {
|
||||||
/* If we're leaving the macro normally, restore original information */
|
/* If we're leaving the macro normally, restore original information */
|
||||||
chan->priority = oldpriority;
|
chan->priority = oldpriority;
|
||||||
ast_copy_string(chan->context, oldcontext, sizeof(chan->context));
|
ast_copy_string(chan->context, oldcontext, sizeof(chan->context));
|
||||||
@@ -299,7 +307,8 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", save_macro_offset);
|
if (!dead)
|
||||||
|
pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", save_macro_offset);
|
||||||
if (save_macro_offset)
|
if (save_macro_offset)
|
||||||
free(save_macro_offset);
|
free(save_macro_offset);
|
||||||
LOCAL_USER_REMOVE(u);
|
LOCAL_USER_REMOVE(u);
|
||||||
@@ -328,7 +337,7 @@ static int macroif_exec(struct ast_channel *chan, void *data)
|
|||||||
*label_b = '\0';
|
*label_b = '\0';
|
||||||
label_b++;
|
label_b++;
|
||||||
}
|
}
|
||||||
if (ast_true(expr))
|
if (pbx_checkcondition(expr))
|
||||||
macro_exec(chan, label_a);
|
macro_exec(chan, label_a);
|
||||||
else if (label_b)
|
else if (label_b)
|
||||||
macro_exec(chan, label_b);
|
macro_exec(chan, label_b);
|
||||||
|
0
apps/app_math.c
Executable file → Normal file
0
apps/app_math.c
Executable file → Normal file
4
apps/app_md5.c
Executable file → Normal file
4
apps/app_md5.c
Executable file → Normal file
@@ -157,9 +157,9 @@ static int md5check_exec(struct ast_channel *chan, void *data)
|
|||||||
ast_log(LOG_DEBUG, "ERROR: MD5 not verified: %s -- %s\n", args.md5hash, args.string);
|
ast_log(LOG_DEBUG, "ERROR: MD5 not verified: %s -- %s\n", args.md5hash, args.string);
|
||||||
pbx_builtin_setvar_helper(chan, "CHECKMD5STATUS", "NOMATCH");
|
pbx_builtin_setvar_helper(chan, "CHECKMD5STATUS", "NOMATCH");
|
||||||
if (priority_jump || option_priority_jumping) {
|
if (priority_jump || option_priority_jumping) {
|
||||||
if (!ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101))
|
if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101))
|
||||||
if (option_debug > 2)
|
if (option_debug > 2)
|
||||||
ast_log(LOG_DEBUG, "ERROR: Can't jump to exten+101 (e%s,p%d), sorry\n", chan->exten,chan->priority+101);
|
ast_log(LOG_DEBUG, "Can't jump to exten+101 (e%s,p%d), sorry\n", chan->exten,chan->priority+101);
|
||||||
}
|
}
|
||||||
LOCAL_USER_REMOVE(u);
|
LOCAL_USER_REMOVE(u);
|
||||||
return res;
|
return res;
|
||||||
|
93
apps/app_meetme.c
Executable file → Normal file
93
apps/app_meetme.c
Executable file → Normal file
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Asterisk -- An open source telephony toolkit.
|
* Asterisk -- An open source telephony toolkit.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 - 2005, Digium, Inc.
|
* Copyright (C) 1999 - 2006, Digium, Inc.
|
||||||
*
|
*
|
||||||
* Mark Spencer <markster@digium.com>
|
* Mark Spencer <markster@digium.com>
|
||||||
*
|
*
|
||||||
@@ -70,8 +70,9 @@ static const char *descrip =
|
|||||||
"If the conference number is omitted, the user will be prompted to enter\n"
|
"If the conference number is omitted, the user will be prompted to enter\n"
|
||||||
"one. \n"
|
"one. \n"
|
||||||
"User can exit the conference by hangup, or if the 'p' option is specified, by pressing '#'.\n"
|
"User can exit the conference by hangup, or if the 'p' option is specified, by pressing '#'.\n"
|
||||||
"Please note: A ZAPTEL INTERFACE MUST BE INSTALLED FOR CONFERENCING TO WORK!\n\n"
|
"Please note: The Zaptel kernel modules and at least one hardware driver (or ztdummy)\n"
|
||||||
|
" must be present for conferencing to operate properly. In addition, the chan_zap\n"
|
||||||
|
" channel driver must be loaded for the 'i' and 'r' options to operate at all.\n\n"
|
||||||
"The option string may contain zero or more of the following characters:\n"
|
"The option string may contain zero or more of the following characters:\n"
|
||||||
" 'a' -- set admin mode\n"
|
" 'a' -- set admin mode\n"
|
||||||
" 'A' -- set marked mode\n"
|
" 'A' -- set marked mode\n"
|
||||||
@@ -95,7 +96,6 @@ static const char *descrip =
|
|||||||
" 's' -- Present menu (user or admin) when '*' is received ('send' to menu)\n"
|
" 's' -- Present menu (user or admin) when '*' is received ('send' to menu)\n"
|
||||||
" 't' -- set talk only mode. (Talk only, no listening)\n"
|
" 't' -- set talk only mode. (Talk only, no listening)\n"
|
||||||
" 'T' -- set talker detection (sent to manager interface and meetme list)\n"
|
" 'T' -- set talker detection (sent to manager interface and meetme list)\n"
|
||||||
" 'v' -- video mode\n"
|
|
||||||
" 'w' -- wait until the marked user enters the conference\n"
|
" 'w' -- wait until the marked user enters the conference\n"
|
||||||
" 'x' -- close the conference when last marked user exits\n"
|
" 'x' -- close the conference when last marked user exits\n"
|
||||||
" 'X' -- allow user to exit the conference by entering a valid single\n"
|
" 'X' -- allow user to exit the conference by entering a valid single\n"
|
||||||
@@ -165,7 +165,7 @@ struct ast_conf_user {
|
|||||||
int talking; /* Is user talking */
|
int talking; /* Is user talking */
|
||||||
int zapchannel; /* Is a Zaptel channel */
|
int zapchannel; /* Is a Zaptel channel */
|
||||||
char usrvalue[50]; /* Custom User Value */
|
char usrvalue[50]; /* Custom User Value */
|
||||||
char namerecloc[AST_MAX_EXTENSION]; /* Name Recorded file Location */
|
char namerecloc[PATH_MAX]; /* Name Recorded file Location */
|
||||||
time_t jointime; /* Time the user joined the conference */
|
time_t jointime; /* Time the user joined the conference */
|
||||||
struct volume talk;
|
struct volume talk;
|
||||||
struct volume listen;
|
struct volume listen;
|
||||||
@@ -211,7 +211,7 @@ static void *recordthread(void *args);
|
|||||||
#define CONFFLAG_STARMENU (1 << 4) /* If set asterisk will provide a menu to the user when '*' is pressed */
|
#define CONFFLAG_STARMENU (1 << 4) /* If set asterisk will provide a menu to the user when '*' is pressed */
|
||||||
#define CONFFLAG_TALKER (1 << 5) /* If set the use can only send audio to the conference */
|
#define CONFFLAG_TALKER (1 << 5) /* If set the use can only send audio to the conference */
|
||||||
#define CONFFLAG_QUIET (1 << 6) /* If set there will be no enter or leave sounds */
|
#define CONFFLAG_QUIET (1 << 6) /* If set there will be no enter or leave sounds */
|
||||||
#define CONFFLAG_VIDEO (1 << 7) /* Set to enable video mode */
|
#define CONFFLAG_ANNOUNCEUSERCOUNT (1 << 7) /* If set, when user joins the conference, they will be told the number of users that are already in */
|
||||||
#define CONFFLAG_AGI (1 << 8) /* Set to run AGI Script in Background */
|
#define CONFFLAG_AGI (1 << 8) /* Set to run AGI Script in Background */
|
||||||
#define CONFFLAG_MOH (1 << 9) /* Set to have music on hold when user is alone in conference */
|
#define CONFFLAG_MOH (1 << 9) /* Set to have music on hold when user is alone in conference */
|
||||||
#define CONFFLAG_MARKEDEXIT (1 << 10) /* If set the MeetMe will return if all marked with this flag left */
|
#define CONFFLAG_MARKEDEXIT (1 << 10) /* If set the MeetMe will return if all marked with this flag left */
|
||||||
@@ -226,7 +226,6 @@ static void *recordthread(void *args);
|
|||||||
#define CONFFLAG_EMPTY (1 << 19)
|
#define CONFFLAG_EMPTY (1 << 19)
|
||||||
#define CONFFLAG_EMPTYNOPIN (1 << 20)
|
#define CONFFLAG_EMPTYNOPIN (1 << 20)
|
||||||
#define CONFFLAG_ALWAYSPROMPT (1 << 21)
|
#define CONFFLAG_ALWAYSPROMPT (1 << 21)
|
||||||
#define CONFFLAG_ANNOUNCEUSERCOUNT (1 << 22) /* If set, when user joins the conference, they will be told the number of users that are already in */
|
|
||||||
|
|
||||||
|
|
||||||
AST_APP_OPTIONS(meetme_opts, {
|
AST_APP_OPTIONS(meetme_opts, {
|
||||||
@@ -263,14 +262,17 @@ static char *istalking(int x)
|
|||||||
return "(not talking)";
|
return "(not talking)";
|
||||||
}
|
}
|
||||||
|
|
||||||
static int careful_write(int fd, unsigned char *data, int len)
|
static int careful_write(int fd, unsigned char *data, int len, int block)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
while (len) {
|
while (len) {
|
||||||
x = ZT_IOMUX_WRITE | ZT_IOMUX_SIGEVENT;
|
if (block) {
|
||||||
res = ioctl(fd, ZT_IOMUX, &x);
|
x = ZT_IOMUX_WRITE | ZT_IOMUX_SIGEVENT;
|
||||||
|
res = ioctl(fd, ZT_IOMUX, &x);
|
||||||
|
} else
|
||||||
|
res = 0;
|
||||||
if (res >= 0)
|
if (res >= 0)
|
||||||
res = write(fd, data, len);
|
res = write(fd, data, len);
|
||||||
if (res < 1) {
|
if (res < 1) {
|
||||||
@@ -423,7 +425,7 @@ static void conf_play(struct ast_channel *chan, struct ast_conference *conf, int
|
|||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
if (data)
|
if (data)
|
||||||
careful_write(conf->fd, data, len);
|
careful_write(conf->fd, data, len, 1);
|
||||||
|
|
||||||
ast_mutex_unlock(&conflock);
|
ast_mutex_unlock(&conflock);
|
||||||
|
|
||||||
@@ -625,7 +627,7 @@ static int conf_cmd(int fd, int argc, char **argv) {
|
|||||||
user->chan->name,
|
user->chan->name,
|
||||||
user->userflags & CONFFLAG_ADMIN ? "(Admin)" : "",
|
user->userflags & CONFFLAG_ADMIN ? "(Admin)" : "",
|
||||||
user->userflags & CONFFLAG_MONITOR ? "(Listen only)" : "",
|
user->userflags & CONFFLAG_MONITOR ? "(Listen only)" : "",
|
||||||
user->adminflags & ADMINFLAG_MUTED ? "(Admn Muted)" : "",
|
user->adminflags & ADMINFLAG_MUTED ? "(Admin Muted)" : "",
|
||||||
istalking(user->talking));
|
istalking(user->talking));
|
||||||
ast_cli(fd,"%d users in that conference.\n",cnf->users);
|
ast_cli(fd,"%d users in that conference.\n",cnf->users);
|
||||||
|
|
||||||
@@ -734,6 +736,8 @@ static void conf_flush(int fd, struct ast_channel *chan)
|
|||||||
f = ast_read(chan);
|
f = ast_read(chan);
|
||||||
if (f)
|
if (f)
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
|
else /* channel was hung up or something else happened */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -898,7 +902,9 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||||||
snprintf(user->namerecloc, sizeof(user->namerecloc),
|
snprintf(user->namerecloc, sizeof(user->namerecloc),
|
||||||
"%s/meetme/meetme-username-%s-%d", ast_config_AST_SPOOL_DIR,
|
"%s/meetme/meetme-username-%s-%d", ast_config_AST_SPOOL_DIR,
|
||||||
conf->confno, user->user_no);
|
conf->confno, user->user_no);
|
||||||
ast_record_review(chan, "vm-rec-name", user->namerecloc, 10, "sln", &duration, NULL);
|
res = ast_record_review(chan, "vm-rec-name", user->namerecloc, 10, "sln", &duration, NULL);
|
||||||
|
if (res == -1)
|
||||||
|
goto outrun;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(confflags & CONFFLAG_QUIET)) {
|
if (!(confflags & CONFFLAG_QUIET)) {
|
||||||
@@ -946,6 +952,8 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ast_indicate(chan, -1);
|
||||||
|
|
||||||
if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) {
|
if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) {
|
||||||
ast_log(LOG_WARNING, "Unable to set '%s' to write linear mode\n", chan->name);
|
ast_log(LOG_WARNING, "Unable to set '%s' to write linear mode\n", chan->name);
|
||||||
goto outrun;
|
goto outrun;
|
||||||
@@ -956,7 +964,6 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||||||
goto outrun;
|
goto outrun;
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_indicate(chan, -1);
|
|
||||||
retryzap = strcasecmp(chan->type, "Zap");
|
retryzap = strcasecmp(chan->type, "Zap");
|
||||||
user->zapchannel = !retryzap;
|
user->zapchannel = !retryzap;
|
||||||
|
|
||||||
@@ -1062,7 +1069,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||||||
if (!firstpass && !(confflags & CONFFLAG_MONITOR) && !(confflags & CONFFLAG_ADMIN)) {
|
if (!firstpass && !(confflags & CONFFLAG_MONITOR) && !(confflags & CONFFLAG_ADMIN)) {
|
||||||
firstpass = 1;
|
firstpass = 1;
|
||||||
if (!(confflags & CONFFLAG_QUIET))
|
if (!(confflags & CONFFLAG_QUIET))
|
||||||
if (!(confflags & CONFFLAG_WAITMARKED) || (conf->markedusers >= 1))
|
if (!(confflags & CONFFLAG_WAITMARKED) || ((confflags & CONFFLAG_MARKEDUSER) && (conf->markedusers >= 1)))
|
||||||
conf_play(chan, conf, ENTER);
|
conf_play(chan, conf, ENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1307,14 +1314,18 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||||||
audio frames (in which case carefully writing would only
|
audio frames (in which case carefully writing would only
|
||||||
have delayed the audio even further).
|
have delayed the audio even further).
|
||||||
*/
|
*/
|
||||||
write(fd, f->data, f->datalen);
|
/* As it turns out, we do want to use careful write. We just
|
||||||
|
don't want to block, but we do want to at least *try*
|
||||||
|
to write out all the samples.
|
||||||
|
*/
|
||||||
|
careful_write(fd, f->data, f->datalen, 0);
|
||||||
}
|
}
|
||||||
} else if ((f->frametype == AST_FRAME_DTMF) && (confflags & CONFFLAG_EXIT_CONTEXT)) {
|
} else if ((f->frametype == AST_FRAME_DTMF) && (confflags & CONFFLAG_EXIT_CONTEXT)) {
|
||||||
char tmp[2];
|
char tmp[2];
|
||||||
|
|
||||||
tmp[0] = f->subclass;
|
tmp[0] = f->subclass;
|
||||||
tmp[1] = '\0';
|
tmp[1] = '\0';
|
||||||
if (ast_goto_if_exists(chan, exitcontext, tmp, 1)) {
|
if (!ast_goto_if_exists(chan, exitcontext, tmp, 1)) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
} else if (option_debug > 1)
|
} else if (option_debug > 1)
|
||||||
@@ -1343,9 +1354,10 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||||||
if (!menu_active) {
|
if (!menu_active) {
|
||||||
menu_active = 1;
|
menu_active = 1;
|
||||||
/* Record this sound! */
|
/* Record this sound! */
|
||||||
if (!ast_streamfile(chan, "conf-adminmenu", chan->language))
|
if (!ast_streamfile(chan, "conf-adminmenu", chan->language)) {
|
||||||
dtmf = ast_waitstream(chan, AST_DIGIT_ANY);
|
dtmf = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||||
else
|
ast_stopstream(chan);
|
||||||
|
} else
|
||||||
dtmf = 0;
|
dtmf = 0;
|
||||||
} else
|
} else
|
||||||
dtmf = f->subclass;
|
dtmf = f->subclass;
|
||||||
@@ -1422,9 +1434,10 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||||||
/* User menu */
|
/* User menu */
|
||||||
if (!menu_active) {
|
if (!menu_active) {
|
||||||
menu_active = 1;
|
menu_active = 1;
|
||||||
if (!ast_streamfile(chan, "conf-usermenu", chan->language))
|
if (!ast_streamfile(chan, "conf-usermenu", chan->language)) {
|
||||||
dtmf = ast_waitstream(chan, AST_DIGIT_ANY);
|
dtmf = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||||
else
|
ast_stopstream(chan);
|
||||||
|
} else
|
||||||
dtmf = 0;
|
dtmf = 0;
|
||||||
} else
|
} else
|
||||||
dtmf = f->subclass;
|
dtmf = f->subclass;
|
||||||
@@ -1513,6 +1526,10 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||||||
lastmarked = currentmarked;
|
lastmarked = currentmarked;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (musiconhold)
|
||||||
|
ast_moh_stop(chan);
|
||||||
|
|
||||||
if (using_pseudo)
|
if (using_pseudo)
|
||||||
close(fd);
|
close(fd);
|
||||||
else {
|
else {
|
||||||
@@ -1602,7 +1619,8 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_conference *find_conf(struct ast_channel *chan, char *confno, int make, int dynamic, char *dynamic_pin)
|
static struct ast_conference *find_conf(struct ast_channel *chan, char *confno, int make, int dynamic, char *dynamic_pin,
|
||||||
|
struct ast_flags *confflags)
|
||||||
{
|
{
|
||||||
struct ast_config *cfg;
|
struct ast_config *cfg;
|
||||||
struct ast_variable *var;
|
struct ast_variable *var;
|
||||||
@@ -1623,7 +1641,8 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno,
|
|||||||
if (dynamic_pin) {
|
if (dynamic_pin) {
|
||||||
if (dynamic_pin[0] == 'q') {
|
if (dynamic_pin[0] == 'q') {
|
||||||
/* Query the user to enter a PIN */
|
/* Query the user to enter a PIN */
|
||||||
ast_app_getdata(chan, "conf-getpin", dynamic_pin, AST_MAX_EXTENSION - 1, 0);
|
if (ast_app_getdata(chan, "conf-getpin", dynamic_pin, AST_MAX_EXTENSION - 1, 0) < 0)
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
cnf = build_conf(confno, dynamic_pin, "", make, dynamic);
|
cnf = build_conf(confno, dynamic_pin, "", make, dynamic);
|
||||||
} else {
|
} else {
|
||||||
@@ -1676,6 +1695,21 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno,
|
|||||||
dynamic_pin[0] = '\0';
|
dynamic_pin[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cnf) {
|
||||||
|
if (confflags && !cnf->chan &&
|
||||||
|
!ast_test_flag(confflags, CONFFLAG_QUIET) &&
|
||||||
|
ast_test_flag(confflags, CONFFLAG_INTROUSER)) {
|
||||||
|
ast_log(LOG_WARNING, "No Zap channel available for conference, user introduction disabled (is chan_zap loaded?)\n");
|
||||||
|
ast_clear_flag(confflags, CONFFLAG_INTROUSER);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (confflags && !cnf->chan &&
|
||||||
|
ast_test_flag(confflags, CONFFLAG_RECORDCONF)) {
|
||||||
|
ast_log(LOG_WARNING, "No Zap channel available for conference, conference recording disabled (is chan_zap loaded?)\n");
|
||||||
|
ast_clear_flag(confflags, CONFFLAG_RECORDCONF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return cnf;
|
return cnf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1704,7 +1738,7 @@ static int count_exec(struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
confnum = strsep(&localdata,"|");
|
confnum = strsep(&localdata,"|");
|
||||||
conf = find_conf(chan, confnum, 0, 0, NULL);
|
conf = find_conf(chan, confnum, 0, 0, NULL, NULL);
|
||||||
if (conf)
|
if (conf)
|
||||||
count = conf->users;
|
count = conf->users;
|
||||||
else
|
else
|
||||||
@@ -1891,7 +1925,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
if (!ast_strlen_zero(confno)) {
|
if (!ast_strlen_zero(confno)) {
|
||||||
/* Check the validity of the conference */
|
/* Check the validity of the conference */
|
||||||
cnf = find_conf(chan, confno, 1, dynamic, the_pin);
|
cnf = find_conf(chan, confno, 1, dynamic, the_pin, &confflags);
|
||||||
if (!cnf) {
|
if (!cnf) {
|
||||||
res = ast_streamfile(chan, "conf-invalid", chan->language);
|
res = ast_streamfile(chan, "conf-invalid", chan->language);
|
||||||
if (!res)
|
if (!res)
|
||||||
@@ -1929,9 +1963,12 @@ static int conf_exec(struct ast_channel *chan, void *data)
|
|||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
/* Pin invalid */
|
/* Pin invalid */
|
||||||
res = ast_streamfile(chan, "conf-invalidpin", chan->language);
|
if (!ast_streamfile(chan, "conf-invalidpin", chan->language))
|
||||||
if (!res)
|
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||||
ast_waitstream(chan, AST_DIGIT_ANY);
|
else {
|
||||||
|
ast_log(LOG_WARNING, "Couldn't play invalid pin msg!\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
break;
|
break;
|
||||||
pin[0] = res;
|
pin[0] = res;
|
||||||
|
15
apps/app_milliwatt.c
Executable file → Normal file
15
apps/app_milliwatt.c
Executable file → Normal file
@@ -73,30 +73,29 @@ static void milliwatt_release(struct ast_channel *chan, void *data)
|
|||||||
static int milliwatt_generate(struct ast_channel *chan, void *data, int len, int samples)
|
static int milliwatt_generate(struct ast_channel *chan, void *data, int len, int samples)
|
||||||
{
|
{
|
||||||
struct ast_frame wf;
|
struct ast_frame wf;
|
||||||
unsigned char waste[AST_FRIENDLY_OFFSET];
|
unsigned char buf[AST_FRIENDLY_OFFSET + 640];
|
||||||
unsigned char buf[640];
|
|
||||||
int i,*indexp = (int *) data;
|
int i,*indexp = (int *) data;
|
||||||
|
|
||||||
if (len > sizeof(buf))
|
if (len + AST_FRIENDLY_OFFSET > sizeof(buf))
|
||||||
{
|
{
|
||||||
ast_log(LOG_WARNING,"Only doing %d bytes (%d bytes requested)\n",(int)sizeof(buf),len);
|
ast_log(LOG_WARNING,"Only doing %d bytes (%d bytes requested)\n",(int)(sizeof(buf) - AST_FRIENDLY_OFFSET),len);
|
||||||
len = sizeof(buf);
|
len = sizeof(buf) - AST_FRIENDLY_OFFSET;
|
||||||
}
|
}
|
||||||
waste[0] = 0; /* make compiler happy */
|
|
||||||
wf.frametype = AST_FRAME_VOICE;
|
wf.frametype = AST_FRAME_VOICE;
|
||||||
wf.subclass = AST_FORMAT_ULAW;
|
wf.subclass = AST_FORMAT_ULAW;
|
||||||
wf.offset = AST_FRIENDLY_OFFSET;
|
wf.offset = AST_FRIENDLY_OFFSET;
|
||||||
wf.mallocd = 0;
|
wf.mallocd = 0;
|
||||||
wf.data = buf;
|
wf.data = buf + AST_FRIENDLY_OFFSET;
|
||||||
wf.datalen = len;
|
wf.datalen = len;
|
||||||
wf.samples = wf.datalen;
|
wf.samples = wf.datalen;
|
||||||
wf.src = "app_milliwatt";
|
wf.src = "app_milliwatt";
|
||||||
wf.delivery.tv_sec = 0;
|
wf.delivery.tv_sec = 0;
|
||||||
wf.delivery.tv_usec = 0;
|
wf.delivery.tv_usec = 0;
|
||||||
|
wf.prev = wf.next = NULL;
|
||||||
/* create a buffer containing the digital milliwatt pattern */
|
/* create a buffer containing the digital milliwatt pattern */
|
||||||
for(i = 0; i < len; i++)
|
for(i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
buf[i] = digital_milliwatt[(*indexp)++];
|
buf[AST_FRIENDLY_OFFSET + i] = digital_milliwatt[(*indexp)++];
|
||||||
*indexp &= 7;
|
*indexp &= 7;
|
||||||
}
|
}
|
||||||
if (ast_write(chan,&wf) < 0)
|
if (ast_write(chan,&wf) < 0)
|
||||||
|
26
apps/app_mixmonitor.c
Executable file → Normal file
26
apps/app_mixmonitor.c
Executable file → Normal file
@@ -112,9 +112,9 @@ AST_APP_OPTIONS(mixmonitor_opts, {
|
|||||||
|
|
||||||
static void stopmon(struct ast_channel *chan, struct ast_channel_spy *spy)
|
static void stopmon(struct ast_channel *chan, struct ast_channel_spy *spy)
|
||||||
{
|
{
|
||||||
/* If our status has changed, then the channel we're spying on is gone....
|
/* If our status has changed to DONE, then the channel we're spying on is gone....
|
||||||
DON'T TOUCH IT!!! RUN AWAY!!! */
|
DON'T TOUCH IT!!! RUN AWAY!!! */
|
||||||
if (spy->status != CHANSPY_RUNNING)
|
if (spy->status == CHANSPY_DONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!chan)
|
if (!chan)
|
||||||
@@ -203,6 +203,17 @@ static void *mixmonitor_thread(void *obj)
|
|||||||
if (option_verbose > 1)
|
if (option_verbose > 1)
|
||||||
ast_verbose(VERBOSE_PREFIX_2 "Begin MixMonitor Recording %s\n", name);
|
ast_verbose(VERBOSE_PREFIX_2 "Begin MixMonitor Recording %s\n", name);
|
||||||
|
|
||||||
|
if (mixmonitor->post_process) {
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
for (p = mixmonitor->post_process; *p ; p++) {
|
||||||
|
if (*p == '^' && *(p+1) == '{') {
|
||||||
|
*p = '$';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pbx_substitute_variables_helper(mixmonitor->chan, mixmonitor->post_process, post_process, sizeof(post_process) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
struct ast_frame *next;
|
struct ast_frame *next;
|
||||||
int write;
|
int write;
|
||||||
@@ -237,17 +248,6 @@ static void *mixmonitor_thread(void *obj)
|
|||||||
ast_mutex_unlock(&spy.lock);
|
ast_mutex_unlock(&spy.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mixmonitor->post_process) {
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
for (p = mixmonitor->post_process; *p ; p++) {
|
|
||||||
if (*p == '^' && *(p+1) == '{') {
|
|
||||||
*p = '$';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pbx_substitute_variables_helper(mixmonitor->chan, mixmonitor->post_process, post_process, sizeof(post_process) - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
stopmon(mixmonitor->chan, &spy);
|
stopmon(mixmonitor->chan, &spy);
|
||||||
|
|
||||||
if (option_verbose > 1)
|
if (option_verbose > 1)
|
||||||
|
3
apps/app_mp3.c
Executable file → Normal file
3
apps/app_mp3.c
Executable file → Normal file
@@ -43,6 +43,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/pbx.h"
|
#include "asterisk/pbx.h"
|
||||||
#include "asterisk/module.h"
|
#include "asterisk/module.h"
|
||||||
#include "asterisk/translate.h"
|
#include "asterisk/translate.h"
|
||||||
|
#include "asterisk/options.h"
|
||||||
|
|
||||||
#define LOCAL_MPG_123 "/usr/local/bin/mpg123"
|
#define LOCAL_MPG_123 "/usr/local/bin/mpg123"
|
||||||
#define MPG_123 "/usr/bin/mpg123"
|
#define MPG_123 "/usr/bin/mpg123"
|
||||||
@@ -71,6 +72,8 @@ static int mp3play(char *filename, int fd)
|
|||||||
ast_log(LOG_WARNING, "Fork failed\n");
|
ast_log(LOG_WARNING, "Fork failed\n");
|
||||||
if (res)
|
if (res)
|
||||||
return res;
|
return res;
|
||||||
|
if (option_highpriority)
|
||||||
|
ast_set_priority(0);
|
||||||
dup2(fd, STDOUT_FILENO);
|
dup2(fd, STDOUT_FILENO);
|
||||||
for (x=0;x<256;x++) {
|
for (x=0;x<256;x++) {
|
||||||
if (x != STDOUT_FILENO)
|
if (x != STDOUT_FILENO)
|
||||||
|
4
apps/app_nbscat.c
Executable file → Normal file
4
apps/app_nbscat.c
Executable file → Normal file
@@ -44,6 +44,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/pbx.h"
|
#include "asterisk/pbx.h"
|
||||||
#include "asterisk/module.h"
|
#include "asterisk/module.h"
|
||||||
#include "asterisk/translate.h"
|
#include "asterisk/translate.h"
|
||||||
|
#include "asterisk/options.h"
|
||||||
|
|
||||||
#define LOCAL_NBSCAT "/usr/local/bin/nbscat8k"
|
#define LOCAL_NBSCAT "/usr/local/bin/nbscat8k"
|
||||||
#define NBSCAT "/usr/bin/nbscat8k"
|
#define NBSCAT "/usr/bin/nbscat8k"
|
||||||
@@ -75,6 +76,9 @@ static int NBScatplay(int fd)
|
|||||||
ast_log(LOG_WARNING, "Fork failed\n");
|
ast_log(LOG_WARNING, "Fork failed\n");
|
||||||
if (res)
|
if (res)
|
||||||
return res;
|
return res;
|
||||||
|
if (option_highpriority)
|
||||||
|
ast_set_priority(0);
|
||||||
|
|
||||||
dup2(fd, STDOUT_FILENO);
|
dup2(fd, STDOUT_FILENO);
|
||||||
for (x=0;x<256;x++) {
|
for (x=0;x<256;x++) {
|
||||||
if (x != STDOUT_FILENO)
|
if (x != STDOUT_FILENO)
|
||||||
|
32
apps/app_osplookup.c
Executable file → Normal file
32
apps/app_osplookup.c
Executable file → Normal file
@@ -216,27 +216,33 @@ static int ospnext_exec(struct ast_channel *chan, void *data)
|
|||||||
cause = str2cause(args.cause);
|
cause = str2cause(args.cause);
|
||||||
temp = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
|
temp = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
|
||||||
result.handle = -1;
|
result.handle = -1;
|
||||||
if (!ast_strlen_zero(temp) && (sscanf(temp, "%d", &result.handle) == 1) && (result.handle > -1)) {
|
if (ast_strlen_zero(temp) || (sscanf(temp, "%d", &result.handle) != 1)) {
|
||||||
if ((res = ast_osp_next(&result, cause)) > 0) {
|
result.handle = -1;
|
||||||
char tmp[80];
|
}
|
||||||
snprintf(tmp, sizeof(tmp), "%d", result.handle);
|
temp = pbx_builtin_getvar_helper(chan, "OSPRESULTS");
|
||||||
pbx_builtin_setvar_helper(chan, "_OSPHANDLE", tmp);
|
if (ast_strlen_zero(temp) || (sscanf(temp, "%d", &result.numresults) != 1)) {
|
||||||
pbx_builtin_setvar_helper(chan, "_OSPTECH", result.tech);
|
result.numresults = 0;
|
||||||
pbx_builtin_setvar_helper(chan, "_OSPDEST", result.dest);
|
}
|
||||||
pbx_builtin_setvar_helper(chan, "_OSPTOKEN", result.token);
|
if ((res = ast_osp_next(&result, cause)) > 0) {
|
||||||
snprintf(tmp, sizeof(tmp), "%d", result.numresults);
|
char tmp[80];
|
||||||
pbx_builtin_setvar_helper(chan, "_OSPRESULTS", tmp);
|
snprintf(tmp, sizeof(tmp), "%d", result.handle);
|
||||||
pbx_builtin_setvar_helper(chan, "OSPNEXTSTATUS", "SUCCESS");
|
pbx_builtin_setvar_helper(chan, "_OSPHANDLE", tmp);
|
||||||
}
|
pbx_builtin_setvar_helper(chan, "_OSPTECH", result.tech);
|
||||||
|
pbx_builtin_setvar_helper(chan, "_OSPDEST", result.dest);
|
||||||
|
pbx_builtin_setvar_helper(chan, "_OSPTOKEN", result.token);
|
||||||
|
snprintf(tmp, sizeof(tmp), "%d", result.numresults);
|
||||||
|
pbx_builtin_setvar_helper(chan, "_OSPRESULTS", tmp);
|
||||||
|
pbx_builtin_setvar_helper(chan, "OSPNEXTSTATUS", "SUCCESS");
|
||||||
} else {
|
} else {
|
||||||
if (!res) {
|
if (!res) {
|
||||||
if (result.handle < 0)
|
if (result.handle < 0)
|
||||||
ast_log(LOG_NOTICE, "OSP Lookup Next failed for handle '%d'\n", result.handle);
|
ast_log(LOG_NOTICE, "OSP Lookup Next failed for handle '%d'\n", result.handle);
|
||||||
else
|
else
|
||||||
ast_log(LOG_DEBUG, "No OSP handle specified\n");
|
ast_log(LOG_DEBUG, "No OSP handle specified\n");
|
||||||
pbx_builtin_setvar_helper(chan, "OSPNEXTSTATUS", "FAILED");
|
|
||||||
} else
|
} else
|
||||||
ast_log(LOG_DEBUG, "Got hangup on '%s' while doing OSP Next!\n", chan->name);
|
ast_log(LOG_DEBUG, "Got hangup on '%s' while doing OSP Next!\n", chan->name);
|
||||||
|
|
||||||
|
pbx_builtin_setvar_helper(chan, "OSPNEXTSTATUS", "FAILED");
|
||||||
}
|
}
|
||||||
if (!res) {
|
if (!res) {
|
||||||
/* Look for a "busy" place */
|
/* Look for a "busy" place */
|
||||||
|
43
apps/app_page.c
Executable file → Normal file
43
apps/app_page.c
Executable file → Normal file
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Asterisk -- An open source telephony toolkit.
|
* Asterisk -- An open source telephony toolkit.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2004 - 2005 Digium, Inc. All rights reserved.
|
* Copyright (c) 2004 - 2006 Digium, Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Mark Spencer <markster@digium.com>
|
* Mark Spencer <markster@digium.com>
|
||||||
*
|
*
|
||||||
@@ -40,6 +40,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/module.h"
|
#include "asterisk/module.h"
|
||||||
#include "asterisk/file.h"
|
#include "asterisk/file.h"
|
||||||
#include "asterisk/app.h"
|
#include "asterisk/app.h"
|
||||||
|
#include "asterisk/chanvars.h"
|
||||||
|
|
||||||
|
|
||||||
static const char *tdesc = "Page Multiple Phones";
|
static const char *tdesc = "Page Multiple Phones";
|
||||||
@@ -77,13 +78,14 @@ struct calloutdata {
|
|||||||
char tech[64];
|
char tech[64];
|
||||||
char resource[256];
|
char resource[256];
|
||||||
char meetmeopts[64];
|
char meetmeopts[64];
|
||||||
|
struct ast_variable *variables;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *page_thread(void *data)
|
static void *page_thread(void *data)
|
||||||
{
|
{
|
||||||
struct calloutdata *cd = data;
|
struct calloutdata *cd = data;
|
||||||
ast_pbx_outgoing_app(cd->tech, AST_FORMAT_SLINEAR, cd->resource, 30000,
|
ast_pbx_outgoing_app(cd->tech, AST_FORMAT_SLINEAR, cd->resource, 30000,
|
||||||
"MeetMe", cd->meetmeopts, NULL, 0, cd->cidnum, cd->cidname, NULL, NULL);
|
"MeetMe", cd->meetmeopts, NULL, 0, cd->cidnum, cd->cidname, cd->variables, NULL, NULL);
|
||||||
free(cd);
|
free(cd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -91,6 +93,9 @@ static void *page_thread(void *data)
|
|||||||
static void launch_page(struct ast_channel *chan, const char *meetmeopts, const char *tech, const char *resource)
|
static void launch_page(struct ast_channel *chan, const char *meetmeopts, const char *tech, const char *resource)
|
||||||
{
|
{
|
||||||
struct calloutdata *cd;
|
struct calloutdata *cd;
|
||||||
|
const char *varname;
|
||||||
|
struct ast_variable *lastvar = NULL;
|
||||||
|
struct ast_var_t *varptr;
|
||||||
pthread_t t;
|
pthread_t t;
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
cd = malloc(sizeof(struct calloutdata));
|
cd = malloc(sizeof(struct calloutdata));
|
||||||
@@ -101,6 +106,29 @@ static void launch_page(struct ast_channel *chan, const char *meetmeopts, const
|
|||||||
ast_copy_string(cd->tech, tech, sizeof(cd->tech));
|
ast_copy_string(cd->tech, tech, sizeof(cd->tech));
|
||||||
ast_copy_string(cd->resource, resource, sizeof(cd->resource));
|
ast_copy_string(cd->resource, resource, sizeof(cd->resource));
|
||||||
ast_copy_string(cd->meetmeopts, meetmeopts, sizeof(cd->meetmeopts));
|
ast_copy_string(cd->meetmeopts, meetmeopts, sizeof(cd->meetmeopts));
|
||||||
|
|
||||||
|
AST_LIST_TRAVERSE(&chan->varshead, varptr, entries) {
|
||||||
|
if (!(varname = ast_var_full_name(varptr)))
|
||||||
|
continue;
|
||||||
|
if (varname[0] == '_') {
|
||||||
|
struct ast_variable *newvar = NULL;
|
||||||
|
|
||||||
|
if (varname[1] == '_') {
|
||||||
|
newvar = ast_variable_new(varname, ast_var_value(varptr));
|
||||||
|
} else {
|
||||||
|
newvar = ast_variable_new(&varname[1], ast_var_value(varptr));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newvar) {
|
||||||
|
if (lastvar)
|
||||||
|
lastvar->next = newvar;
|
||||||
|
else
|
||||||
|
cd->variables = newvar;
|
||||||
|
lastvar = newvar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||||
if (ast_pthread_create(&t, &attr, page_thread, cd)) {
|
if (ast_pthread_create(&t, &attr, page_thread, cd)) {
|
||||||
@@ -121,6 +149,7 @@ static int page_exec(struct ast_channel *chan, void *data)
|
|||||||
struct ast_app *app;
|
struct ast_app *app;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
int res=0;
|
int res=0;
|
||||||
|
char originator[AST_CHANNEL_NAME];
|
||||||
|
|
||||||
if (ast_strlen_zero(data)) {
|
if (ast_strlen_zero(data)) {
|
||||||
ast_log(LOG_WARNING, "This application requires at least one argument (destination(s) to page)\n");
|
ast_log(LOG_WARNING, "This application requires at least one argument (destination(s) to page)\n");
|
||||||
@@ -142,12 +171,21 @@ static int page_exec(struct ast_channel *chan, void *data)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ast_copy_string(originator, chan->name, sizeof(originator));
|
||||||
|
if ((tmp = strchr(originator, '-')))
|
||||||
|
*tmp = '\0';
|
||||||
|
|
||||||
tmp = strsep(&options, "|");
|
tmp = strsep(&options, "|");
|
||||||
if (options)
|
if (options)
|
||||||
ast_app_parse_options(page_opts, &flags, NULL, options);
|
ast_app_parse_options(page_opts, &flags, NULL, options);
|
||||||
|
|
||||||
snprintf(meetmeopts, sizeof(meetmeopts), "%ud|%sqxdw", confid, ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m");
|
snprintf(meetmeopts, sizeof(meetmeopts), "%ud|%sqxdw", confid, ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m");
|
||||||
|
|
||||||
while ((tech = strsep(&tmp, "&"))) {
|
while ((tech = strsep(&tmp, "&"))) {
|
||||||
|
/* don't call the originating device */
|
||||||
|
if (!strcasecmp(tech, originator))
|
||||||
|
continue;
|
||||||
|
|
||||||
if ((resource = strchr(tech, '/'))) {
|
if ((resource = strchr(tech, '/'))) {
|
||||||
*resource++ = '\0';
|
*resource++ = '\0';
|
||||||
launch_page(chan, meetmeopts, tech, resource);
|
launch_page(chan, meetmeopts, tech, resource);
|
||||||
@@ -155,6 +193,7 @@ static int page_exec(struct ast_channel *chan, void *data)
|
|||||||
ast_log(LOG_WARNING, "Incomplete destination '%s' supplied.\n", tech);
|
ast_log(LOG_WARNING, "Incomplete destination '%s' supplied.\n", tech);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ast_test_flag(&flags, PAGE_QUIET)) {
|
if (!ast_test_flag(&flags, PAGE_QUIET)) {
|
||||||
res = ast_streamfile(chan, "beep", chan->language);
|
res = ast_streamfile(chan, "beep", chan->language);
|
||||||
if (!res)
|
if (!res)
|
||||||
|
0
apps/app_parkandannounce.c
Executable file → Normal file
0
apps/app_parkandannounce.c
Executable file → Normal file
0
apps/app_playback.c
Executable file → Normal file
0
apps/app_playback.c
Executable file → Normal file
16
apps/app_privacy.c
Executable file → Normal file
16
apps/app_privacy.c
Executable file → Normal file
@@ -193,13 +193,21 @@ static int privacy_exec (struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*Got a number, play sounds and send them on their way*/
|
/*Got a number, play sounds and send them on their way*/
|
||||||
if ((retries < maxretries) && res == 1 ) {
|
if ((retries < maxretries) && res >= 0 ) {
|
||||||
res = ast_streamfile(chan, "privacy-thankyou", chan->language);
|
res = ast_streamfile(chan, "privacy-thankyou", chan->language);
|
||||||
if (!res)
|
if (!res)
|
||||||
res = ast_waitstream(chan, "");
|
res = ast_waitstream(chan, "");
|
||||||
ast_set_callerid (chan, phone, "Privacy Manager", NULL);
|
|
||||||
if (option_verbose > 2)
|
ast_set_callerid (chan, phone, "Privacy Manager", NULL);
|
||||||
ast_verbose (VERBOSE_PREFIX_3 "Changed Caller*ID to %s\n",phone);
|
|
||||||
|
/* Clear the unavailable presence bit so if it came in on PRI
|
||||||
|
* the caller id will now be passed out to other channels
|
||||||
|
*/
|
||||||
|
chan->cid.cid_pres &= (AST_PRES_UNAVAILABLE ^ 0xFF);
|
||||||
|
|
||||||
|
if (option_verbose > 2) {
|
||||||
|
ast_verbose (VERBOSE_PREFIX_3 "Changed Caller*ID to %s, callerpres to %d\n",phone,chan->cid.cid_pres);
|
||||||
|
}
|
||||||
pbx_builtin_setvar_helper(chan, "PRIVACYMGRSTATUS", "SUCCESS");
|
pbx_builtin_setvar_helper(chan, "PRIVACYMGRSTATUS", "SUCCESS");
|
||||||
} else {
|
} else {
|
||||||
if (priority_jump || option_priority_jumping)
|
if (priority_jump || option_priority_jumping)
|
||||||
|
594
apps/app_queue.c
Executable file → Normal file
594
apps/app_queue.c
Executable file → Normal file
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Asterisk -- An open source telephony toolkit.
|
* Asterisk -- An open source telephony toolkit.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 - 2005, Digium, Inc.
|
* Copyright (C) 1999 - 2006, Digium, Inc.
|
||||||
*
|
*
|
||||||
* Mark Spencer <markster@digium.com>
|
* Mark Spencer <markster@digium.com>
|
||||||
*
|
*
|
||||||
@@ -298,10 +298,18 @@ struct member {
|
|||||||
int status; /*!< Status of queue member */
|
int status; /*!< Status of queue member */
|
||||||
int paused; /*!< Are we paused (not accepting calls)? */
|
int paused; /*!< Are we paused (not accepting calls)? */
|
||||||
time_t lastcall; /*!< When last successful call was hungup */
|
time_t lastcall; /*!< When last successful call was hungup */
|
||||||
int dead; /*!< Used to detect members deleted in realtime */
|
unsigned int dead:1; /*!< Used to detect members deleted in realtime */
|
||||||
|
unsigned int delme:1; /*!< Flag to delete entry on reload */
|
||||||
struct member *next; /*!< Next member */
|
struct member *next; /*!< Next member */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ast_member_interfaces {
|
||||||
|
char interface[80];
|
||||||
|
AST_LIST_ENTRY(ast_member_interfaces) list; /*!< Next call queue */
|
||||||
|
};
|
||||||
|
|
||||||
|
static AST_LIST_HEAD_STATIC(interfaces, ast_member_interfaces);
|
||||||
|
|
||||||
/* values used in multi-bit flags in ast_call_queue */
|
/* values used in multi-bit flags in ast_call_queue */
|
||||||
#define QUEUE_EMPTY_NORMAL 1
|
#define QUEUE_EMPTY_NORMAL 1
|
||||||
#define QUEUE_EMPTY_STRICT 2
|
#define QUEUE_EMPTY_STRICT 2
|
||||||
@@ -430,6 +438,8 @@ static enum queue_member_status get_member_status(const struct ast_call_queue *q
|
|||||||
enum queue_member_status result = QUEUE_NO_MEMBERS;
|
enum queue_member_status result = QUEUE_NO_MEMBERS;
|
||||||
|
|
||||||
for (member = q->members; member; member = member->next) {
|
for (member = q->members; member; member = member->next) {
|
||||||
|
if (member->paused) continue;
|
||||||
|
|
||||||
switch (member->status) {
|
switch (member->status) {
|
||||||
case AST_DEVICE_INVALID:
|
case AST_DEVICE_INVALID:
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
@@ -455,6 +465,7 @@ static void *changethread(void *data)
|
|||||||
struct ast_call_queue *q;
|
struct ast_call_queue *q;
|
||||||
struct statechange *sc = data;
|
struct statechange *sc = data;
|
||||||
struct member *cur;
|
struct member *cur;
|
||||||
|
struct ast_member_interfaces *curint;
|
||||||
char *loc;
|
char *loc;
|
||||||
char *technology;
|
char *technology;
|
||||||
|
|
||||||
@@ -467,36 +478,50 @@ static void *changethread(void *data)
|
|||||||
free(sc);
|
free(sc);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (option_debug)
|
|
||||||
ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s)\n", technology, loc, sc->state, devstate2str(sc->state));
|
AST_LIST_LOCK(&interfaces);
|
||||||
ast_mutex_lock(&qlock);
|
AST_LIST_TRAVERSE(&interfaces, curint, list) {
|
||||||
for (q = queues; q; q = q->next) {
|
if (!strcasecmp(curint->interface, sc->dev))
|
||||||
ast_mutex_lock(&q->lock);
|
break;
|
||||||
cur = q->members;
|
}
|
||||||
while(cur) {
|
AST_LIST_UNLOCK(&interfaces);
|
||||||
if (!strcasecmp(sc->dev, cur->interface)) {
|
|
||||||
if (cur->status != sc->state) {
|
if (curint) {
|
||||||
cur->status = sc->state;
|
|
||||||
if (!q->maskmemberstatus) {
|
if (option_debug)
|
||||||
manager_event(EVENT_FLAG_AGENT, "QueueMemberStatus",
|
ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s)\n", technology, loc, sc->state, devstate2str(sc->state));
|
||||||
"Queue: %s\r\n"
|
ast_mutex_lock(&qlock);
|
||||||
"Location: %s\r\n"
|
for (q = queues; q; q = q->next) {
|
||||||
"Membership: %s\r\n"
|
ast_mutex_lock(&q->lock);
|
||||||
"Penalty: %d\r\n"
|
cur = q->members;
|
||||||
"CallsTaken: %d\r\n"
|
while(cur) {
|
||||||
"LastCall: %ld\r\n"
|
if (!strcasecmp(sc->dev, cur->interface)) {
|
||||||
"Status: %d\r\n"
|
if (cur->status != sc->state) {
|
||||||
"Paused: %d\r\n",
|
cur->status = sc->state;
|
||||||
q->name, cur->interface, cur->dynamic ? "dynamic" : "static",
|
if (!q->maskmemberstatus) {
|
||||||
cur->penalty, cur->calls, cur->lastcall, cur->status, cur->paused);
|
manager_event(EVENT_FLAG_AGENT, "QueueMemberStatus",
|
||||||
|
"Queue: %s\r\n"
|
||||||
|
"Location: %s\r\n"
|
||||||
|
"Membership: %s\r\n"
|
||||||
|
"Penalty: %d\r\n"
|
||||||
|
"CallsTaken: %d\r\n"
|
||||||
|
"LastCall: %d\r\n"
|
||||||
|
"Status: %d\r\n"
|
||||||
|
"Paused: %d\r\n",
|
||||||
|
q->name, cur->interface, cur->dynamic ? "dynamic" : "static",
|
||||||
|
cur->penalty, cur->calls, (int)cur->lastcall, cur->status, cur->paused);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cur = cur->next;
|
||||||
}
|
}
|
||||||
cur = cur->next;
|
ast_mutex_unlock(&q->lock);
|
||||||
}
|
}
|
||||||
ast_mutex_unlock(&q->lock);
|
ast_mutex_unlock(&qlock);
|
||||||
}
|
} else {
|
||||||
ast_mutex_unlock(&qlock);
|
if (option_debug)
|
||||||
|
ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s) but we don't care because they're not a member of any queue.\n", technology, loc, sc->state, devstate2str(sc->state));
|
||||||
|
}
|
||||||
free(sc);
|
free(sc);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -593,6 +618,99 @@ static void clear_queue(struct ast_call_queue *q)
|
|||||||
q->wrapuptime = 0;
|
q->wrapuptime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int add_to_interfaces(char *interface)
|
||||||
|
{
|
||||||
|
struct ast_member_interfaces *curint, *newint;
|
||||||
|
|
||||||
|
if (!interface)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
AST_LIST_LOCK(&interfaces);
|
||||||
|
AST_LIST_TRAVERSE(&interfaces, curint, list) {
|
||||||
|
if (!strcasecmp(curint->interface, interface))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!curint) {
|
||||||
|
if (option_debug)
|
||||||
|
ast_log(LOG_DEBUG, "Adding %s to the list of interfaces that make up all of our queue members.\n", interface);
|
||||||
|
|
||||||
|
if ((newint = malloc(sizeof(*newint)))) {
|
||||||
|
memset(newint, 0, sizeof(*newint));
|
||||||
|
ast_copy_string(newint->interface, interface, sizeof(newint->interface));
|
||||||
|
AST_LIST_INSERT_HEAD(&interfaces, newint, list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AST_LIST_UNLOCK(&interfaces);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int interface_exists_global(char *interface)
|
||||||
|
{
|
||||||
|
struct ast_call_queue *q;
|
||||||
|
struct member *mem;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if (!interface)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ast_mutex_lock(&qlock);
|
||||||
|
for (q = queues; q && !ret; q = q->next) {
|
||||||
|
ast_mutex_lock(&q->lock);
|
||||||
|
mem = q->members;
|
||||||
|
while(mem) {
|
||||||
|
if (!strcasecmp(interface, mem->interface)) {
|
||||||
|
ret = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
mem = mem->next;
|
||||||
|
}
|
||||||
|
ast_mutex_unlock(&q->lock);
|
||||||
|
}
|
||||||
|
ast_mutex_unlock(&qlock);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int remove_from_interfaces(char *interface)
|
||||||
|
{
|
||||||
|
struct ast_member_interfaces *curint;
|
||||||
|
|
||||||
|
if (!interface)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
AST_LIST_LOCK(&interfaces);
|
||||||
|
AST_LIST_TRAVERSE_SAFE_BEGIN(&interfaces, curint, list) {
|
||||||
|
if (!strcasecmp(curint->interface, interface) && !interface_exists_global(interface)) {
|
||||||
|
if (option_debug)
|
||||||
|
ast_log(LOG_DEBUG, "Removing %s from the list of interfaces that make up all of our queue members.\n", interface);
|
||||||
|
AST_LIST_REMOVE_CURRENT(&interfaces, list);
|
||||||
|
free(curint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AST_LIST_TRAVERSE_SAFE_END;
|
||||||
|
AST_LIST_UNLOCK(&interfaces);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void clear_and_free_interfaces(void)
|
||||||
|
{
|
||||||
|
struct ast_member_interfaces *curint;
|
||||||
|
|
||||||
|
AST_LIST_LOCK(&interfaces);
|
||||||
|
AST_LIST_TRAVERSE_SAFE_BEGIN(&interfaces, curint, list) {
|
||||||
|
AST_LIST_REMOVE_CURRENT(&interfaces, list);
|
||||||
|
free(curint);
|
||||||
|
}
|
||||||
|
AST_LIST_TRAVERSE_SAFE_END;
|
||||||
|
AST_LIST_UNLOCK(&interfaces);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*! \brief Configure a queue parameter.
|
/*! \brief Configure a queue parameter.
|
||||||
\par
|
\par
|
||||||
For error reporting, line number is passed for .conf static configuration.
|
For error reporting, line number is passed for .conf static configuration.
|
||||||
@@ -743,6 +861,7 @@ static void rt_handle_member_record(struct ast_call_queue *q, char *interface, c
|
|||||||
m = create_queue_member(interface, penalty, 0);
|
m = create_queue_member(interface, penalty, 0);
|
||||||
if (m) {
|
if (m) {
|
||||||
m->dead = 0;
|
m->dead = 0;
|
||||||
|
add_to_interfaces(interface);
|
||||||
if (prev_m) {
|
if (prev_m) {
|
||||||
prev_m->next = m;
|
prev_m->next = m;
|
||||||
} else {
|
} else {
|
||||||
@@ -755,28 +874,67 @@ static void rt_handle_member_record(struct ast_call_queue *q, char *interface, c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void free_members(struct ast_call_queue *q, int all)
|
||||||
|
{
|
||||||
|
/* Free non-dynamic members */
|
||||||
|
struct member *curm, *next, *prev = NULL;
|
||||||
|
|
||||||
|
for (curm = q->members; curm; curm = next) {
|
||||||
|
next = curm->next;
|
||||||
|
if (all || !curm->dynamic) {
|
||||||
|
if (prev)
|
||||||
|
prev->next = next;
|
||||||
|
else
|
||||||
|
q->members = next;
|
||||||
|
remove_from_interfaces(curm->interface);
|
||||||
|
free(curm);
|
||||||
|
} else
|
||||||
|
prev = curm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void destroy_queue(struct ast_call_queue *q)
|
||||||
|
{
|
||||||
|
free_members(q, 1);
|
||||||
|
ast_mutex_destroy(&q->lock);
|
||||||
|
free(q);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void remove_queue(struct ast_call_queue *q)
|
||||||
|
{
|
||||||
|
struct ast_call_queue *cur, *prev = NULL;
|
||||||
|
|
||||||
|
ast_mutex_lock(&qlock);
|
||||||
|
for (cur = queues; cur; cur = cur->next) {
|
||||||
|
if (cur == q) {
|
||||||
|
if (prev)
|
||||||
|
prev->next = cur->next;
|
||||||
|
else
|
||||||
|
queues = cur->next;
|
||||||
|
} else {
|
||||||
|
prev = cur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ast_mutex_unlock(&qlock);
|
||||||
|
}
|
||||||
|
|
||||||
/*!\brief Reload a single queue via realtime.
|
/*!\brief Reload a single queue via realtime.
|
||||||
\return Return the queue, or NULL if it doesn't exist.
|
\return Return the queue, or NULL if it doesn't exist.
|
||||||
\note Should be called with the global qlock locked.
|
\note Should be called with the global qlock locked. */
|
||||||
When found, the queue is returned with q->lock locked. */
|
static struct ast_call_queue *find_queue_by_name_rt(const char *queuename, struct ast_variable *queue_vars, struct ast_config *member_config)
|
||||||
static struct ast_call_queue *reload_queue_rt(const char *queuename, struct ast_variable *queue_vars, struct ast_config *member_config)
|
|
||||||
{
|
{
|
||||||
struct ast_variable *v;
|
struct ast_variable *v;
|
||||||
struct ast_call_queue *q, *prev_q;
|
struct ast_call_queue *q, *prev_q = NULL;
|
||||||
struct member *m, *prev_m, *next_m;
|
struct member *m, *prev_m, *next_m;
|
||||||
char *interface;
|
char *interface;
|
||||||
char *tmp, *tmp_name;
|
char *tmp, *tmp_name;
|
||||||
char tmpbuf[64]; /* Must be longer than the longest queue param name. */
|
char tmpbuf[64]; /* Must be longer than the longest queue param name. */
|
||||||
|
|
||||||
/* Find the queue in the in-core list (we will create a new one if not found). */
|
/* Find the queue in the in-core list (we will create a new one if not found). */
|
||||||
q = queues;
|
for (q = queues; q; q = q->next) {
|
||||||
prev_q = NULL;
|
|
||||||
while (q) {
|
|
||||||
if (!strcasecmp(q->name, queuename)) {
|
if (!strcasecmp(q->name, queuename)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
q = q->next;
|
|
||||||
prev_q = q;
|
prev_q = q;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -788,6 +946,7 @@ static struct ast_call_queue *reload_queue_rt(const char *queuename, struct ast_
|
|||||||
ast_mutex_unlock(&q->lock);
|
ast_mutex_unlock(&q->lock);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
|
ast_mutex_unlock(&q->lock);
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -814,7 +973,7 @@ static struct ast_call_queue *reload_queue_rt(const char *queuename, struct ast_
|
|||||||
prev_q->next = q->next;
|
prev_q->next = q->next;
|
||||||
}
|
}
|
||||||
ast_mutex_unlock(&q->lock);
|
ast_mutex_unlock(&q->lock);
|
||||||
free(q);
|
destroy_queue(q);
|
||||||
} else
|
} else
|
||||||
ast_mutex_unlock(&q->lock);
|
ast_mutex_unlock(&q->lock);
|
||||||
}
|
}
|
||||||
@@ -850,10 +1009,11 @@ static struct ast_call_queue *reload_queue_rt(const char *queuename, struct ast_
|
|||||||
v = v->next;
|
v = v->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Temporarily set members dead so we can detect deleted ones. */
|
/* Temporarily set non-dynamic members dead so we can detect deleted ones. */
|
||||||
m = q->members;
|
m = q->members;
|
||||||
while (m) {
|
while (m) {
|
||||||
m->dead = 1;
|
if (!m->dynamic)
|
||||||
|
m->dead = 1;
|
||||||
m = m->next;
|
m = m->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -874,6 +1034,7 @@ static struct ast_call_queue *reload_queue_rt(const char *queuename, struct ast_
|
|||||||
} else {
|
} else {
|
||||||
q->members = next_m;
|
q->members = next_m;
|
||||||
}
|
}
|
||||||
|
remove_from_interfaces(m->interface);
|
||||||
free(m);
|
free(m);
|
||||||
} else {
|
} else {
|
||||||
prev_m = m;
|
prev_m = m;
|
||||||
@@ -881,13 +1042,60 @@ static struct ast_call_queue *reload_queue_rt(const char *queuename, struct ast_
|
|||||||
m = next_m;
|
m = next_m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ast_mutex_unlock(&q->lock);
|
||||||
|
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct ast_call_queue *load_realtime_queue(char *queuename)
|
||||||
|
{
|
||||||
|
struct ast_variable *queue_vars = NULL;
|
||||||
|
struct ast_config *member_config = NULL;
|
||||||
|
struct ast_call_queue *q;
|
||||||
|
|
||||||
|
/* Find the queue in the in-core list first. */
|
||||||
|
ast_mutex_lock(&qlock);
|
||||||
|
for (q = queues; q; q = q->next) {
|
||||||
|
if (!strcasecmp(q->name, queuename)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ast_mutex_unlock(&qlock);
|
||||||
|
|
||||||
|
if (!q || q->realtime) {
|
||||||
|
/*! \note Load from realtime before taking the global qlock, to avoid blocking all
|
||||||
|
queue operations while waiting for the DB.
|
||||||
|
|
||||||
|
This will be two separate database transactions, so we might
|
||||||
|
see queue parameters as they were before another process
|
||||||
|
changed the queue and member list as it was after the change.
|
||||||
|
Thus we might see an empty member list when a queue is
|
||||||
|
deleted. In practise, this is unlikely to cause a problem. */
|
||||||
|
|
||||||
|
queue_vars = ast_load_realtime("queues", "name", queuename, NULL);
|
||||||
|
if (queue_vars) {
|
||||||
|
member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", queuename, NULL);
|
||||||
|
if (!member_config) {
|
||||||
|
ast_log(LOG_ERROR, "no queue_members defined in your config (extconfig.conf).\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ast_mutex_lock(&qlock);
|
||||||
|
|
||||||
|
q = find_queue_by_name_rt(queuename, queue_vars, member_config);
|
||||||
|
if (member_config)
|
||||||
|
ast_config_destroy(member_config);
|
||||||
|
if (queue_vars)
|
||||||
|
ast_variables_destroy(queue_vars);
|
||||||
|
|
||||||
|
ast_mutex_unlock(&qlock);
|
||||||
|
}
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason)
|
static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason)
|
||||||
{
|
{
|
||||||
struct ast_variable *queue_vars = NULL;
|
|
||||||
struct ast_config *member_config = NULL;
|
|
||||||
struct ast_call_queue *q;
|
struct ast_call_queue *q;
|
||||||
struct queue_ent *cur, *prev = NULL;
|
struct queue_ent *cur, *prev = NULL;
|
||||||
int res = -1;
|
int res = -1;
|
||||||
@@ -895,35 +1103,12 @@ static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *
|
|||||||
int inserted = 0;
|
int inserted = 0;
|
||||||
enum queue_member_status stat;
|
enum queue_member_status stat;
|
||||||
|
|
||||||
/*! \note Load from realtime before taking the global qlock, to avoid blocking all
|
q = load_realtime_queue(queuename);
|
||||||
queue operations while waiting for the DB.
|
if (!q)
|
||||||
|
return res;
|
||||||
This will be two separate database transactions, so we might
|
|
||||||
see queue parameters as they were before another process
|
|
||||||
changed the queue and member list as it was after the change.
|
|
||||||
Thus we might see an empty member list when a queue is
|
|
||||||
deleted. In practise, this is unlikely to cause a problem. */
|
|
||||||
queue_vars = ast_load_realtime("queues", "name", queuename, NULL);
|
|
||||||
if (queue_vars) {
|
|
||||||
member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", queuename, NULL);
|
|
||||||
if (!member_config) {
|
|
||||||
ast_log(LOG_ERROR, "no queue_members defined in your config (extconfig.conf).\n");
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ast_mutex_lock(&qlock);
|
ast_mutex_lock(&qlock);
|
||||||
q = reload_queue_rt(queuename, queue_vars, member_config);
|
ast_mutex_lock(&q->lock);
|
||||||
/* Note: If found, reload_queue_rt() returns with q->lock locked. */
|
|
||||||
if(member_config)
|
|
||||||
ast_config_destroy(member_config);
|
|
||||||
if(queue_vars)
|
|
||||||
ast_variables_destroy(queue_vars);
|
|
||||||
|
|
||||||
if (!q) {
|
|
||||||
ast_mutex_unlock(&qlock);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is our one */
|
/* This is our one */
|
||||||
stat = get_member_status(q);
|
stat = get_member_status(q);
|
||||||
@@ -966,57 +1151,15 @@ static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *
|
|||||||
qe->chan->cid.cid_num ? qe->chan->cid.cid_num : "unknown",
|
qe->chan->cid.cid_num ? qe->chan->cid.cid_num : "unknown",
|
||||||
qe->chan->cid.cid_name ? qe->chan->cid.cid_name : "unknown",
|
qe->chan->cid.cid_name ? qe->chan->cid.cid_name : "unknown",
|
||||||
q->name, qe->pos, q->count );
|
q->name, qe->pos, q->count );
|
||||||
#if 0
|
|
||||||
ast_log(LOG_NOTICE, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, qe->chan->name, qe->pos );
|
if (option_debug)
|
||||||
#endif
|
ast_log(LOG_DEBUG, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, qe->chan->name, qe->pos );
|
||||||
}
|
}
|
||||||
ast_mutex_unlock(&q->lock);
|
ast_mutex_unlock(&q->lock);
|
||||||
ast_mutex_unlock(&qlock);
|
ast_mutex_unlock(&qlock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_members(struct ast_call_queue *q, int all)
|
|
||||||
{
|
|
||||||
/* Free non-dynamic members */
|
|
||||||
struct member *curm, *next, *prev;
|
|
||||||
|
|
||||||
curm = q->members;
|
|
||||||
prev = NULL;
|
|
||||||
while(curm) {
|
|
||||||
next = curm->next;
|
|
||||||
if (all || !curm->dynamic) {
|
|
||||||
if (prev)
|
|
||||||
prev->next = next;
|
|
||||||
else
|
|
||||||
q->members = next;
|
|
||||||
free(curm);
|
|
||||||
} else
|
|
||||||
prev = curm;
|
|
||||||
curm = next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void destroy_queue(struct ast_call_queue *q)
|
|
||||||
{
|
|
||||||
struct ast_call_queue *cur, *prev = NULL;
|
|
||||||
|
|
||||||
ast_mutex_lock(&qlock);
|
|
||||||
for (cur = queues; cur; cur = cur->next) {
|
|
||||||
if (cur == q) {
|
|
||||||
if (prev)
|
|
||||||
prev->next = cur->next;
|
|
||||||
else
|
|
||||||
queues = cur->next;
|
|
||||||
} else {
|
|
||||||
prev = cur;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ast_mutex_unlock(&qlock);
|
|
||||||
free_members(q, 1);
|
|
||||||
ast_mutex_destroy(&q->lock);
|
|
||||||
free(q);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int play_file(struct ast_channel *chan, char *filename)
|
static int play_file(struct ast_channel *chan, char *filename)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
@@ -1156,12 +1299,17 @@ static int say_position(struct queue_ent *qe)
|
|||||||
ast_verbose(VERBOSE_PREFIX_3 "Told %s in %s their queue position (which was %d)\n",
|
ast_verbose(VERBOSE_PREFIX_3 "Told %s in %s their queue position (which was %d)\n",
|
||||||
qe->chan->name, qe->parent->name, qe->pos);
|
qe->chan->name, qe->parent->name, qe->pos);
|
||||||
res = play_file(qe->chan, qe->parent->sound_thanks);
|
res = play_file(qe->chan, qe->parent->sound_thanks);
|
||||||
|
if (res && !valid_exit(qe, res))
|
||||||
|
res = 0;
|
||||||
|
|
||||||
playout:
|
playout:
|
||||||
/* Set our last_pos indicators */
|
/* Set our last_pos indicators */
|
||||||
qe->last_pos = now;
|
qe->last_pos = now;
|
||||||
qe->last_pos_said = qe->pos;
|
qe->last_pos_said = qe->pos;
|
||||||
ast_moh_start(qe->chan, qe->moh);
|
|
||||||
|
/* Don't restart music on hold if we're about to exit the caller from the queue */
|
||||||
|
if (!res)
|
||||||
|
ast_moh_start(qe->chan, qe->moh);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -1178,7 +1326,7 @@ static void recalc_holdtime(struct queue_ent *qe)
|
|||||||
|
|
||||||
ast_mutex_lock(&qe->parent->lock);
|
ast_mutex_lock(&qe->parent->lock);
|
||||||
if (newvalue <= qe->parent->servicelevel)
|
if (newvalue <= qe->parent->servicelevel)
|
||||||
qe->parent->callscompletedinsl++;
|
qe->parent->callscompletedinsl++;
|
||||||
oldvalue = qe->parent->holdtime;
|
oldvalue = qe->parent->holdtime;
|
||||||
qe->parent->holdtime = (((oldvalue << 2) - oldvalue) + newvalue) >> 2;
|
qe->parent->holdtime = (((oldvalue << 2) - oldvalue) + newvalue) >> 2;
|
||||||
ast_mutex_unlock(&qe->parent->lock);
|
ast_mutex_unlock(&qe->parent->lock);
|
||||||
@@ -1224,6 +1372,7 @@ ast_log(LOG_NOTICE, "Queue '%s' Leave, Channel '%s'\n", q->name, qe->chan->name
|
|||||||
ast_mutex_unlock(&q->lock);
|
ast_mutex_unlock(&q->lock);
|
||||||
if (q->dead && !q->count) {
|
if (q->dead && !q->count) {
|
||||||
/* It's dead and nobody is in it, so kill it */
|
/* It's dead and nobody is in it, so kill it */
|
||||||
|
remove_queue(q);
|
||||||
destroy_queue(q);
|
destroy_queue(q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1261,11 +1410,11 @@ static int update_status(struct ast_call_queue *q, struct member *member, int st
|
|||||||
"Membership: %s\r\n"
|
"Membership: %s\r\n"
|
||||||
"Penalty: %d\r\n"
|
"Penalty: %d\r\n"
|
||||||
"CallsTaken: %d\r\n"
|
"CallsTaken: %d\r\n"
|
||||||
"LastCall: %ld\r\n"
|
"LastCall: %d\r\n"
|
||||||
"Status: %d\r\n"
|
"Status: %d\r\n"
|
||||||
"Paused: %d\r\n",
|
"Paused: %d\r\n",
|
||||||
q->name, cur->interface, cur->dynamic ? "dynamic" : "static",
|
q->name, cur->interface, cur->dynamic ? "dynamic" : "static",
|
||||||
cur->penalty, cur->calls, cur->lastcall, cur->status, cur->paused);
|
cur->penalty, cur->calls, (int)cur->lastcall, cur->status, cur->paused);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1304,7 +1453,7 @@ static int compare_weight(struct ast_call_queue *rq, struct member *member)
|
|||||||
ast_mutex_lock(&q->lock);
|
ast_mutex_lock(&q->lock);
|
||||||
if (q->count && q->members) {
|
if (q->count && q->members) {
|
||||||
for (mem = q->members; mem; mem = mem->next) {
|
for (mem = q->members; mem; mem = mem->next) {
|
||||||
if (mem == member) {
|
if (!strcmp(mem->interface, member->interface)) {
|
||||||
ast_log(LOG_DEBUG, "Found matching member %s in queue '%s'\n", mem->interface, q->name);
|
ast_log(LOG_DEBUG, "Found matching member %s in queue '%s'\n", mem->interface, q->name);
|
||||||
if (q->weight > rq->weight) {
|
if (q->weight > rq->weight) {
|
||||||
ast_log(LOG_DEBUG, "Queue '%s' (weight %d, calls %d) is preferred over '%s' (weight %d, calls %d)\n", q->name, q->weight, q->count, rq->name, rq->weight, rq->count);
|
ast_log(LOG_DEBUG, "Queue '%s' (weight %d, calls %d) is preferred over '%s' (weight %d, calls %d)\n", q->name, q->weight, q->count, rq->name, rq->weight, rq->count);
|
||||||
@@ -1528,7 +1677,7 @@ static int background_file(struct queue_ent *qe, struct ast_channel *chan, char
|
|||||||
if (!res) {
|
if (!res) {
|
||||||
/* Wait for a keypress */
|
/* Wait for a keypress */
|
||||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||||
if (res <= 0 || !valid_exit(qe, res))
|
if (res < 0 || !valid_exit(qe, res))
|
||||||
res = 0;
|
res = 0;
|
||||||
|
|
||||||
/* Stop playback */
|
/* Stop playback */
|
||||||
@@ -1566,8 +1715,9 @@ static int say_periodic_announcement(struct queue_ent *qe)
|
|||||||
/* play the announcement */
|
/* play the announcement */
|
||||||
res = background_file(qe, qe->chan, qe->parent->sound_periodicannounce);
|
res = background_file(qe, qe->chan, qe->parent->sound_periodicannounce);
|
||||||
|
|
||||||
/* Resume Music on Hold */
|
/* Resume Music on Hold if the caller is going to stay in the queue */
|
||||||
ast_moh_start(qe->chan, qe->moh);
|
if (!res)
|
||||||
|
ast_moh_start(qe->chan, qe->moh);
|
||||||
|
|
||||||
/* update last_periodic_announce_time */
|
/* update last_periodic_announce_time */
|
||||||
qe->last_periodic_announce_time = now;
|
qe->last_periodic_announce_time = now;
|
||||||
@@ -1728,7 +1878,7 @@ static struct localuser *wait_for_answer(struct queue_ent *qe, struct localuser
|
|||||||
if (f) {
|
if (f) {
|
||||||
if (f->frametype == AST_FRAME_CONTROL) {
|
if (f->frametype == AST_FRAME_CONTROL) {
|
||||||
switch(f->subclass) {
|
switch(f->subclass) {
|
||||||
case AST_CONTROL_ANSWER:
|
case AST_CONTROL_ANSWER:
|
||||||
/* This is our guy if someone answered. */
|
/* This is our guy if someone answered. */
|
||||||
if (!peer) {
|
if (!peer) {
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
@@ -1892,18 +2042,17 @@ static int wait_our_turn(struct queue_ent *qe, int ringing, enum queue_result *r
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Make a position announcement, if enabled */
|
/* Make a position announcement, if enabled */
|
||||||
if (qe->parent->announcefrequency && !ringing)
|
if (qe->parent->announcefrequency && !ringing &&
|
||||||
res = say_position(qe);
|
(res = say_position(qe)))
|
||||||
if (res)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Make a periodic announcement, if enabled */
|
/* Make a periodic announcement, if enabled */
|
||||||
if (qe->parent->periodicannouncefrequency && !ringing)
|
if (qe->parent->periodicannouncefrequency && !ringing &&
|
||||||
res = say_periodic_announcement(qe);
|
(res = say_periodic_announcement(qe)))
|
||||||
|
break;
|
||||||
|
|
||||||
/* Wait a second before checking again */
|
/* Wait a second before checking again */
|
||||||
if (!res) res = ast_waitfordigit(qe->chan, RECHECK * 1000);
|
if ((res = ast_waitfordigit(qe->chan, RECHECK * 1000)))
|
||||||
if (res)
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
@@ -2097,10 +2246,10 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
|
|||||||
|
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
}
|
}
|
||||||
if (qe->parent->timeout)
|
if (qe->expire && (!qe->parent->timeout || (qe->expire - now) <= qe->parent->timeout))
|
||||||
to = qe->parent->timeout * 1000;
|
to = (qe->expire - now) * 1000;
|
||||||
else
|
else
|
||||||
to = -1;
|
to = (qe->parent->timeout) ? qe->parent->timeout * 1000 : -1;
|
||||||
ring_one(qe, outgoing, &numbusies);
|
ring_one(qe, outgoing, &numbusies);
|
||||||
ast_mutex_unlock(&qe->parent->lock);
|
ast_mutex_unlock(&qe->parent->lock);
|
||||||
if (use_weight)
|
if (use_weight)
|
||||||
@@ -2118,7 +2267,6 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
|
|||||||
if (!peer) {
|
if (!peer) {
|
||||||
if (to) {
|
if (to) {
|
||||||
/* Musta gotten hung up */
|
/* Musta gotten hung up */
|
||||||
record_abandoned(qe);
|
|
||||||
res = -1;
|
res = -1;
|
||||||
} else {
|
} else {
|
||||||
res = digit;
|
res = digit;
|
||||||
@@ -2173,7 +2321,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
|
|||||||
/* Agent must have hung up */
|
/* Agent must have hung up */
|
||||||
ast_log(LOG_WARNING, "Agent on %s hungup on the customer. They're going to be pissed.\n", peer->name);
|
ast_log(LOG_WARNING, "Agent on %s hungup on the customer. They're going to be pissed.\n", peer->name);
|
||||||
ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "AGENTDUMP", "%s", "");
|
ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "AGENTDUMP", "%s", "");
|
||||||
record_abandoned(qe);
|
record_abandoned(qe);
|
||||||
if (qe->parent->eventwhencalled) {
|
if (qe->parent->eventwhencalled) {
|
||||||
manager_event(EVENT_FLAG_AGENT, "AgentDump",
|
manager_event(EVENT_FLAG_AGENT, "AgentDump",
|
||||||
"Queue: %s\r\n"
|
"Queue: %s\r\n"
|
||||||
@@ -2203,7 +2351,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
|
|||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "SYSCOMPAT", "%s", "");
|
ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "SYSCOMPAT", "%s", "");
|
||||||
ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", qe->chan->name, peer->name);
|
ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", qe->chan->name, peer->name);
|
||||||
record_abandoned(qe);
|
record_abandoned(qe);
|
||||||
ast_hangup(peer);
|
ast_hangup(peer);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -2280,13 +2428,10 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
|
|||||||
(long)(time(NULL) - callstart));
|
(long)(time(NULL) - callstart));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bridge != AST_PBX_NO_HANGUP_PEER)
|
if (bridge != AST_PBX_NO_HANGUP_PEER)
|
||||||
ast_hangup(peer);
|
ast_hangup(peer);
|
||||||
update_queue(qe->parent, member);
|
update_queue(qe->parent, member);
|
||||||
if (bridge == 0)
|
res = bridge ? -1 : 0;
|
||||||
res = 1; /* JDG: bridge successfull, leave app_queue */
|
|
||||||
else
|
|
||||||
res = bridge; /* bridge error, stay in the queue */
|
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
hangupcalls(outgoing, NULL);
|
hangupcalls(outgoing, NULL);
|
||||||
@@ -2383,7 +2528,7 @@ static int remove_from_queue(char *queuename, char *interface)
|
|||||||
free(last_member);
|
free(last_member);
|
||||||
|
|
||||||
if (queue_persistent_members)
|
if (queue_persistent_members)
|
||||||
dump_queue_members(q);
|
dump_queue_members(q);
|
||||||
|
|
||||||
res = RES_OKAY;
|
res = RES_OKAY;
|
||||||
} else {
|
} else {
|
||||||
@@ -2394,6 +2539,8 @@ static int remove_from_queue(char *queuename, char *interface)
|
|||||||
}
|
}
|
||||||
ast_mutex_unlock(&q->lock);
|
ast_mutex_unlock(&q->lock);
|
||||||
}
|
}
|
||||||
|
if (res == RES_OKAY)
|
||||||
|
remove_from_interfaces(interface);
|
||||||
ast_mutex_unlock(&qlock);
|
ast_mutex_unlock(&qlock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -2404,41 +2551,45 @@ static int add_to_queue(char *queuename, char *interface, int penalty, int pause
|
|||||||
struct member *new_member;
|
struct member *new_member;
|
||||||
int res = RES_NOSUCHQUEUE;
|
int res = RES_NOSUCHQUEUE;
|
||||||
|
|
||||||
ast_mutex_lock(&qlock);
|
/* \note Ensure the appropriate realtime queue is loaded. Note that this
|
||||||
for (q = queues ; q ; q = q->next) {
|
* short-circuits if the queue is already in memory. */
|
||||||
ast_mutex_lock(&q->lock);
|
q = load_realtime_queue(queuename);
|
||||||
if (!strcmp(q->name, queuename)) {
|
|
||||||
if (interface_exists(q, interface) == NULL) {
|
|
||||||
new_member = create_queue_member(interface, penalty, paused);
|
|
||||||
|
|
||||||
if (new_member != NULL) {
|
ast_mutex_lock(&qlock);
|
||||||
new_member->dynamic = 1;
|
|
||||||
new_member->next = q->members;
|
if (q) {
|
||||||
q->members = new_member;
|
ast_mutex_lock(&q->lock);
|
||||||
manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded",
|
if (interface_exists(q, interface) == NULL) {
|
||||||
|
|
||||||
|
add_to_interfaces(interface);
|
||||||
|
|
||||||
|
new_member = create_queue_member(interface, penalty, paused);
|
||||||
|
|
||||||
|
if (new_member != NULL) {
|
||||||
|
new_member->dynamic = 1;
|
||||||
|
new_member->next = q->members;
|
||||||
|
q->members = new_member;
|
||||||
|
manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded",
|
||||||
"Queue: %s\r\n"
|
"Queue: %s\r\n"
|
||||||
"Location: %s\r\n"
|
"Location: %s\r\n"
|
||||||
"Membership: %s\r\n"
|
"Membership: %s\r\n"
|
||||||
"Penalty: %d\r\n"
|
"Penalty: %d\r\n"
|
||||||
"CallsTaken: %d\r\n"
|
"CallsTaken: %d\r\n"
|
||||||
"LastCall: %ld\r\n"
|
"LastCall: %d\r\n"
|
||||||
"Status: %d\r\n"
|
"Status: %d\r\n"
|
||||||
"Paused: %d\r\n",
|
"Paused: %d\r\n",
|
||||||
q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
|
q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
|
||||||
new_member->penalty, new_member->calls, new_member->lastcall, new_member->status, new_member->paused);
|
new_member->penalty, new_member->calls, (int)new_member->lastcall, new_member->status, new_member->paused);
|
||||||
|
|
||||||
if (dump)
|
|
||||||
dump_queue_members(q);
|
|
||||||
|
|
||||||
res = RES_OKAY;
|
if (dump)
|
||||||
} else {
|
dump_queue_members(q);
|
||||||
res = RES_OUTOFMEMORY;
|
|
||||||
}
|
res = RES_OKAY;
|
||||||
} else {
|
} else {
|
||||||
res = RES_EXISTS;
|
res = RES_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
ast_mutex_unlock(&q->lock);
|
} else {
|
||||||
break;
|
res = RES_EXISTS;
|
||||||
}
|
}
|
||||||
ast_mutex_unlock(&q->lock);
|
ast_mutex_unlock(&q->lock);
|
||||||
}
|
}
|
||||||
@@ -2468,7 +2619,7 @@ static int set_member_paused(char *queuename, char *interface, int paused)
|
|||||||
mem->paused = paused;
|
mem->paused = paused;
|
||||||
|
|
||||||
if (queue_persistent_members)
|
if (queue_persistent_members)
|
||||||
dump_queue_members(q);
|
dump_queue_members(q);
|
||||||
|
|
||||||
ast_queue_log(q->name, "NONE", interface, (paused ? "PAUSE" : "UNPAUSE"), "%s", "");
|
ast_queue_log(q->name, "NONE", interface, (paused ? "PAUSE" : "UNPAUSE"), "%s", "");
|
||||||
|
|
||||||
@@ -2876,7 +3027,7 @@ static int queue_exec(struct ast_channel *chan, void *data)
|
|||||||
queuetimeoutstr = info_ptr;
|
queuetimeoutstr = info_ptr;
|
||||||
|
|
||||||
/* set the expire time based on the supplied timeout; */
|
/* set the expire time based on the supplied timeout; */
|
||||||
if (queuetimeoutstr)
|
if (!ast_strlen_zero(queuetimeoutstr))
|
||||||
qe.expire = qe.start + atoi(queuetimeoutstr);
|
qe.expire = qe.start + atoi(queuetimeoutstr);
|
||||||
else
|
else
|
||||||
qe.expire = 0;
|
qe.expire = 0;
|
||||||
@@ -2917,7 +3068,7 @@ static int queue_exec(struct ast_channel *chan, void *data)
|
|||||||
check_turns:
|
check_turns:
|
||||||
if (ringing) {
|
if (ringing) {
|
||||||
ast_indicate(chan, AST_CONTROL_RINGING);
|
ast_indicate(chan, AST_CONTROL_RINGING);
|
||||||
} else {
|
} else {
|
||||||
ast_moh_start(chan, qe.moh);
|
ast_moh_start(chan, qe.moh);
|
||||||
}
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@@ -2931,8 +3082,8 @@ check_turns:
|
|||||||
ast_queue_log(queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", qe.pos, qe.opos, (long)time(NULL) - qe.start);
|
ast_queue_log(queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", qe.pos, qe.opos, (long)time(NULL) - qe.start);
|
||||||
if (option_verbose > 2) {
|
if (option_verbose > 2) {
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "User disconnected from queue %s while waiting their turn\n", queuename);
|
ast_verbose(VERBOSE_PREFIX_3 "User disconnected from queue %s while waiting their turn\n", queuename);
|
||||||
res = -1;
|
|
||||||
}
|
}
|
||||||
|
res = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!res)
|
if (!res)
|
||||||
@@ -2954,7 +3105,7 @@ check_turns:
|
|||||||
|
|
||||||
/* Leave if we have exceeded our queuetimeout */
|
/* Leave if we have exceeded our queuetimeout */
|
||||||
if (qe.expire && (time(NULL) > qe.expire)) {
|
if (qe.expire && (time(NULL) > qe.expire)) {
|
||||||
record_abandoned(&qe);
|
record_abandoned(&qe);
|
||||||
reason = QUEUE_TIMEOUT;
|
reason = QUEUE_TIMEOUT;
|
||||||
res = 0;
|
res = 0;
|
||||||
ast_queue_log(queuename, chan->uniqueid,"NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
|
ast_queue_log(queuename, chan->uniqueid,"NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
|
||||||
@@ -2963,9 +3114,8 @@ check_turns:
|
|||||||
|
|
||||||
if (makeannouncement) {
|
if (makeannouncement) {
|
||||||
/* Make a position announcement, if enabled */
|
/* Make a position announcement, if enabled */
|
||||||
if (qe.parent->announcefrequency && !ringing)
|
if (qe.parent->announcefrequency && !ringing &&
|
||||||
res = say_position(&qe);
|
(res = say_position(&qe))) {
|
||||||
if (res && valid_exit(&qe, res)) {
|
|
||||||
ast_queue_log(queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos);
|
ast_queue_log(queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2974,10 +3124,8 @@ check_turns:
|
|||||||
makeannouncement = 1;
|
makeannouncement = 1;
|
||||||
|
|
||||||
/* Make a periodic announcement, if enabled */
|
/* Make a periodic announcement, if enabled */
|
||||||
if (qe.parent->periodicannouncefrequency && !ringing)
|
if (qe.parent->periodicannouncefrequency && !ringing &&
|
||||||
res = say_periodic_announcement(&qe);
|
(res = say_periodic_announcement(&qe))) {
|
||||||
|
|
||||||
if (res && valid_exit(&qe, res)) {
|
|
||||||
ast_queue_log(queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%c|%d", res, qe.pos);
|
ast_queue_log(queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%c|%d", res, qe.pos);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2990,8 +3138,9 @@ check_turns:
|
|||||||
record_abandoned(&qe);
|
record_abandoned(&qe);
|
||||||
ast_queue_log(queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", qe.pos, qe.opos, (long)time(NULL) - qe.start);
|
ast_queue_log(queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", qe.pos, qe.opos, (long)time(NULL) - qe.start);
|
||||||
}
|
}
|
||||||
} else if (res > 0)
|
} else if (valid_exit(&qe, res)) {
|
||||||
ast_queue_log(queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos);
|
ast_queue_log(queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3029,8 +3178,8 @@ check_turns:
|
|||||||
ast_queue_log(queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", qe.pos, qe.opos, (long)time(NULL) - qe.start);
|
ast_queue_log(queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", qe.pos, qe.opos, (long)time(NULL) - qe.start);
|
||||||
if (option_verbose > 2) {
|
if (option_verbose > 2) {
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "User disconnected from queue %s when they almost made it\n", queuename);
|
ast_verbose(VERBOSE_PREFIX_3 "User disconnected from queue %s when they almost made it\n", queuename);
|
||||||
res = -1;
|
|
||||||
}
|
}
|
||||||
|
res = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (res && valid_exit(&qe, res)) {
|
if (res && valid_exit(&qe, res)) {
|
||||||
@@ -3039,12 +3188,10 @@ check_turns:
|
|||||||
}
|
}
|
||||||
/* exit after 'timeout' cycle if 'n' option enabled */
|
/* exit after 'timeout' cycle if 'n' option enabled */
|
||||||
if (go_on) {
|
if (go_on) {
|
||||||
if (option_verbose > 2) {
|
if (option_verbose > 2)
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "Exiting on time-out cycle\n");
|
ast_verbose(VERBOSE_PREFIX_3 "Exiting on time-out cycle\n");
|
||||||
res = -1;
|
|
||||||
}
|
|
||||||
ast_queue_log(queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
|
ast_queue_log(queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
|
||||||
record_abandoned(&qe);
|
record_abandoned(&qe);
|
||||||
reason = QUEUE_TIMEOUT;
|
reason = QUEUE_TIMEOUT;
|
||||||
res = 0;
|
res = 0;
|
||||||
break;
|
break;
|
||||||
@@ -3056,7 +3203,7 @@ check_turns:
|
|||||||
if (!is_our_turn(&qe)) {
|
if (!is_our_turn(&qe)) {
|
||||||
if (option_debug)
|
if (option_debug)
|
||||||
ast_log(LOG_DEBUG, "Darn priorities, going back in queue (%s)!\n",
|
ast_log(LOG_DEBUG, "Darn priorities, going back in queue (%s)!\n",
|
||||||
qe.chan->name);
|
qe.chan->name);
|
||||||
goto check_turns;
|
goto check_turns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3140,7 +3287,7 @@ static void reload_queues(void)
|
|||||||
struct ast_config *cfg;
|
struct ast_config *cfg;
|
||||||
char *cat, *tmp;
|
char *cat, *tmp;
|
||||||
struct ast_variable *var;
|
struct ast_variable *var;
|
||||||
struct member *prev, *cur;
|
struct member *prev, *cur, *newm;
|
||||||
int new;
|
int new;
|
||||||
char *general_val = NULL;
|
char *general_val = NULL;
|
||||||
char interface[80];
|
char interface[80];
|
||||||
@@ -3188,15 +3335,13 @@ static void reload_queues(void)
|
|||||||
/* Re-initialize the queue, and clear statistics */
|
/* Re-initialize the queue, and clear statistics */
|
||||||
init_queue(q);
|
init_queue(q);
|
||||||
clear_queue(q);
|
clear_queue(q);
|
||||||
free_members(q, 0);
|
for (cur = q->members; cur; cur = cur->next) {
|
||||||
prev = q->members;
|
if (!cur->dynamic) {
|
||||||
if (prev) {
|
cur->delme = 1;
|
||||||
/* find the end of any dynamic members */
|
}
|
||||||
while(prev->next)
|
|
||||||
prev = prev->next;
|
|
||||||
}
|
}
|
||||||
var = ast_variable_browse(cfg, cat);
|
var = ast_variable_browse(cfg, cat);
|
||||||
while(var) {
|
while (var) {
|
||||||
if (!strcasecmp(var->name, "member")) {
|
if (!strcasecmp(var->name, "member")) {
|
||||||
/* Add a new member */
|
/* Add a new member */
|
||||||
ast_copy_string(interface, var->value, sizeof(interface));
|
ast_copy_string(interface, var->value, sizeof(interface));
|
||||||
@@ -3209,19 +3354,55 @@ static void reload_queues(void)
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
penalty = 0;
|
penalty = 0;
|
||||||
cur = create_queue_member(interface, penalty, 0);
|
|
||||||
|
/* Find the old position in the list */
|
||||||
|
for (prev = NULL, cur = q->members; cur; prev = cur, cur = cur->next) {
|
||||||
|
if (!strcmp(cur->interface, interface)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
newm = create_queue_member(interface, penalty, cur ? cur->paused : 0);
|
||||||
|
|
||||||
if (cur) {
|
if (cur) {
|
||||||
if (prev)
|
/* Delete it now */
|
||||||
prev->next = cur;
|
newm->next = cur->next;
|
||||||
else
|
if (prev) {
|
||||||
q->members = cur;
|
prev->next = newm;
|
||||||
prev = cur;
|
} else {
|
||||||
|
q->members = newm;
|
||||||
|
}
|
||||||
|
free(cur);
|
||||||
|
} else {
|
||||||
|
/* Add them to the master int list if necessary */
|
||||||
|
add_to_interfaces(interface);
|
||||||
|
newm->next = q->members;
|
||||||
|
q->members = newm;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
queue_set_param(q, var->name, var->value, var->lineno, 1);
|
queue_set_param(q, var->name, var->value, var->lineno, 1);
|
||||||
}
|
}
|
||||||
var = var->next;
|
var = var->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Free remaining members marked as delme */
|
||||||
|
for (prev = NULL, newm = NULL, cur = q->members; cur; prev = cur, cur = cur->next) {
|
||||||
|
if (newm) {
|
||||||
|
free(newm);
|
||||||
|
newm = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cur->delme) {
|
||||||
|
if (prev) {
|
||||||
|
prev->next = cur->next;
|
||||||
|
newm = cur;
|
||||||
|
} else {
|
||||||
|
q->members = cur->next;
|
||||||
|
newm = cur;
|
||||||
|
}
|
||||||
|
remove_from_interfaces(cur->interface);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!new)
|
if (!new)
|
||||||
ast_mutex_unlock(&q->lock);
|
ast_mutex_unlock(&q->lock);
|
||||||
if (new) {
|
if (new) {
|
||||||
@@ -3243,7 +3424,7 @@ static void reload_queues(void)
|
|||||||
else
|
else
|
||||||
queues = q->next;
|
queues = q->next;
|
||||||
if (!q->count) {
|
if (!q->count) {
|
||||||
free(q);
|
destroy_queue(q);
|
||||||
} else
|
} else
|
||||||
ast_log(LOG_WARNING, "XXX Leaking a little memory :( XXX\n");
|
ast_log(LOG_WARNING, "XXX Leaking a little memory :( XXX\n");
|
||||||
} else {
|
} else {
|
||||||
@@ -3272,7 +3453,13 @@ static int __queues_show(int manager, int fd, int argc, char **argv, int queue_s
|
|||||||
time(&now);
|
time(&now);
|
||||||
if ((!queue_show && argc != 2) || (queue_show && argc != 3))
|
if ((!queue_show && argc != 2) || (queue_show && argc != 3))
|
||||||
return RESULT_SHOWUSAGE;
|
return RESULT_SHOWUSAGE;
|
||||||
|
|
||||||
|
/* We only want to load realtime queues when a specific queue is asked for. */
|
||||||
|
if (queue_show)
|
||||||
|
load_realtime_queue(argv[2]);
|
||||||
|
|
||||||
ast_mutex_lock(&qlock);
|
ast_mutex_lock(&qlock);
|
||||||
|
|
||||||
q = queues;
|
q = queues;
|
||||||
if (!q) {
|
if (!q) {
|
||||||
ast_mutex_unlock(&qlock);
|
ast_mutex_unlock(&qlock);
|
||||||
@@ -3435,13 +3622,13 @@ static int manager_queues_status( struct mansession *s, struct message *m )
|
|||||||
"Membership: %s\r\n"
|
"Membership: %s\r\n"
|
||||||
"Penalty: %d\r\n"
|
"Penalty: %d\r\n"
|
||||||
"CallsTaken: %d\r\n"
|
"CallsTaken: %d\r\n"
|
||||||
"LastCall: %ld\r\n"
|
"LastCall: %d\r\n"
|
||||||
"Status: %d\r\n"
|
"Status: %d\r\n"
|
||||||
"Paused: %d\r\n"
|
"Paused: %d\r\n"
|
||||||
"%s"
|
"%s"
|
||||||
"\r\n",
|
"\r\n",
|
||||||
q->name, mem->interface, mem->dynamic ? "dynamic" : "static",
|
q->name, mem->interface, mem->dynamic ? "dynamic" : "static",
|
||||||
mem->penalty, mem->calls, mem->lastcall, mem->status, mem->paused, idText);
|
mem->penalty, mem->calls, (int)mem->lastcall, mem->status, mem->paused, idText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* List Queue Entries */
|
/* List Queue Entries */
|
||||||
@@ -3464,13 +3651,13 @@ static int manager_queues_status( struct mansession *s, struct message *m )
|
|||||||
}
|
}
|
||||||
ast_mutex_unlock(&q->lock);
|
ast_mutex_unlock(&q->lock);
|
||||||
}
|
}
|
||||||
ast_mutex_unlock(&qlock);
|
|
||||||
|
|
||||||
ast_cli(s->fd,
|
ast_cli(s->fd,
|
||||||
"Event: QueueStatusComplete\r\n"
|
"Event: QueueStatusComplete\r\n"
|
||||||
"%s"
|
"%s"
|
||||||
"\r\n",idText);
|
"\r\n",idText);
|
||||||
|
|
||||||
|
ast_mutex_unlock(&qlock);
|
||||||
|
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -3766,6 +3953,7 @@ int unload_module(void)
|
|||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
clear_and_free_interfaces();
|
||||||
res = ast_cli_unregister(&cli_show_queue);
|
res = ast_cli_unregister(&cli_show_queue);
|
||||||
res |= ast_cli_unregister(&cli_show_queues);
|
res |= ast_cli_unregister(&cli_show_queues);
|
||||||
res |= ast_cli_unregister(&cli_add_queue_member);
|
res |= ast_cli_unregister(&cli_add_queue_member);
|
||||||
|
2
apps/app_random.c
Executable file → Normal file
2
apps/app_random.c
Executable file → Normal file
@@ -82,7 +82,7 @@ static int random_exec(struct ast_channel *chan, void *data)
|
|||||||
if ((!prob) || (sscanf(prob, "%d", &probint) != 1))
|
if ((!prob) || (sscanf(prob, "%d", &probint) != 1))
|
||||||
probint = 0;
|
probint = 0;
|
||||||
|
|
||||||
if ((random() % 100) + probint > 100) {
|
if ((random() % 100) + probint >= 100) {
|
||||||
res = ast_parseable_goto(chan, s);
|
res = ast_parseable_goto(chan, s);
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose( VERBOSE_PREFIX_3 "Random branches to (%s,%s,%d)\n",
|
ast_verbose( VERBOSE_PREFIX_3 "Random branches to (%s,%s,%d)\n",
|
||||||
|
0
apps/app_read.c
Executable file → Normal file
0
apps/app_read.c
Executable file → Normal file
17
apps/app_readfile.c
Executable file → Normal file
17
apps/app_readfile.c
Executable file → Normal file
@@ -95,15 +95,16 @@ static int readfile_exec(struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
returnvar = ast_read_textfile(file);
|
if ((returnvar = ast_read_textfile(file))) {
|
||||||
if(len > 0){
|
if (len > 0) {
|
||||||
if(len < strlen(returnvar))
|
if (len < strlen(returnvar))
|
||||||
returnvar[len]='\0';
|
returnvar[len]='\0';
|
||||||
else
|
else
|
||||||
ast_log(LOG_WARNING,"%s is longer than %d, and %d \n", file, len, (int)strlen(returnvar));
|
ast_log(LOG_WARNING, "%s is longer than %d, and %d \n", file, len, (int)strlen(returnvar));
|
||||||
|
}
|
||||||
|
pbx_builtin_setvar_helper(chan, varname, returnvar);
|
||||||
|
free(returnvar);
|
||||||
}
|
}
|
||||||
pbx_builtin_setvar_helper(chan, varname, returnvar);
|
|
||||||
free(returnvar);
|
|
||||||
LOCAL_USER_REMOVE(u);
|
LOCAL_USER_REMOVE(u);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
0
apps/app_realtime.c
Executable file → Normal file
0
apps/app_realtime.c
Executable file → Normal file
8
apps/app_record.c
Executable file → Normal file
8
apps/app_record.c
Executable file → Normal file
@@ -277,6 +277,7 @@ static int record_exec(struct ast_channel *chan, void *data)
|
|||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
ast_log(LOG_WARNING, "Problem writing frame\n");
|
ast_log(LOG_WARNING, "Problem writing frame\n");
|
||||||
|
ast_frfree(f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,16 +296,15 @@ static int record_exec(struct ast_channel *chan, void *data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (f->frametype == AST_FRAME_VIDEO) {
|
||||||
if (f->frametype == AST_FRAME_VIDEO) {
|
|
||||||
res = ast_writestream(s, f);
|
res = ast_writestream(s, f);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
ast_log(LOG_WARNING, "Problem writing frame\n");
|
ast_log(LOG_WARNING, "Problem writing frame\n");
|
||||||
|
ast_frfree(f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else if ((f->frametype == AST_FRAME_DTMF) &&
|
||||||
if ((f->frametype == AST_FRAME_DTMF) &&
|
|
||||||
(f->subclass == terminator)) {
|
(f->subclass == terminator)) {
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
break;
|
break;
|
||||||
|
0
apps/app_rpt.c
Executable file → Normal file
0
apps/app_rpt.c
Executable file → Normal file
0
apps/app_sayunixtime.c
Executable file → Normal file
0
apps/app_sayunixtime.c
Executable file → Normal file
2
apps/app_senddtmf.c
Executable file → Normal file
2
apps/app_senddtmf.c
Executable file → Normal file
@@ -50,7 +50,7 @@ static char *synopsis = "Sends arbitrary DTMF digits";
|
|||||||
|
|
||||||
static char *descrip =
|
static char *descrip =
|
||||||
" SendDTMF(digits[|timeout_ms]): Sends DTMF digits on a channel. \n"
|
" SendDTMF(digits[|timeout_ms]): Sends DTMF digits on a channel. \n"
|
||||||
" Accepted digits: 0-9, *#abcd\n"
|
" Accepted digits: 0-9, *#abcd, w (.5s pause)\n"
|
||||||
" The application will either pass the assigned digits or terminate if it\n"
|
" The application will either pass the assigned digits or terminate if it\n"
|
||||||
" encounters an error.\n";
|
" encounters an error.\n";
|
||||||
|
|
||||||
|
0
apps/app_sendtext.c
Executable file → Normal file
0
apps/app_sendtext.c
Executable file → Normal file
0
apps/app_setcallerid.c
Executable file → Normal file
0
apps/app_setcallerid.c
Executable file → Normal file
0
apps/app_setcdruserfield.c
Executable file → Normal file
0
apps/app_setcdruserfield.c
Executable file → Normal file
0
apps/app_setcidname.c
Executable file → Normal file
0
apps/app_setcidname.c
Executable file → Normal file
0
apps/app_setcidnum.c
Executable file → Normal file
0
apps/app_setcidnum.c
Executable file → Normal file
0
apps/app_setrdnis.c
Executable file → Normal file
0
apps/app_setrdnis.c
Executable file → Normal file
0
apps/app_settransfercapability.c
Executable file → Normal file
0
apps/app_settransfercapability.c
Executable file → Normal file
9
apps/app_skel.c
Executable file → Normal file
9
apps/app_skel.c
Executable file → Normal file
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) <Year>, <Your Name Here>
|
* Copyright (C) <Year>, <Your Name Here>
|
||||||
*
|
*
|
||||||
* <Your Name Here> <<You Email Here>>
|
* <Your Name Here> <<Your Email Here>>
|
||||||
*
|
*
|
||||||
* See http://www.asterisk.org for more information about
|
* See http://www.asterisk.org for more information about
|
||||||
* the Asterisk project. Please do not directly contact
|
* the Asterisk project. Please do not directly contact
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* \brief Skeleton application
|
* \brief Skeleton application
|
||||||
*
|
*
|
||||||
* This is a skeleton for development of an Asterisk application */
|
* This is a skeleton for development of an Asterisk application
|
||||||
* \ingroup applications
|
* \ingroup applications
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ static char *descrip = "This application is a template to build other applicatio
|
|||||||
#define OPTION_C (1 << 2) /* Option C(str) */
|
#define OPTION_C (1 << 2) /* Option C(str) */
|
||||||
#define OPTION_NULL (1 << 3) /* Dummy Termination */
|
#define OPTION_NULL (1 << 3) /* Dummy Termination */
|
||||||
|
|
||||||
AST_DECLARE_OPTIONS(app_opts,{
|
AST_APP_OPTIONS(app_opts,{
|
||||||
['a'] = { OPTION_A },
|
['a'] = { OPTION_A },
|
||||||
['b'] = { OPTION_B, 1 },
|
['b'] = { OPTION_B, 1 },
|
||||||
['c'] = { OPTION_C, 2 }
|
['c'] = { OPTION_C, 2 }
|
||||||
@@ -77,7 +77,6 @@ static int app_exec(struct ast_channel *chan, void *data)
|
|||||||
|
|
||||||
if (ast_strlen_zero(data)) {
|
if (ast_strlen_zero(data)) {
|
||||||
ast_log(LOG_WARNING, "%s requires an argument (dummy|[options])\n",app);
|
ast_log(LOG_WARNING, "%s requires an argument (dummy|[options])\n",app);
|
||||||
LOCAL_USER_REMOVE(u);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +95,7 @@ static int app_exec(struct ast_channel *chan, void *data)
|
|||||||
if ((argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
|
if ((argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
|
||||||
dummy = argv[0];
|
dummy = argv[0];
|
||||||
options = argv[1];
|
options = argv[1];
|
||||||
ast_parseoptions(app_opts, &flags, opts, options);
|
ast_app_parse_options(app_opts, &flags, opts, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ast_strlen_zero(dummy))
|
if (!ast_strlen_zero(dummy))
|
||||||
|
34
apps/app_sms.c
Executable file → Normal file
34
apps/app_sms.c
Executable file → Normal file
@@ -694,7 +694,7 @@ static void sms_readfile (sms_t * h, char *fn)
|
|||||||
}
|
}
|
||||||
while (fgets (line, sizeof (line), s))
|
while (fgets (line, sizeof (line), s))
|
||||||
{ /* process line in file */
|
{ /* process line in file */
|
||||||
char *p;
|
unsigned char *p;
|
||||||
for (p = line; *p && *p != '\n' && *p != '\r'; p++);
|
for (p = line; *p && *p != '\n' && *p != '\r'; p++);
|
||||||
*p = 0; /* strip eoln */
|
*p = 0; /* strip eoln */
|
||||||
p = line;
|
p = line;
|
||||||
@@ -1178,25 +1178,24 @@ static void sms_messagetx(sms_t * h)
|
|||||||
static int sms_generate (struct ast_channel *chan, void *data, int len, int samples)
|
static int sms_generate (struct ast_channel *chan, void *data, int len, int samples)
|
||||||
{
|
{
|
||||||
struct ast_frame f = { 0 };
|
struct ast_frame f = { 0 };
|
||||||
unsigned char waste[AST_FRIENDLY_OFFSET];
|
#define MAXSAMPLES 800
|
||||||
#ifdef OUTALAW
|
#ifdef OUTALAW
|
||||||
unsigned char buf[800];
|
unsigned char *buf;
|
||||||
#else
|
#else
|
||||||
signed short buf[800];
|
short *buf;
|
||||||
#endif
|
#endif
|
||||||
|
#define SAMPLE2LEN sizeof(*buf)
|
||||||
sms_t *h = data;
|
sms_t *h = data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (len > sizeof (buf)) {
|
if (samples > MAXSAMPLES) {
|
||||||
ast_log (LOG_WARNING, "Only doing %d bytes (%d bytes requested)\n", (int)(sizeof (buf) / sizeof (signed short)), len);
|
ast_log (LOG_WARNING, "Only doing %d samples (%d requested)\n",
|
||||||
len = sizeof (buf);
|
MAXSAMPLES, samples);
|
||||||
#ifdef OUTALAW
|
samples = MAXSAMPLES;
|
||||||
samples = len;
|
|
||||||
#else
|
|
||||||
samples = len / 2;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
waste[0] = 0; /* make compiler happy */
|
len = samples * SAMPLE2LEN + AST_FRIENDLY_OFFSET;
|
||||||
|
buf = alloca(len);
|
||||||
|
|
||||||
f.frametype = AST_FRAME_VOICE;
|
f.frametype = AST_FRAME_VOICE;
|
||||||
#ifdef OUTALAW
|
#ifdef OUTALAW
|
||||||
f.subclass = AST_FORMAT_ALAW;
|
f.subclass = AST_FORMAT_ALAW;
|
||||||
@@ -1206,8 +1205,7 @@ static int sms_generate (struct ast_channel *chan, void *data, int len, int samp
|
|||||||
f.datalen = samples * 2;
|
f.datalen = samples * 2;
|
||||||
#endif
|
#endif
|
||||||
f.offset = AST_FRIENDLY_OFFSET;
|
f.offset = AST_FRIENDLY_OFFSET;
|
||||||
f.mallocd = 0;
|
f.data = buf + AST_FRIENDLY_OFFSET;
|
||||||
f.data = buf;
|
|
||||||
f.samples = samples;
|
f.samples = samples;
|
||||||
f.src = "app_sms";
|
f.src = "app_sms";
|
||||||
/* create a buffer containing the digital sms pattern */
|
/* create a buffer containing the digital sms pattern */
|
||||||
@@ -1379,8 +1377,8 @@ static int sms_exec (struct ast_channel *chan, void *data)
|
|||||||
ast_copy_string (h.cli, chan->cid.cid_num, sizeof (h.cli));
|
ast_copy_string (h.cli, chan->cid.cid_num, sizeof (h.cli));
|
||||||
|
|
||||||
{
|
{
|
||||||
char *d = data,
|
unsigned char *p;
|
||||||
*p,
|
unsigned char *d = data,
|
||||||
answer = 0;
|
answer = 0;
|
||||||
if (!*d || *d == '|') {
|
if (!*d || *d == '|') {
|
||||||
ast_log (LOG_ERROR, "Requires queue name\n");
|
ast_log (LOG_ERROR, "Requires queue name\n");
|
||||||
@@ -1449,7 +1447,7 @@ static int sms_exec (struct ast_channel *chan, void *data)
|
|||||||
d = p;
|
d = p;
|
||||||
h.udl = 0;
|
h.udl = 0;
|
||||||
while (*p && h.udl < SMSLEN)
|
while (*p && h.udl < SMSLEN)
|
||||||
h.ud[h.udl++] = utf8decode((unsigned char **)&p);
|
h.ud[h.udl++] = utf8decode(&p);
|
||||||
if (is7bit (h.dcs) && packsms7 (0, h.udhl, h.udh, h.udl, h.ud) < 0)
|
if (is7bit (h.dcs) && packsms7 (0, h.udhl, h.udh, h.udl, h.ud) < 0)
|
||||||
ast_log (LOG_WARNING, "Invalid 7 bit GSM data\n");
|
ast_log (LOG_WARNING, "Invalid 7 bit GSM data\n");
|
||||||
if (is8bit (h.dcs) && packsms8 (0, h.udhl, h.udh, h.udl, h.ud) < 0)
|
if (is8bit (h.dcs) && packsms8 (0, h.udhl, h.udh, h.udl, h.ud) < 0)
|
||||||
|
0
apps/app_softhangup.c
Executable file → Normal file
0
apps/app_softhangup.c
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user