In hijacking mode (CAPIFLAG_HIGHJACKING), a PTY master/slave pair is created to
pass data back and forth between the application and mISDNcapid. However, there
is a small time window between creating the PTY slave and the application
opening the PTY slave. If a B3 data connection is established before the
application has opened the PTY slave, and B3 data is received and written to the
PTY master end, it is immediately read back by the B3 data receiver thread
(BCthread), which then sends the data back to the original sender, causing a
loopback. This e.g. happens when the application is the PPP daemon pppd which
has been configured to not send any data until it receives a valid LCP packet
("silent" option).
In order to fix this, an additional flag called tty_received remembers whether
the B3 data receiver thread has already read data from the PTY at least once.
Only if this is the case B3 data is written to the PTY master end, otherwise it
is discarded as there is no potential receiver at the PTY slave end yet. This
effectively avoids any loopback situations due to an unconnected PTY slave end.
Signed-off-by: Christoph Schulz <develop@kristov.de>
Always sends PH_ACTIVATE_REQ and not DL_ESTABLISH_REQ down the mISDN stack when
opening a B-channel, as DL_ESTABLISH_REQ is only understood by layer-2, and
B-channel management is done at layer-1.
Signed-off-by: Christoph Schulz <develop@kristov.de>
Early B3 support is an useful functionality not only to listen to actual
exchange ringback tone but also to hear announcements like number changed,
line not provisioned, etc.
This commit adds partial early B3 support: mISDNcapid will try to open
B channel on "Call is not end-to-end ISDN; further call progress
information may be available in-band" and "In-band information or an
appropriate pattern is now available" progress indications, so CAPI
application will be able to connect to this B channel with CONNECT_B3_REQ
message.
Doing it this way needs only minimal changes to existing code - we just
need to make sure that B channel opening function ( lPLCILinkUp() )
doesn't try do it again when it is called for the second time.
Full early B3 support would need further decoupling NCCI management
from PLCI management so B channel could be opened on demand when CAPI
application issues CONNECT_B3_REQ.
While we are at it also make sure that lPLCILinkUp() function also
cleans up what it has already done when it exits early with an error.
Since this functionality is experimental it is not enabled by default -
a define needs to be uncommented at top of capi20/lplci.c to enable it.
Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Under some conditions it could be happen that on a freeing capi object
a other thread still get a reference and then it use the already freed object.
To avoid this, we do 2 things, we only take a refernce if get_obj() succeed, it
do not longer succeed if the object is already cleaned. We also force scheduling
after releaseing the lock before really freeing the object - so the waiting thread
will not get a new reference.
Implement a method to disable temporary messages from applications to
synchronize the delivery of a incoming call. It is important, that
all listening application get informed before the first answer was handled.
Signed-off-by: Karsten Keil <keil@b1-systems.de>
- Add a timeout in the B-channel handler to catch a broken
downlinks on release
- Do not join the own thread
- pthread functions return error directly, not via errno
- better debug messages
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
If a CAPI message was bigger as it was indicated, the buffer
length was not set at all. Now use the indicated length.
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
Fix issues that CIPmask got reset to zero and now
we are removing unused logical contrllers if a
application was deleted.
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
To allow access to the filesystem socket the effective group is changed
to the MISDN_GROUP, which is uucp or dialout usually.
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
- Fixed all issues found by valgrind
- Fixed all memory leaks
- Add signal handler for clean shutdown (SIGTERM, SIGHUP, SIGINT)
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>