Compare commits
292 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
182e49bb99 | ||
|
|
954bdb25aa | ||
|
|
64eaca5bfa | ||
|
|
67bc1003ab | ||
|
|
419282d399 | ||
|
|
9e6df1092c | ||
|
|
1c7588ead5 | ||
|
|
16df54e01a | ||
|
|
16719a5f74 | ||
|
|
8c5da8a278 | ||
|
|
aad7c3e8f1 | ||
|
|
95ccc0e03c | ||
|
|
b9a6ab0c69 | ||
|
|
dee4c9ae0f | ||
|
|
b9bd97cdb7 | ||
|
|
c93dfbae5f | ||
|
|
160be09f76 | ||
|
|
ba46c5ca03 | ||
|
|
33a28eeda1 | ||
|
|
595154da5a | ||
|
|
cdb9c294c1 | ||
|
|
2a27c0f173 | ||
|
|
e498bef21f | ||
|
|
ac51a8e058 | ||
|
|
11f13f9b2d | ||
|
|
cd56dc1b1c | ||
|
|
a17ce5bdea | ||
|
|
fcd5775b8b | ||
|
|
199d4c7fc5 | ||
|
|
a22bd0df05 | ||
|
|
a898653315 | ||
|
|
16ae0df732 | ||
|
|
342c1f81ca | ||
|
|
9969553056 | ||
|
|
9037525b7b | ||
|
|
f245f64a2e | ||
|
|
cd91dba660 | ||
|
|
a24748c0f8 | ||
|
|
8c69834e21 | ||
|
|
8192b42674 | ||
|
|
de00a26f71 | ||
|
|
fe9fff6dcb | ||
|
|
2ce7890fdd | ||
|
|
de008c4d60 | ||
|
|
7db8af4b80 | ||
|
|
a33fd59dc6 | ||
|
|
a3ee176154 | ||
|
|
f316eed834 | ||
|
|
c6ccbf69ca | ||
|
|
f10e2174b4 | ||
|
|
fd75f5ade1 | ||
|
|
ed9c90a985 | ||
|
|
f57f033aac | ||
|
|
11984069b6 | ||
|
|
533412e361 | ||
|
|
e2091c29ef | ||
|
|
b92b08dad7 | ||
|
|
e225476864 | ||
|
|
e17aebfc82 | ||
|
|
d8f64e6c98 | ||
|
|
3c061000b5 | ||
|
|
a98061f019 | ||
|
|
3ea2ea8cf1 | ||
|
|
6f831daaed | ||
|
|
681a5f582e | ||
|
|
0a326a9744 | ||
|
|
30188c642d | ||
|
|
3f78370c92 | ||
|
|
4c20e50a5d | ||
|
|
6b5781bb3a | ||
|
|
333a5eb67a | ||
|
|
0e2e37b537 | ||
|
|
cb7b843e10 | ||
|
|
d97a630a81 | ||
|
|
9447f39f3f | ||
|
|
8fa183a4bc | ||
|
|
9e03b9b8c7 | ||
|
|
274f535654 | ||
|
|
424fa816e3 | ||
|
|
9c8628715f | ||
|
|
bb1f882f8a | ||
|
|
8738891752 | ||
|
|
b1db8aaae6 | ||
|
|
dd611af000 | ||
|
|
8d6d58ab09 | ||
|
|
d6cab1d527 | ||
|
|
a634c4253b | ||
|
|
cf8c723f8b | ||
|
|
014fd45a37 | ||
|
|
89384a8472 | ||
|
|
e0de929e20 | ||
|
|
160b8c91b8 | ||
|
|
326c5c66d6 | ||
|
|
9842934154 | ||
|
|
f64108e394 | ||
|
|
83c78f9e85 | ||
|
|
cfee7ff007 | ||
|
|
4bbe741b99 | ||
|
|
3269a4b034 | ||
|
|
21d693f0b4 | ||
|
|
598e8092f1 | ||
|
|
bbd1d88f70 | ||
|
|
badbe8cf1f | ||
|
|
25cb0b7457 | ||
|
|
ac9bba5121 | ||
|
|
00d12810bb | ||
|
|
d8ac58da6d | ||
|
|
3fe76c6aea | ||
|
|
f622f51004 | ||
|
|
6694b84e88 | ||
|
|
849ec03cb0 | ||
|
|
9bcef26cd6 | ||
|
|
c9710c8b33 | ||
|
|
3c1f055287 | ||
|
|
b81d7389a9 | ||
|
|
6e98b36cfb | ||
|
|
6341ab3c6e | ||
|
|
2a263061f2 | ||
|
|
64088fe864 | ||
|
|
1e4b4fbdbb | ||
|
|
8205ce358a | ||
|
|
3803535593 | ||
|
|
099ee35431 | ||
|
|
3e8f5869ae | ||
|
|
4ecc27efab | ||
|
|
0a3a816622 | ||
|
|
c03b48392a | ||
|
|
e4fbf8c388 | ||
|
|
7f866680ad | ||
|
|
fa826f1151 | ||
|
|
240cd3ece0 | ||
|
|
241f97782c | ||
|
|
02abf57233 | ||
|
|
23a638cf66 | ||
|
|
d7b60b28e0 | ||
|
|
84adda970c | ||
|
|
545e628f65 | ||
|
|
9d279a6d6e | ||
|
|
86cf50b9c3 | ||
|
|
c164cccc87 | ||
|
|
bbaa1ed2e7 | ||
|
|
e7b075b6f6 | ||
|
|
6f32fe5793 | ||
|
|
75a5597f39 | ||
|
|
0e0d251e15 | ||
|
|
dc74d755a8 | ||
|
|
14796a30af | ||
|
|
f89bbdd6a3 | ||
|
|
1cfe36a944 | ||
|
|
3cfff2fe15 | ||
|
|
c05e4b45c0 | ||
|
|
1630193827 | ||
|
|
073bd4fa70 | ||
|
|
b210417743 | ||
|
|
7f2237532a | ||
|
|
eb07e6e76c | ||
|
|
610abad23b | ||
|
|
ecaf1b6103 | ||
|
|
a6977c6ddb | ||
|
|
0f6b3ad8ac | ||
|
|
77bc439e4a | ||
|
|
e1d6903ed4 | ||
|
|
f0396f6fa5 | ||
|
|
b75e9f8355 | ||
|
|
56dc30315b | ||
|
|
8ae7489b5a | ||
|
|
2728db0c83 | ||
|
|
52f8d6bbd9 | ||
|
|
b6d1f4016f | ||
|
|
5b2bc04f41 | ||
|
|
660a6a7754 | ||
|
|
69e8d42ac2 | ||
|
|
8a5895191f | ||
|
|
cea480c941 | ||
|
|
6bfef709dc | ||
|
|
542a5ffe0c | ||
|
|
a3101da9fe | ||
|
|
8ac2db33d4 | ||
|
|
ba5a5ca907 | ||
|
|
2b7b7e2e68 | ||
|
|
9682be31fb | ||
|
|
ea146a8f6f | ||
|
|
12155fa6c3 | ||
|
|
96535a0c17 | ||
|
|
cac414333f | ||
|
|
748702c5c5 | ||
|
|
6dd859f5de | ||
|
|
5fd79b6b1b | ||
|
|
e88ac71b3d | ||
|
|
5166adfb1e | ||
|
|
f8b7c404a0 | ||
|
|
b93317f38b | ||
|
|
18958fa7e8 | ||
|
|
c9bb969586 | ||
|
|
7cdd6c7f2c | ||
|
|
3193d779ef | ||
|
|
97648bb1b4 | ||
|
|
20e146406b | ||
|
|
1e5fad5fe7 | ||
|
|
dd9ba5b8a5 | ||
|
|
d4eab6216e | ||
|
|
1cabafb5fb | ||
|
|
66781c3141 | ||
|
|
832475b271 | ||
|
|
6ccb8df101 | ||
|
|
fd0f41e4a5 | ||
|
|
0933575a5d | ||
|
|
818a8cb57a | ||
|
|
de0e6ba4cc | ||
|
|
30d983f45f | ||
|
|
d0c78dd62d | ||
|
|
551f0fafc8 | ||
|
|
2300f57294 | ||
|
|
f065327cc1 | ||
|
|
bce8bfb87f | ||
|
|
4ae8cc7bcf | ||
|
|
76955b74c3 | ||
|
|
baefdcb18d | ||
|
|
7aac157b7f | ||
|
|
2c26d98a89 | ||
|
|
c413151375 | ||
|
|
8098266c90 | ||
|
|
c8528b633a | ||
|
|
c591726079 | ||
|
|
9f724a22f3 | ||
|
|
c39fdd5cad | ||
|
|
f2eb8afb7f | ||
|
|
8da0a1e5a7 | ||
|
|
4743ebd26f | ||
|
|
949afd2385 | ||
|
|
480160c5cf | ||
|
|
2f5952fa86 | ||
|
|
be3a8c206b | ||
|
|
ee394a7916 | ||
|
|
91b4a60c1f | ||
|
|
d00abddee3 | ||
|
|
09645488d6 | ||
|
|
24fba7f9b7 | ||
|
|
c3544cb866 | ||
|
|
ccafdd739b | ||
|
|
acf0e055ab | ||
|
|
e1394704ad | ||
|
|
0961ecb4b0 | ||
|
|
a36186ce49 | ||
|
|
5f6e12c3e5 | ||
|
|
d80324dbdd | ||
|
|
e172ca2a03 | ||
|
|
e4f9ea7583 | ||
|
|
b5fa5986b2 | ||
|
|
f63cc76a94 | ||
|
|
cb01262a54 | ||
|
|
79e10c30a1 | ||
|
|
06d9c2aeb3 | ||
|
|
4e6c9e0410 | ||
|
|
88656d9497 | ||
|
|
fe0eba8175 | ||
|
|
24b85a379b | ||
|
|
ec99ad86dd | ||
|
|
ee9ef9ef3c | ||
|
|
f6966bc35b | ||
|
|
45efb97ebd | ||
|
|
110062aef6 | ||
|
|
de24dd76a6 | ||
|
|
e09654f0ed | ||
|
|
86fe59eacc | ||
|
|
2809056303 | ||
|
|
f8d3569b56 | ||
|
|
5f1aba027a | ||
|
|
a85d2c508b | ||
|
|
34f700b584 | ||
|
|
5137d733f9 | ||
|
|
5478d68b2a | ||
|
|
6e8e051464 | ||
|
|
80355d96c5 | ||
|
|
e4d3ca388b | ||
|
|
426336f4e6 | ||
|
|
af1366fcde | ||
|
|
96695361e4 | ||
|
|
cc7adcd328 | ||
|
|
2a1c974412 | ||
|
|
b00db5738c | ||
|
|
c0ce1c85ed | ||
|
|
64f6535c65 | ||
|
|
a4d5210d18 | ||
|
|
7857739408 | ||
|
|
05f41a4926 | ||
|
|
a6bebcaafc | ||
|
|
a68a6bd01d | ||
|
|
455227676a | ||
|
|
834b8d85d7 | ||
|
|
f81ba655b2 | ||
|
|
8cf62085ee |
353
ChangeLog
Executable file → Normal file
353
ChangeLog
Executable file → Normal file
@@ -1,12 +1,347 @@
|
||||
-- Fix strncpy stuff
|
||||
libpri 0.1.2
|
||||
-- Added PRI_EVENT_HANGUP_ACK so you can know when the disconnect was
|
||||
acknowledged
|
||||
2008-08-05 Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
libpri 0.1.1
|
||||
-- Added PRI_DEBUG_Q931_ANOMALY flag so that certain non-error-related
|
||||
messages would not be output unless specifically desired.
|
||||
* libpri 1.4.7 released.
|
||||
|
||||
libpri 0.1.0
|
||||
-- Initial release
|
||||
2008-08-05 22:18 +0000 [r611] Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
* pritest.c, pri.c, pri_internal.h, q921.c, q931.c, copy_string.c,
|
||||
prisched.c, pri_q921.h, pri_q931.h, pri_facility.c, /,
|
||||
compiler.h, pridump.c, testprilib.c, pri_timers.h,
|
||||
pri_facility.h, libpri.h: Merged revisions 610 via svnmerge from
|
||||
https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r610
|
||||
| kpfleming | 2008-08-05 17:16:58 -0500 (Tue, 05 Aug 2008) | 2
|
||||
lines clean up license headers, and explicitly grant additional
|
||||
permissions when used with Asterisk ........
|
||||
|
||||
2008-07-30 15:43 +0000 [r606-607] Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
* /: update ignore list
|
||||
|
||||
* Makefile, mkdep (removed): use better version.c creation process,
|
||||
and better dependency tracking process too
|
||||
|
||||
2008-07-29 22:47 +0000 [r598-602] Jason Parker <jparker@digium.com>
|
||||
|
||||
* build_tools/make_version: I believe this is what was meant. (it
|
||||
matches how Asterisk does it)
|
||||
|
||||
* build_tools/make_version: libpri is not libss7 :D
|
||||
|
||||
2008-07-22 22:36 +0000 [r594] Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
* pri_internal.h, libpri.h: correct comments to match code
|
||||
|
||||
2008-07-22 Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
* Libpri 1.4.6 released.
|
||||
|
||||
2008-07-22 19:43 +0000 [r589] Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
* pri.c, pri_internal.h, q931.c, libpri.h: rename API call and
|
||||
option (nothing has been released to use it yet so this should be
|
||||
safe) to be more accurate in describing what it does (closes
|
||||
issue #13042)
|
||||
|
||||
2008-07-11 Jason Parker <jparker@digium.com>
|
||||
|
||||
* Libpri 1.4.5 released.
|
||||
|
||||
2008-07-11 16:44 +0000 [r574-579] Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
* /: ignore generated files
|
||||
|
||||
* pri.c, pri_internal.h, q931.c, libpri.h: modify work done for
|
||||
issue #10552, making the support of inband audio after RELEASE a
|
||||
configurable option, since it is causing problems for a number of
|
||||
users (closes issue #13042)
|
||||
|
||||
2008-06-04 17:02 +0000 [r562] Dwayne M. Hubbard <dhubbard@digium.com>
|
||||
|
||||
* q931.c: While working on issue 3450 I noticed that the
|
||||
information channel selection field in the channel identification
|
||||
IE was displayed incorrectly when using 'pri intense debug'. I
|
||||
wanted another pair of eyes to look at the code because
|
||||
everything looked correct until Shaun Ruffell noticed the missing
|
||||
comma in the msg_chan_sel array.
|
||||
|
||||
2008-05-07 19:51 +0000 [r557] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* pri.c, pritest.c, pri_internal.h, pri_q921.h, Makefile, q921.c,
|
||||
q931.c, pri_facility.c, prisched.c, testprilib.c, pri_timers.h,
|
||||
pri_facility.h, libpri.h: Moving trunk changes back into 1.4
|
||||
|
||||
2008-05-07 Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* Libpri 1.4.4 released.
|
||||
|
||||
2008-05-06 16:43 +0000 [r553-555] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q921.c, pri.c: Remove some unnecessary debug messages
|
||||
|
||||
* q931.c: We passed TBR3 layer 2 and layer 3 testing with this
|
||||
commit in for BRI-TE PTMP.
|
||||
|
||||
* q931.c: Final patch to pass certification
|
||||
|
||||
2008-04-22 15:30 +0000 [r546] Russell Bryant <russell@digium.com>
|
||||
|
||||
* Makefile: All versions of libpri have been installed as
|
||||
libpri.so.1.0, even though the API and ABI have changed over
|
||||
time. This patch changes the Makefile to install the library as
|
||||
libpri.so.1.4 to indicate that this is not compatible with
|
||||
previous versions. In the future, this should be changed as we
|
||||
make ABI changes. (closes issue #10376) Reported by: tzafrir
|
||||
Patches: libpri-soname.diff uploaded by tzafrir (license 46) --
|
||||
with very minor changes by me
|
||||
|
||||
2008-03-15 19:57 +0000 [r541-543] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* libpri.h, pri.c: Remove some useless event items
|
||||
|
||||
* q921.c, pri_internal.h: Make sure if we're a bri and in PTMP mode
|
||||
that we release the TEI and try to get a new one with the other
|
||||
end when we lose activity in multiframe mode
|
||||
|
||||
* q921.c, pri.c, pri_q921.h: When we recieve a UA in any TEI
|
||||
established state other than awaiting establishement make sure we
|
||||
drop the TEI and get a new one. For passing tests PC37.2 - PC41.2
|
||||
in Q.921
|
||||
|
||||
2008-03-06 23:43 +0000 [r538-539] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q921.c: Make sure we are sending as command not as response
|
||||
|
||||
* q921.c: Make sure C/R bit is correct
|
||||
|
||||
2008-03-01 23:30 +0000 [r531-535] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q921.c: Remove some (currently) useless code
|
||||
|
||||
* q921.c, pri.c, pri_internal.h: Some more updates to add code for
|
||||
passing PC 27.1 in Q.921
|
||||
|
||||
* q921.c, pri.c: Various coding style cleanups as well as a bug fix
|
||||
for TEI removal
|
||||
|
||||
* q921.c, q931.c, pri.c, pri_internal.h: Initial checkin of code to
|
||||
pass Q.921 PC25 and PC26
|
||||
|
||||
* q921.c: Add support for responding to TEI requests (Q.921 PC23.x)
|
||||
|
||||
2008-02-18 20:31 +0000 [r525] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c, libpri.h: Improve transmission, receiving, and dumping of
|
||||
bearer capability IE (#11593)
|
||||
|
||||
2008-01-16 18:06 +0000 [r518] Jason Parker <jparker@digium.com>
|
||||
|
||||
* Makefile, /: Add logging for 'make update' command (also fixes
|
||||
updates in some places). Issue #11766, initial patch by jmls.
|
||||
|
||||
2007-12-26 17:35 +0000 [r505] Russell Bryant <russell@digium.com>
|
||||
|
||||
* libpri.h: Remove unnecessary usage of the extern keyword.
|
||||
|
||||
2007-12-06 22:16 +0000 [r494-496] Russell Bryant <russell@digium.com>
|
||||
|
||||
* q921.c, q931.c, pri_facility.c, pri.c: Change malloc+memset to
|
||||
calloc. Also, handle allocation failures early to reduce
|
||||
indentation. (closes issue #11469) Reported by: eliel Patches:
|
||||
pri.c.patch uploaded by eliel (license 64) q931.c.patch uploaded
|
||||
by eliel (license 64) q921.c.patch uploaded by eliel (license 64)
|
||||
pri_facility.c.patch uploaded by eliel (license 64)
|
||||
|
||||
* pri.c: Change a use of malloc+memset to calloc. Also, reduce
|
||||
indentation of a function by doing the check for memory
|
||||
allocation failure at the beginning.
|
||||
|
||||
* pri.c: Change the table used to hold the default timers to be
|
||||
global and const, instead of allocating it on the stack each time
|
||||
the function is called.
|
||||
|
||||
2007-12-05 00:20 +0000 [r491-493] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c: Improve the parameter name to better reflect its use
|
||||
|
||||
* q921.c, q931.c: More PTMP fixes. Stand by, more changes to come
|
||||
|
||||
* q921.c, q931.c, testprilib.c: More magic to make BRI CPE PTMP
|
||||
work
|
||||
|
||||
2007-11-21 22:30 +0000 [r486-487] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c: Make sure we loop BRI call references for one byte CREFs
|
||||
instead of two
|
||||
|
||||
* q921.c, q931.c, libpri.h, pri.c, pritest.c, pri_internal.h: Add
|
||||
BRI support to libpri
|
||||
|
||||
2007-10-13 16:00 +0000 [r473] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q921.c: Make sure that we only output the message handling debug
|
||||
when we're actually debugging
|
||||
|
||||
2007-09-25 21:56 +0000 [r469] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c: Fix user-user IE order in setup message (#10705)
|
||||
|
||||
2007-06-20 15:18 +0000 [r428-430] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* Makefile: Revert that back to how it was
|
||||
|
||||
* Makefile, q921.c, q931.c, prisched.c, testprilib.c, pri_timers.h,
|
||||
libpri.h, pri.c, pri_internal.h, pri_q921.h: Patch to add PTMP
|
||||
mode (BRI support)
|
||||
|
||||
2007-06-06 21:59 +0000 [r417-425] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c, pri_facility.c, pri_facility.h, pri.c, pri_internal.h:
|
||||
Preliminary patch plus mods for Q.SIG Path Replacement (Q.SIG
|
||||
version of 2BCT) #7778
|
||||
|
||||
2007-05-25 17:36 +0000 [r413] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c, pri_facility.c, pri_facility.h, libpri.h: Commit path for
|
||||
ROSE-12 and ROSE-13 support (#9076)
|
||||
|
||||
2006-11-03 18:16 +0000 [r382] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q921.c: Remove pointless recursion. (#8281)
|
||||
|
||||
2008-05-07 19:51 +0000 [r557] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* pri.c, pritest.c, pri_internal.h, pri_q921.h, Makefile, q921.c,
|
||||
q931.c, pri_facility.c, prisched.c, testprilib.c, pri_timers.h,
|
||||
pri_facility.h, libpri.h: Moving trunk changes back into 1.4
|
||||
|
||||
2008-05-02 20:21 +0000 [r552] Brett Bryant <bbryant@digium.com>
|
||||
|
||||
* Makefile, build_tools (added), build_tools/make_version (added),
|
||||
build_tools/make_version_c (added), libpri.h: Add new API call
|
||||
(pri_get_version) to show the current version of the branch for
|
||||
support purposes.
|
||||
|
||||
2008-04-16 00:21 +0000 [r544] Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
* q921.c: fix the indentation in this function so that it is
|
||||
actually possible to read it and understand the logic and flow
|
||||
|
||||
2008-02-21 16:38 +0000 [r528] Joshua Colp <jcolp@digium.com>
|
||||
|
||||
* q931.c: If inband audio is being provided with a disconnect
|
||||
message let the audio be heard before releasing the channel.
|
||||
(closes issue #10552) Reported by: paravoid Patches:
|
||||
disconnect-audio.diff uploaded by paravoid (license 200)
|
||||
|
||||
2008-02-18 20:31 +0000 [r524] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c, libpri.h: Improve transmission, receiving, and dumping of
|
||||
bearer capability IE (#11593)
|
||||
|
||||
2008-01-11 16:34 +0000 [r514] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c, /: Merged revisions 513 via svnmerge from
|
||||
https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r513
|
||||
| mattf | 2008-01-11 10:33:52 -0600 (Fri, 11 Jan 2008) | 1 line
|
||||
We should not be parsing further into the bearer capability IE if
|
||||
the length does not confirm that there actually is data present
|
||||
........
|
||||
|
||||
2007-12-13 Russell Bryant <russell@digium.com>
|
||||
|
||||
* libpri 1.4.3 released.
|
||||
|
||||
2007-10-22 15:10 +0000 [r479] Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
* pri_internal.h, /: Merged revisions 478 via svnmerge from
|
||||
https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r478
|
||||
| kpfleming | 2007-10-22 10:09:27 -0500 (Mon, 22 Oct 2007) | 3
|
||||
lines we need to include stddef.h for 'size_t' ........
|
||||
|
||||
2007-10-16 Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* libpri 1.4.2 released.
|
||||
|
||||
2007-10-05 16:45 +0000 [r470] Jason Parker <jparker@digium.com>
|
||||
|
||||
* libpri.h: Fix an incorrect pri_event structure definition. Issue
|
||||
10832, patch by flefoll
|
||||
|
||||
2007-09-25 21:37 +0000 [r468] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c: Fix user-user IE order in setup message (#10705)
|
||||
|
||||
2007-09-14 21:32 +0000 [r465] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c, libpri.h: Fix for #10189. Make sure we properly report
|
||||
the user layer 1 for H.223 and H.245
|
||||
|
||||
2007-09-06 15:11 +0000 [r462] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* pri.c, pri_facility.c, /: Merged revisions 460 via svnmerge from
|
||||
https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r460
|
||||
| mattf | 2007-09-06 10:06:42 -0500 (Thu, 06 Sep 2007) | 1 line
|
||||
TBCT now works. It should work for NI2, 4E, and 5E. This code was
|
||||
tested on NI2. ........
|
||||
|
||||
2007-08-27 19:21 +0000 [r446] Jason Parker <jparker@digium.com>
|
||||
|
||||
* Makefile, /: Merged revisions 445 via svnmerge from
|
||||
https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r445
|
||||
| qwell | 2007-08-27 14:20:23 -0500 (Mon, 27 Aug 2007) | 2 lines
|
||||
Make sure we build both the static and shared modules with -fPIC.
|
||||
........
|
||||
|
||||
2007-08-06 19:58 +0000 [r441] Jason Parker <jparker@digium.com>
|
||||
|
||||
* Makefile: Allow setting CC to something with a space, such as
|
||||
`make CC="gcc -m32"` Issue 10253.
|
||||
|
||||
2007-07-09 Russell Bryant <russell@digium.com>
|
||||
|
||||
* libpri 1.4.1 released.
|
||||
|
||||
2007-06-19 18:23 +0000 [r427] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c, /: Merged revisions 426 via svnmerge from
|
||||
https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r426
|
||||
| mattf | 2007-06-19 13:22:33 -0500 (Tue, 19 Jun 2007) | 1 line
|
||||
Try to send pending facility messages if we receive alerting (for
|
||||
when we don't get proceeding) (#9651) ........
|
||||
|
||||
2007-06-06 21:58 +0000 [r416-424] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* pri_facility.c, /: Merged revisions 423 via svnmerge from
|
||||
https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r423
|
||||
| mattf | 2007-06-06 16:57:15 -0500 (Wed, 06 Jun 2007) | 1 line
|
||||
Oops, that should not be on one line ........
|
||||
|
||||
* pri_facility.c, /: Merged revisions 415 via svnmerge from
|
||||
https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r415
|
||||
| mattf | 2007-06-06 08:20:05 -0500 (Wed, 06 Jun 2007) | 2 lines
|
||||
Make sure we only send the NFE when we are talking QSIG ........
|
||||
|
||||
2007-01-22 22:29 +0000 [r390] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c, /: Merged revisions 389 via svnmerge from
|
||||
https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r389
|
||||
| mattf | 2007-01-22 16:20:59 -0600 (Mon, 22 Jan 2007) | 2 lines
|
||||
Make sure we send DISCONNECT if we reached the active state and a
|
||||
call is disconnected, regardless of cause code. ........
|
||||
|
||||
2006-12-30 19:17 +0000 [r386] Joshua Colp <jcolp@digium.com>
|
||||
|
||||
* Makefile, /: Merged revisions 385 via svnmerge from
|
||||
https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r385
|
||||
| file | 2006-12-30 14:16:17 -0500 (Sat, 30 Dec 2006) | 2 lines
|
||||
Specify full path to restorecon instead of assuming it will be
|
||||
available from what is in $PATH. (issue #8670 reported by djflux)
|
||||
........
|
||||
|
||||
2006-12-23 Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
* libpri 1.4.0 released.
|
||||
|
||||
2006-09-20 Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
* libpri 1.4.0-beta1 released.
|
||||
|
||||
341
LICENSE
Normal file
341
LICENSE
Normal file
@@ -0,0 +1,341 @@
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
153
Makefile
Executable file → Normal file
153
Makefile
Executable file → Normal file
@@ -20,36 +20,149 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
TOBJS=testpri.o
|
||||
#
|
||||
# Uncomment if you want libpri not send PROGRESS_INDICATOR w/ALERTING
|
||||
#ALERTING=-DALERTING_NO_PROGRESS
|
||||
|
||||
# Uncomment if you want libpri to count number of Q921/Q931 sent/received
|
||||
#LIBPRI_COUNTERS=-DLIBPRI_COUNTERS
|
||||
|
||||
CC=gcc
|
||||
GREP=grep
|
||||
AWK=awk
|
||||
|
||||
OSARCH=$(shell uname -s)
|
||||
PROC?=$(shell uname -m)
|
||||
|
||||
# SONAME version; should be changed on every ABI change
|
||||
# please don't change it needlessly; it's perfectly fine to have a SONAME
|
||||
# of 1.2 and a version of 1.4.x
|
||||
SONAME:=1.4
|
||||
|
||||
STATIC_LIBRARY=libpri.a
|
||||
DYNAMIC_LIBRARY=libpri.so.1.0
|
||||
STATIC_OBJS=pri.o q921.o prisched.o q931.o
|
||||
DYNAMIC_OBJS=pri.lo q921.lo prisched.lo q931.lo
|
||||
CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g
|
||||
DYNAMIC_LIBRARY:=libpri.so.$(SONAME)
|
||||
STATIC_OBJS=copy_string.o pri.o q921.o prisched.o q931.o pri_facility.o version.o
|
||||
DYNAMIC_OBJS=copy_string.lo pri.lo q921.lo prisched.lo q931.lo pri_facility.lo version.lo
|
||||
CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -fPIC $(ALERTING) $(LIBPRI_COUNTERS)
|
||||
INSTALL_PREFIX=$(DESTDIR)
|
||||
INSTALL_BASE=/usr
|
||||
SOFLAGS:=-Wl,-h$(DYNAMIC_LIBRARY)
|
||||
LDCONFIG = /sbin/ldconfig
|
||||
ifneq (,$(findstring X$(OSARCH)X, XLinuxX XGNU/kFreeBSDX))
|
||||
LDCONFIG_FLAGS=-n
|
||||
else
|
||||
ifeq (${OSARCH},FreeBSD)
|
||||
LDCONFIG_FLAGS=-m
|
||||
CFLAGS += -I../zaptel -I../zapata
|
||||
INSTALL_BASE=/usr/local
|
||||
endif
|
||||
endif
|
||||
ifeq (${OSARCH},SunOS)
|
||||
CFLAGS += -DSOLARIS -I../zaptel-solaris
|
||||
LDCONFIG =
|
||||
LDCONFIG_FLAGS = \# # Trick to comment out the period in the command below
|
||||
#INSTALL_PREFIX = /opt/asterisk # Uncomment out to install in standard Solaris location for 3rd party code
|
||||
endif
|
||||
|
||||
export PRIVERSION
|
||||
|
||||
PRIVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) build_tools/make_version .)
|
||||
|
||||
#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
|
||||
#This works for even old (2.96) versions of gcc and provides a small boost either way.
|
||||
#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesnt support it.
|
||||
ifeq ($(PROC),sparc64)
|
||||
PROC=ultrasparc
|
||||
CFLAGS += -mtune=$(PROC) -O3 -pipe -fomit-frame-pointer -mcpu=v8
|
||||
endif
|
||||
|
||||
all: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
|
||||
|
||||
install: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
|
||||
mkdir -p /usr/lib
|
||||
mkdir -p /usr/include
|
||||
install -m 644 libpri.h /usr/include
|
||||
install -m 755 $(DYNAMIC_LIBRARY) /usr/lib
|
||||
( cd /usr/lib ; ln -sf libpri.so.1 libpri.so )
|
||||
install -m 644 $(STATIC_LIBRARY) /usr/lib
|
||||
/sbin/ldconfig
|
||||
update:
|
||||
@if [ -d .svn ]; then \
|
||||
echo "Updating from Subversion..." ; \
|
||||
fromrev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
|
||||
svn update | tee update.out; \
|
||||
torev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
|
||||
echo "`date` Updated from revision $${fromrev} to $${torev}." >> update.log; \
|
||||
rm -f .version; \
|
||||
if [ `grep -c ^C update.out` -gt 0 ]; then \
|
||||
echo ; echo "The following files have conflicts:" ; \
|
||||
grep ^C update.out | cut -b4- ; \
|
||||
fi ; \
|
||||
rm -f update.out; \
|
||||
else \
|
||||
echo "Not under version control"; \
|
||||
fi
|
||||
|
||||
%.lo : %.c
|
||||
$(CC) -fPIC $(CFLAGS) -o $@ -c $<
|
||||
install: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
|
||||
mkdir -p $(INSTALL_PREFIX)$(INSTALL_BASE)/lib
|
||||
mkdir -p $(INSTALL_PREFIX)$(INSTALL_BASE)/include
|
||||
ifneq (${OSARCH},SunOS)
|
||||
install -m 644 libpri.h $(INSTALL_PREFIX)$(INSTALL_BASE)/include
|
||||
install -m 755 $(DYNAMIC_LIBRARY) $(INSTALL_PREFIX)$(INSTALL_BASE)/lib
|
||||
if [ -x /usr/sbin/sestatus ] && ( /usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled"); then /sbin/restorecon -v $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/$(DYNAMIC_LIBRARY); fi
|
||||
( cd $(INSTALL_PREFIX)$(INSTALL_BASE)/lib ; ln -sf libpri.so.$(SONAME) libpri.so)
|
||||
install -m 644 $(STATIC_LIBRARY) $(INSTALL_PREFIX)$(INSTALL_BASE)/lib
|
||||
if test $$(id -u) = 0; then $(LDCONFIG) $(LDCONFIG_FLAGS) $(INSTALL_PREFIX)$(INSTALL_BASE)/lib; fi
|
||||
else
|
||||
install -f $(INSTALL_PREFIX)$(INSTALL_BASE)/include -m 644 libpri.h
|
||||
install -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib -m 755 $(DYNAMIC_LIBRARY)
|
||||
( cd $(INSTALL_PREFIX)$(INSTALL_BASE)/lib ; ln -sf libpri.so.$(SONAME) libpri.so)
|
||||
install -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib -m 644 $(STATIC_LIBRARY)
|
||||
endif
|
||||
|
||||
uninstall:
|
||||
@echo "Removing Libpri"
|
||||
rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/libpri.so.$(SONAME)
|
||||
rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/libpri.so
|
||||
rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/libpri.a
|
||||
rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/include/libpri.h
|
||||
|
||||
pritest: pritest.o
|
||||
$(CC) -o pritest pritest.o -L. -lpri -lzap $(CFLAGS)
|
||||
|
||||
testprilib.o: testprilib.c
|
||||
$(CC) $(CFLAGS) -D_REENTRANT -D_GNU_SOURCE -o $@ -c $<
|
||||
|
||||
testprilib: testprilib.o
|
||||
$(CC) -o testprilib testprilib.o -L. -lpri -lpthread $(CFLAGS)
|
||||
|
||||
pridump: pridump.o
|
||||
$(CC) -o pridump pridump.o -L. -lpri $(CFLAGS)
|
||||
|
||||
MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$@).d -MP
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $<
|
||||
|
||||
%.lo: %.c
|
||||
$(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $<
|
||||
|
||||
$(STATIC_LIBRARY): $(STATIC_OBJS)
|
||||
ar rcs $(STATIC_LIBRARY) $(STATIC_OBJS)
|
||||
ranlib $(STATIC_LIBRARY)
|
||||
|
||||
$(DYNAMIC_LIBRARY): $(DYNAMIC_OBJS)
|
||||
$(CC) -shared -Wl,-soname,libpri.so.1 -o $@ $(DYNAMIC_OBJS)
|
||||
/sbin/ldconfig -n .
|
||||
ln -sf libpri.so.1 libpri.so
|
||||
$(CC) -shared $(SOFLAGS) -o $@ $(DYNAMIC_OBJS)
|
||||
$(LDCONFIG) $(LDCONFIG_FLAGS) .
|
||||
ln -sf libpri.so.$(SONAME) libpri.so
|
||||
|
||||
version.c: FORCE
|
||||
@build_tools/make_version_c > $@.tmp
|
||||
@cmp -s $@.tmp $@ || mv $@.tmp $@
|
||||
@rm -f $@.tmp
|
||||
|
||||
clean:
|
||||
rm -f *.o *.so *.lo
|
||||
rm -f testpri $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
|
||||
rm -f *.o *.so *.lo *.so.$(SONAME)
|
||||
rm -f testprilib $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
|
||||
rm -f pritest pridump
|
||||
rm -f .*.d
|
||||
|
||||
.PHONY:
|
||||
|
||||
FORCE:
|
||||
|
||||
ifneq ($(wildcard .*.d),)
|
||||
include .*.d
|
||||
endif
|
||||
|
||||
30
README
Executable file → Normal file
30
README
Executable file → Normal file
@@ -1,31 +1,45 @@
|
||||
libpri: An implementation of Primate Rate ISDN
|
||||
libpri: An implementation of Primary Rate ISDN
|
||||
|
||||
Written by Mark Spencer <markster@linux-support.net>
|
||||
Written by Mark Spencer <markster@digium.com>
|
||||
|
||||
What is libpri?
|
||||
===============
|
||||
|
||||
libpri is a C implementation of the Primary Rate ISDN specification. It was
|
||||
based on the Bellcore specification SR-NWT-002343 for National ISDN. As of
|
||||
May 12, 2001, it has been tested work with NI-2, Nortel DMS-100, and Lucent 5E Custom protocols on switches from Nortel and Lucent.
|
||||
May 12, 2001, it has been tested work with NI-2, Nortel DMS-100, and
|
||||
Lucent 5E Custom protocols on switches from Nortel and Lucent.
|
||||
|
||||
What is the license for libpri?
|
||||
===============================
|
||||
libpri is distributed under the terms of the GNU General Public License, which permit its use and linking with other GPL'd software only.
|
||||
libpri is distributed under the terms of the GNU General Public License,
|
||||
which permit its use and linking with other GPL'd software only.
|
||||
The GNU GPL is included in the file LICENSE in this directory.
|
||||
|
||||
As a special exception, libpri may also be linked to the OpenH323
|
||||
library, so long as the entirity of the derivative work (as defined
|
||||
within the GPL) is licensed either under the MPL of the OpenH323 license
|
||||
or the GPL of libpri.
|
||||
|
||||
If you wish to use libpri in an application for which the GPL is not
|
||||
appropriate (e.g. a proprietary embedded system), licenses for libpri
|
||||
under more flexible terms can be readily obtained through Digium, Inc.
|
||||
at reasonable cost.
|
||||
|
||||
If you wish to use libpri in an application for which the GPL is not appropriate (e.g. a proprietary embedded system), licenses for libpri under more flexible terms can be readily obtained through Linux Support Services, Inc. at reasonable cost.
|
||||
|
||||
How do I report bugs or contribute?
|
||||
===================================
|
||||
For now, contact the author directly. In the future if there is sufficient interest, we will setup a mailing list.
|
||||
For now, contact the author directly. In the future if there is
|
||||
sufficient interest, we will setup a mailing list.
|
||||
|
||||
Does anything use this library so far?
|
||||
======================================
|
||||
Yes, the Asterisk Open Source PBX does. http://www.asteriskpbx.com
|
||||
Yes, the Asterisk Open Source PBX does. http://www.asterisk.org
|
||||
|
||||
Also, the Zapata library has hooks for it. http://www.zapatatelephony.org
|
||||
|
||||
Special thanks
|
||||
==============
|
||||
Special thanks to Jim Dixon <jim@lambdatel.com> for his help in testing and fixing the implementation.
|
||||
Special thanks to Jim Dixon <jim@lambdatel.com> for his help in
|
||||
testing and fixing the implementation.
|
||||
|
||||
|
||||
4
TODO
Executable file → Normal file
4
TODO
Executable file → Normal file
@@ -1,10 +1,8 @@
|
||||
General:
|
||||
-- D-Channel Backup
|
||||
-- Test against 4e
|
||||
|
||||
Q.921:
|
||||
-- Support unnumbered information frames
|
||||
-- Get TEI codes working for BRI interfaces
|
||||
|
||||
Q.931:
|
||||
-- Locking Shift IE
|
||||
-- Implement the 11 missing Q.931 timers
|
||||
|
||||
72
build_tools/make_version
Executable file
72
build_tools/make_version
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -f ${1}/.version ]; then
|
||||
cat ${1}/.version
|
||||
elif [ -d .svn ]; then
|
||||
PARTS=`LANG=C svn info ${1} | ${GREP} URL | ${AWK} '{print $2;}' | sed -e 's:^.*/svn/libpri/::' | sed -e 's:/: :g'`
|
||||
BRANCH=0
|
||||
TEAM=0
|
||||
TAG=0
|
||||
|
||||
REV=`svnversion -c ${1} | cut -d: -f2`
|
||||
|
||||
BASE=`LANG=C svn pg svnmerge-integrated ${1} | cut -d: -f1`
|
||||
|
||||
if [ "${PARTS}" = "trunk" ] ; then
|
||||
echo SVN-trunk-r${REV}
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for PART in $PARTS ; do
|
||||
if [ ${TAG} != 0 ] ; then
|
||||
if [ "${PART}" = "autotag_for_be" ] ; then
|
||||
continue
|
||||
fi
|
||||
if [ "${PART}" = "autotag_for_sx00i" ] ; then
|
||||
continue
|
||||
fi
|
||||
RESULT="${PART}"
|
||||
break
|
||||
fi
|
||||
|
||||
if [ ${BRANCH} != 0 ] ; then
|
||||
if [ -z ${RESULT} ] ; then
|
||||
RESULT="${PART}"
|
||||
else
|
||||
RESULT="${RESULT}-${PART}"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
|
||||
if [ ${TEAM} != 0 ] ; then
|
||||
if [ -z ${RESULT} ] ; then
|
||||
RESULT="${PART}"
|
||||
else
|
||||
RESULT="${RESULT}-${PART}"
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "${PART}" = "branches" ] ; then
|
||||
BRANCH=1
|
||||
RESULT="branch"
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "${PART}" = "tags" ] ; then
|
||||
TAG=1
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "${PART}" = "team" ] ; then
|
||||
TEAM=1
|
||||
continue
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${TAG} != 0 ] ; then
|
||||
echo ${RESULT}
|
||||
else
|
||||
echo SVN-${RESULT}-r${REV}${BASE:+-${BASE}}
|
||||
fi
|
||||
fi
|
||||
24
build_tools/make_version_c
Executable file
24
build_tools/make_version_c
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
if [ ! -f ../.flavor ]; then
|
||||
EXTRA=""
|
||||
else
|
||||
aadkver=`cat ../.version`
|
||||
aadkflavor=`cat ../.flavor`
|
||||
EXTRA=" (${aadkflavor} ${aadkver})"
|
||||
fi
|
||||
cat << END
|
||||
/*
|
||||
* version.c
|
||||
* Automatically generated
|
||||
*/
|
||||
|
||||
#include "libpri.h"
|
||||
|
||||
static const char pri_version[] = "${PRIVERSION}${EXTRA}";
|
||||
|
||||
const char *pri_get_version(void)
|
||||
{
|
||||
return pri_version;
|
||||
}
|
||||
|
||||
END
|
||||
10
compat.h
Normal file
10
compat.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef __COMPAT_H
|
||||
#define __COMPAT_H
|
||||
|
||||
#ifdef SOLARIS
|
||||
typedef unsigned char u_int8_t;
|
||||
typedef unsigned short u_int16_t;
|
||||
typedef unsigned int u_int32_t;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
36
compiler.h
Normal file
36
compiler.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Asterisk -- A telephony toolkit for Linux.
|
||||
*
|
||||
* Compiler-specific macros and other items
|
||||
*
|
||||
* Copyright (C) 2005, Digium, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2 as published by the
|
||||
* Free Software Foundation. See the LICENSE file included with
|
||||
* this program for more details.
|
||||
*
|
||||
* In addition, when this program is distributed with Asterisk in
|
||||
* any form that would qualify as a 'combined work' or as a
|
||||
* 'derivative work' (but not mere aggregation), you can redistribute
|
||||
* and/or modify the combination under the terms of the license
|
||||
* provided with that copy of Asterisk, instead of the license
|
||||
* terms granted here.
|
||||
*/
|
||||
|
||||
#ifndef _ASTERISK_COMPILER_H
|
||||
#define _ASTERISK_COMPILER_H
|
||||
|
||||
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
|
||||
#define __builtin_expect(exp, c) (exp)
|
||||
#endif
|
||||
|
||||
#endif /* _ASTERISK_COMPILER_H */
|
||||
47
copy_string.c
Normal file
47
copy_string.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* libpri: An implementation of Primary Rate ISDN
|
||||
*
|
||||
* Written by Mark Spencer <markster@digium.com>
|
||||
*
|
||||
* Copyright (C) 2005, Digium, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2 as published by the
|
||||
* Free Software Foundation. See the LICENSE file included with
|
||||
* this program for more details.
|
||||
*
|
||||
* In addition, when this program is distributed with Asterisk in
|
||||
* any form that would qualify as a 'combined work' or as a
|
||||
* 'derivative work' (but not mere aggregation), you can redistribute
|
||||
* and/or modify the combination under the terms of the license
|
||||
* provided with that copy of Asterisk, instead of the license
|
||||
* terms granted here.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "compiler.h"
|
||||
#include "libpri.h"
|
||||
#include "pri_internal.h"
|
||||
|
||||
void libpri_copy_string(char *dst, const char *src, size_t size)
|
||||
{
|
||||
while (*src && size) {
|
||||
*dst++ = *src++;
|
||||
size--;
|
||||
}
|
||||
if (__builtin_expect(!size, 0))
|
||||
dst--;
|
||||
*dst = '\0';
|
||||
}
|
||||
561
libpri.h
Executable file → Normal file
561
libpri.h
Executable file → Normal file
@@ -1,29 +1,34 @@
|
||||
/*
|
||||
* libpri: An implementation of Primary Rate ISDN
|
||||
*
|
||||
* Written by Mark Spencer <markster@linux-support.net>
|
||||
* Written by Mark Spencer <markster@digium.com>
|
||||
*
|
||||
* Copyright (C) 2001, Linux Support Services, Inc.
|
||||
* Copyright (C) 2001, Digium, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2 as published by the
|
||||
* Free Software Foundation. See the LICENSE file included with
|
||||
* this program for more details.
|
||||
*
|
||||
* In addition, when this program is distributed with Asterisk in
|
||||
* any form that would qualify as a 'combined work' or as a
|
||||
* 'derivative work' (but not mere aggregation), you can redistribute
|
||||
* and/or modify the combination under the terms of the license
|
||||
* provided with that copy of Asterisk, instead of the license
|
||||
* terms granted here.
|
||||
*/
|
||||
|
||||
#ifndef _PRI_H
|
||||
#define _PRI_H
|
||||
#ifndef _LIBPRI_H
|
||||
#define _LIBPRI_H
|
||||
|
||||
/* Node types */
|
||||
#define PRI_NETWORK 1
|
||||
@@ -37,6 +42,8 @@
|
||||
#define PRI_DEBUG_Q931_DUMP (1 << 5) /* Show interpreted Q.931 frames */
|
||||
#define PRI_DEBUG_Q931_STATE (1 << 6) /* Debug Q.931 state machine changes */
|
||||
#define PRI_DEBUG_Q931_ANOMALY (1 << 7) /* Show unexpected events */
|
||||
#define PRI_DEBUG_APDU (1 << 8) /* Debug of APDU components such as ROSE */
|
||||
#define PRI_DEBUG_AOC (1 << 9) /* Debug of Advice of Charge ROSE Messages */
|
||||
|
||||
#define PRI_DEBUG_ALL (0xffff) /* Everything */
|
||||
|
||||
@@ -46,24 +53,80 @@
|
||||
#define PRI_SWITCH_DMS100 2 /* DMS 100 */
|
||||
#define PRI_SWITCH_LUCENT5E 3 /* Lucent 5E */
|
||||
#define PRI_SWITCH_ATT4ESS 4 /* AT&T 4ESS */
|
||||
#define PRI_SWITCH_EUROISDN_E1 5 /* Standard EuroISDN (CTR4, ETSI 300-102) */
|
||||
#define PRI_SWITCH_EUROISDN_T1 6 /* T1 EuroISDN variant (ETSI 300-102) */
|
||||
#define PRI_SWITCH_EUROISDN_E1 5 /* Standard EuroISDN (CTR4, ETSI 300-102) */
|
||||
#define PRI_SWITCH_EUROISDN_T1 6 /* T1 EuroISDN variant (ETSI 300-102) */
|
||||
#define PRI_SWITCH_NI1 7 /* National ISDN 1 */
|
||||
#define PRI_SWITCH_GR303_EOC 8 /* GR-303 Embedded Operations Channel */
|
||||
#define PRI_SWITCH_GR303_TMC 9 /* GR-303 Timeslot Management Channel */
|
||||
#define PRI_SWITCH_QSIG 10 /* QSIG Switch */
|
||||
/* Switchtypes 11 - 20 are reserved for internal use */
|
||||
|
||||
|
||||
/* PRI D-Channel Events */
|
||||
#define PRI_EVENT_DCHAN_UP 1 /* D-channel is up */
|
||||
#define PRI_EVENT_DCHAN_DOWN 2 /* D-channel is down */
|
||||
#define PRI_EVENT_RESTART 3 /* B-channel is restarted */
|
||||
#define PRI_EVENT_CONFIG_ERR 4 /* Configuration Error Detected */
|
||||
#define PRI_EVENT_RING 5 /* Incoming call */
|
||||
#define PRI_EVENT_HANGUP 6 /* Call got hung up */
|
||||
#define PRI_EVENT_RINGING 7 /* Call is ringing (alerting) */
|
||||
#define PRI_EVENT_ANSWER 8 /* Call has been answered */
|
||||
#define PRI_EVENT_HANGUP_ACK 9 /* Call hangup has been acknowledged */
|
||||
#define PRI_EVENT_DCHAN_UP 1 /* D-channel is up */
|
||||
#define PRI_EVENT_DCHAN_DOWN 2 /* D-channel is down */
|
||||
#define PRI_EVENT_RESTART 3 /* B-channel is restarted */
|
||||
#define PRI_EVENT_CONFIG_ERR 4 /* Configuration Error Detected */
|
||||
#define PRI_EVENT_RING 5 /* Incoming call */
|
||||
#define PRI_EVENT_HANGUP 6 /* Call got hung up */
|
||||
#define PRI_EVENT_RINGING 7 /* Call is ringing (alerting) */
|
||||
#define PRI_EVENT_ANSWER 8 /* Call has been answered */
|
||||
#define PRI_EVENT_HANGUP_ACK 9 /* Call hangup has been acknowledged */
|
||||
#define PRI_EVENT_RESTART_ACK 10 /* Restart complete on a given channel */
|
||||
#define PRI_EVENT_FACNAME 11 /* Caller*ID Name received on Facility */
|
||||
#define PRI_EVENT_INFO_RECEIVED 12 /* Additional info (keypad) received */
|
||||
#define PRI_EVENT_PROCEEDING 13 /* When we get CALL_PROCEEDING or PROGRESS */
|
||||
#define PRI_EVENT_SETUP_ACK 14 /* When we get SETUP_ACKNOWLEDGE */
|
||||
#define PRI_EVENT_HANGUP_REQ 15 /* Requesting the higher layer to hangup */
|
||||
#define PRI_EVENT_NOTIFY 16 /* Notification received */
|
||||
#define PRI_EVENT_PROGRESS 17 /* When we get CALL_PROCEEDING or PROGRESS */
|
||||
#define PRI_EVENT_KEYPAD_DIGIT 18 /* When we receive during ACTIVE state */
|
||||
|
||||
/* Simple states */
|
||||
#define PRI_STATE_DOWN 0
|
||||
#define PRI_STATE_UP 1
|
||||
|
||||
#define PRI_PROGRESS_MASK
|
||||
|
||||
/* Progress indicator values */
|
||||
#define PRI_PROG_CALL_NOT_E2E_ISDN (1 << 0)
|
||||
#define PRI_PROG_CALLED_NOT_ISDN (1 << 1)
|
||||
#define PRI_PROG_CALLER_NOT_ISDN (1 << 2)
|
||||
#define PRI_PROG_INBAND_AVAILABLE (1 << 3)
|
||||
#define PRI_PROG_DELAY_AT_INTERF (1 << 4)
|
||||
#define PRI_PROG_INTERWORKING_WITH_PUBLIC (1 << 5)
|
||||
#define PRI_PROG_INTERWORKING_NO_RELEASE (1 << 6)
|
||||
#define PRI_PROG_INTERWORKING_NO_RELEASE_PRE_ANSWER (1 << 7)
|
||||
#define PRI_PROG_INTERWORKING_NO_RELEASE_POST_ANSWER (1 << 8)
|
||||
#define PRI_PROG_CALLER_RETURNED_TO_ISDN (1 << 9)
|
||||
|
||||
/* Numbering plan identifier */
|
||||
#define PRI_NPI_UNKNOWN 0x0
|
||||
#define PRI_NPI_E163_E164 0x1
|
||||
#define PRI_NPI_X121 0x3
|
||||
#define PRI_NPI_F69 0x4
|
||||
#define PRI_NPI_NATIONAL 0x8
|
||||
#define PRI_NPI_PRIVATE 0x9
|
||||
#define PRI_NPI_RESERVED 0xF
|
||||
|
||||
/* Type of number */
|
||||
#define PRI_TON_UNKNOWN 0x0
|
||||
#define PRI_TON_INTERNATIONAL 0x1
|
||||
#define PRI_TON_NATIONAL 0x2
|
||||
#define PRI_TON_NET_SPECIFIC 0x3
|
||||
#define PRI_TON_SUBSCRIBER 0x4
|
||||
#define PRI_TON_ABBREVIATED 0x6
|
||||
#define PRI_TON_RESERVED 0x7
|
||||
|
||||
/* Redirection reasons */
|
||||
#define PRI_REDIR_UNKNOWN 0x0
|
||||
#define PRI_REDIR_FORWARD_ON_BUSY 0x1
|
||||
#define PRI_REDIR_FORWARD_ON_NO_REPLY 0x2
|
||||
#define PRI_REDIR_DEFLECTION 0x3
|
||||
#define PRI_REDIR_DTE_OUT_OF_ORDER 0x9
|
||||
#define PRI_REDIR_FORWARDED_BY_DTE 0xA
|
||||
#define PRI_REDIR_UNCONDITIONAL 0xF
|
||||
|
||||
/* Dialing plan */
|
||||
#define PRI_INTERNATIONAL_ISDN 0x11
|
||||
#define PRI_NATIONAL_ISDN 0x21
|
||||
@@ -84,10 +147,10 @@
|
||||
|
||||
/* Causes for disconnection */
|
||||
#define PRI_CAUSE_UNALLOCATED 1
|
||||
#define PRI_CAUSE_NO_ROUTE_TRANSIT_NET 2
|
||||
#define PRI_CAUSE_NO_ROUTE_TRANSIT_NET 2 /* !Q.SIG */
|
||||
#define PRI_CAUSE_NO_ROUTE_DESTINATION 3
|
||||
#define PRI_CAUSE_CHANNEL_UNACCEPTABLE 6
|
||||
#define PRI_CAUSE_CALL_AWARDED_DELIVERED 7
|
||||
#define PRI_CAUSE_CALL_AWARDED_DELIVERED 7 /* !Q.SIG */
|
||||
#define PRI_CAUSE_NORMAL_CLEARING 16
|
||||
#define PRI_CAUSE_USER_BUSY 17
|
||||
#define PRI_CAUSE_NO_USER_RESPONSE 18
|
||||
@@ -96,56 +159,150 @@
|
||||
#define PRI_CAUSE_NUMBER_CHANGED 22
|
||||
#define PRI_CAUSE_DESTINATION_OUT_OF_ORDER 27
|
||||
#define PRI_CAUSE_INVALID_NUMBER_FORMAT 28
|
||||
#define PRI_CAUSE_FACILITY_REJECTED 29
|
||||
#define PRI_CAUSE_FACILITY_REJECTED 29 /* !Q.SIG */
|
||||
#define PRI_CAUSE_RESPONSE_TO_STATUS_ENQUIRY 30
|
||||
#define PRI_CAUSE_NORMAL_UNSPECIFIED 31
|
||||
#define PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION 34
|
||||
#define PRI_CAUSE_NETWORK_OUT_OF_ORDER 38
|
||||
#define PRI_CAUSE_NETWORK_OUT_OF_ORDER 38 /* !Q.SIG */
|
||||
#define PRI_CAUSE_NORMAL_TEMPORARY_FAILURE 41
|
||||
#define PRI_CAUSE_SWITCH_CONGESTION 42
|
||||
#define PRI_CAUSE_ACCESS_INFO_DISCARDED 43
|
||||
#define PRI_CAUSE_SWITCH_CONGESTION 42 /* !Q.SIG */
|
||||
#define PRI_CAUSE_ACCESS_INFO_DISCARDED 43 /* !Q.SIG */
|
||||
#define PRI_CAUSE_REQUESTED_CHAN_UNAVAIL 44
|
||||
#define PRI_CAUSE_PRE_EMPTED 45
|
||||
#define PRI_CAUSE_FACILITY_NOT_SUBSCRIBED 50
|
||||
#define PRI_CAUSE_OUTGOING_CALL_BARRED 52
|
||||
#define PRI_CAUSE_INCOMING_CALL_BARRED 54
|
||||
#define PRI_CAUSE_PRE_EMPTED 45 /* !Q.SIG */
|
||||
#define PRI_CAUSE_FACILITY_NOT_SUBSCRIBED 50 /* !Q.SIG */
|
||||
#define PRI_CAUSE_OUTGOING_CALL_BARRED 52 /* !Q.SIG */
|
||||
#define PRI_CAUSE_INCOMING_CALL_BARRED 54 /* !Q.SIG */
|
||||
#define PRI_CAUSE_BEARERCAPABILITY_NOTAUTH 57
|
||||
#define PRI_CAUSE_BEARERCAPABILITY_NOTAVAIL 58
|
||||
#define PRI_CAUSE_SERVICEOROPTION_NOTAVAIL 63 /* Q.SIG */
|
||||
#define PRI_CAUSE_BEARERCAPABILITY_NOTIMPL 65
|
||||
#define PRI_CAUSE_CHAN_NOT_IMPLEMENTED 66
|
||||
#define PRI_CAUSE_FACILITY_NOT_IMPLEMENTED 69
|
||||
#define PRI_CAUSE_CHAN_NOT_IMPLEMENTED 66 /* !Q.SIG */
|
||||
#define PRI_CAUSE_FACILITY_NOT_IMPLEMENTED 69 /* !Q.SIG */
|
||||
#define PRI_CAUSE_INVALID_CALL_REFERENCE 81
|
||||
#define PRI_CAUSE_IDENTIFIED_CHANNEL_NOTEXIST 82 /* Q.SIG */
|
||||
#define PRI_CAUSE_INCOMPATIBLE_DESTINATION 88
|
||||
#define PRI_CAUSE_INVALID_MSG_UNSPECIFIED 95
|
||||
#define PRI_CAUSE_INVALID_MSG_UNSPECIFIED 95 /* !Q.SIG */
|
||||
#define PRI_CAUSE_MANDATORY_IE_MISSING 96
|
||||
#define PRI_CAUSE_MESSAGE_TYPE_NONEXIST 97
|
||||
#define PRI_CAUSE_WRONG_MESSAGE 98
|
||||
#define PRI_CAUSE_WRONG_MESSAGE 98
|
||||
#define PRI_CAUSE_IE_NONEXIST 99
|
||||
#define PRI_CAUSE_INVALID_IE_CONTENTS 100
|
||||
#define PRI_CAUSE_WRONG_CALL_STATE 101
|
||||
#define PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE 102
|
||||
#define PRI_CAUSE_MANDATORY_IE_LENGTH_ERROR 103
|
||||
#define PRI_CAUSE_MANDATORY_IE_LENGTH_ERROR 103 /* !Q.SIG */
|
||||
#define PRI_CAUSE_PROTOCOL_ERROR 111
|
||||
#define PRI_CAUSE_INTERWORKING 127
|
||||
#define PRI_CAUSE_INTERWORKING 127 /* !Q.SIG */
|
||||
|
||||
/* Transmit capabilities */
|
||||
#define PRI_TRANS_CAP_SPEECH 0x0
|
||||
#define PRI_TRANS_CAP_DIGITAL 0x08
|
||||
#define PRI_TRANS_CAP_RESTRICTED_DIGITAL 0x09
|
||||
#define PRI_TRANS_CAP_3_1K_AUDIO 0x10
|
||||
#define PRI_TRANS_CAP_7K_AUDIO 0x11
|
||||
#define PRI_TRANS_CAP_7K_AUDIO 0x11 /* Depriciated ITU Q.931 (05/1998)*/
|
||||
#define PRI_TRANS_CAP_DIGITAL_W_TONES 0x11
|
||||
#define PRI_TRANS_CAP_VIDEO 0x18
|
||||
|
||||
#define PRI_LAYER_1_ITU_RATE_ADAPT 0x21
|
||||
#define PRI_LAYER_1_ULAW 0x22
|
||||
#define PRI_LAYER_1_ALAW 0x23
|
||||
#define PRI_LAYER_1_G721 0x24
|
||||
#define PRI_LAYER_1_ULAW 0x22
|
||||
#define PRI_LAYER_1_ALAW 0x23
|
||||
#define PRI_LAYER_1_G721 0x24
|
||||
#define PRI_LAYER_1_G722_G725 0x25
|
||||
#define PRI_LAYER_1_G7XX_384K 0x26
|
||||
#define PRI_LAYER_1_H223_H245 0x26
|
||||
#define PRI_LAYER_1_NON_ITU_ADAPT 0x27
|
||||
#define PRI_LAYER_1_V120_RATE_ADAPT 0x28
|
||||
#define PRI_LAYER_1_X31_RATE_ADAPT 0x29
|
||||
|
||||
|
||||
/* Intermediate rates for V.110 */
|
||||
#define PRI_INT_RATE_8K 1
|
||||
#define PRI_INT_RATE_16K 2
|
||||
#define PRI_INT_RATE_32K 3
|
||||
|
||||
|
||||
/* Rate adaption for bottom 5 bits of rateadaption */
|
||||
#define PRI_RATE_USER_RATE_MASK 0x1F
|
||||
#define PRI_RATE_ADAPT_UNSPEC 0x00
|
||||
#define PRI_RATE_ADAPT_0K6 0x01
|
||||
#define PRI_RATE_ADAPT_1K2 0x02
|
||||
#define PRI_RATE_ADAPT_2K4 0x03
|
||||
#define PRI_RATE_ADAPT_3K6 0x04
|
||||
#define PRI_RATE_ADAPT_4K8 0x05
|
||||
#define PRI_RATE_ADAPT_7K2 0x06
|
||||
#define PRI_RATE_ADAPT_8K 0x07
|
||||
#define PRI_RATE_ADAPT_9K6 0x08
|
||||
#define PRI_RATE_ADAPT_14K4 0x09
|
||||
#define PRI_RATE_ADAPT_16K 0x0A
|
||||
#define PRI_RATE_ADAPT_19K2 0x0B
|
||||
#define PRI_RATE_ADAPT_32K 0x0C
|
||||
#define PRI_RATE_ADAPT_38K4 0x0D
|
||||
#define PRI_RATE_ADAPT_48K 0x0E
|
||||
#define PRI_RATE_ADAPT_56K 0x0F
|
||||
#define PRI_RATE_ADAPT_57K6 0x12
|
||||
#define PRI_RATE_ADAPT_28K8 0x13
|
||||
#define PRI_RATE_ADAPT_24K 0x14
|
||||
#define PRI_RATE_ADAPT_0K1345 0x15
|
||||
#define PRI_RATE_ADAPT_0K1 0x16
|
||||
#define PRI_RATE_ADAPT_0K075_1K2 0x17
|
||||
#define PRI_RATE_ADAPT_1K2_0K075 0x18
|
||||
#define PRI_RATE_ADAPT_0K05 0x19
|
||||
#define PRI_RATE_ADAPT_0K075 0x1A
|
||||
#define PRI_RATE_ADAPT_0K110 0x1B
|
||||
#define PRI_RATE_ADAPT_0K150 0x1C
|
||||
#define PRI_RATE_ADAPT_0K200 0x1D
|
||||
#define PRI_RATE_ADAPT_0K300 0x1E
|
||||
#define PRI_RATE_ADAPT_12K 0x1F
|
||||
|
||||
/* in-band negotiation flag for rateadaption bit 5 */
|
||||
#define PRI_RATE_ADAPT_NEGOTIATION_POSS 0x20
|
||||
|
||||
/* async flag for rateadaption bit 6 */
|
||||
#define PRI_RATE_ADAPT_ASYNC 0x40
|
||||
|
||||
/* Notifications */
|
||||
#define PRI_NOTIFY_USER_SUSPENDED 0x00 /* User suspended */
|
||||
#define PRI_NOTIFY_USER_RESUMED 0x01 /* User resumed */
|
||||
#define PRI_NOTIFY_BEARER_CHANGE 0x02 /* Bearer service change (DSS1) */
|
||||
#define PRI_NOTIFY_ASN1_COMPONENT 0x03 /* ASN.1 encoded component (DSS1) */
|
||||
#define PRI_NOTIFY_COMPLETION_DELAY 0x04 /* Call completion delay */
|
||||
#define PRI_NOTIFY_CONF_ESTABLISHED 0x42 /* Conference established */
|
||||
#define PRI_NOTIFY_CONF_DISCONNECTED 0x43 /* Conference disconnected */
|
||||
#define PRI_NOTIFY_CONF_PARTY_ADDED 0x44 /* Other party added */
|
||||
#define PRI_NOTIFY_CONF_ISOLATED 0x45 /* Isolated */
|
||||
#define PRI_NOTIFY_CONF_REATTACHED 0x46 /* Reattached */
|
||||
#define PRI_NOTIFY_CONF_OTHER_ISOLATED 0x47 /* Other party isolated */
|
||||
#define PRI_NOTIFY_CONF_OTHER_REATTACHED 0x48 /* Other party reattached */
|
||||
#define PRI_NOTIFY_CONF_OTHER_SPLIT 0x49 /* Other party split */
|
||||
#define PRI_NOTIFY_CONF_OTHER_DISCONNECTED 0x4a /* Other party disconnected */
|
||||
#define PRI_NOTIFY_CONF_FLOATING 0x4b /* Conference floating */
|
||||
#define PRI_NOTIFY_WAITING_CALL 0x60 /* Call is waiting call */
|
||||
#define PRI_NOTIFY_DIVERSION_ACTIVATED 0x68 /* Diversion activated (DSS1) */
|
||||
#define PRI_NOTIFY_TRANSFER_ALERTING 0x69 /* Call transfer, alerting */
|
||||
#define PRI_NOTIFY_TRANSFER_ACTIVE 0x6a /* Call transfer, active */
|
||||
#define PRI_NOTIFY_REMOTE_HOLD 0x79 /* Remote hold */
|
||||
#define PRI_NOTIFY_REMOTE_RETRIEVAL 0x7a /* Remote retrieval */
|
||||
#define PRI_NOTIFY_CALL_DIVERTING 0x7b /* Call is diverting */
|
||||
|
||||
#define PRI_COPY_DIGITS_CALLED_NUMBER
|
||||
|
||||
/* Network Specific Facilities (AT&T) */
|
||||
#define PRI_NSF_NONE -1
|
||||
#define PRI_NSF_SID_PREFERRED 0xB1
|
||||
#define PRI_NSF_ANI_PREFERRED 0xB2
|
||||
#define PRI_NSF_SID_ONLY 0xB3
|
||||
#define PRI_NSF_ANI_ONLY 0xB4
|
||||
#define PRI_NSF_CALL_ASSOC_TSC 0xB9
|
||||
#define PRI_NSF_NOTIF_CATSC_CLEARING 0xBA
|
||||
#define PRI_NSF_OPERATOR 0xB5
|
||||
#define PRI_NSF_PCCO 0xB6
|
||||
#define PRI_NSF_SDN 0xE1
|
||||
#define PRI_NSF_TOLL_FREE_MEGACOM 0xE2
|
||||
#define PRI_NSF_MEGACOM 0xE3
|
||||
#define PRI_NSF_ACCUNET 0xE6
|
||||
#define PRI_NSF_LONG_DISTANCE_SERVICE 0xE7
|
||||
#define PRI_NSF_INTERNATIONAL_TOLL_FREE 0xE8
|
||||
#define PRI_NSF_ATT_MULTIQUEST 0xF0
|
||||
#define PRI_NSF_CALL_REDIRECTION_SERVICE 0xF7
|
||||
|
||||
typedef struct q931_call q931_call;
|
||||
|
||||
typedef struct pri_event_generic {
|
||||
@@ -167,29 +324,65 @@ typedef struct pri_event_ringing {
|
||||
int e;
|
||||
int channel;
|
||||
int cref;
|
||||
int progress;
|
||||
int progressmask;
|
||||
q931_call *call;
|
||||
char useruserinfo[260]; /* User->User info */
|
||||
} pri_event_ringing;
|
||||
|
||||
typedef struct pri_event_answer {
|
||||
int e;
|
||||
int channel;
|
||||
int cref;
|
||||
int progress;
|
||||
int progressmask;
|
||||
q931_call *call;
|
||||
char useruserinfo[260]; /* User->User info */
|
||||
} pri_event_answer;
|
||||
|
||||
typedef struct pri_event_facname {
|
||||
int e;
|
||||
char callingname[256];
|
||||
char callingnum[256];
|
||||
int channel;
|
||||
int cref;
|
||||
q931_call *call;
|
||||
int callingpres; /* Presentation of Calling CallerID */
|
||||
int callingplan; /* Dialing plan of Calling entity */
|
||||
} pri_event_facname;
|
||||
|
||||
#define PRI_CALLINGPLANANI
|
||||
#define PRI_CALLINGPLANRDNIS
|
||||
typedef struct pri_event_ring {
|
||||
int e;
|
||||
int channel; /* Channel requested */
|
||||
int callingpres; /* Presentation of Calling CallerID */
|
||||
int callingplanani; /* Dialing plan of Calling entity ANI */
|
||||
int callingplan; /* Dialing plan of Calling entity */
|
||||
char callingani[256]; /* Calling ANI */
|
||||
char callingnum[256]; /* Calling number */
|
||||
char callingname[256]; /* Calling name (if provided) */
|
||||
int calledplan; /* Dialing plan of Called number */
|
||||
int ani2; /* ANI II */
|
||||
char callednum[256]; /* Called number */
|
||||
char redirectingnum[256]; /* Redirecting number */
|
||||
char redirectingname[256]; /* Redirecting name */
|
||||
int redirectingreason; /* Reason for redirect */
|
||||
int callingplanrdnis; /* Dialing plan of Redirecting Number */
|
||||
char useruserinfo[260]; /* User->User info */
|
||||
int flexible; /* Are we flexible with our channel selection? */
|
||||
int cref; /* Call Reference Number */
|
||||
int ctype; /* Call type (see PRI_TRANS_CAP_* */
|
||||
int layer1; /* User layer 1 */
|
||||
int layer1; /* User layer 1 */
|
||||
int complete; /* Have we seen "Complete" i.e. no more number? */
|
||||
q931_call *call; /* Opaque call pointer */
|
||||
char callingsubaddr[256]; /* Calling parties subaddress */
|
||||
int progress;
|
||||
int progressmask;
|
||||
char origcalledname[256];
|
||||
char origcallednum[256];
|
||||
int callingplanorigcalled; /* Dialing plan of Originally Called Number */
|
||||
int origredirectingreason;
|
||||
} pri_event_ring;
|
||||
|
||||
typedef struct pri_event_hangup {
|
||||
@@ -198,87 +391,305 @@ typedef struct pri_event_hangup {
|
||||
int cause;
|
||||
int cref;
|
||||
q931_call *call; /* Opaque call pointer */
|
||||
long aoc_units; /* Advise of Charge number of charged units */
|
||||
char useruserinfo[260]; /* User->User info */
|
||||
} pri_event_hangup;
|
||||
|
||||
typedef struct pri_event_restart_ack {
|
||||
int e;
|
||||
int channel;
|
||||
} pri_event_restart_ack;
|
||||
|
||||
#define PRI_PROGRESS_CAUSE
|
||||
typedef struct pri_event_proceeding {
|
||||
int e;
|
||||
int channel;
|
||||
int cref;
|
||||
int progress;
|
||||
int progressmask;
|
||||
int cause;
|
||||
q931_call *call;
|
||||
} pri_event_proceeding;
|
||||
|
||||
typedef struct pri_event_setup_ack {
|
||||
int e;
|
||||
int channel;
|
||||
q931_call *call;
|
||||
} pri_event_setup_ack;
|
||||
|
||||
typedef struct pri_event_notify {
|
||||
int e;
|
||||
int channel;
|
||||
int info;
|
||||
} pri_event_notify;
|
||||
|
||||
typedef struct pri_event_keypad_digit {
|
||||
int e;
|
||||
int channel;
|
||||
q931_call *call;
|
||||
char digits[64];
|
||||
} pri_event_keypad_digit;
|
||||
|
||||
typedef union {
|
||||
int e;
|
||||
pri_event_generic gen; /* Generic view */
|
||||
pri_event_restart restart; /* Restart view */
|
||||
pri_event_error err; /* Error view */
|
||||
pri_event_facname facname; /* Caller*ID Name on Facility */
|
||||
pri_event_ring ring; /* Ring */
|
||||
pri_event_hangup hangup; /* Hang up */
|
||||
pri_event_ringing ringing; /* Ringing */
|
||||
pri_event_ringing answer; /* Answer */
|
||||
pri_event_answer answer; /* Answer */
|
||||
pri_event_restart_ack restartack; /* Restart Acknowledge */
|
||||
pri_event_proceeding proceeding; /* Call proceeding & Progress */
|
||||
pri_event_setup_ack setup_ack; /* SETUP_ACKNOWLEDGE structure */
|
||||
pri_event_notify notify; /* Notification */
|
||||
pri_event_keypad_digit digit; /* Digits that come during a call */
|
||||
} pri_event;
|
||||
|
||||
struct pri;
|
||||
struct pri_sr;
|
||||
|
||||
#define PRI_IO_FUNCS
|
||||
/* Type declaration for callbacks to read or write a HDLC frame as below */
|
||||
typedef int (*pri_io_cb)(struct pri *pri, void *buf, int buflen);
|
||||
|
||||
/* Create a D-channel on a given file descriptor. The file descriptor must be a
|
||||
channel operating in HDLC mode with FCS computed by the fd's driver. Also it
|
||||
must be NON-BLOCKING! Frames received on the fd should include FCS. Nodetype
|
||||
must be one of PRI_NETWORK or PRI_CPE. switchtype should be PRI_SWITCH_* */
|
||||
extern struct pri *pri_new(int fd, int nodetype, int switchtype);
|
||||
struct pri *pri_new(int fd, int nodetype, int switchtype);
|
||||
struct pri *pri_new_bri(int fd, int ptpmode, int nodetype, int switchtype);
|
||||
|
||||
/* Create D-channel just as above with user defined I/O callbacks and data */
|
||||
struct pri *pri_new_cb(int fd, int nodetype, int switchtype, pri_io_cb io_read, pri_io_cb io_write, void *userdata);
|
||||
|
||||
/* Retrieve the user data associated with the D channel */
|
||||
void *pri_get_userdata(struct pri *pri);
|
||||
|
||||
/* Set the user data associated with the D channel */
|
||||
void pri_set_userdata(struct pri *pri, void *userdata);
|
||||
|
||||
/* Set Network Specific Facility for PRI */
|
||||
void pri_set_nsf(struct pri *pri, int nsf);
|
||||
|
||||
/* Set debug parameters on PRI -- see above debug definitions */
|
||||
extern void pri_set_debug(struct pri *pri, int debug);
|
||||
void pri_set_debug(struct pri *pri, int debug);
|
||||
|
||||
/* Get debug parameters on PRI -- see above debug definitions */
|
||||
int pri_get_debug(struct pri *pri);
|
||||
|
||||
#define PRI_FACILITY_ENABLE
|
||||
/* Enable transmission support of Facility IEs on the pri */
|
||||
void pri_facility_enable(struct pri *pri);
|
||||
|
||||
/* Run PRI on the given D-channel, taking care of any events that
|
||||
need to be handled. If block is set, it will block until an event
|
||||
occurs which needs to be handled */
|
||||
extern pri_event *pri_dchannel_run(struct pri *pri, int block);
|
||||
pri_event *pri_dchannel_run(struct pri *pri, int block);
|
||||
|
||||
/* Check for an outstanding event on the PRI */
|
||||
pri_event *pri_check_event(struct pri *pri);
|
||||
|
||||
/* Give a name to a given event ID */
|
||||
extern char *pri_event2str(int id);
|
||||
char *pri_event2str(int id);
|
||||
|
||||
/* Give a name toa node type */
|
||||
extern char *pri_node2str(int id);
|
||||
/* Give a name to a node type */
|
||||
char *pri_node2str(int id);
|
||||
|
||||
/* Give a name to a switch type */
|
||||
extern char *pri_switch2str(int id);
|
||||
char *pri_switch2str(int id);
|
||||
|
||||
/* Print an event */
|
||||
extern void pri_dump_event(struct pri *pri, pri_event *e);
|
||||
|
||||
/* Turn an event ID into a string */
|
||||
extern char *pri_event2str(int e);
|
||||
void pri_dump_event(struct pri *pri, pri_event *e);
|
||||
|
||||
/* Turn presentation into a string */
|
||||
extern char *pri_pres2str(int pres);
|
||||
char *pri_pres2str(int pres);
|
||||
|
||||
/* Turn numbering plan into a string */
|
||||
extern char *pri_plan2str(int plan);
|
||||
char *pri_plan2str(int plan);
|
||||
|
||||
/* Turn cause into a string */
|
||||
extern char *pri_cause2str(int cause);
|
||||
char *pri_cause2str(int cause);
|
||||
|
||||
/* Acknowledge a call and place it on the given channel. Set info to non-zero if there
|
||||
is in-band data available on the channel */
|
||||
extern int pri_acknowledge(struct pri *pri, q931_call *call, int channel, int info);
|
||||
int pri_acknowledge(struct pri *pri, q931_call *call, int channel, int info);
|
||||
|
||||
/* Send a digit in overlap mode */
|
||||
int pri_information(struct pri *pri, q931_call *call, char digit);
|
||||
|
||||
#define PRI_KEYPAD_FACILITY_TX
|
||||
/* Send a keypad facility string of digits */
|
||||
int pri_keypad_facility(struct pri *pri, q931_call *call, char *digits);
|
||||
|
||||
/* Answer the incomplete(call without called number) call on the given channel.
|
||||
Set non-isdn to non-zero if you are not connecting to ISDN equipment */
|
||||
int pri_need_more_info(struct pri *pri, q931_call *call, int channel, int nonisdn);
|
||||
|
||||
/* Answer the call on the given channel (ignored if you called acknowledge already).
|
||||
Set non-isdn to non-zero if you are not connecting to ISDN equipment */
|
||||
extern int pri_answer(struct pri *pri, q931_call *call, int channel, int nonisdn);
|
||||
int pri_answer(struct pri *pri, q931_call *call, int channel, int nonisdn);
|
||||
|
||||
/* Release/Reject a call */
|
||||
extern int pri_release(struct pri *pri, q931_call *call, int cause);
|
||||
/* Set CRV reference for GR-303 calls */
|
||||
|
||||
/* Hangup / Disconnect a call */
|
||||
extern int pri_disconnect(struct pri *pri, q931_call *call, int cause);
|
||||
|
||||
#undef pri_release
|
||||
#undef pri_disconnect
|
||||
|
||||
/* backwards compatibility for those who don't use asterisk with libpri */
|
||||
#define pri_release(a,b,c) \
|
||||
pri_hangup(a,b,c)
|
||||
|
||||
#define pri_disconnect(a,b,c) \
|
||||
pri_hangup(a,b,c)
|
||||
|
||||
/* Hangup a call */
|
||||
#define PRI_HANGUP
|
||||
int pri_hangup(struct pri *pri, q931_call *call, int cause);
|
||||
|
||||
#define PRI_DESTROYCALL
|
||||
void pri_destroycall(struct pri *pri, q931_call *call);
|
||||
|
||||
#define PRI_RESTART
|
||||
int pri_restart(struct pri *pri);
|
||||
|
||||
int pri_reset(struct pri *pri, int channel);
|
||||
|
||||
/* Create a new call */
|
||||
extern q931_call *pri_new_call(struct pri *pri);
|
||||
q931_call *pri_new_call(struct pri *pri);
|
||||
|
||||
/* Retrieve CRV reference for GR-303 calls. Returns >0 on success. */
|
||||
int pri_get_crv(struct pri *pri, q931_call *call, int *callmode);
|
||||
|
||||
/* Retrieve CRV reference for GR-303 calls. CRV must be >0, call mode should be 0 */
|
||||
int pri_set_crv(struct pri *pri, q931_call *call, int crv, int callmode);
|
||||
|
||||
/* How long until you need to poll for a new event */
|
||||
extern struct timeval *pri_schedule_next(struct pri *pri);
|
||||
struct timeval *pri_schedule_next(struct pri *pri);
|
||||
|
||||
/* Run any pending schedule events */
|
||||
extern pri_event *pri_schedule_run(struct pri *pri);
|
||||
extern pri_event *pri_schedule_run_tv(struct pri *pri, const struct timeval *now);
|
||||
|
||||
extern int pri_call(struct pri *pri, q931_call *c, int transmode, int channel,
|
||||
int exclusive, int nonisdn, char *caller, int callerplan, int callerpres,
|
||||
int pri_call(struct pri *pri, q931_call *c, int transmode, int channel,
|
||||
int exclusive, int nonisdn, char *caller, int callerplan, char *callername, int callerpres,
|
||||
char *called,int calledplan, int ulayer1);
|
||||
|
||||
struct pri_sr *pri_sr_new(void);
|
||||
void pri_sr_free(struct pri_sr *sr);
|
||||
|
||||
int pri_sr_set_channel(struct pri_sr *sr, int channel, int exclusive, int nonisdn);
|
||||
int pri_sr_set_bearer(struct pri_sr *sr, int transmode, int userl1);
|
||||
int pri_sr_set_called(struct pri_sr *sr, char *called, int calledplan, int complete);
|
||||
int pri_sr_set_caller(struct pri_sr *sr, char *caller, char *callername, int callerplan, int callerpres);
|
||||
int pri_sr_set_redirecting(struct pri_sr *sr, char *num, int plan, int pres, int reason);
|
||||
#define PRI_USER_USER_TX
|
||||
/* Set the user user field. Warning! don't send binary data accross this field */
|
||||
void pri_sr_set_useruser(struct pri_sr *sr, const char *userchars);
|
||||
|
||||
void pri_call_set_useruser(q931_call *sr, const char *userchars);
|
||||
|
||||
int pri_setup(struct pri *pri, q931_call *call, struct pri_sr *req);
|
||||
|
||||
/* Set a call has a call indpendent signalling connection (i.e. no bchan) */
|
||||
int pri_sr_set_connection_call_independent(struct pri_sr *req);
|
||||
|
||||
/* Send an MWI indication to a remote location. If activate is non zero, activates, if zero, decativates */
|
||||
int pri_mwi_activate(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres, char *called, int calledplan);
|
||||
|
||||
/* Send an MWI deactivate request to a remote location */
|
||||
int pri_mwi_deactivate(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres, char *called, int calledplan);
|
||||
|
||||
#define PRI_2BCT
|
||||
/* Attempt to pass the channels back to the NET side if compatable and
|
||||
* suscribed. Sometimes called 2 bchannel transfer (2BCT) */
|
||||
int pri_channel_bridge(q931_call *call1, q931_call *call2);
|
||||
|
||||
/* Override message and error stuff */
|
||||
#define PRI_NEW_SET_API
|
||||
void pri_set_message(void (*__pri_error)(struct pri *pri, char *));
|
||||
void pri_set_error(void (*__pri_error)(struct pri *pri, char *));
|
||||
|
||||
/* Set overlap mode */
|
||||
#define PRI_SET_OVERLAPDIAL
|
||||
void pri_set_overlapdial(struct pri *pri,int state);
|
||||
|
||||
#define PRI_DUMP_INFO_STR
|
||||
char *pri_dump_info_str(struct pri *pri);
|
||||
|
||||
/* Get file descriptor */
|
||||
int pri_fd(struct pri *pri);
|
||||
|
||||
#define PRI_PROGRESS
|
||||
/* Send call proceeding */
|
||||
int pri_progress(struct pri *pri, q931_call *c, int channel, int info);
|
||||
|
||||
#define PRI_PROCEEDING_FULL
|
||||
/* Send call proceeding */
|
||||
int pri_proceeding(struct pri *pri, q931_call *c, int channel, int info);
|
||||
|
||||
/* Enable inband progress when a DISCONNECT is received */
|
||||
void pri_set_inbanddisconnect(struct pri *pri, unsigned int enable);
|
||||
|
||||
/* Enslave a PRI to another, so they share the same call list
|
||||
(and maybe some timers) */
|
||||
void pri_enslave(struct pri *master, struct pri *slave);
|
||||
|
||||
#define PRI_GR303_SUPPORT
|
||||
#define PRI_ENSLAVE_SUPPORT
|
||||
#define PRI_SETUP_CALL
|
||||
#define PRI_RECEIVE_SUBADDR
|
||||
#define PRI_REDIRECTING_REASON
|
||||
#define PRI_AOC_UNITS
|
||||
#define PRI_ANI
|
||||
|
||||
/* Send notification */
|
||||
int pri_notify(struct pri *pri, q931_call *c, int channel, int info);
|
||||
|
||||
/* Get/Set PRI Timers */
|
||||
#define PRI_GETSET_TIMERS
|
||||
int pri_set_timer(struct pri *pri, int timer, int value);
|
||||
int pri_get_timer(struct pri *pri, int timer);
|
||||
int pri_timer2idx(char *timer);
|
||||
|
||||
#define PRI_MAX_TIMERS 32
|
||||
|
||||
#define PRI_TIMER_N200 0 /* Maximum numer of q921 retransmissions */
|
||||
#define PRI_TIMER_N201 1 /* Maximum numer of octets in an information field */
|
||||
#define PRI_TIMER_N202 2 /* Maximum numer of transmissions of the TEI identity request message */
|
||||
#define PRI_TIMER_K 3 /* Maximum number of outstanding I-frames */
|
||||
|
||||
#define PRI_TIMER_T200 4 /* time between SABME's */
|
||||
#define PRI_TIMER_T201 5 /* minimum time between retransmissions of the TEI Identity check messages */
|
||||
#define PRI_TIMER_T202 6 /* minimum time between transmission of TEI Identity request messages */
|
||||
#define PRI_TIMER_T203 7 /* maxiumum time without exchanging packets */
|
||||
|
||||
#define PRI_TIMER_T300 8
|
||||
#define PRI_TIMER_T301 9 /* maximum time to respond to an ALERT */
|
||||
#define PRI_TIMER_T302 10
|
||||
#define PRI_TIMER_T303 11 /* maximum time to wait after sending a SETUP without a response */
|
||||
#define PRI_TIMER_T304 12
|
||||
#define PRI_TIMER_T305 13
|
||||
#define PRI_TIMER_T306 14
|
||||
#define PRI_TIMER_T307 15
|
||||
#define PRI_TIMER_T308 16
|
||||
#define PRI_TIMER_T309 17
|
||||
#define PRI_TIMER_T310 18 /* maximum time between receiving a CALLPROCEEDING and receiving a ALERT/CONNECT/DISCONNECT/PROGRESS */
|
||||
#define PRI_TIMER_T313 19
|
||||
#define PRI_TIMER_T314 20
|
||||
#define PRI_TIMER_T316 21 /* maximum time between transmitting a RESTART and receiving a RESTART ACK */
|
||||
#define PRI_TIMER_T317 22
|
||||
#define PRI_TIMER_T318 23
|
||||
#define PRI_TIMER_T319 24
|
||||
#define PRI_TIMER_T320 25
|
||||
#define PRI_TIMER_T321 26
|
||||
#define PRI_TIMER_T322 27
|
||||
|
||||
#define PRI_TIMER_TM20 28 /* maximum time avaiting XID response */
|
||||
#define PRI_TIMER_NM20 29 /* number of XID retransmits */
|
||||
|
||||
/* Get PRI version */
|
||||
const char *pri_get_version(void);
|
||||
|
||||
#endif
|
||||
|
||||
734
pri.c
Executable file → Normal file
734
pri.c
Executable file → Normal file
@@ -1,13 +1,30 @@
|
||||
/*
|
||||
* libpri: An implementation of Primary Rate ISDN
|
||||
*
|
||||
* Written by Mark Spencer <markster@linux-suppot.net>
|
||||
* Written by Mark Spencer <markster@digium.com>
|
||||
*
|
||||
* This program is confidential
|
||||
*
|
||||
* Copyright (C) 2001, Linux Support Services, Inc.
|
||||
* Copyright (C) 2001-2005, Digium, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2 as published by the
|
||||
* Free Software Foundation. See the LICENSE file included with
|
||||
* this program for more details.
|
||||
*
|
||||
* In addition, when this program is distributed with Asterisk in
|
||||
* any form that would qualify as a 'combined work' or as a
|
||||
* 'derivative work' (but not mere aggregation), you can redistribute
|
||||
* and/or modify the combination under the terms of the license
|
||||
* provided with that copy of Asterisk, instead of the license
|
||||
* terms granted here.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
@@ -18,10 +35,14 @@
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/select.h>
|
||||
#include <stdarg.h>
|
||||
#include "compat.h"
|
||||
#include "libpri.h"
|
||||
#include "pri_internal.h"
|
||||
#include "pri_facility.h"
|
||||
#include "pri_q921.h"
|
||||
#include "pri_q931.h"
|
||||
#include "pri_timers.h"
|
||||
|
||||
char *pri_node2str(int node)
|
||||
{
|
||||
@@ -48,27 +69,262 @@ char *pri_switch2str(int sw)
|
||||
return "Lucent 5E";
|
||||
case PRI_SWITCH_ATT4ESS:
|
||||
return "AT&T 4ESS";
|
||||
case PRI_SWITCH_NI1:
|
||||
return "National ISDN 1";
|
||||
case PRI_SWITCH_EUROISDN_E1:
|
||||
return "EuroISDN";
|
||||
case PRI_SWITCH_GR303_EOC:
|
||||
return "GR303 EOC";
|
||||
case PRI_SWITCH_GR303_TMC:
|
||||
return "GR303 TMC";
|
||||
case PRI_SWITCH_QSIG:
|
||||
return "Q.SIG switch";
|
||||
default:
|
||||
return "Unknown switchtype";
|
||||
}
|
||||
}
|
||||
|
||||
struct pri *pri_new(int fd, int node, int switchtype)
|
||||
static void pri_default_timers(struct pri *pri, int switchtype)
|
||||
{
|
||||
static const int defaulttimers[20][PRI_MAX_TIMERS] = PRI_TIMERS_ALL;
|
||||
int x;
|
||||
|
||||
for (x = 0; x<PRI_MAX_TIMERS; x++) {
|
||||
pri->timers[x] = defaulttimers[switchtype][x];
|
||||
}
|
||||
}
|
||||
|
||||
int pri_set_timer(struct pri *pri, int timer, int value)
|
||||
{
|
||||
if (timer < 0 || timer > PRI_MAX_TIMERS || value < 0)
|
||||
return -1;
|
||||
|
||||
pri->timers[timer] = value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pri_get_timer(struct pri *pri, int timer)
|
||||
{
|
||||
if (timer < 0 || timer > PRI_MAX_TIMERS)
|
||||
return -1;
|
||||
return pri->timers[timer];
|
||||
}
|
||||
|
||||
int pri_timer2idx(char *timer)
|
||||
{
|
||||
if (!strcasecmp(timer, "N200"))
|
||||
return PRI_TIMER_N200;
|
||||
else if (!strcasecmp(timer, "N201"))
|
||||
return PRI_TIMER_N201;
|
||||
else if (!strcasecmp(timer, "N202"))
|
||||
return PRI_TIMER_N202;
|
||||
else if (!strcasecmp(timer, "K"))
|
||||
return PRI_TIMER_K;
|
||||
else if (!strcasecmp(timer, "T200"))
|
||||
return PRI_TIMER_T200;
|
||||
else if (!strcasecmp(timer, "T202"))
|
||||
return PRI_TIMER_T202;
|
||||
else if (!strcasecmp(timer, "T203"))
|
||||
return PRI_TIMER_T203;
|
||||
else if (!strcasecmp(timer, "T300"))
|
||||
return PRI_TIMER_T300;
|
||||
else if (!strcasecmp(timer, "T301"))
|
||||
return PRI_TIMER_T301;
|
||||
else if (!strcasecmp(timer, "T302"))
|
||||
return PRI_TIMER_T302;
|
||||
else if (!strcasecmp(timer, "T303"))
|
||||
return PRI_TIMER_T303;
|
||||
else if (!strcasecmp(timer, "T304"))
|
||||
return PRI_TIMER_T304;
|
||||
else if (!strcasecmp(timer, "T305"))
|
||||
return PRI_TIMER_T305;
|
||||
else if (!strcasecmp(timer, "T306"))
|
||||
return PRI_TIMER_T306;
|
||||
else if (!strcasecmp(timer, "T307"))
|
||||
return PRI_TIMER_T307;
|
||||
else if (!strcasecmp(timer, "T308"))
|
||||
return PRI_TIMER_T308;
|
||||
else if (!strcasecmp(timer, "T309"))
|
||||
return PRI_TIMER_T309;
|
||||
else if (!strcasecmp(timer, "T310"))
|
||||
return PRI_TIMER_T310;
|
||||
else if (!strcasecmp(timer, "T313"))
|
||||
return PRI_TIMER_T313;
|
||||
else if (!strcasecmp(timer, "T314"))
|
||||
return PRI_TIMER_T314;
|
||||
else if (!strcasecmp(timer, "T316"))
|
||||
return PRI_TIMER_T316;
|
||||
else if (!strcasecmp(timer, "T317"))
|
||||
return PRI_TIMER_T317;
|
||||
else if (!strcasecmp(timer, "T318"))
|
||||
return PRI_TIMER_T318;
|
||||
else if (!strcasecmp(timer, "T319"))
|
||||
return PRI_TIMER_T319;
|
||||
else if (!strcasecmp(timer, "T320"))
|
||||
return PRI_TIMER_T320;
|
||||
else if (!strcasecmp(timer, "T321"))
|
||||
return PRI_TIMER_T321;
|
||||
else if (!strcasecmp(timer, "T322"))
|
||||
return PRI_TIMER_T322;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int __pri_read(struct pri *pri, void *buf, int buflen)
|
||||
{
|
||||
int res = read(pri->fd, buf, buflen);
|
||||
if (res < 0) {
|
||||
if (errno != EAGAIN)
|
||||
pri_error(pri, "Read on %d failed: %s\n", pri->fd, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static int __pri_write(struct pri *pri, void *buf, int buflen)
|
||||
{
|
||||
int res = write(pri->fd, buf, buflen);
|
||||
if (res < 0) {
|
||||
if (errno != EAGAIN)
|
||||
pri_error(pri, "Write to %d failed: %s\n", pri->fd, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Pass in the master for this function */
|
||||
void __pri_free_tei(struct pri * p)
|
||||
{
|
||||
free (p);
|
||||
}
|
||||
|
||||
struct pri *__pri_new_tei(int fd, int node, int switchtype, struct pri *master, pri_io_cb rd, pri_io_cb wr, void *userdata, int tei, int bri)
|
||||
{
|
||||
struct pri *p;
|
||||
p = malloc(sizeof(struct pri));
|
||||
if (p) {
|
||||
memset(p, 0, sizeof(struct pri));
|
||||
p->fd = fd;
|
||||
p->localtype = node;
|
||||
p->switchtype = switchtype;
|
||||
p->cref = 1;
|
||||
/* Start Q.921 layer */
|
||||
q921_start(p);
|
||||
|
||||
if (!(p = calloc(1, sizeof(*p))))
|
||||
return NULL;
|
||||
|
||||
p->bri = bri;
|
||||
p->fd = fd;
|
||||
p->read_func = rd;
|
||||
p->write_func = wr;
|
||||
p->userdata = userdata;
|
||||
p->localtype = node;
|
||||
p->switchtype = switchtype;
|
||||
p->cref = 1;
|
||||
p->sapi = (tei == Q921_TEI_GROUP) ? Q921_SAPI_LAYER2_MANAGEMENT : Q921_SAPI_CALL_CTRL;
|
||||
p->tei = tei;
|
||||
p->nsf = PRI_NSF_NONE;
|
||||
p->protodisc = Q931_PROTOCOL_DISCRIMINATOR;
|
||||
p->master = master;
|
||||
p->callpool = &p->localpool;
|
||||
pri_default_timers(p, switchtype);
|
||||
if (master) {
|
||||
pri_set_debug(p, master->debug);
|
||||
if (master->sendfacility)
|
||||
pri_facility_enable(p);
|
||||
}
|
||||
#ifdef LIBPRI_COUNTERS
|
||||
p->q921_rxcount = 0;
|
||||
p->q921_txcount = 0;
|
||||
p->q931_rxcount = 0;
|
||||
p->q931_txcount = 0;
|
||||
#endif
|
||||
if (switchtype == PRI_SWITCH_GR303_EOC) {
|
||||
p->protodisc = GR303_PROTOCOL_DISCRIMINATOR;
|
||||
p->sapi = Q921_SAPI_GR303_EOC;
|
||||
p->tei = Q921_TEI_GR303_EOC_OPS;
|
||||
p->subchannel = __pri_new_tei(-1, node, PRI_SWITCH_GR303_EOC_PATH, p, NULL, NULL, NULL, Q921_TEI_GR303_EOC_PATH, 0);
|
||||
if (!p->subchannel) {
|
||||
free(p);
|
||||
p = NULL;
|
||||
}
|
||||
} else if (switchtype == PRI_SWITCH_GR303_TMC) {
|
||||
p->protodisc = GR303_PROTOCOL_DISCRIMINATOR;
|
||||
p->sapi = Q921_SAPI_GR303_TMC_CALLPROC;
|
||||
p->tei = Q921_TEI_GR303_TMC_CALLPROC;
|
||||
p->subchannel = __pri_new_tei(-1, node, PRI_SWITCH_GR303_TMC_SWITCHING, p, NULL, NULL, NULL, Q921_TEI_GR303_TMC_SWITCHING, 0);
|
||||
if (!p->subchannel) {
|
||||
free(p);
|
||||
p = NULL;
|
||||
}
|
||||
} else if (switchtype == PRI_SWITCH_GR303_TMC_SWITCHING) {
|
||||
p->protodisc = GR303_PROTOCOL_DISCRIMINATOR;
|
||||
p->sapi = Q921_SAPI_GR303_TMC_SWITCHING;
|
||||
p->tei = Q921_TEI_GR303_TMC_SWITCHING;
|
||||
} else if (switchtype == PRI_SWITCH_GR303_EOC_PATH) {
|
||||
p->protodisc = GR303_PROTOCOL_DISCRIMINATOR;
|
||||
p->sapi = Q921_SAPI_GR303_EOC;
|
||||
p->tei = Q921_TEI_GR303_EOC_PATH;
|
||||
}
|
||||
/* Start Q.921 layer, Wait if we're the network */
|
||||
if (p)
|
||||
q921_start(p, p->localtype == PRI_CPE);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void pri_call_set_useruser(q931_call *c, const char *userchars)
|
||||
{
|
||||
if (userchars)
|
||||
libpri_copy_string(c->useruserinfo, userchars, sizeof(c->useruserinfo));
|
||||
}
|
||||
|
||||
void pri_sr_set_useruser(struct pri_sr *sr, const char *userchars)
|
||||
{
|
||||
sr->useruserinfo = userchars;
|
||||
}
|
||||
|
||||
int pri_restart(struct pri *pri)
|
||||
{
|
||||
/* Restart Q.921 layer */
|
||||
if (pri) {
|
||||
q921_reset(pri);
|
||||
q921_start(pri, pri->localtype == PRI_CPE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct pri *pri_new(int fd, int nodetype, int switchtype)
|
||||
{
|
||||
return __pri_new_tei(fd, nodetype, switchtype, NULL, __pri_read, __pri_write, NULL, Q921_TEI_PRI, 0);
|
||||
}
|
||||
|
||||
struct pri *pri_new_bri(int fd, int ptpmode, int nodetype, int switchtype)
|
||||
{
|
||||
if (ptpmode)
|
||||
return __pri_new_tei(fd, nodetype, switchtype, NULL, __pri_read, __pri_write, NULL, Q921_TEI_PRI, 1);
|
||||
else
|
||||
return __pri_new_tei(fd, nodetype, switchtype, NULL, __pri_read, __pri_write, NULL, Q921_TEI_GROUP, 1);
|
||||
}
|
||||
|
||||
struct pri *pri_new_cb(int fd, int nodetype, int switchtype, pri_io_cb io_read, pri_io_cb io_write, void *userdata)
|
||||
{
|
||||
if (!io_read)
|
||||
io_read = __pri_read;
|
||||
if (!io_write)
|
||||
io_write = __pri_write;
|
||||
return __pri_new_tei(fd, nodetype, switchtype, NULL, io_read, io_write, userdata, Q921_TEI_PRI, 0);
|
||||
}
|
||||
|
||||
void *pri_get_userdata(struct pri *pri)
|
||||
{
|
||||
return pri ? pri->userdata : NULL;
|
||||
}
|
||||
|
||||
void pri_set_userdata(struct pri *pri, void *userdata)
|
||||
{
|
||||
if (pri)
|
||||
pri->userdata = userdata;
|
||||
}
|
||||
|
||||
void pri_set_nsf(struct pri *pri, int nsf)
|
||||
{
|
||||
if (pri)
|
||||
pri->nsf = nsf;
|
||||
}
|
||||
|
||||
char *pri_event2str(int id)
|
||||
{
|
||||
switch(id) {
|
||||
@@ -80,6 +336,30 @@ char *pri_event2str(int id)
|
||||
return "Restart channel";
|
||||
case PRI_EVENT_RING:
|
||||
return "Ring";
|
||||
case PRI_EVENT_HANGUP:
|
||||
return "Hangup";
|
||||
case PRI_EVENT_RINGING:
|
||||
return "Ringing";
|
||||
case PRI_EVENT_ANSWER:
|
||||
return "Answer";
|
||||
case PRI_EVENT_HANGUP_ACK:
|
||||
return "Hangup ACK";
|
||||
case PRI_EVENT_RESTART_ACK:
|
||||
return "Restart ACK";
|
||||
case PRI_EVENT_FACNAME:
|
||||
return "FacName";
|
||||
case PRI_EVENT_INFO_RECEIVED:
|
||||
return "Info Received";
|
||||
case PRI_EVENT_PROCEEDING:
|
||||
return "Proceeding";
|
||||
case PRI_EVENT_SETUP_ACK:
|
||||
return "Setup ACK";
|
||||
case PRI_EVENT_HANGUP_REQ:
|
||||
return "Hangup Req";
|
||||
case PRI_EVENT_NOTIFY:
|
||||
return "Notify";
|
||||
case PRI_EVENT_PROGRESS:
|
||||
return "Progress";
|
||||
case PRI_EVENT_CONFIG_ERR:
|
||||
return "Configuration Error";
|
||||
default:
|
||||
@@ -92,12 +372,9 @@ pri_event *pri_check_event(struct pri *pri)
|
||||
char buf[1024];
|
||||
int res;
|
||||
pri_event *e;
|
||||
res = read(pri->fd, buf, sizeof(buf));
|
||||
if (res < 0) {
|
||||
if (errno != EAGAIN)
|
||||
fprintf(stderr, "Read on %d failed: %s\n", pri->fd, strerror(errno));
|
||||
res = pri->read_func ? pri->read_func(pri, buf, sizeof(buf)) : 0;
|
||||
if (!res)
|
||||
return NULL;
|
||||
}
|
||||
/* Receive the q921 packet */
|
||||
e = q921_receive(pri, (q921_h *)buf, res);
|
||||
return e;
|
||||
@@ -134,7 +411,7 @@ pri_event *pri_mkerror(struct pri *pri, char *errstr)
|
||||
{
|
||||
/* Return a configuration error */
|
||||
pri->ev.err.e = PRI_EVENT_CONFIG_ERR;
|
||||
strncpy(pri->ev.err.err, errstr, sizeof(pri->ev.err.err) - 1);
|
||||
libpri_copy_string(pri->ev.err.err, errstr, sizeof(pri->ev.err.err));
|
||||
return &pri->ev;
|
||||
}
|
||||
|
||||
@@ -169,6 +446,27 @@ void pri_set_debug(struct pri *pri, int debug)
|
||||
if (!pri)
|
||||
return;
|
||||
pri->debug = debug;
|
||||
if (pri->subchannel)
|
||||
pri_set_debug(pri->subchannel, debug);
|
||||
}
|
||||
|
||||
int pri_get_debug(struct pri *pri)
|
||||
{
|
||||
if (!pri)
|
||||
return -1;
|
||||
if (pri->subchannel)
|
||||
return pri_get_debug(pri->subchannel);
|
||||
return pri->debug;
|
||||
}
|
||||
|
||||
void pri_facility_enable(struct pri *pri)
|
||||
{
|
||||
if (!pri)
|
||||
return;
|
||||
pri->sendfacility = 1;
|
||||
if (pri->subchannel)
|
||||
pri_facility_enable(pri->subchannel);
|
||||
return;
|
||||
}
|
||||
|
||||
int pri_acknowledge(struct pri *pri, q931_call *call, int channel, int info)
|
||||
@@ -178,6 +476,56 @@ int pri_acknowledge(struct pri *pri, q931_call *call, int channel, int info)
|
||||
return q931_alerting(pri, call, channel, info);
|
||||
}
|
||||
|
||||
int pri_proceeding(struct pri *pri, q931_call *call, int channel, int info)
|
||||
{
|
||||
if (!pri || !call)
|
||||
return -1;
|
||||
return q931_call_proceeding(pri, call, channel, info);
|
||||
}
|
||||
|
||||
int pri_progress(struct pri *pri, q931_call *call, int channel, int info)
|
||||
{
|
||||
if (!pri || !call)
|
||||
return -1;
|
||||
return q931_call_progress(pri, call, channel, info);
|
||||
}
|
||||
|
||||
int pri_information(struct pri *pri, q931_call *call, char digit)
|
||||
{
|
||||
if (!pri || !call)
|
||||
return -1;
|
||||
return q931_information(pri, call, digit);
|
||||
}
|
||||
|
||||
int pri_keypad_facility(struct pri *pri, q931_call *call, char *digits)
|
||||
{
|
||||
if (!pri || !call || !digits || !digits[0])
|
||||
return -1;
|
||||
|
||||
return q931_keypad_facility(pri, call, digits);
|
||||
}
|
||||
|
||||
int pri_notify(struct pri *pri, q931_call *call, int channel, int info)
|
||||
{
|
||||
if (!pri || !call)
|
||||
return -1;
|
||||
return q931_notify(pri, call, channel, info);
|
||||
}
|
||||
|
||||
void pri_destroycall(struct pri *pri, q931_call *call)
|
||||
{
|
||||
if (pri && call)
|
||||
__q931_destroycall(pri, call);
|
||||
return;
|
||||
}
|
||||
|
||||
int pri_need_more_info(struct pri *pri, q931_call *call, int channel, int nonisdn)
|
||||
{
|
||||
if (!pri || !call)
|
||||
return -1;
|
||||
return q931_setup_ack(pri, call, channel, nonisdn);
|
||||
}
|
||||
|
||||
int pri_answer(struct pri *pri, q931_call *call, int channel, int nonisdn)
|
||||
{
|
||||
if (!pri || !call)
|
||||
@@ -185,6 +533,8 @@ int pri_answer(struct pri *pri, q931_call *call, int channel, int nonisdn)
|
||||
return q931_connect(pri, call, channel, nonisdn);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* deprecated routines, use pri_hangup */
|
||||
int pri_release(struct pri *pri, q931_call *call, int cause)
|
||||
{
|
||||
if (!pri || !call)
|
||||
@@ -198,6 +548,69 @@ int pri_disconnect(struct pri *pri, q931_call *call, int cause)
|
||||
return -1;
|
||||
return q931_disconnect(pri, call, cause);
|
||||
}
|
||||
#endif
|
||||
|
||||
int pri_channel_bridge(q931_call *call1, q931_call *call2)
|
||||
{
|
||||
if (!call1 || !call2)
|
||||
return -1;
|
||||
|
||||
/* Make sure we have compatible switchtypes */
|
||||
if (call1->pri->switchtype != call2->pri->switchtype)
|
||||
return -1;
|
||||
|
||||
/* Check for bearer capability */
|
||||
if (call1->transcapability != call2->transcapability)
|
||||
return -1;
|
||||
|
||||
/* Check to see if we're on the same PRI */
|
||||
if (call1->pri != call2->pri)
|
||||
return -1;
|
||||
|
||||
switch (call1->pri->switchtype) {
|
||||
case PRI_SWITCH_NI2:
|
||||
case PRI_SWITCH_LUCENT5E:
|
||||
case PRI_SWITCH_ATT4ESS:
|
||||
if (eect_initiate_transfer(call1->pri, call1, call2))
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
break;
|
||||
case PRI_SWITCH_DMS100:
|
||||
if (rlt_initiate_transfer(call1->pri, call1, call2))
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
break;
|
||||
case PRI_SWITCH_QSIG:
|
||||
call1->bridged_call = call2;
|
||||
call2->bridged_call = call1;
|
||||
if (anfpr_initiate_transfer(call1->pri, call1, call2))
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int pri_hangup(struct pri *pri, q931_call *call, int cause)
|
||||
{
|
||||
if (!pri || !call)
|
||||
return -1;
|
||||
if (cause == -1)
|
||||
/* normal clear cause */
|
||||
cause = 16;
|
||||
return q931_hangup(pri, call, cause);
|
||||
}
|
||||
|
||||
int pri_reset(struct pri *pri, int channel)
|
||||
{
|
||||
if (!pri)
|
||||
return -1;
|
||||
return q931_restart(pri, channel);
|
||||
}
|
||||
|
||||
q931_call *pri_new_call(struct pri *pri)
|
||||
{
|
||||
@@ -210,34 +623,291 @@ void pri_dump_event(struct pri *pri, pri_event *e)
|
||||
{
|
||||
if (!pri || !e)
|
||||
return;
|
||||
printf("Event type: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
|
||||
pri_message(pri, "Event type: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
|
||||
switch(e->gen.e) {
|
||||
case PRI_EVENT_DCHAN_UP:
|
||||
case PRI_EVENT_DCHAN_DOWN:
|
||||
break;
|
||||
case PRI_EVENT_CONFIG_ERR:
|
||||
printf("Error: %s", e->err.err);
|
||||
pri_message(pri, "Error: %s", e->err.err);
|
||||
break;
|
||||
case PRI_EVENT_RESTART:
|
||||
printf("Restart on channel %d\n", e->restart.channel);
|
||||
pri_message(pri, "Restart on channel %d\n", e->restart.channel);
|
||||
case PRI_EVENT_RING:
|
||||
printf("Calling number: %s (%s, %s)\n", e->ring.callingnum, pri_plan2str(e->ring.callingplan), pri_pres2str(e->ring.callingpres));
|
||||
printf("Called number: %s (%s)\n", e->ring.callednum, pri_plan2str(e->ring.calledplan));
|
||||
printf("Channel: %d (%s) Reference number: %d\n", e->ring.channel, e->ring.flexible ? "Flexible" : "Not Flexible", e->ring.cref);
|
||||
pri_message(pri, "Calling number: %s (%s, %s)\n", e->ring.callingnum, pri_plan2str(e->ring.callingplan), pri_pres2str(e->ring.callingpres));
|
||||
pri_message(pri, "Called number: %s (%s)\n", e->ring.callednum, pri_plan2str(e->ring.calledplan));
|
||||
pri_message(pri, "Channel: %d (%s) Reference number: %d\n", e->ring.channel, e->ring.flexible ? "Flexible" : "Not Flexible", e->ring.cref);
|
||||
break;
|
||||
case PRI_EVENT_HANGUP:
|
||||
printf("Hangup, reference number: %d, reason: %s\n", e->hangup.cref, pri_cause2str(e->hangup.cause));
|
||||
pri_message(pri, "Hangup, reference number: %d, reason: %s\n", e->hangup.cref, pri_cause2str(e->hangup.cause));
|
||||
break;
|
||||
default:
|
||||
printf("Don't know how to dump events of type %d\n", e->gen.e);
|
||||
pri_message(pri, "Don't know how to dump events of type %d\n", e->gen.e);
|
||||
}
|
||||
}
|
||||
|
||||
int pri_call(struct pri *pri, q931_call *c, int transmode, int channel, int exclusive,
|
||||
int nonisdn, char *caller, int callerplan, int callerpres, char *called,
|
||||
int calledplan,int ulayer1)
|
||||
static void pri_sr_init(struct pri_sr *req)
|
||||
{
|
||||
memset(req, 0, sizeof(struct pri_sr));
|
||||
|
||||
}
|
||||
|
||||
int pri_sr_set_connection_call_independent(struct pri_sr *req)
|
||||
{
|
||||
if (!req)
|
||||
return -1;
|
||||
|
||||
req->justsignalling = 1; /* have to set justsignalling for all those pesky IEs we need to setup */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Don't call any other pri functions on this */
|
||||
int pri_mwi_activate(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres, char *called,
|
||||
int calledplan)
|
||||
{
|
||||
struct pri_sr req;
|
||||
if (!pri || !c)
|
||||
return -1;
|
||||
|
||||
pri_sr_init(&req);
|
||||
pri_sr_set_connection_call_independent(&req);
|
||||
|
||||
req.caller = caller;
|
||||
req.callerplan = callerplan;
|
||||
req.callername = callername;
|
||||
req.callerpres = callerpres;
|
||||
req.called = called;
|
||||
req.calledplan = calledplan;
|
||||
|
||||
if (mwi_message_send(pri, c, &req, 1) < 0) {
|
||||
pri_message(pri, "Unable to send MWI activate message\n");
|
||||
return -1;
|
||||
}
|
||||
/* Do more stuff when we figure out that the CISC stuff works */
|
||||
return q931_setup(pri, c, &req);
|
||||
}
|
||||
|
||||
int pri_mwi_deactivate(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres, char *called,
|
||||
int calledplan)
|
||||
{
|
||||
struct pri_sr req;
|
||||
if (!pri || !c)
|
||||
return -1;
|
||||
|
||||
pri_sr_init(&req);
|
||||
pri_sr_set_connection_call_independent(&req);
|
||||
|
||||
req.caller = caller;
|
||||
req.callerplan = callerplan;
|
||||
req.callername = callername;
|
||||
req.callerpres = callerpres;
|
||||
req.called = called;
|
||||
req.calledplan = calledplan;
|
||||
|
||||
if(mwi_message_send(pri, c, &req, 0) < 0) {
|
||||
pri_message(pri, "Unable to send MWI deactivate message\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return q931_setup(pri, c, &req);
|
||||
}
|
||||
|
||||
int pri_setup(struct pri *pri, q931_call *c, struct pri_sr *req)
|
||||
{
|
||||
if (!pri || !c)
|
||||
return -1;
|
||||
return q931_setup(pri, c, transmode, channel, exclusive, nonisdn, caller, callerplan, callerpres, called, calledplan, ulayer1);
|
||||
|
||||
return q931_setup(pri, c, req);
|
||||
}
|
||||
|
||||
int pri_call(struct pri *pri, q931_call *c, int transmode, int channel, int exclusive,
|
||||
int nonisdn, char *caller, int callerplan, char *callername, int callerpres, char *called,
|
||||
int calledplan,int ulayer1)
|
||||
{
|
||||
struct pri_sr req;
|
||||
if (!pri || !c)
|
||||
return -1;
|
||||
pri_sr_init(&req);
|
||||
req.transmode = transmode;
|
||||
req.channel = channel;
|
||||
req.exclusive = exclusive;
|
||||
req.nonisdn = nonisdn;
|
||||
req.caller = caller;
|
||||
req.callerplan = callerplan;
|
||||
req.callername = callername;
|
||||
req.callerpres = callerpres;
|
||||
req.called = called;
|
||||
req.calledplan = calledplan;
|
||||
req.userl1 = ulayer1;
|
||||
return q931_setup(pri, c, &req);
|
||||
}
|
||||
|
||||
static void (*__pri_error)(struct pri *pri, char *stuff);
|
||||
static void (*__pri_message)(struct pri *pri, char *stuff);
|
||||
|
||||
void pri_set_message(void (*func)(struct pri *pri, char *stuff))
|
||||
{
|
||||
__pri_message = func;
|
||||
}
|
||||
|
||||
void pri_set_error(void (*func)(struct pri *pri, char *stuff))
|
||||
{
|
||||
__pri_error = func;
|
||||
}
|
||||
|
||||
void pri_message(struct pri *pri, char *fmt, ...)
|
||||
{
|
||||
char tmp[1024];
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(tmp, sizeof(tmp), fmt, ap);
|
||||
va_end(ap);
|
||||
if (__pri_message)
|
||||
__pri_message(pri, tmp);
|
||||
else
|
||||
fputs(tmp, stdout);
|
||||
}
|
||||
|
||||
void pri_error(struct pri *pri, char *fmt, ...)
|
||||
{
|
||||
char tmp[1024];
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(tmp, sizeof(tmp), fmt, ap);
|
||||
va_end(ap);
|
||||
if (__pri_error)
|
||||
__pri_error(pri, tmp);
|
||||
else
|
||||
fputs(tmp, stderr);
|
||||
}
|
||||
|
||||
/* Set overlap mode */
|
||||
void pri_set_overlapdial(struct pri *pri,int state)
|
||||
{
|
||||
pri->overlapdial = state;
|
||||
}
|
||||
|
||||
void pri_set_inbanddisconnect(struct pri *pri, unsigned int enable)
|
||||
{
|
||||
pri->acceptinbanddisconnect = (enable != 0);
|
||||
}
|
||||
|
||||
int pri_fd(struct pri *pri)
|
||||
{
|
||||
return pri->fd;
|
||||
}
|
||||
|
||||
char *pri_dump_info_str(struct pri *pri)
|
||||
{
|
||||
char buf[4096];
|
||||
int len = 0;
|
||||
#ifdef LIBPRI_COUNTERS
|
||||
struct q921_frame *f;
|
||||
int q921outstanding = 0;
|
||||
#endif
|
||||
if (!pri)
|
||||
return NULL;
|
||||
|
||||
/* Might be nice to format these a little better */
|
||||
len += sprintf(buf + len, "Switchtype: %s\n", pri_switch2str(pri->switchtype));
|
||||
len += sprintf(buf + len, "Type: %s\n", pri_node2str(pri->localtype));
|
||||
#ifdef LIBPRI_COUNTERS
|
||||
/* Remember that Q921 Counters include Q931 packets (and any retransmissions) */
|
||||
len += sprintf(buf + len, "Q931 RX: %d\n", pri->q931_rxcount);
|
||||
len += sprintf(buf + len, "Q931 TX: %d\n", pri->q931_txcount);
|
||||
len += sprintf(buf + len, "Q921 RX: %d\n", pri->q921_rxcount);
|
||||
len += sprintf(buf + len, "Q921 TX: %d\n", pri->q921_txcount);
|
||||
f = pri->txqueue;
|
||||
while (f) {
|
||||
q921outstanding++;
|
||||
f = f->next;
|
||||
}
|
||||
len += sprintf(buf + len, "Q921 Outstanding: %d\n", q921outstanding);
|
||||
#endif
|
||||
len += sprintf(buf + len, "Window Length: %d/%d\n", pri->windowlen, pri->window);
|
||||
len += sprintf(buf + len, "Sentrej: %d\n", pri->sentrej);
|
||||
len += sprintf(buf + len, "SolicitFbit: %d\n", pri->solicitfbit);
|
||||
len += sprintf(buf + len, "Retrans: %d\n", pri->retrans);
|
||||
len += sprintf(buf + len, "Busy: %d\n", pri->busy);
|
||||
len += sprintf(buf + len, "Overlap Dial: %d\n", pri->overlapdial);
|
||||
len += sprintf(buf + len, "T200 Timer: %d\n", pri->timers[PRI_TIMER_T200]);
|
||||
len += sprintf(buf + len, "T203 Timer: %d\n", pri->timers[PRI_TIMER_T203]);
|
||||
len += sprintf(buf + len, "T305 Timer: %d\n", pri->timers[PRI_TIMER_T305]);
|
||||
len += sprintf(buf + len, "T308 Timer: %d\n", pri->timers[PRI_TIMER_T308]);
|
||||
len += sprintf(buf + len, "T309 Timer: %d\n", pri->timers[PRI_TIMER_T309]);
|
||||
len += sprintf(buf + len, "T313 Timer: %d\n", pri->timers[PRI_TIMER_T313]);
|
||||
len += sprintf(buf + len, "N200 Counter: %d\n", pri->timers[PRI_TIMER_N200]);
|
||||
|
||||
return strdup(buf);
|
||||
}
|
||||
|
||||
int pri_get_crv(struct pri *pri, q931_call *call, int *callmode)
|
||||
{
|
||||
return q931_call_getcrv(pri, call, callmode);
|
||||
}
|
||||
|
||||
int pri_set_crv(struct pri *pri, q931_call *call, int crv, int callmode)
|
||||
{
|
||||
return q931_call_setcrv(pri, call, crv, callmode);
|
||||
}
|
||||
|
||||
void pri_enslave(struct pri *master, struct pri *slave)
|
||||
{
|
||||
if (master && slave)
|
||||
slave->callpool = &master->localpool;
|
||||
}
|
||||
|
||||
struct pri_sr *pri_sr_new(void)
|
||||
{
|
||||
struct pri_sr *req;
|
||||
req = malloc(sizeof(*req));
|
||||
if (req)
|
||||
pri_sr_init(req);
|
||||
return req;
|
||||
}
|
||||
|
||||
void pri_sr_free(struct pri_sr *sr)
|
||||
{
|
||||
free(sr);
|
||||
}
|
||||
|
||||
int pri_sr_set_channel(struct pri_sr *sr, int channel, int exclusive, int nonisdn)
|
||||
{
|
||||
sr->channel = channel;
|
||||
sr->exclusive = exclusive;
|
||||
sr->nonisdn = nonisdn;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pri_sr_set_bearer(struct pri_sr *sr, int transmode, int userl1)
|
||||
{
|
||||
sr->transmode = transmode;
|
||||
sr->userl1 = userl1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pri_sr_set_called(struct pri_sr *sr, char *called, int calledplan, int numcomplete)
|
||||
{
|
||||
sr->called = called;
|
||||
sr->calledplan = calledplan;
|
||||
sr->numcomplete = numcomplete;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pri_sr_set_caller(struct pri_sr *sr, char *caller, char *callername, int callerplan, int callerpres)
|
||||
{
|
||||
sr->caller = caller;
|
||||
sr->callername = callername;
|
||||
sr->callerplan = callerplan;
|
||||
sr->callerpres = callerpres;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pri_sr_set_redirecting(struct pri_sr *sr, char *num, int plan, int pres, int reason)
|
||||
{
|
||||
sr->redirectingnum = num;
|
||||
sr->redirectingplan = plan;
|
||||
sr->redirectingpres = pres;
|
||||
sr->redirectingreason = reason;
|
||||
return 0;
|
||||
}
|
||||
|
||||
2438
pri_facility.c
Normal file
2438
pri_facility.c
Normal file
File diff suppressed because it is too large
Load Diff
325
pri_facility.h
Normal file
325
pri_facility.h
Normal file
@@ -0,0 +1,325 @@
|
||||
/*
|
||||
This file contains all data structures and definitions associated
|
||||
with facility message usage and the ROSE components included
|
||||
within those messages.
|
||||
|
||||
by Matthew Fredrickson <creslin@digium.com>
|
||||
Copyright (C) Digium, Inc. 2004-2005
|
||||
*/
|
||||
|
||||
/*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2 as published by the
|
||||
* Free Software Foundation. See the LICENSE file included with
|
||||
* this program for more details.
|
||||
*
|
||||
* In addition, when this program is distributed with Asterisk in
|
||||
* any form that would qualify as a 'combined work' or as a
|
||||
* 'derivative work' (but not mere aggregation), you can redistribute
|
||||
* and/or modify the combination under the terms of the license
|
||||
* provided with that copy of Asterisk, instead of the license
|
||||
* terms granted here.
|
||||
*/
|
||||
|
||||
#ifndef _PRI_FACILITY_H
|
||||
#define _PRI_FACILITY_H
|
||||
#include "pri_q931.h"
|
||||
|
||||
/* Protocol Profile field */
|
||||
#define Q932_PROTOCOL_ROSE 0x11 /* X.219 & X.229 */
|
||||
#define Q932_PROTOCOL_CMIP 0x12 /* Q.941 */
|
||||
#define Q932_PROTOCOL_ACSE 0x13 /* X.217 & X.227 */
|
||||
#define Q932_PROTOCOL_GAT 0x16
|
||||
#define Q932_PROTOCOL_EXTENSIONS 0x1F
|
||||
|
||||
/* Argument values */
|
||||
#define ROSE_NAME_PRESENTATION_ALLOWED_SIMPLE 0x80
|
||||
#define ROSE_NAME_PRESENTATION_RESTRICTED_NULL 0x87
|
||||
#define ROSE_NAME_NOT_AVAIL 0x84
|
||||
|
||||
/* Component types */
|
||||
#define COMP_TYPE_INTERPRETATION 0x8B
|
||||
#define COMP_TYPE_NETWORK_PROTOCOL_PROFILE 0x92
|
||||
#define COMP_TYPE_INVOKE 0xA1
|
||||
#define COMP_TYPE_RETURN_RESULT 0xA2
|
||||
#define COMP_TYPE_RETURN_ERROR 0xA3
|
||||
#define COMP_TYPE_REJECT 0xA4
|
||||
#define COMP_TYPE_NFE 0xAA
|
||||
|
||||
/* Operation ID values */
|
||||
/* Q.952.7 (ECMA-178) ROSE operations (Transfer) */
|
||||
#define ROSE_CALL_TRANSFER_IDENTIFY 7
|
||||
#define ROSE_CALL_TRANSFER_ABANDON 8
|
||||
#define ROSE_CALL_TRANSFER_INITIATE 9
|
||||
#define ROSE_CALL_TRANSFER_SETUP 10
|
||||
#define ROSE_CALL_TRANSFER_ACTIVE 11
|
||||
#define ROSE_CALL_TRANSFER_COMPLETE 12
|
||||
#define ROSE_CALL_TRANSFER_UPDATE 13
|
||||
#define ROSE_SUBADDRESS_TRANSFER 14
|
||||
/* Q.952 ROSE operations (Diverting) */
|
||||
#define ROSE_DIVERTING_LEG_INFORMATION1 18
|
||||
#define ROSE_DIVERTING_LEG_INFORMATION2 0x15
|
||||
#define ROSE_DIVERTING_LEG_INFORMATION3 19
|
||||
/* Q.956 ROSE operations (Advice Of Charge) */
|
||||
#define ROSE_AOC_NO_CHARGING_INFO_AVAILABLE 26
|
||||
#define ROSE_AOC_CHARGING_REQUEST 30
|
||||
#define ROSE_AOC_AOCS_CURRENCY 31
|
||||
#define ROSE_AOC_AOCS_SPECIAL_ARR 32
|
||||
#define ROSE_AOC_AOCD_CURRENCY 33
|
||||
#define ROSE_AOC_AOCD_CHARGING_UNIT 34
|
||||
#define ROSE_AOC_AOCE_CURRENCY 35
|
||||
#define ROSE_AOC_AOCE_CHARGING_UNIT 36
|
||||
#define ROSE_AOC_IDENTIFICATION_OF_CHARGE 37
|
||||
/* Q.SIG operations */
|
||||
#define SS_CNID_CALLINGNAME 0
|
||||
#define SS_ANFPR_PATHREPLACEMENT 4
|
||||
#define SS_DIVERTING_LEG_INFORMATION2 21
|
||||
#define SS_MWI_ACTIVATE 80
|
||||
#define SS_MWI_DEACTIVATE 81
|
||||
#define SS_MWI_INTERROGATE 82
|
||||
|
||||
/* ROSE definitions and data structures */
|
||||
#define INVOKE_IDENTIFIER 0x02
|
||||
#define INVOKE_LINKED_IDENTIFIER 0x80
|
||||
#define INVOKE_NULL_IDENTIFIER __USE_ASN1_NULL
|
||||
|
||||
/* ASN.1 Identifier Octet - Data types */
|
||||
#define ASN1_TYPE_MASK 0x1f
|
||||
#define ASN1_BOOLEAN 0x01
|
||||
#define ASN1_INTEGER 0x02
|
||||
#define ASN1_BITSTRING 0x03
|
||||
#define ASN1_OCTETSTRING 0x04
|
||||
#define ASN1_NULL 0x05
|
||||
#define ASN1_OBJECTIDENTIFIER 0x06
|
||||
#define ASN1_OBJECTDESCRIPTOR 0x07
|
||||
#define ASN1_EXTERN 0x08
|
||||
#define ASN1_REAL 0x09
|
||||
#define ASN1_ENUMERATED 0x0a
|
||||
#define ASN1_EMBEDDEDPDV 0x0b
|
||||
#define ASN1_UTF8STRING 0x0c
|
||||
#define ASN1_RELATIVEOBJECTID 0x0d
|
||||
/* 0x0e & 0x0f are reserved for future ASN.1 editions */
|
||||
#define ASN1_SEQUENCE 0x10
|
||||
#define ASN1_SET 0x11
|
||||
#define ASN1_NUMERICSTRING 0x12
|
||||
#define ASN1_PRINTABLESTRING 0x13
|
||||
#define ASN1_TELETEXSTRING 0x14
|
||||
#define ASN1_IA5STRING 0x16
|
||||
#define ASN1_UTCTIME 0x17
|
||||
#define ASN1_GENERALIZEDTIME 0x18
|
||||
|
||||
/* ASN.1 Identifier Octet - Tags */
|
||||
#define ASN1_TAG_0 0x00
|
||||
#define ASN1_TAG_1 0x01
|
||||
#define ASN1_TAG_2 0x02
|
||||
#define ASN1_TAG_3 0x03
|
||||
#define ASN1_TAG_4 0x04
|
||||
#define ASN1_TAG_5 0x05
|
||||
#define ASN1_TAG_6 0x06
|
||||
#define ASN1_TAG_7 0x07
|
||||
#define ASN1_TAG_8 0x08
|
||||
#define ASN1_TAG_9 0x09
|
||||
|
||||
/* ASN.1 Identifier Octet - Primitive/Constructor Bit */
|
||||
#define ASN1_PC_MASK 0x20
|
||||
#define ASN1_PRIMITIVE 0x00
|
||||
#define ASN1_CONSTRUCTOR 0x20
|
||||
|
||||
/* ASN.1 Identifier Octet - Clan Bits */
|
||||
#define ASN1_CLAN_MASK 0xc0
|
||||
#define ASN1_UNIVERSAL 0x00
|
||||
#define ASN1_APPLICATION 0x40
|
||||
#define ASN1_CONTEXT_SPECIFIC 0x80
|
||||
#define ASN1_PRIVATE 0xc0
|
||||
|
||||
/* ASN.1 Length masks */
|
||||
#define ASN1_LEN_INDEF 0x80
|
||||
|
||||
|
||||
#define INVOKE_OPERATION_INT __USE_ASN1_INTEGER
|
||||
#define INVOKE_OBJECT_ID __USE_ASN1_OBJECTIDENTIFIER
|
||||
|
||||
/* Q.952 Divert cause */
|
||||
#define Q952_DIVERT_REASON_UNKNOWN 0x00
|
||||
#define Q952_DIVERT_REASON_CFU 0x01
|
||||
#define Q952_DIVERT_REASON_CFB 0x02
|
||||
#define Q952_DIVERT_REASON_CFNR 0x03
|
||||
#define Q952_DIVERT_REASON_CD 0x04
|
||||
#define Q952_DIVERT_REASON_IMMEDIATE 0x05
|
||||
/* Q.SIG Divert cause. Listed in ECMA-174 */
|
||||
#define QSIG_DIVERT_REASON_UNKNOWN 0x00 /* Call forward unknown reason */
|
||||
#define QSIG_DIVERT_REASON_CFU 0x01 /* Call Forward Unconditional (other reason) */
|
||||
#define QSIG_DIVERT_REASON_CFB 0x02 /* Call Forward Busy */
|
||||
#define QSIG_DIVERT_REASON_CFNR 0x03 /* Call Forward No Reply */
|
||||
|
||||
/* Q.932 Type of number */
|
||||
#define Q932_TON_UNKNOWN 0x00
|
||||
#define Q932_TON_INTERNATIONAL 0x01
|
||||
#define Q932_TON_NATIONAL 0x02
|
||||
#define Q932_TON_NET_SPECIFIC 0x03
|
||||
#define Q932_TON_SUBSCRIBER 0x04
|
||||
#define Q932_TON_ABBREVIATED 0x06
|
||||
|
||||
/* RLT related Operations */
|
||||
#define RLT_SERVICE_ID 0x3e
|
||||
#define RLT_OPERATION_IND 0x01
|
||||
#define RLT_THIRD_PARTY 0x02
|
||||
|
||||
struct rose_component {
|
||||
u_int8_t type;
|
||||
u_int8_t len;
|
||||
u_int8_t data[0];
|
||||
};
|
||||
|
||||
#if 1
|
||||
#define GET_COMPONENT(component, idx, ptr, length) \
|
||||
if ((idx)+2 > (length)) \
|
||||
break; \
|
||||
(component) = (struct rose_component*)&((ptr)[idx]); \
|
||||
if ((idx)+(component)->len+2 > (length)) { \
|
||||
if ((component)->len != ASN1_LEN_INDEF) \
|
||||
pri_message(pri, "Length (%d) of 0x%X component is too long\n", (component)->len, (component)->type); \
|
||||
}
|
||||
#else /* Debugging */
|
||||
#define GET_COMPONENT(component, idx, ptr, length) \
|
||||
if ((idx)+2 > (length)) \
|
||||
break; \
|
||||
(component) = (struct rose_component*)&((ptr)[idx]); \
|
||||
if ((idx)+(component)->len+2 > (length)) { \
|
||||
if ((component)->len != 128) \
|
||||
pri_message(pri, "Length (%d) of 0x%X component is too long\n", (component)->len, (component)->type); \
|
||||
} \
|
||||
pri_message(pri, "XX %s:%d Got component %d (0x%02X), length %d\n", __FUNCTION__, __LINE__, (component)->type, (component)->type, (component)->len); \
|
||||
if ((component)->len > 0) { \
|
||||
int zzz; \
|
||||
pri_message(pri, "XX Data:"); \
|
||||
for (zzz = 0; zzz < (component)->len; ++zzz) \
|
||||
pri_message(pri, " %02X", (component)->data[zzz]); \
|
||||
pri_message(pri, "\n"); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define NEXT_COMPONENT(component, idx) \
|
||||
(idx) += (component)->len + 2
|
||||
|
||||
#define SUB_COMPONENT(component, idx) \
|
||||
(idx) += 2
|
||||
|
||||
#define CHECK_COMPONENT(component, comptype, message) \
|
||||
if ((component)->type && ((component)->type & ASN1_TYPE_MASK) != (comptype)) { \
|
||||
pri_message(pri, (message), (component)->type); \
|
||||
asn1_dump(pri, (component), (component)->len+2); \
|
||||
break; \
|
||||
}
|
||||
|
||||
#define ASN1_GET_INTEGER(component, variable) \
|
||||
do { \
|
||||
int comp_idx; \
|
||||
(variable) = 0; \
|
||||
for (comp_idx = 0; comp_idx < (component)->len; ++comp_idx) \
|
||||
(variable) = ((variable) << 8) | (component)->data[comp_idx]; \
|
||||
} while (0)
|
||||
|
||||
#define ASN1_FIXUP_LEN(component, size) \
|
||||
do { \
|
||||
if ((component)->len == ASN1_LEN_INDEF) \
|
||||
size += 2; \
|
||||
} while (0)
|
||||
|
||||
#define ASN1_ADD_SIMPLE(component, comptype, ptr, idx) \
|
||||
do { \
|
||||
(component) = (struct rose_component *)&((ptr)[(idx)]); \
|
||||
(component)->type = (comptype); \
|
||||
(component)->len = 0; \
|
||||
(idx) += 2; \
|
||||
} while (0)
|
||||
|
||||
#define ASN1_ADD_BYTECOMP(component, comptype, ptr, idx, value) \
|
||||
do { \
|
||||
(component) = (struct rose_component *)&((ptr)[(idx)]); \
|
||||
(component)->type = (comptype); \
|
||||
(component)->len = 1; \
|
||||
(component)->data[0] = (value); \
|
||||
(idx) += 3; \
|
||||
} while (0)
|
||||
|
||||
#define ASN1_ADD_WORDCOMP(component, comptype, ptr, idx, value) \
|
||||
do { \
|
||||
int __val = (value); \
|
||||
int __i = 0; \
|
||||
(component) = (struct rose_component *)&((ptr)[(idx)]); \
|
||||
(component)->type = (comptype); \
|
||||
if ((__val >> 24)) \
|
||||
(component)->data[__i++] = (__val >> 24) & 0xff; \
|
||||
if ((__val >> 16)) \
|
||||
(component)->data[__i++] = (__val >> 16) & 0xff; \
|
||||
if ((__val >> 8)) \
|
||||
(component)->data[__i++] = (__val >> 8) & 0xff; \
|
||||
(component)->data[__i++] = __val & 0xff; \
|
||||
(component)->len = __i; \
|
||||
(idx) += 2 + __i; \
|
||||
} while (0)
|
||||
|
||||
#define ASN1_PUSH(stack, stackpointer, component) \
|
||||
(stack)[(stackpointer)++] = (component)
|
||||
|
||||
#define ASN1_FIXUP(stack, stackpointer, data, idx) \
|
||||
do { \
|
||||
--(stackpointer); \
|
||||
(stack)[(stackpointer)]->len = (unsigned char *)&((data)[(idx)]) - (unsigned char *)(stack)[(stackpointer)] - 2; \
|
||||
} while (0)
|
||||
|
||||
/* Decoder for the invoke ROSE component */
|
||||
int rose_invoke_decode(struct pri *pri, struct q931_call *call, q931_ie *ie, unsigned char *data, int len);
|
||||
|
||||
/* Decoder for the return result ROSE component */
|
||||
int rose_return_result_decode(struct pri *pri, struct q931_call *call, q931_ie *ie, unsigned char *data, int len);
|
||||
|
||||
/* Decoder for the return error ROSE component */
|
||||
int rose_return_error_decode(struct pri *pri, struct q931_call *call, q931_ie *ie, unsigned char *data, int len);
|
||||
|
||||
/* Decoder for the reject ROSE component */
|
||||
int rose_reject_decode(struct pri *pri, struct q931_call *call, q931_ie *ie, unsigned char *data, int len);
|
||||
|
||||
int asn1_copy_string(char * buf, int buflen, struct rose_component *comp);
|
||||
|
||||
int asn1_string_encode(unsigned char asn1_type, void *data, int len, int max_len, void *src, int src_len);
|
||||
|
||||
/* Get Name types from ASN.1 */
|
||||
int asn1_name_decode(void * data, int len, char *namebuf, int buflen);
|
||||
|
||||
int typeofnumber_from_q931(struct pri *pri, int ton);
|
||||
|
||||
int redirectingreason_from_q931(struct pri *pri, int redirectingreason);
|
||||
|
||||
/* Queues an MWI apdu on a the given call */
|
||||
int mwi_message_send(struct pri *pri, q931_call *call, struct pri_sr *req, int activate);
|
||||
|
||||
/* starts a 2BCT */
|
||||
int eect_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2);
|
||||
|
||||
int rlt_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2);
|
||||
|
||||
/* starts a QSIG Path Replacement */
|
||||
extern int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2);
|
||||
|
||||
/* Use this function to queue a facility-IE born APDU onto a call
|
||||
* call is the call to use, messagetype is any one of the Q931 messages,
|
||||
* apdu is the apdu data, apdu_len is the length of the apdu data */
|
||||
int pri_call_apdu_queue(q931_call *call, int messagetype, void *apdu, int apdu_len, void (*function)(void *data), void *data);
|
||||
|
||||
/* Used by q931.c to cleanup the apdu queue upon destruction of a call */
|
||||
int pri_call_apdu_queue_cleanup(q931_call *call);
|
||||
|
||||
/* Adds the "standard" APDUs to a call */
|
||||
int pri_call_add_standard_apdus(struct pri *pri, q931_call *call);
|
||||
|
||||
int asn1_dump(struct pri *pri, void *comp, int len);
|
||||
|
||||
#endif /* _PRI_FACILITY_H */
|
||||
227
pri_internal.h
Executable file → Normal file
227
pri_internal.h
Executable file → Normal file
@@ -1,32 +1,41 @@
|
||||
/*
|
||||
* libpri: An implementation of Primary Rate ISDN
|
||||
*
|
||||
* Written by Mark Spencer <markster@linux-support.net>
|
||||
* Written by Mark Spencer <markster@digium.com>
|
||||
*
|
||||
* Copyright (C) 2001, Linux Support Services, Inc.
|
||||
* Copyright (C) 2001, Digium, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2 as published by the
|
||||
* Free Software Foundation. See the LICENSE file included with
|
||||
* this program for more details.
|
||||
*
|
||||
* In addition, when this program is distributed with Asterisk in
|
||||
* any form that would qualify as a 'combined work' or as a
|
||||
* 'derivative work' (but not mere aggregation), you can redistribute
|
||||
* and/or modify the combination under the terms of the license
|
||||
* provided with that copy of Asterisk, instead of the license
|
||||
* terms granted here.
|
||||
*/
|
||||
|
||||
#ifndef _PRI_INTERNAL_H
|
||||
#define _PRI_INTERNAL_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define DBGHEAD __FILE__ ":%d %s: "
|
||||
#define DBGINFO __LINE__,__PRETTY_FUNCTION__
|
||||
|
||||
struct pri_sched {
|
||||
struct timeval when;
|
||||
void (*callback)(void *data);
|
||||
@@ -40,24 +49,40 @@ enum q931_mode;
|
||||
/* No more than 128 scheduled events */
|
||||
#define MAX_SCHED 128
|
||||
|
||||
#define MAX_TIMERS 32
|
||||
|
||||
struct pri {
|
||||
int fd; /* File descriptor for D-Channel */
|
||||
pri_io_cb read_func; /* Read data callback */
|
||||
pri_io_cb write_func; /* Write data callback */
|
||||
void *userdata;
|
||||
struct pri *subchannel; /* Sub-channel if appropriate */
|
||||
struct pri *master; /* Master channel if appropriate */
|
||||
struct pri_sched pri_sched[MAX_SCHED]; /* Scheduled events */
|
||||
int debug; /* Debug stuff */
|
||||
int state; /* State of D-channel */
|
||||
int switchtype; /* Switch type */
|
||||
int nsf; /* Network-Specific Facility (if any) */
|
||||
int localtype; /* Local network type (unknown, network, cpe) */
|
||||
int remotetype; /* Remote network type (unknown, network, cpe) */
|
||||
|
||||
int sapi;
|
||||
int tei;
|
||||
int protodisc;
|
||||
unsigned int bri:1;
|
||||
unsigned int acceptinbanddisconnect:1; /* Should we allow inband progress after DISCONNECT? */
|
||||
|
||||
/* Q.921 State */
|
||||
int q921_state;
|
||||
int window; /* Max window size */
|
||||
int windowlen; /* Fullness of window */
|
||||
int v_s; /* Next N(S) for transmission */
|
||||
int v_a; /* Last acknowledged frame */
|
||||
int v_r; /* Next frame expected to be received */
|
||||
int v_na; /* What we've told our peer we've acknowledged */
|
||||
int solicitfbit; /* Have we sent an I or S frame with the F-bit set? */
|
||||
int retrans; /* Retransmissions */
|
||||
int sentrej; /* Are we in reject state */
|
||||
|
||||
int cref; /* Next call reference value */
|
||||
|
||||
@@ -65,9 +90,15 @@ struct pri {
|
||||
|
||||
/* Various timers */
|
||||
int sabme_timer; /* SABME retransmit */
|
||||
int sabme_count; /* SABME retransmit counter for BRI */
|
||||
int t203_timer; /* Max idle time */
|
||||
int t202_timer;
|
||||
int n202_counter;
|
||||
int ri;
|
||||
int t200_timer; /* T-200 retransmission timer */
|
||||
|
||||
/* All ISDN Timer values */
|
||||
int timers[MAX_TIMERS];
|
||||
|
||||
/* Used by scheduler */
|
||||
struct timeval tv;
|
||||
int schedev;
|
||||
@@ -77,7 +108,159 @@ struct pri {
|
||||
struct q921_frame *txqueue;
|
||||
|
||||
/* Q.931 calls */
|
||||
q931_call *calls;
|
||||
q931_call **callpool;
|
||||
q931_call *localpool;
|
||||
|
||||
/* do we do overlap dialing */
|
||||
int overlapdial;
|
||||
|
||||
#ifdef LIBPRI_COUNTERS
|
||||
/* q921/q931 packet counters */
|
||||
unsigned int q921_txcount;
|
||||
unsigned int q921_rxcount;
|
||||
unsigned int q931_txcount;
|
||||
unsigned int q931_rxcount;
|
||||
#endif
|
||||
|
||||
unsigned char last_invoke; /* Last ROSE invoke ID */
|
||||
unsigned char sendfacility;
|
||||
};
|
||||
|
||||
struct pri_sr {
|
||||
int transmode;
|
||||
int channel;
|
||||
int exclusive;
|
||||
int nonisdn;
|
||||
char *caller;
|
||||
int callerplan;
|
||||
char *callername;
|
||||
int callerpres;
|
||||
char *called;
|
||||
int calledplan;
|
||||
int userl1;
|
||||
int numcomplete;
|
||||
char *redirectingnum;
|
||||
int redirectingplan;
|
||||
int redirectingpres;
|
||||
int redirectingreason;
|
||||
int justsignalling;
|
||||
const char *useruserinfo;
|
||||
int transferable;
|
||||
};
|
||||
|
||||
/* Internal switch types */
|
||||
#define PRI_SWITCH_GR303_EOC_PATH 19
|
||||
#define PRI_SWITCH_GR303_TMC_SWITCHING 20
|
||||
|
||||
struct apdu_event {
|
||||
int message; /* What message to send the ADPU in */
|
||||
void (*callback)(void *data); /* Callback function for when response is received */
|
||||
void *data; /* Data to callback */
|
||||
unsigned char apdu[255]; /* ADPU to send */
|
||||
int apdu_len; /* Length of ADPU */
|
||||
int sent; /* Have we been sent already? */
|
||||
struct apdu_event *next; /* Linked list pointer */
|
||||
};
|
||||
|
||||
/* q931_call datastructure */
|
||||
|
||||
struct q931_call {
|
||||
struct pri *pri; /* PRI */
|
||||
int cr; /* Call Reference */
|
||||
int forceinvert; /* Force inversion of call number even if 0 */
|
||||
q931_call *next;
|
||||
/* Slotmap specified (bitmap of channels 31/24-1) (Channel Identifier IE) (-1 means not specified) */
|
||||
int slotmap;
|
||||
/* An explicit channel (Channel Identifier IE) (-1 means not specified) */
|
||||
int channelno;
|
||||
/* An explicit DS1 (-1 means not specified) */
|
||||
int ds1no;
|
||||
/* Whether or not the ds1 is explicitly identified or implicit. If implicit
|
||||
the bchan is on the same span as the current active dchan (NFAS) */
|
||||
int ds1explicit;
|
||||
/* Channel flags (0 means none retrieved) */
|
||||
int chanflags;
|
||||
|
||||
int alive; /* Whether or not the call is alive */
|
||||
int acked; /* Whether setup has been acked or not */
|
||||
int sendhangupack; /* Whether or not to send a hangup ack */
|
||||
int proc; /* Whether we've sent a call proceeding / alerting */
|
||||
|
||||
int ri; /* Restart Indicator (Restart Indicator IE) */
|
||||
|
||||
/* Bearer Capability */
|
||||
int transcapability;
|
||||
int transmoderate;
|
||||
int transmultiple;
|
||||
int userl1;
|
||||
int userl2;
|
||||
int userl3;
|
||||
int rateadaption;
|
||||
|
||||
int sentchannel;
|
||||
int justsignalling; /* for a signalling-only connection */
|
||||
|
||||
int progcode; /* Progress coding */
|
||||
int progloc; /* Progress Location */
|
||||
int progress; /* Progress indicator */
|
||||
int progressmask; /* Progress Indicator bitmask */
|
||||
|
||||
int notify; /* Notification */
|
||||
|
||||
int causecode; /* Cause Coding */
|
||||
int causeloc; /* Cause Location */
|
||||
int cause; /* Cause of clearing */
|
||||
|
||||
int peercallstate; /* Call state of peer as reported */
|
||||
int ourcallstate; /* Our call state */
|
||||
int sugcallstate; /* Status call state */
|
||||
|
||||
int callerplan;
|
||||
int callerplanani;
|
||||
int callerpres; /* Caller presentation */
|
||||
char callerani[256]; /* Caller */
|
||||
char callernum[256];
|
||||
char callername[256];
|
||||
|
||||
char keypad_digits[64]; /* Buffer for digits that come in KEYPAD_FACILITY */
|
||||
|
||||
int ani2; /* ANI II */
|
||||
|
||||
int calledplan;
|
||||
int nonisdn;
|
||||
char callednum[256]; /* Called Number */
|
||||
int complete; /* no more digits coming */
|
||||
int newcall; /* if the received message has a new call reference value */
|
||||
|
||||
int retranstimer; /* Timer for retransmitting DISC */
|
||||
int t308_timedout; /* Whether t308 timed out once */
|
||||
|
||||
int redirectingplan;
|
||||
int redirectingpres;
|
||||
int redirectingreason;
|
||||
char redirectingnum[256]; /* Number of redirecting party */
|
||||
char redirectingname[256]; /* Name of redirecting party */
|
||||
|
||||
/* Filled in cases of multiple diversions */
|
||||
int origcalledplan;
|
||||
int origcalledpres;
|
||||
int origredirectingreason; /* Original reason for redirect (in cases of multiple redirects) */
|
||||
char origcalledname[256]; /* Original name of person being called */
|
||||
char origcallednum[256]; /* Orignal number of person being called */
|
||||
|
||||
int useruserprotocoldisc;
|
||||
char useruserinfo[256];
|
||||
char callingsubaddr[256]; /* Calling parties sub address */
|
||||
|
||||
long aoc_units; /* Advice of Charge Units */
|
||||
|
||||
struct apdu_event *apdus; /* APDU queue for call */
|
||||
|
||||
int transferable;
|
||||
unsigned int rlt_call_id; /* RLT call id */
|
||||
|
||||
/* Bridged call info */
|
||||
q931_call *bridged_call; /* Pointer to other leg of bridged call */
|
||||
};
|
||||
|
||||
extern int pri_schedule_event(struct pri *pri, int ms, void (*function)(void *data), void *data);
|
||||
@@ -88,4 +271,14 @@ extern void pri_schedule_del(struct pri *pri, int ev);
|
||||
|
||||
extern pri_event *pri_mkerror(struct pri *pri, char *errstr);
|
||||
|
||||
extern void pri_message(struct pri *pri, char *fmt, ...);
|
||||
|
||||
extern void pri_error(struct pri *pri, char *fmt, ...);
|
||||
|
||||
void libpri_copy_string(char *dst, const char *src, size_t size);
|
||||
|
||||
struct pri *__pri_new_tei(int fd, int node, int switchtype, struct pri *master, pri_io_cb rd, pri_io_cb wr, void *userdata, int tei, int bri);
|
||||
|
||||
void __pri_free_tei(struct pri *p);
|
||||
|
||||
#endif
|
||||
|
||||
86
pri_q921.h
Executable file → Normal file
86
pri_q921.h
Executable file → Normal file
@@ -1,40 +1,49 @@
|
||||
/*
|
||||
* libpri: An implementation of Primary Rate ISDN
|
||||
*
|
||||
* Written by Mark Spencer <markster@linux-support.net>
|
||||
* Written by Mark Spencer <markster@digium.com>
|
||||
*
|
||||
* Copyright (C) 2001, Linux Support Services, Inc.
|
||||
* Copyright (C) 2001, Digium, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2 as published by the
|
||||
* Free Software Foundation. See the LICENSE file included with
|
||||
* this program for more details.
|
||||
*
|
||||
* In addition, when this program is distributed with Asterisk in
|
||||
* any form that would qualify as a 'combined work' or as a
|
||||
* 'derivative work' (but not mere aggregation), you can redistribute
|
||||
* and/or modify the combination under the terms of the license
|
||||
* provided with that copy of Asterisk, instead of the license
|
||||
* terms granted here.
|
||||
*/
|
||||
|
||||
#ifndef _PRI_Q921_H
|
||||
#define _PRI_Q921_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#if defined(__linux__)
|
||||
#include <endian.h>
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <sys/endian.h>
|
||||
#define __BYTE_ORDER _BYTE_ORDER
|
||||
#define __BIG_ENDIAN _BIG_ENDIAN
|
||||
#define __LITTLE_ENDIAN _LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
/* Timer values */
|
||||
|
||||
#define T_WAIT_MIN 2000
|
||||
#define T_WAIT_MAX 10000
|
||||
#define T_200 1000 /* 1 second between SABME's */
|
||||
#define T_203 10000 /* 10 seconds with no packets max */
|
||||
#define N_200 3 /* 3 retries */
|
||||
|
||||
#define Q921_FRAMETYPE_MASK 0x3
|
||||
|
||||
@@ -42,14 +51,32 @@
|
||||
#define Q921_FRAMETYPE_I 0x0
|
||||
#define Q921_FRAMETYPE_S 0x1
|
||||
|
||||
#define Q921_TEI_GROUP 127
|
||||
#define Q921_TEI_GROUP 127
|
||||
#define Q921_TEI_PRI 0
|
||||
#define Q921_TEI_GR303_EOC_PATH 0
|
||||
#define Q921_TEI_GR303_EOC_OPS 4
|
||||
#define Q921_TEI_GR303_TMC_SWITCHING 0
|
||||
#define Q921_TEI_GR303_TMC_CALLPROC 0
|
||||
|
||||
#define Q921_SAPI_CALL_CTRL 0
|
||||
#define Q921_SAPI_GR303_EOC 1
|
||||
#define Q921_SAPI_GR303_TMC_SWITCHING 1
|
||||
#define Q921_SAPI_GR303_TMC_CALLPROC 0
|
||||
|
||||
|
||||
#define Q921_SAPI_CALL_CTRL 0
|
||||
#define Q921_SAPI_PACKET_MODE 1
|
||||
#define Q921_SAPI_X25_LAYER3 16
|
||||
#define Q921_SAPI_LAYER2_MANAGEMENT 63
|
||||
|
||||
|
||||
#define Q921_TEI_IDENTITY_REQUEST 1
|
||||
#define Q921_TEI_IDENTITY_ASSIGNED 2
|
||||
#define Q921_TEI_IDENTITY_DENIED 3
|
||||
#define Q921_TEI_IDENTITY_CHECK_REQUEST 4
|
||||
#define Q921_TEI_IDENTITY_CHECK_RESPONSE 5
|
||||
#define Q921_TEI_IDENTITY_REMOVE 6
|
||||
#define Q921_TEI_IDENTITY_VERIFY 7
|
||||
|
||||
typedef struct q921_header {
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
u_int8_t sapi:6; /* Service Access Point Indentifier (always 0 for PRI) (0) */
|
||||
@@ -65,7 +92,7 @@ typedef struct q921_header {
|
||||
u_int8_t tei:7; /* Terminal Endpoint Identifier (0) */
|
||||
#endif
|
||||
u_int8_t data[0]; /* Further data */
|
||||
} q921_header;
|
||||
} __attribute__ ((packed)) q921_header;
|
||||
|
||||
/* A Supervisory Format frame */
|
||||
typedef struct q921_s {
|
||||
@@ -85,7 +112,7 @@ typedef struct q921_s {
|
||||
#endif
|
||||
u_int8_t data[0]; /* Any further data */
|
||||
u_int8_t fcs[2]; /* At least an FCS */
|
||||
} q921_s;
|
||||
} __attribute__ ((packed)) q921_s;
|
||||
|
||||
/* An Unnumbered Format frame */
|
||||
typedef struct q921_u {
|
||||
@@ -103,7 +130,7 @@ typedef struct q921_u {
|
||||
#endif
|
||||
u_int8_t data[0]; /* Any further data */
|
||||
u_int8_t fcs[2]; /* At least an FCS */
|
||||
} q921_u;
|
||||
} __attribute__ ((packed)) q921_u;
|
||||
|
||||
/* An Information frame */
|
||||
typedef struct q921_i {
|
||||
@@ -134,12 +161,19 @@ typedef union {
|
||||
typedef struct q921_frame {
|
||||
struct q921_frame *next; /* Next in list */
|
||||
int len; /* Length of header + body */
|
||||
int transmitted; /* Have we been transmitted */
|
||||
q921_i h;
|
||||
} q921_frame;
|
||||
|
||||
#define Q921_INC(j) (j) = ((j) + 1) % 128
|
||||
#define Q921_INC(j) (j) = (((j) + 1) % 128)
|
||||
|
||||
typedef enum q921_state {
|
||||
Q921_DOWN = 0,
|
||||
Q921_TEI_UNASSIGNED,
|
||||
Q921_TEI_AWAITING_ESTABLISH,
|
||||
Q921_TEI_AWAITING_ASSIGN,
|
||||
Q921_TEI_ASSIGNED,
|
||||
Q921_NEGOTIATION,
|
||||
Q921_LINK_CONNECTION_RELEASED, /* Also known as TEI_ASSIGNED */
|
||||
Q921_LINK_CONNECTION_ESTABLISHED,
|
||||
Q921_AWAITING_ESTABLISH,
|
||||
@@ -147,10 +181,10 @@ typedef enum q921_state {
|
||||
} q921_state;
|
||||
|
||||
/* Dumps a *known good* Q.921 packet */
|
||||
extern void q921_dump(q921_h *h, int len, int showraw, int txrx);
|
||||
extern void q921_dump(struct pri *pri, q921_h *h, int len, int showraw, int txrx);
|
||||
|
||||
/* Bring up the D-channel */
|
||||
extern void q921_start(struct pri *pri);
|
||||
extern void q921_start(struct pri *pri, int now);
|
||||
|
||||
extern void q921_reset(struct pri *pri);
|
||||
|
||||
|
||||
122
pri_q931.h
Executable file → Normal file
122
pri_q931.h
Executable file → Normal file
@@ -1,25 +1,30 @@
|
||||
/*
|
||||
* libpri: An implementation of Primary Rate ISDN
|
||||
*
|
||||
* Written by Mark Spencer <markster@linux-support.net>
|
||||
* Written by Mark Spencer <markster@digium.com>
|
||||
*
|
||||
* Copyright (C) 2001, Linux Support Services, Inc.
|
||||
* Copyright (C) 2001, Digium, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2 as published by the
|
||||
* Free Software Foundation. See the LICENSE file included with
|
||||
* this program for more details.
|
||||
*
|
||||
* In addition, when this program is distributed with Asterisk in
|
||||
* any form that would qualify as a 'combined work' or as a
|
||||
* 'derivative work' (but not mere aggregation), you can redistribute
|
||||
* and/or modify the combination under the terms of the license
|
||||
* provided with that copy of Asterisk, instead of the license
|
||||
* terms granted here.
|
||||
*/
|
||||
|
||||
#ifndef _PRI_Q931_H
|
||||
@@ -81,7 +86,7 @@ typedef struct q931_h {
|
||||
#endif
|
||||
u_int8_t contents[0];
|
||||
u_int8_t crv[3];
|
||||
} q931_h;
|
||||
} __attribute__ ((packed)) q931_h;
|
||||
|
||||
|
||||
/* Message type header */
|
||||
@@ -94,25 +99,20 @@ typedef struct q931_mh {
|
||||
u_int8_t f:1;
|
||||
#endif
|
||||
u_int8_t data[0];
|
||||
} q931_mh;
|
||||
} __attribute__ ((packed)) q931_mh;
|
||||
|
||||
/* Information element format */
|
||||
typedef struct q931_ie {
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
u_int8_t f:1;
|
||||
u_int8_t ie:7;
|
||||
#else
|
||||
u_int8_t ie:7;
|
||||
u_int8_t f:1;
|
||||
#endif
|
||||
u_int8_t ie;
|
||||
u_int8_t len;
|
||||
u_int8_t data[0];
|
||||
} q931_ie;
|
||||
} __attribute__ ((packed)) q931_ie;
|
||||
|
||||
#define Q931_RES_HAVEEVENT (1 << 0)
|
||||
#define Q931_RES_INERRROR (1 << 1)
|
||||
|
||||
#define Q931_PROTOCOL_DISCRIMINATOR 0x08
|
||||
#define GR303_PROTOCOL_DISCRIMINATOR 0x4f
|
||||
|
||||
/* Q.931 / National ISDN Message Types */
|
||||
|
||||
@@ -165,6 +165,7 @@ typedef struct q931_ie {
|
||||
|
||||
/* Q.931 / National ISDN Information Elements */
|
||||
#define Q931_LOCKING_SHIFT 0x90
|
||||
#define Q931_NON_LOCKING_SHIFT 0x98
|
||||
#define Q931_BEARER_CAPABILITY 0x04
|
||||
#define Q931_CAUSE 0x08
|
||||
#define Q931_CALL_STATE 0x14
|
||||
@@ -190,14 +191,21 @@ typedef struct q931_ie {
|
||||
#define Q931_LOW_LAYER_COMPAT 0x7c
|
||||
#define Q931_HIGH_LAYER_COMPAT 0x7d
|
||||
|
||||
#define Q931_CODESET(x) ((x) << 8)
|
||||
#define Q931_IE_CODESET(x) ((x) >> 8)
|
||||
#define Q931_IE_IE(x) ((x) & 0xff)
|
||||
#define Q931_FULL_IE(codeset, ie) (((codeset) << 8) | ((ie) & 0xff))
|
||||
|
||||
#define Q931_DISPLAY 0x28
|
||||
#define Q931_IE_SEGMENTED_MSG 0x00
|
||||
#define Q931_IE_CHANGE_STATUS 0x01
|
||||
#define Q931_IE_CONNECTED_NUM 0x0C
|
||||
#define Q931_IE_ORIGINATING_LINE_INFO (0x01 | Q931_CODESET(6))
|
||||
#define Q931_IE_CONNECTED_ADDR 0x0C
|
||||
#define Q931_IE_CONNECTED_NUM 0x4C
|
||||
#define Q931_IE_CALL_IDENTITY 0x10
|
||||
#define Q931_IE_FACILITY 0x1c
|
||||
#define Q931_IE_ENDPOINT_ID 0x26
|
||||
#define Q931_IE_NOTIFY_IND 0x27
|
||||
#define Q931_IE_DISPLAY 0x28
|
||||
#define Q931_IE_TIME_DATE 0x29
|
||||
#define Q931_IE_KEYPAD_FACILITY 0x2c
|
||||
#define Q931_IE_CALL_STATUS 0x2d
|
||||
@@ -205,6 +213,7 @@ typedef struct q931_ie {
|
||||
#define Q931_IE_INFO_REQUEST 0x32
|
||||
#define Q931_IE_SIGNAL 0x34
|
||||
#define Q931_IE_SWITCHHOOK 0x36
|
||||
#define Q931_IE_GENERIC_DIGITS (0x37 | Q931_CODESET(6))
|
||||
#define Q931_IE_FEATURE_ACTIVATE 0x38
|
||||
#define Q931_IE_FEATURE_IND 0x39
|
||||
#define Q931_IE_ORIGINAL_CALLED_NUMBER 0x73
|
||||
@@ -214,14 +223,50 @@ typedef struct q931_ie {
|
||||
#define Q931_IE_USER_USER 0x7E
|
||||
#define Q931_IE_ESCAPE_FOR_EXT 0x7F
|
||||
|
||||
|
||||
/* Call state stuff */
|
||||
#define Q931_CALL_STATE_NULL 0
|
||||
#define Q931_CALL_STATE_CALL_INITIATED 1
|
||||
#define Q931_CALL_STATE_OVERLAP_SENDING 2
|
||||
#define Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING 3
|
||||
#define Q931_CALL_STATE_CALL_DELIVERED 4
|
||||
#define Q931_CALL_STATE_CALL_PRESENT 6
|
||||
#define Q931_CALL_STATE_CALL_RECEIVED 7
|
||||
#define Q931_CALL_STATE_CONNECT_REQUEST 8
|
||||
#define Q931_CALL_STATE_INCOMING_CALL_PROCEEDING 9
|
||||
#define Q931_CALL_STATE_ACTIVE 10
|
||||
#define Q931_CALL_STATE_DISCONNECT_REQUEST 11
|
||||
#define Q931_CALL_STATE_DISCONNECT_INDICATION 12
|
||||
#define Q931_CALL_STATE_SUSPEND_REQUEST 15
|
||||
#define Q931_CALL_STATE_RESUME_REQUEST 17
|
||||
#define Q931_CALL_STATE_RELEASE_REQUEST 19
|
||||
#define Q931_CALL_STATE_OVERLAP_RECEIVING 25
|
||||
#define Q931_CALL_STATE_RESTART_REQUEST 61
|
||||
#define Q931_CALL_STATE_RESTART 62
|
||||
|
||||
|
||||
/* EuroISDN */
|
||||
#define Q931_SENDING_COMPLETE 0x21
|
||||
#define Q931_SENDING_COMPLETE 0xa1
|
||||
|
||||
|
||||
/* Q.SIG specific */
|
||||
#define QSIG_IE_TRANSIT_COUNT 0x31
|
||||
|
||||
extern int q931_receive(struct pri *pri, q931_h *h, int len);
|
||||
|
||||
extern int q931_alerting(struct pri *pri, q931_call *call, int channel, int info);
|
||||
|
||||
extern int q931_call_proceeding(struct pri *pri, q931_call *call);
|
||||
extern int q931_call_progress(struct pri *pri, q931_call *call, int channel, int info);
|
||||
|
||||
extern int q931_notify(struct pri *pri, q931_call *call, int channel, int info);
|
||||
|
||||
extern int q931_call_proceeding(struct pri *pri, q931_call *call, int channel, int info);
|
||||
|
||||
extern int q931_setup_ack(struct pri *pri, q931_call *call, int channel, int nonisdn);
|
||||
|
||||
extern int q931_information(struct pri *pri, q931_call *call, char digit);
|
||||
|
||||
extern int q931_keypad_facility(struct pri *pri, q931_call *call, char *digits);
|
||||
|
||||
extern int q931_connect(struct pri *pri, q931_call *call, int channel, int nonisdn);
|
||||
|
||||
@@ -229,10 +274,23 @@ extern int q931_release(struct pri *pri, q931_call *call, int cause);
|
||||
|
||||
extern int q931_disconnect(struct pri *pri, q931_call *call, int cause);
|
||||
|
||||
extern int q931_hangup(struct pri *pri, q931_call *call, int cause);
|
||||
|
||||
extern int q931_restart(struct pri *pri, int channel);
|
||||
|
||||
extern int q931_facility(struct pri *pri, q931_call *call);
|
||||
|
||||
extern int q931_call_getcrv(struct pri *pri, q931_call *call, int *callmode);
|
||||
|
||||
extern int q931_call_setcrv(struct pri *pri, q931_call *call, int crv, int callmode);
|
||||
|
||||
extern q931_call *q931_new_call(struct pri *pri);
|
||||
|
||||
extern int q931_setup(struct pri *pri, q931_call *c, int transmode, int channel, int exclusive,
|
||||
int nonisdn, char *caller, int callerplan, int callerpres, char *called,
|
||||
int calledplan, int ulay1);
|
||||
extern int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req);
|
||||
extern void q931_dump(struct pri *pri, q931_h *h, int len, int txrx);
|
||||
|
||||
extern void __q931_destroycall(struct pri *pri, q931_call *c);
|
||||
|
||||
extern void q931_dl_indication(struct pri *pri, int event);
|
||||
|
||||
#endif
|
||||
|
||||
97
pri_timers.h
Normal file
97
pri_timers.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* libpri: An implementation of Primary Rate ISDN
|
||||
*
|
||||
* Written by Mark Spencer <markster@digium.com>
|
||||
*
|
||||
* Copyright (C) 2001, Digium, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2 as published by the
|
||||
* Free Software Foundation. See the LICENSE file included with
|
||||
* this program for more details.
|
||||
*
|
||||
* In addition, when this program is distributed with Asterisk in
|
||||
* any form that would qualify as a 'combined work' or as a
|
||||
* 'derivative work' (but not mere aggregation), you can redistribute
|
||||
* and/or modify the combination under the terms of the license
|
||||
* provided with that copy of Asterisk, instead of the license
|
||||
* terms granted here.
|
||||
*/
|
||||
|
||||
#ifndef _PRI_TIMERS_H
|
||||
#define _PRI_TIMERS_H
|
||||
|
||||
/* -1 means we dont currently support the timer/counter */
|
||||
#define PRI_TIMERS_DEFAULT { \
|
||||
3, /* N200 */ \
|
||||
-1, /* N201 */ \
|
||||
3, /* N202 */ \
|
||||
7, /* K */ \
|
||||
1000, /* T200 */ \
|
||||
-1, /* T201 */ \
|
||||
10000, /* T202 */ \
|
||||
10000, /* T203 */ \
|
||||
-1, /* T300 */ \
|
||||
-1, /* T301 */ \
|
||||
-1, /* T302 */ \
|
||||
-1, /* T303 */ \
|
||||
-1, /* T304 */ \
|
||||
30000, /* T305 */ \
|
||||
-1, /* T306 */ \
|
||||
-1, /* T307 */ \
|
||||
4000, /* T308 */ \
|
||||
-1, /* T309 */ \
|
||||
-1, /* T310 */ \
|
||||
4000, /* T313 */ \
|
||||
-1, /* T314 */ \
|
||||
-1, /* T316 */ \
|
||||
-1, /* T317 */ \
|
||||
-1, /* T318 */ \
|
||||
-1, /* T319 */ \
|
||||
-1, /* T320 */ \
|
||||
-1, /* T321 */ \
|
||||
-1, /* T322 */ \
|
||||
2500, /* TM20 - Q.921 Appendix IV */ \
|
||||
3, /* NM20 - Q.921 Appendix IV */ \
|
||||
}
|
||||
|
||||
/* XXX Only our default timers are setup now XXX */
|
||||
#define PRI_TIMERS_UNKNOWN PRI_TIMERS_DEFAULT
|
||||
#define PRI_TIMERS_NI2 PRI_TIMERS_DEFAULT
|
||||
#define PRI_TIMERS_DMS100 PRI_TIMERS_DEFAULT
|
||||
#define PRI_TIMERS_LUCENT5E PRI_TIMERS_DEFAULT
|
||||
#define PRI_TIMERS_ATT4ESS PRI_TIMERS_DEFAULT
|
||||
#define PRI_TIMERS_EUROISDN_E1 PRI_TIMERS_DEFAULT
|
||||
#define PRI_TIMERS_EUROISDN_T1 PRI_TIMERS_DEFAULT
|
||||
#define PRI_TIMERS_NI1 PRI_TIMERS_DEFAULT
|
||||
#define PRI_TIMERS_GR303_EOC PRI_TIMERS_DEFAULT
|
||||
#define PRI_TIMERS_GR303_TMC PRI_TIMERS_DEFAULT
|
||||
#define PRI_TIMERS_QSIG PRI_TIMERS_DEFAULT
|
||||
#define __PRI_TIMERS_GR303_EOC_INT PRI_TIMERS_DEFAULT
|
||||
#define __PRI_TIMERS_GR303_TMC_INT PRI_TIMERS_DEFAULT
|
||||
|
||||
#define PRI_TIMERS_ALL { PRI_TIMERS_UNKNOWN, \
|
||||
PRI_TIMERS_NI2, \
|
||||
PRI_TIMERS_DMS100, \
|
||||
PRI_TIMERS_LUCENT5E, \
|
||||
PRI_TIMERS_ATT4ESS, \
|
||||
PRI_TIMERS_EUROISDN_E1, \
|
||||
PRI_TIMERS_EUROISDN_T1, \
|
||||
PRI_TIMERS_NI1, \
|
||||
PRI_TIMERS_QSIG, \
|
||||
PRI_TIMERS_GR303_EOC, \
|
||||
PRI_TIMERS_GR303_TMC, \
|
||||
__PRI_TIMERS_GR303_EOC_INT, \
|
||||
__PRI_TIMERS_GR303_TMC_INT, \
|
||||
}
|
||||
|
||||
#endif
|
||||
149
pridump.c
Normal file
149
pridump.c
Normal file
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* libpri: An implementation of Primary Rate ISDN
|
||||
*
|
||||
* Written by Mark Spencer <markster@digium.com>
|
||||
*
|
||||
* Copyright (C) 2001-2005, Digium, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2 as published by the
|
||||
* Free Software Foundation. See the LICENSE file included with
|
||||
* this program for more details.
|
||||
*
|
||||
* In addition, when this program is distributed with Asterisk in
|
||||
* any form that would qualify as a 'combined work' or as a
|
||||
* 'derivative work' (but not mere aggregation), you can redistribute
|
||||
* and/or modify the combination under the terms of the license
|
||||
* provided with that copy of Asterisk, instead of the license
|
||||
* terms granted here.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program tests libpri call reception using a zaptel interface.
|
||||
* Its state machines are setup for RECEIVING CALLS ONLY, so if you
|
||||
* are trying to both place and receive calls you have to a bit more.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/types.h>
|
||||
#include <zaptel/zaptel.h>
|
||||
#include "libpri.h"
|
||||
#include "pri_q921.h"
|
||||
#include "pri_q931.h"
|
||||
|
||||
static int pri_open(char *dev)
|
||||
{
|
||||
int dfd;
|
||||
struct zt_params p;
|
||||
|
||||
dfd = open(dev, O_RDWR);
|
||||
if (dfd < 0) {
|
||||
fprintf(stderr, "Failed to open dchannel '%s': %s\n", dev, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (ioctl(dfd, ZT_GET_PARAMS, &p)) {
|
||||
fprintf(stderr, "Unable to get parameters on '%s': %s\n", dev, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if ((p.sigtype != ZT_SIG_HDLCRAW) && (p.sigtype != ZT_SIG_HDLCFCS)) {
|
||||
fprintf(stderr, "%s is in %d signalling, not FCS HDLC or RAW HDLC mode\n", dev, p.sigtype);
|
||||
return -1;
|
||||
}
|
||||
return dfd;
|
||||
}
|
||||
|
||||
static void dump_packet(struct pri *pri, char *buf, int len, int txrx)
|
||||
{
|
||||
q921_h *h = (q921_h *)buf;
|
||||
q921_dump(pri, h, len, 1, txrx);
|
||||
if (!((h->h.data[0] & Q921_FRAMETYPE_MASK) & 0x3)) {
|
||||
q931_dump(pri, (q931_h *)(h->i.data), len - 4 - 2 /* FCS */, txrx);
|
||||
}
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
|
||||
static int pri_bridge(int d1, int d2)
|
||||
{
|
||||
char buf[1024];
|
||||
fd_set fds;
|
||||
int max;
|
||||
int e;
|
||||
int res;
|
||||
for(;;) {
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(d1, &fds);
|
||||
FD_SET(d2, &fds);
|
||||
max = d1;
|
||||
if (max < d2)
|
||||
max = d2;
|
||||
ioctl(d1, ZT_GETEVENT, &e);
|
||||
ioctl(d2, ZT_GETEVENT, &e);
|
||||
res = select(max + 1, &fds, NULL, NULL, NULL);
|
||||
if (res < 0) {
|
||||
fprintf(stderr, "Select returned %d: %s\n", res, strerror(errno));
|
||||
continue;
|
||||
};
|
||||
if (FD_ISSET(d1, &fds)) {
|
||||
/* Copy from d1 to d2 */
|
||||
res = read(d1, buf, sizeof(buf));
|
||||
dump_packet((struct pri *)NULL, buf, res, 1);
|
||||
res = write(d2, buf, res);
|
||||
}
|
||||
if (FD_ISSET(d2, &fds)) {
|
||||
/* Copy from d2 to d1 */
|
||||
res = read(d2, buf, sizeof(buf));
|
||||
dump_packet((struct pri *)NULL, buf, res, 0);
|
||||
res = write(d1, buf, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void my_pri_message(struct pri *pri, char *stuff)
|
||||
{
|
||||
fprintf(stdout, "%s", stuff);
|
||||
}
|
||||
|
||||
static void my_pri_error(struct pri *pri, char *stuff)
|
||||
{
|
||||
fprintf(stderr, "%s", stuff);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int d1, d2;
|
||||
|
||||
if (argc < 3) {
|
||||
fprintf(stderr, "Usage: pridump <dev1> <dev2>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pri_set_message(my_pri_message);
|
||||
pri_set_error(my_pri_error);
|
||||
|
||||
d1 = pri_open(argv[1]);
|
||||
if (d1 < 0)
|
||||
exit(1);
|
||||
d2 = pri_open(argv[2]);
|
||||
if (d2 < 0)
|
||||
exit(1);
|
||||
pri_bridge(d1, d2);
|
||||
return 0;
|
||||
}
|
||||
82
prisched.c
Executable file → Normal file
82
prisched.c
Executable file → Normal file
@@ -1,30 +1,36 @@
|
||||
/*
|
||||
* libpri: An implementation of Primary Rate ISDN
|
||||
*
|
||||
* Written by Mark Spencer <markster@linux-support.net>
|
||||
* Written by Mark Spencer <markster@digium.com>
|
||||
*
|
||||
* Copyright (C) 2001, Linux Support Services, Inc.
|
||||
* Copyright (C) 2001-2005, Digium, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2 as published by the
|
||||
* Free Software Foundation. See the LICENSE file included with
|
||||
* this program for more details.
|
||||
*
|
||||
* In addition, when this program is distributed with Asterisk in
|
||||
* any form that would qualify as a 'combined work' or as a
|
||||
* 'derivative work' (but not mere aggregation), you can redistribute
|
||||
* and/or modify the combination under the terms of the license
|
||||
* provided with that copy of Asterisk, instead of the license
|
||||
* terms granted here.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "libpri.h"
|
||||
#include "pri_internal.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static int maxsched = 0;
|
||||
@@ -34,11 +40,14 @@ int pri_schedule_event(struct pri *pri, int ms, void (*function)(void *data), vo
|
||||
{
|
||||
int x;
|
||||
struct timeval tv;
|
||||
/* Scheduling runs on master channels only */
|
||||
while (pri->master)
|
||||
pri = pri->master;
|
||||
for (x=1;x<MAX_SCHED;x++)
|
||||
if (!pri->pri_sched[x].callback)
|
||||
break;
|
||||
if (x == MAX_SCHED) {
|
||||
fprintf(stderr, "No more room in scheduler\n");
|
||||
pri_error(pri, "No more room in scheduler\n");
|
||||
return -1;
|
||||
}
|
||||
if (x > maxsched)
|
||||
@@ -60,6 +69,9 @@ struct timeval *pri_schedule_next(struct pri *pri)
|
||||
{
|
||||
struct timeval *closest = NULL;
|
||||
int x;
|
||||
/* Check subchannels */
|
||||
if (pri->subchannel)
|
||||
closest = pri_schedule_next(pri->subchannel);
|
||||
for (x=1;x<MAX_SCHED;x++) {
|
||||
if (pri->pri_sched[x].callback &&
|
||||
(!closest || (closest->tv_sec > pri->pri_sched[x].when.tv_sec) ||
|
||||
@@ -70,19 +82,23 @@ struct timeval *pri_schedule_next(struct pri *pri)
|
||||
return closest;
|
||||
}
|
||||
|
||||
pri_event *pri_schedule_run(struct pri *pri)
|
||||
static pri_event *__pri_schedule_run(struct pri *pri, struct timeval *tv)
|
||||
{
|
||||
struct timeval tv;
|
||||
int x;
|
||||
void (*callback)(void *);
|
||||
void *data;
|
||||
gettimeofday(&tv, NULL);
|
||||
pri_event *e;
|
||||
if (pri->subchannel) {
|
||||
if ((e = __pri_schedule_run(pri->subchannel, tv))) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
for (x=1;x<MAX_SCHED;x++) {
|
||||
if (pri->pri_sched[x].callback &&
|
||||
((pri->pri_sched[x].when.tv_sec < tv.tv_sec) ||
|
||||
((pri->pri_sched[x].when.tv_sec == tv.tv_sec) &&
|
||||
(pri->pri_sched[x].when.tv_usec <= tv.tv_usec)))) {
|
||||
pri->schedev = 0;
|
||||
((pri->pri_sched[x].when.tv_sec < tv->tv_sec) ||
|
||||
((pri->pri_sched[x].when.tv_sec == tv->tv_sec) &&
|
||||
(pri->pri_sched[x].when.tv_usec <= tv->tv_usec)))) {
|
||||
pri->schedev = 0;
|
||||
callback = pri->pri_sched[x].callback;
|
||||
data = pri->pri_sched[x].data;
|
||||
pri->pri_sched[x].callback = NULL;
|
||||
@@ -90,14 +106,24 @@ pri_event *pri_schedule_run(struct pri *pri)
|
||||
callback(data);
|
||||
if (pri->schedev)
|
||||
return &pri->ev;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pri_event *pri_schedule_run(struct pri *pri)
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
return __pri_schedule_run(pri, &tv);
|
||||
}
|
||||
|
||||
|
||||
void pri_schedule_del(struct pri *pri,int id)
|
||||
{
|
||||
while (pri->master)
|
||||
pri = pri->master;
|
||||
if ((id >= MAX_SCHED) || (id < 0))
|
||||
fprintf(stderr, "Asked to delete sched id %d???\n", id);
|
||||
pri_error(pri, "Asked to delete sched id %d???\n", id);
|
||||
pri->pri_sched[id].callback = NULL;
|
||||
}
|
||||
|
||||
410
pritest.c
Normal file
410
pritest.c
Normal file
@@ -0,0 +1,410 @@
|
||||
/*
|
||||
* libpri: An implementation of Primary Rate ISDN
|
||||
*
|
||||
* Written by Mark Spencer <markster@digium.com>
|
||||
*
|
||||
* Copyright (C) 2001-2005, Digium, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2 as published by the
|
||||
* Free Software Foundation. See the LICENSE file included with
|
||||
* this program for more details.
|
||||
*
|
||||
* In addition, when this program is distributed with Asterisk in
|
||||
* any form that would qualify as a 'combined work' or as a
|
||||
* 'derivative work' (but not mere aggregation), you can redistribute
|
||||
* and/or modify the combination under the terms of the license
|
||||
* provided with that copy of Asterisk, instead of the license
|
||||
* terms granted here.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program tests libpri call reception using a zaptel interface.
|
||||
* Its state machines are setup for RECEIVING CALLS ONLY, so if you
|
||||
* are trying to both place and receive calls you have to a bit more.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/time.h>
|
||||
#include <zaptel/zaptel.h>
|
||||
#include <zap.h>
|
||||
#include "libpri.h"
|
||||
|
||||
#define PRI_DEF_NODETYPE PRI_CPE
|
||||
#define PRI_DEF_SWITCHTYPE PRI_SWITCH_NI2
|
||||
|
||||
#define MAX_CHAN 32
|
||||
#define DCHANNEL_TIMESLOT 16
|
||||
|
||||
|
||||
static int offset = 0;
|
||||
|
||||
static void do_channel(ZAP *z)
|
||||
{
|
||||
/* This is the part that runs on a given channel */
|
||||
zap_playf(z, "raw.ulaw", 0);
|
||||
}
|
||||
|
||||
struct pri_chan {
|
||||
pid_t pid;
|
||||
int needhangup;
|
||||
int alreadyhungup;
|
||||
q931_call *call;
|
||||
} chans[MAX_CHAN];
|
||||
|
||||
static int str2node(char *node)
|
||||
{
|
||||
if (!strcasecmp(node, "cpe"))
|
||||
return PRI_CPE;
|
||||
if (!strcasecmp(node, "network"))
|
||||
return PRI_NETWORK;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void chan_ended(int sig)
|
||||
{
|
||||
int status;
|
||||
int x;
|
||||
struct rusage rusage;
|
||||
pid_t pid;
|
||||
pid = wait4(-1, &status, WNOHANG, &rusage);
|
||||
|
||||
for (x=0;x<MAX_CHAN;x++) {
|
||||
if (pid == chans[x].pid) {
|
||||
printf("-- PID %d ended, channel %d\n", pid, x);
|
||||
chans[x].pid = 0;
|
||||
if (!chans[x].alreadyhungup) {
|
||||
/* It died, we need to hangup now */
|
||||
chans[x].needhangup = 1;
|
||||
} else {
|
||||
/* We've already been hungup, just clear it */
|
||||
chans[x].alreadyhungup = 0;
|
||||
chans[x].call = NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (pid > -1) {
|
||||
fprintf(stderr, "--!! Unknown PID %d exited\n", pid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
static int str2switch(char *swtype)
|
||||
{
|
||||
if (!strcasecmp(swtype, "ni2"))
|
||||
return PRI_SWITCH_NI2;
|
||||
if (!strcasecmp(swtype, "dms100"))
|
||||
return PRI_SWITCH_DMS100;
|
||||
if (!strcasecmp(swtype, "lucent5e"))
|
||||
return PRI_SWITCH_LUCENT5E;
|
||||
if (!strcasecmp(swtype, "att4ess"))
|
||||
return PRI_SWITCH_ATT4ESS;
|
||||
if (!strcasecmp(swtype, "euroisdn"))
|
||||
return PRI_SWITCH_EUROISDN_E1;
|
||||
if (!strcasecmp(swtype, "gr303eoc"))
|
||||
return PRI_SWITCH_GR303_EOC;
|
||||
if (!strcasecmp(swtype, "gr303tmc"))
|
||||
return PRI_SWITCH_GR303_TMC;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void hangup_channel(int channo)
|
||||
{
|
||||
if (chans[channo].pid) {
|
||||
|
||||
#if 0
|
||||
printf("Killing channel %d (pid = %d)\n", channo, chans[channo].pid);
|
||||
#endif
|
||||
chans[channo].alreadyhungup = 1;
|
||||
kill(chans[channo].pid, SIGTERM);
|
||||
} else if (chans[channo].needhangup)
|
||||
chans[channo].needhangup = 0;
|
||||
}
|
||||
|
||||
static void launch_channel(int channo)
|
||||
{
|
||||
pid_t pid;
|
||||
ZAP *z;
|
||||
char ch[80];
|
||||
|
||||
/* Make sure hangup state is reset */
|
||||
chans[channo].needhangup = 0;
|
||||
chans[channo].alreadyhungup = 0;
|
||||
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
fprintf(stderr, "--!! Unable to fork\n");
|
||||
chans[channo].needhangup = 1;
|
||||
}
|
||||
if (pid) {
|
||||
printf("-- Launching process %d to handle channel %d\n", pid, channo);
|
||||
chans[channo].pid = pid;
|
||||
} else {
|
||||
sprintf(ch, "%d", channo + offset);
|
||||
z = zap_open(ch, 0);
|
||||
if (z) {
|
||||
do_channel(z);
|
||||
exit(0);
|
||||
} else {
|
||||
fprintf(stderr, "--!! Unable to open channel %d\n", channo);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int get_free_channel(int channo)
|
||||
{
|
||||
channo--;
|
||||
if((channo>MAX_CHAN)||(channo<0)) {
|
||||
fprintf(stderr, "Invalid Bchannel RANGE <%d", channo);
|
||||
return 0;
|
||||
};
|
||||
|
||||
while(chans[channo].pid) {
|
||||
channo--;
|
||||
}
|
||||
|
||||
return channo;
|
||||
}
|
||||
|
||||
/* place here criteria for completion of destination number */
|
||||
static int number_incommplete(char *number)
|
||||
{
|
||||
return strlen(number) < 3;
|
||||
}
|
||||
|
||||
static void start_channel(struct pri *pri, pri_event *e)
|
||||
{
|
||||
int channo = e->ring.channel;
|
||||
int flag = 1;
|
||||
pri_event_ring *ring = &e->ring;
|
||||
|
||||
if(channo == -1) {
|
||||
channo = e->ring.channel = get_free_channel(MAX_CHAN);
|
||||
|
||||
if(channo == DCHANNEL_TIMESLOT)
|
||||
channo = e->ring.channel = get_free_channel(MAX_CHAN);
|
||||
|
||||
|
||||
fprintf(stdout, "Any channel selected: %d\n", channo);
|
||||
|
||||
if(!channo) {
|
||||
pri_release(pri, ring->call, PRI_CAUSE_REQUESTED_CHAN_UNAVAIL);
|
||||
fprintf(stdout, "Abort call due to no avl B channels\n");
|
||||
return;
|
||||
}
|
||||
|
||||
flag = 0;
|
||||
}
|
||||
/* Make sure it's a valid number */
|
||||
if ((channo >= MAX_CHAN) || (channo < 0)) {
|
||||
fprintf(stderr, "--!! Channel %d is out of range\n", channo);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Make sure nothing is there */
|
||||
if (chans[channo].pid) {
|
||||
fprintf(stderr, "--!! Channel %d still has a call on it, ending it...\n", channo);
|
||||
hangup_channel(channo);
|
||||
/* Wait for it to die */
|
||||
while(chans[channo].pid)
|
||||
usleep(100);
|
||||
}
|
||||
|
||||
/* Record call number */
|
||||
chans[channo].call = e->ring.call;
|
||||
|
||||
/* Answer the line */
|
||||
if(flag) {
|
||||
pri_answer(pri, chans[channo].call, channo, 1);
|
||||
} else {
|
||||
pri_need_more_info(pri, chans[channo].call, channo, 1);
|
||||
}
|
||||
|
||||
/* Launch a process to handle it */
|
||||
launch_channel(channo);
|
||||
|
||||
}
|
||||
|
||||
static void handle_pri_event(struct pri *pri, pri_event *e)
|
||||
{
|
||||
switch(e->e) {
|
||||
case PRI_EVENT_DCHAN_UP:
|
||||
printf("-- D-Channel is now up! :-)\n");
|
||||
break;
|
||||
case PRI_EVENT_DCHAN_DOWN:
|
||||
printf("-- D-Channel is now down! :-(\n");
|
||||
break;
|
||||
case PRI_EVENT_RESTART:
|
||||
printf("-- Restarting channel %d\n", e->restart.channel);
|
||||
hangup_channel(e->restart.channel);
|
||||
break;
|
||||
case PRI_EVENT_CONFIG_ERR:
|
||||
printf("-- Configuration error detected: %s\n", e->err.err);
|
||||
break;
|
||||
case PRI_EVENT_RING:
|
||||
printf("-- Ring on channel %d (from %s to %s), answering...\n", e->ring.channel, e->ring.callingnum, e->ring.callednum);
|
||||
start_channel(pri, e);
|
||||
break;
|
||||
case PRI_EVENT_HANGUP:
|
||||
printf("-- Hanging up channel %d\n", e->hangup.channel);
|
||||
hangup_channel(e->hangup.channel);
|
||||
break;
|
||||
case PRI_EVENT_RINGING:
|
||||
case PRI_EVENT_ANSWER:
|
||||
fprintf(stderr, "--!! What? We shouldn't be making any calls...\n");
|
||||
break;
|
||||
case PRI_EVENT_HANGUP_ACK:
|
||||
/* Ignore */
|
||||
break;
|
||||
case PRI_EVENT_INFO_RECEIVED:
|
||||
fprintf(stdout, "number is: %s\n", e->ring.callednum);
|
||||
if(!number_incommplete(e->ring.callednum)) {
|
||||
fprintf(stdout, "final number is: %s\n", e->ring.callednum);
|
||||
pri_answer(pri, e->ring.call, 0, 1);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "--!! Unknown PRI event %d\n", e->e);
|
||||
}
|
||||
}
|
||||
|
||||
static int run_pri(int dfd, int swtype, int node)
|
||||
{
|
||||
struct pri *pri;
|
||||
pri_event *e;
|
||||
struct timeval tv = {0,0}, *next;
|
||||
fd_set rfds, efds;
|
||||
int res,x;
|
||||
|
||||
pri = pri_new_bri(dfd, 1, node, swtype);
|
||||
if (!pri) {
|
||||
fprintf(stderr, "Unable to create PRI\n");
|
||||
return -1;
|
||||
}
|
||||
pri_set_debug(pri, -1);
|
||||
for (;;) {
|
||||
|
||||
/* Run the D-Channel */
|
||||
FD_ZERO(&rfds);
|
||||
FD_ZERO(&efds);
|
||||
FD_SET(dfd, &rfds);
|
||||
FD_SET(dfd, &efds);
|
||||
|
||||
if ((next = pri_schedule_next(pri))) {
|
||||
gettimeofday(&tv, NULL);
|
||||
tv.tv_sec = next->tv_sec - tv.tv_sec;
|
||||
tv.tv_usec = next->tv_usec - tv.tv_usec;
|
||||
if (tv.tv_usec < 0) {
|
||||
tv.tv_usec += 1000000;
|
||||
tv.tv_sec -= 1;
|
||||
}
|
||||
if (tv.tv_sec < 0) {
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
}
|
||||
}
|
||||
res = select(dfd + 1, &rfds, NULL, &efds, next ? &tv : NULL);
|
||||
e = NULL;
|
||||
|
||||
if (!res) {
|
||||
e = pri_schedule_run(pri);
|
||||
} else if (res > 0) {
|
||||
e = pri_check_event(pri);
|
||||
} else if (errno == ELAST) {
|
||||
res = ioctl(dfd, ZT_GETEVENT, &x);
|
||||
printf("Got Zaptel event: %d\n", x);
|
||||
} else if (errno != EINTR)
|
||||
fprintf(stderr, "Error (%d) on select: %s\n", ELAST, strerror(errno));
|
||||
|
||||
if (e) {
|
||||
handle_pri_event(pri, e);
|
||||
}
|
||||
|
||||
res = ioctl(dfd, ZT_GETEVENT, &x);
|
||||
|
||||
if (!res && x) {
|
||||
fprintf(stderr, "Got event on PRI interface: %d\n", x);
|
||||
}
|
||||
|
||||
/* Check for lines that need hangups */
|
||||
for (x=0;x<MAX_CHAN;x++)
|
||||
if (chans[x].needhangup) {
|
||||
chans[x].needhangup = 0;
|
||||
pri_release(pri, chans[x].call, PRI_CAUSE_NORMAL_CLEARING);
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int dfd;
|
||||
int swtype = PRI_DEF_SWITCHTYPE;
|
||||
int node = PRI_DEF_NODETYPE;
|
||||
struct zt_params p;
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Usage: pritest <dchannel> [swtypetype] [nodetype]\n");
|
||||
exit(1);
|
||||
}
|
||||
dfd = open(argv[1], O_RDWR);
|
||||
if (dfd < 0) {
|
||||
fprintf(stderr, "Failed to open dchannel '%s': %s\n", argv[1], strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
if (ioctl(dfd, ZT_GET_PARAMS, &p)) {
|
||||
fprintf(stderr, "Unable to get parameters on '%s': %s\n", argv[1], strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
if ((p.sigtype != ZT_SIG_HDLCRAW) && (p.sigtype != ZT_SIG_HDLCFCS)) {
|
||||
fprintf(stderr, "%s is in %d signalling, not FCS HDLC or RAW HDLC mode\n", argv[1], p.sigtype);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (argc > 2) {
|
||||
swtype = str2switch(argv[2]);
|
||||
if (swtype < 0) {
|
||||
fprintf(stderr, "Valid switchtypes are: ni2, dms100, lucent5e, att4ess, and euroisdn\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc > 3) {
|
||||
node = str2node(argv[3]);
|
||||
if (node < 0) {
|
||||
fprintf(stderr, "Valid node types are: network and cpe\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
signal(SIGCHLD, chan_ended);
|
||||
|
||||
if (run_pri(dfd, swtype, node))
|
||||
exit(1);
|
||||
exit(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
288
testprilib.c
Normal file
288
testprilib.c
Normal file
@@ -0,0 +1,288 @@
|
||||
/*
|
||||
* libpri: An implementation of Primary Rate ISDN
|
||||
*
|
||||
* Written by Mark Spencer <markster@digium.com>
|
||||
*
|
||||
* Copyright (C) 2001-2005, Digium, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2 as published by the
|
||||
* Free Software Foundation. See the LICENSE file included with
|
||||
* this program for more details.
|
||||
*
|
||||
* In addition, when this program is distributed with Asterisk in
|
||||
* any form that would qualify as a 'combined work' or as a
|
||||
* 'derivative work' (but not mere aggregation), you can redistribute
|
||||
* and/or modify the combination under the terms of the license
|
||||
* provided with that copy of Asterisk, instead of the license
|
||||
* terms granted here.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* This program tests libpri call reception using a zaptel interface.
|
||||
* Its state machines are setup for RECEIVING CALLS ONLY, so if you
|
||||
* are trying to both place and receive calls you have to a bit more.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/time.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <zaptel/zaptel.h>
|
||||
#ifndef SOLARIS
|
||||
#include <zap.h>
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
#include <sys/select.h>
|
||||
#include "libpri.h"
|
||||
#include "pri_q931.h"
|
||||
|
||||
#ifndef AF_LOCAL
|
||||
#define AF_LOCAL AF_UNIX
|
||||
#endif
|
||||
|
||||
#define DEBUG_LEVEL PRI_DEBUG_ALL
|
||||
|
||||
#define PRI_DEF_NODETYPE PRI_CPE
|
||||
#define PRI_DEF_SWITCHTYPE PRI_SWITCH_NI2
|
||||
|
||||
static struct pri *first, *cur;
|
||||
|
||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
#define TEST_CALLS 1
|
||||
|
||||
static void event1(struct pri *pri, pri_event *e)
|
||||
{
|
||||
/* Network */
|
||||
int x;
|
||||
static q931_call *calls[TEST_CALLS];
|
||||
char name[256], num[256], dest[256];
|
||||
switch(e->gen.e) {
|
||||
case PRI_EVENT_DCHAN_UP:
|
||||
printf("Network is up. Sending blast of calls!\n");
|
||||
for (x=0;x<TEST_CALLS;x++) {
|
||||
sprintf(name, "Caller %d", x + 1);
|
||||
sprintf(num, "25642860%02d", x+1);
|
||||
sprintf(dest, "60%02d", x + 1);
|
||||
if (!(calls[x] = pri_new_call(pri))) {
|
||||
perror("pri_new_call");
|
||||
continue;
|
||||
}
|
||||
#if 0
|
||||
{
|
||||
struct pri_sr *sr;
|
||||
sr = pri_sr_new();
|
||||
pri_sr_set_channel(sr, x+1, 0, 0);
|
||||
pri_sr_set_bearer(sr, 0, PRI_LAYER_1_ULAW);
|
||||
pri_sr_set_called(sr, dest, PRI_NATIONAL_ISDN, 1);
|
||||
pri_sr_set_caller(sr, num, name, PRI_NATIONAL_ISDN, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN);
|
||||
pri_sr_set_redirecting(sr, num, PRI_NATIONAL_ISDN, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL);
|
||||
if (pri_setup(pri, calls[x], sr))
|
||||
perror("pri_setup");
|
||||
pri_sr_free(sr);
|
||||
}
|
||||
#else
|
||||
if (pri_call(pri, calls[x], PRI_TRANS_CAP_DIGITAL, x + 1, 1, 1, num,
|
||||
PRI_NATIONAL_ISDN, name, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN,
|
||||
dest, PRI_NATIONAL_ISDN, PRI_LAYER_1_ULAW)) {
|
||||
perror("pri_call");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
printf("Setup %d calls!\n", TEST_CALLS);
|
||||
break;
|
||||
case PRI_EVENT_RINGING:
|
||||
printf("PRI 1: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
|
||||
q931_facility(pri, e->ringing.call);
|
||||
pri_answer(pri, e->ringing.call, e->ringing.channel, 0);
|
||||
break;
|
||||
case PRI_EVENT_HANGUP_REQ:
|
||||
printf("PRI 1: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
|
||||
pri_hangup(pri, e->hangup.call, e->hangup.cause);
|
||||
break;
|
||||
default:
|
||||
printf("PRI 1: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
|
||||
}
|
||||
}
|
||||
|
||||
static void event2(struct pri *pri, pri_event *e)
|
||||
{
|
||||
/* CPE */
|
||||
switch(e->gen.e) {
|
||||
case PRI_EVENT_RING:
|
||||
printf("PRI 2: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
|
||||
pri_proceeding(pri, e->ring.call, e->ring.channel, 0);
|
||||
pri_acknowledge(pri, e->ring.call, e->ring.channel, 0);
|
||||
break;
|
||||
case PRI_EVENT_ANSWER:
|
||||
printf("PRI 2: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
|
||||
pri_hangup(pri, e->answer.call, PRI_CAUSE_NORMAL_UNSPECIFIED);
|
||||
break;
|
||||
case PRI_EVENT_HANGUP:
|
||||
printf("PRI 2: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
|
||||
pri_hangup(pri, e->hangup.call, e->hangup.cause);
|
||||
break;
|
||||
case PRI_EVENT_DCHAN_UP:
|
||||
default:
|
||||
printf("PRI 2: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
|
||||
}
|
||||
}
|
||||
|
||||
static void testmsg(struct pri *pri, char *s)
|
||||
{
|
||||
char *c;
|
||||
static int keeplast = 0;
|
||||
do {
|
||||
c = strchr(s, '\n');
|
||||
if (c) {
|
||||
*c = '\0';
|
||||
c++;
|
||||
}
|
||||
if (keeplast)
|
||||
printf("%s", s);
|
||||
else if (cur == first)
|
||||
printf("-1 %s", s);
|
||||
else
|
||||
printf("-2 %s", s);
|
||||
if (c)
|
||||
printf("\n");
|
||||
s = c;
|
||||
} while(c && *c);
|
||||
if (!c)
|
||||
keeplast = 1;
|
||||
else
|
||||
keeplast = 0;
|
||||
}
|
||||
|
||||
static void testerr(struct pri *pri, char *s)
|
||||
{
|
||||
char *c;
|
||||
static int keeplast = 0;
|
||||
do {
|
||||
c = strchr(s, '\n');
|
||||
if (c) {
|
||||
*c = '\0';
|
||||
c++;
|
||||
}
|
||||
if (keeplast)
|
||||
printf("%s", s);
|
||||
else if (cur == first)
|
||||
printf("=1 %s", s);
|
||||
else
|
||||
printf("=2 %s", s);
|
||||
if (c)
|
||||
printf("\n");
|
||||
s = c;
|
||||
} while(c && *c);
|
||||
if (!c)
|
||||
keeplast = 1;
|
||||
else
|
||||
keeplast = 0;
|
||||
}
|
||||
|
||||
|
||||
static void *dchan(void *data)
|
||||
{
|
||||
/* Joint D-channel */
|
||||
struct pri *pri = data;
|
||||
struct timeval *next, tv;
|
||||
pri_event *e;
|
||||
fd_set fds;
|
||||
int res;
|
||||
for(;;) {
|
||||
if ((next = pri_schedule_next(pri))) {
|
||||
gettimeofday(&tv, NULL);
|
||||
tv.tv_sec = next->tv_sec - tv.tv_sec;
|
||||
tv.tv_usec = next->tv_usec - tv.tv_usec;
|
||||
if (tv.tv_usec < 0) {
|
||||
tv.tv_usec += 1000000;
|
||||
tv.tv_sec -= 1;
|
||||
}
|
||||
if (tv.tv_sec < 0) {
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
}
|
||||
}
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(pri_fd(pri), &fds);
|
||||
res = select(pri_fd(pri) + 1, &fds, NULL, NULL, next ? &tv : NULL);
|
||||
pthread_mutex_lock(&lock);
|
||||
cur = pri;
|
||||
if (res < 0) {
|
||||
perror("select");
|
||||
} else if (!res) {
|
||||
e = pri_schedule_run(pri);
|
||||
} else {
|
||||
e = pri_check_event(pri);
|
||||
}
|
||||
if (e) {
|
||||
if (first == pri) {
|
||||
event1(e->gen.pri, e);
|
||||
} else {
|
||||
event2(e->gen.pri, e);
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&lock);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int pair[2];
|
||||
pthread_t tmp;
|
||||
struct pri *pri;
|
||||
pri_set_message(testmsg);
|
||||
pri_set_error(testerr);
|
||||
if (socketpair(AF_LOCAL, SOCK_DGRAM, 0, pair)) {
|
||||
perror("socketpair");
|
||||
exit(1);
|
||||
}
|
||||
if (!(pri = pri_new_bri(pair[0], 0, PRI_NETWORK, PRI_DEF_SWITCHTYPE))) {
|
||||
perror("pri(0)");
|
||||
exit(1);
|
||||
}
|
||||
first = pri;
|
||||
pri_set_debug(pri, DEBUG_LEVEL);
|
||||
pri_facility_enable(pri);
|
||||
if (pthread_create(&tmp, NULL, dchan, pri)) {
|
||||
perror("thread(0)");
|
||||
exit(1);
|
||||
}
|
||||
if (!(pri = pri_new_bri(pair[1], 0, PRI_CPE, PRI_DEF_SWITCHTYPE))) {
|
||||
perror("pri(1)");
|
||||
exit(1);
|
||||
}
|
||||
pri_set_debug(pri, DEBUG_LEVEL);
|
||||
pri_facility_enable(pri);
|
||||
if (pthread_create(&tmp, NULL, dchan, pri)) {
|
||||
perror("thread(1)");
|
||||
exit(1);
|
||||
}
|
||||
/* Wait for things to run */
|
||||
sleep(5);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user