James Zhang [Tue, 3 Apr 2012 15:23:49 +0000 (11:23 -0400)]
freetdm: Clean up SS7 native bridge code to separate the call control, queuing and
resource-cleanup responsibilities clearly between the 2 channels involved in the bridge
- Each channel is responsible for clearning its own peer_data and event queue
at the end of the call (when moving to DOWN state)
- Each channel dequeues messages only from its own queue and enqueues messages
in the peer's queue, with the only exception being messages received before
the bridge is stablished (IAM for sure and possible SAM messages) because
if the bridge is not yet stablished the messages must be queued by the channel
in its own queue temporarily until the bridge is ready
- When the bridge is ready it is the responsibility of the incoming channel to
move the messages that stored temporarily in its own queue to the bridged peer queue
- During hangup, each channel is responsible for moving itself to DOWN. The procedure
however differs slightly depending on the hangup conditions
If the user requests hangup (ie, FreeSWITCH) the request will be noted by setting the
FTDM_CHANNEL_USER_HANGUP flag but will not be processed yet because call control is
driven only by the link messages (so no hangup from ESL or command line allowed)
When REL message comes, the channel receiving it must move to TERMINATING state and:
- If the user has not hangup yet (FTDM_CHANNEL_USER_HANGUP flag not set) then
notify the user via SIGEVENT_STOP and wait for the user to move to HANGUP
state by calling ftdm_channel_call_hangup() before sending RLC
- If the user did hangup already (FTDM_CHANNEL_USER_HANGUP flag is set) then
skip user notification and move to HANGUP state directly where the RLC message
will be sent
- On HANGUP state the RLC is sent and the channel is moved to DOWN, final state
The peer channel will forward the REL message and wait for RLC from the network, when
RLC is received the channel can move straight to DOWN itself because the peer channel
is completing its own shutdown procedure when it received the REL message
James Zhang [Fri, 30 Mar 2012 20:50:00 +0000 (16:50 -0400)]
freetdm: Adding condition to parse sip headers only for non-freetdm channels.
This fixes an issue where ss7 native bridge was accidentally enabled
any time two freetdm channels were bridged regardless of the freetdm_native_sigbridge
variable value.
Moises Silva [Thu, 8 Mar 2012 00:04:31 +0000 (19:04 -0500)]
freetdm: Fix redmine issue #2931 - Crash on SIP to SS7 call after sigbridge call
The code was improperly using peer_data as an indicator that the sigbridge
ss7 mode was enabled. The channel flag FTDM_CHANNEL_NATIVE_SIGBRDIGE should
be used instead
Moises Silva [Thu, 16 Feb 2012 19:49:18 +0000 (14:49 -0500)]
freetdm: Fix spirou certification native bridge issue
- The outgoing tdm leg should not move to UP until
after the IAM is sent at the end of the function
- The UP state should be processed immediately otherwise
the state processor is not run due to the way the main
ss7 processing loop currently works
Moises Silva [Tue, 31 Jan 2012 20:18:53 +0000 (15:18 -0500)]
freetdm: Fix bug in SS7 state processing introduced during the changes
for native bridging that caused infinite SUSPEND state executions
due to peer member not being cleared at the end of the call
James Zhang [Tue, 31 Jan 2012 00:15:02 +0000 (19:15 -0500)]
freetdm: Some more clean up for ss7 event cloning
- The queue size has been bumped again, long calls could potentially require more elements (multiple resume/suspend)
- The queue is only used when there is a call active
Moises Silva [Fri, 27 Jan 2012 04:51:21 +0000 (23:51 -0500)]
freetdm: Tweaks to SS7 native bridge feature
- Enable native bridge also when receiving the UUID via SIP header
- Remove some debug CRIT messages and set a more proper log level
Moises Silva [Fri, 27 Jan 2012 04:31:29 +0000 (23:31 -0500)]
freetdm: Fixes for native signaling bridge (now tested, and works for basic call flows)
- Fix typo when unlocking channel that resulted in deadlock
- Defer clearing of the peer data until it is completely safe (next call)
James Zhang [Thu, 26 Jan 2012 23:00:34 +0000 (18:00 -0500)]
FreeTDM: fix for SPIROU
- adding freetdm_iam_fwd_ind_isdn_access_ind (value must be 0 or 1)
to modify forward call indicator's ISDN access indicator value in
transparent IAM
James Zhang [Thu, 26 Jan 2012 22:37:35 +0000 (17:37 -0500)]
FreeTDM: patch SPIROU requests
- adding freetdm_iam_loc_pres variable to disable LOC in transparent IAM
- confirming freetdm_bearer_capability is working properly
James Zhang [Thu, 26 Jan 2012 16:19:41 +0000 (11:19 -0500)]
FreeTDM: Fixing issues of SPIROU
- redirect number in Transparent IAM
- redirect information in Transparent IAM
- called party number in Transparent IAM
- adding incoming uuid to x-header to check loop calls
Nenad Corbic [Mon, 19 Dec 2011 07:27:38 +0000 (02:27 -0500)]
freetdm: Added sng_cc_resource_check()
On SIG Down we must not fail a call instead try hunting for another.
The only time we can fail the call and not bother hunting is
if sng_cc_resource_check fails.
Took out configuration retry as the config code is now
fixed in sng_ss7 library. Transaction id fix.
Unit Tested:
NSG UP -- start full load
kill NSG
NSG UP again on full load
make sure it comes up fine.
Nenad Corbic [Mon, 19 Dec 2011 04:02:59 +0000 (23:02 -0500)]
freetdm: The remote hangup logic that waits for 3sec for FS to hanup up
before hanging up the freetdm channel by force
seems to have a memory leak. I have increased the timeout
to 30sec and made the print statement WARNING level.
Nenad Corbic [Fri, 16 Dec 2011 01:39:38 +0000 (20:39 -0500)]
Fix for 3000ms timeout on hangup.
Where FS does not hangup the channel with in 3sec.
Without this fix, it was possible that 2 FS sessions
use the single span/chan freetdm session.
Merged the feature from git master of freetdm
Moises Silva [Thu, 15 Dec 2011 17:34:56 +0000 (12:34 -0500)]
switch-core: changed the exit status when modules fail to load to 65 (EX_DATAERR), init scripts must
be updated to handle 65 instead of 1 to detect module loading errors
James Zhang [Tue, 6 Dec 2011 20:38:05 +0000 (15:38 -0500)]
freetdm: adding support of x-headers for Redirection Information
X-FreeTDM-RDINF-Indicator
X-FreeTDM-RDINF-OrigReason
X-FreeTDM-RDINF-Count
X-FreeTDM-RDINF-Reason
Moises Silva [Fri, 2 Dec 2011 16:24:34 +0000 (11:24 -0500)]
freetdm: fix license path to use sngss7 path limits
do not use strcpy, use ftdm_set_string which is safer
do not use strcpy when snprintf is safer and cleaner
James Zhang [Fri, 2 Dec 2011 00:18:54 +0000 (19:18 -0500)]
Update to the SUSPEND state machine updated 2 commits ago.
SUSPEND will not only change the return state in few
cases.
I have retested all test cases from previous 2 commits.
What is missing is timer for each Tx Event. RSC,BLO,UBL.
Its possible to loose a message from Slave via relay to Master.
If that ever occours we will not know what state we are in.
Thus we need a timer that will re-transmit a packet if
it does not get acknowledged.
Moises Silva [Thu, 1 Dec 2011 17:13:12 +0000 (12:13 -0500)]
freetdm: fix cpu monitor inconsistent messages, variable names etc
changed parameter name from cpu_reset_alarm_threshold to cpu_clear_alarm_threshold
(old parameter name still valid for backwards compatibility in configuration files)
James Zhang [Thu, 1 Dec 2011 08:16:59 +0000 (03:16 -0500)]
Fixed the exception condition - trigger reset
used to clear ckt_flags, this was wrong.
if ctk_flags are blindly cleard a PAUSE might be cleared.
changed the code to clear only TX RESET and try to reset again.
Release Collision
If we get out of sync with other side we must
reset the circuit.
This condition occoured at 1+3 test box
Local Management Block
Its possible for stack to send us a BLO indicating to us
that we are local blocked. This case never worked and
we would get stuck there forever.
If we never manaully sent a LOCAL block, the BLO from
the stack will be acked and then unblocked.
This condition occoured at 1+3 test box
James Zhang [Thu, 1 Dec 2011 01:02:25 +0000 (20:02 -0500)]
Fixed following two secnarios
From previous commit, failed to clear the done flag _DN
which cause SUSPEND to think that there was a block
pending, causing state to remain in RESTART
S UP -> relay down -> Tx AIS -> relay up -> Tx AIS off
-> confirm all back up
-> In this condition BLO will not go out due to PAUSE
S UP -> Tx AIS -> relay down -> Tx AIS off -> relay up
-> confirm all back up
-> In this condition UBL will not go out due to PAUSE
James Zhang [Thu, 1 Dec 2011 00:11:33 +0000 (19:11 -0500)]
Sigificant changes to the core state machine :)
Visually status of channels will only be DOWN once all resets/blocks are cleared.
Therefore if any reset/block is active on a channel, the channel state will be in RESTART not DOWN.
Logic Change
SUSPENDED
-> Originally used as intermediate state. Purpose is to handle a condition
from any state and go back to the previous state.
Conditions: such as block/ucic.
-> Updated logic is that SUSPEND will be smart enough not to
go back to just any state. SUSPEND will only go back to
UP - if call is still up
RESTART - if for any reason singaling is not up due to
blocks/resets/etc...
DOWN - if signaling is UP - no resets/blocks
In this case we avoid infinite loops due to state jumping
from STATE->SUSPEND->STATE->SUSPEND
HANGUP_COMPLETE
-> If call is in use and a RESET comes on a call
the RESTART state will first try the HANGUP_COMPLETE state.
HANGUP_COMPLETE will Tx RSC and wait for it.
Reset Response handle was updated if current state HANGUP/HANGUP_COMPLETE
go back to RESTART state. Which will call HANGUP COMPLETE due to
channel in usage and HANDLE_COMPLETE will clear RESET condition and go back to DOWN
TERMINATING
-> This state is used to hangup a call. Sends a signal to FS.
-> Usually TERMINATING state stays in TERMINATING until FS comes back.
-> I added a condition in case of RESET on the line though TERMINATING
will go back to RESTART.
This allows us to process RESET commands even though we are
in the middle of hanging up.
Block Handler
If BLO is received on circuit is already blocked,
we failed to trasmit BLA. We should always ack the BLO
even though it was alrady in blocked state.
Fixed & Tested
S UP --> place call --> relay down --> hangup --> relay up-->
Confirm that call is hungup properly.
In this condition, on relay up the circuit is put into RESET.
Since circuit is still in use, it will HANGUP first, then RESET
then clear pending BLOCK.
S UP --> place call -> Tx RSC on call.
Used to cause infitie loop
Confirm call is cleard properly
Re-Tested
S UP --> place call -> Rx RSC on call
Confirm call is cleard properly
S UP --> place call -> Rx BLO -> hangup -> place call
Confirm call cannot be placed
Tx UBL
Confirm call can be placed
S UP --> place call -> Rx BLO -> Tx BLO -> hangup -> place call
Confirm call cannot be placed
Tx UBL
Confirm call cannot be placed
Rx UBL
Confirm call can be placed
S UP --> place call -> relay down --> Rx BLO on channel from telco
--> relay up
Confirm that relay detects the BLO channels even though relay was down
Tx AIS -> S Start -> Confirm HW block -> Tx AIS off
-> Confirm hw block clear and UP
S UP -> Tx AIS -> Confirm HW block -> Tx AIS off
-> confirm hw block clear and UP
S UP -> relay down -> Tx AIS -> relay up -> Tx AIS off
-> confirm all back up
-> In this condition BLO will not go out due to PAUSE
S UP -> Tx AIS -> relay down -> Tx AIS off -> relay up
-> confirm all back up
-> In this condition UBL will not go out due to PAUSE
James Zhang [Sat, 26 Nov 2011 02:05:39 +0000 (21:05 -0500)]
Fixed 5 relay conditions
M UP -> S UP
M Down -> S UP -> M UP
M UP -> S UP -> relay down -> relay up
M UP -> S UP -> Kill M -> M UP
M Up -> S UP -> relay down -> M link down -> relay up -> M link up
James Zhang [Tue, 15 Nov 2011 19:46:57 +0000 (14:46 -0500)]
freetdm: fixing relay must start after master.
relay - configuring circuits only when resume is recieved.
master - configuring relay after all the others are configured.
wadam [Tue, 8 Nov 2011 03:26:02 +0000 (22:26 -0500)]
Fix error in call reference conversion to string.
src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c
cc1: warnings being treated as errors
src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c: In function
'handle_con_ind':
src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c:255: warning: format '%x'
expects type 'unsigned int', but argument 3 has type 'U32'
make[6]: *** [ftmod_sangoma_ss7_la-ftmod_sangoma_ss7_handle.lo] Error 1
Nenad Corbic [Mon, 7 Nov 2011 05:08:38 +0000 (00:08 -0500)]
freetdm: Allow for backward compatibility.
cpg_on_progress_media is default to TRUE if not xml option exists.
transparent_iam_max_size added to ccspan. Gloal value is used
if transparent_iam_max_size is not in ccSpan.
Nenad Corbic [Thu, 3 Nov 2011 00:53:14 +0000 (20:53 -0400)]
freetdm: Fixed blocks/unblocks resets. Performed conformance tests
Fixed hw alarm handling: physical ids were not used which caused alarms
read wrong.
Tested sip hold
Group blocks/unblock
Group reset
Link down-> block -> unblock
FS start with link down then link up
FS start with link up, take link down and up -> make incoming call
Nenad Corbic [Wed, 26 Oct 2011 18:57:27 +0000 (14:57 -0400)]
freetdm: Its possible to get HW ALARM clear even though we never got the initial alarm.
Only send out an unblock if block was sent from hw alarm and there are no
maintenance blocks pending.