[Home]

Summary:ASTERISK-13410: [patch] CCBS/CCNR support for QSIG (libpri & chan_dahdi)
Reporter:Thomas Arimont (tomaso)Labels:
Date Opened:2009-01-21 03:33:14.000-0600Date Closed:2010-05-26 11:07:39
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_dahdi/NewFeature
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) asterisk-issue8824-2008-12-10-ccbsccnr-0.1.0.patch
( 1) ccbsccnrabort.patch
( 2) chan_local.patch
( 3) corrected_send_qsig_alertingname.patch
( 4) disc_rel_userbusy.patch
( 5) divleginfo1_to_connectednum.patch
( 6) libpri-1.4-2008-12-10-ccbsccnr-0.1.0.patch
( 7) libpri-1.4-2009-01-29-rerouting-0.1.9.patch
( 8) QSIG_CCBS-CCNR.doc
( 9) send_qsig_alertingname.patch
Description:Based on the COLP/CONP work in asterisk team branch issue8824 http://svn.digium.com/view/asterisk/team/group/issue8824 and the QSIG COLP/CONP patch in issue 0014068 here comes another patch for chan_dahdi & libpri regarding the ISDN/QSIG CCBS/CCNR feature.

Since there is some basic stuff done in issue 0014068 regarding QSIG facility handling in libpri and chan_dahdi the patches requires the patches from issue 0014068 first.

It has been tested with HiPath 3000 V4.0 and HICOM 300.

libpri-1.4-2008-12-10-ccbsccnr-0.1.0.patch adds CCBS/CCNR support to libpri-1.4 branch.
asterisk-issue8824-2008-12-10-ccbsccnr-0.1.0.patch is used to patch chan_dahdi.c in asterisk-issue8824.

QSIG CCBS-CCNR.doc is a short description of the new dahdi dialplan applications and gives information how to use them in the dialplan.



****** STEPS TO REPRODUCE ******

-

****** ADDITIONAL INFORMATION ******

-
Comments:By: Richard Mudgett (rmudgett) 2009-01-21 16:21:54.000-0600

Created the following branches:
asterisk/team/group/issue14292
libpri/team/group/issue14292

and applied the latest patch files above to the branches.

By: Thomas Arimont (tomaso) 2009-08-06 09:37:25

In a heavy traffic environment we have detected some channel/mutex deadlocks regarding the libpri/dahdi related COLP/CONP feature in chan_dahdi.c (We still working on the original issue8824 based branch, but the same should be applied on this 14292 branch too)
For a fix please make sure that in function dahdi_pri_handle_subcmds() the following functions are called with 'pri->lock' mutex unlocked:

ast_channel_queue_connected_line_update(owner, &ast_connected);
ast_channel_queue_redirecting_update(owner, &ast_redirecting);

e.g.
ast_mutex_unlock(&pri->lock);
ast_channel_queue_connected_line_update(owner, &ast_connected);
ast_mutex_lock(&pri->lock);

Thomas Arimont
DATUS AG

By: Richard Mudgett (rmudgett) 2009-08-06 10:32:57

tomaso
I think the deadlock issue you are referring to is already avoided in the current branch code. There are three locks involved:
1) PRI access lock
2) chan_dahdi private lock.
3) channel lock
The function dahdi_pri_lock_owner() goes through deadlock avoidance to obtain the third lock if the owner pointer is not null.

By: Thomas Arimont (tomaso) 2009-08-06 10:38:47

rmudgett,
Ahh, yes I see. Sorry, you're right. Good job!

By: Thomas Arimont (tomaso) 2009-09-14 11:16:00

I have to report some bugs & associated fixes (mostly) regarding the COLP/CONP/CCBS/CCNR feature.
I think the best place to post them is here 'on block'.
(Sorry, we still working on the original (patched) issue8824 based branch, but the same should be applied on this 14292 branch too. We're going to do a version switch-over as soon as the implementation find the way to an open source release candidate - we are such anxious and lazy guys ;-))


Feature related bugs:
--------------------
--------------------

1. Call rerouting (Sending QSIG facility)
----------------------------------------
a) Account for pSS1InfoElement where the bearer capability for the new rerouted call is described.
The call could be a fax or data call, let's use the appropriate signalling to avoid call rejects on the other end.
b) Handle calling number element appropriate, number can be prohibited or non-existent
c) For calling number element use "unknown number" better than "private number"
(I guess this i already done)
d) take the diversion counter from DivLegInfo2 (if was present in the incoming Setup) and increment

Fix see libpri-1.4-2009-01-29-rerouting-0.1.9.patch

2. Stop CCBS/CCNR response-timer immediately if CCBS/CCNR is not possible
-------------------------------------------------------------------------

Proposed fix see ccbsccnrabort.patch
and change CCBS/CCNR TIMER_T1 macro in dialplan, taking respect of  
${CCBSNRREQSTATE}"="ABORTED"

macro TIMER_T1() {
CC_TIMER_T1 = 10;
while ( ${CC_TIMER_T1} > 0 ) {
CC_TIMER_T1 = ${CC_TIMER_T1}-1;
Wait(1);
if ( "${CCBSNRREQSTATE}"="ACTIVATED" ) {
Playback(rueckruf-programmiert);
return;
}
else if ( "${CCBSNRREQSTATE}"="ABORTED" ) {
Playback(kein&rueckruf-programmiert);
return;
}
}
// Timeout
Playback(kein&rueckruf-programmiert);
return;

}; // Macro Ende

3. Take diverted-to-number from DivLegInfo1 to propagate it as connected number
-----------------------------------------------------------------------------
(when no ISDN connected number is signalled in an ISDN Connect afterwards)

Fix see divleginfo1_to_connectednum.patch

4. Get new encoded Q.931 info elements into canonical order inside Q.931 message
--------------------------------------------------------------------------------
(otherwise pedantic PBX's like Siemens/HICOM reports non-critical L3 erros)

Fix see also divleginfo1_to_connectednum.patch


Not feature related:
--------------------
--------------------

1. Hanging (never released) pri channels when using Busy() (or Congestion()) dialplan-application
----------------------------------------------------------------------------

When the Busy() or Congestion() application is used towards ISDN (an ISDN progress is sent), the responding ISDN Disconnect
or Release may contain the ISDN cause user busy or one of the congestion causes. In chan_dahdi.c these causes will only set the
needbusy or needcongestion flags and not activating the softhangup procedure. Unfortunately only the ladder can interrupt the
endless wait loop of Busys()/Congestion(). Result: pri channels keep staying in state busy for the rest of * life.

Fix see dic_rel_userbusy.patch for chan_dahdi.c


2. Segmentation fault in chan_local when calling 'core show channels' (intensively) and simultaneous
generating calls towards pri/ISDN
>> addendum: o.k., I see there is a change in the current asterisk trunk, but I can't see a null pointer access check? (for: struct local_pvt *p = bridge->tech_pvt;)
------------------------------------------------------------------

For replication apply similar scripts as below:

Shell 1:
while true; do i=0; while [ $i -lt 13 ]; do echo $i; printf
"Channel:local/80455004@from-sbc\nCallerid:<$(date
+%s)>\nApplication:Playback\nData:tt-weasels\n" > /var/spool/asterisk/tmp/$i;
mv /var/spool/asterisk/tmp/$i /var/spool/asterisk/outgoing/$i; sleep 0.5;
i=$((i+1)); done; sleep 7; done

Shell 2:
while true; do clear; rasterisk -x"core show channels"; sleep 1; done

Fix see chan_local.patch



By: Thomas Arimont (tomaso) 2009-09-14 11:27:15

This (except the CCBS/CCNR bug) is also related to the 14068 branch/issue.

By: Thomas Arimont (tomaso) 2009-09-15 04:25:59

One other feature related fix:
The COLP/CONP information of a SIP ringing (e.g. P-Asserted-Header) was not mapped to an QSIG Alerted Name Facility, if a QSIG/Q.931 Call Proceeding was sent out before towards ISDN (e.g. using Proceeding() application in dialplan)

Fix see send_qsig_alertingname.patch


One Request:
Please port the SIP UPDATE handling extension of ABE this branch in near future!
>> addendum: o.k., I saw it's already in the current asterisk trunk, skip that

Another Request:
It would be nice to have the ability to deactivate call forwarding in case of a SIP 482 Loop Detect response.

AddOn:
To allow partial rerouting from SIP to QSIG we implemented a patch to do so.
Abstract: A SIP 301/302 response 'moved temporarely' does not automatically invoke * call forwarding (internal forward switching) but returns to dialplan where a astdb parameter can be read (diverted-to-number). Calling the QSIG Call Rerouting Feature at this point does the rest.
This helps nicely to suppress ugly call loops ...



By: Thomas Arimont (tomaso) 2009-09-21 06:31:03

Corrected one other feature related fix:
The COLP/CONP information of a SIP ringing (e.g. P-Asserted-Header) was not mapped to an QSIG Alerted Name Facility, if a QSIG/Q.931 Call Proceeding was sent out before towards ISDN (e.g. using Proceeding() application in dialplan)

(I mixed up user and network ISDN L3 states)
Corrected fix see corrected_send_qsig_alertingname.patch

By: Digium Subversion (svnbot) 2009-10-07 13:37:26

Repository: libpri
Revision: 1152

U   branches/1.4/pri_facility.c

------------------------------------------------------------------------
r1152 | rmudgett | 2009-10-07 13:37:25 -0500 (Wed, 07 Oct 2009) | 19 lines

Sent Q.SIG call rerouting message fixes.

a) Account for pSS1InfoElement where the bearer capability for the new
rerouted call is described.  The call could be a fax or data call, let's
use the appropriate signaling to avoid call rejects on the other end.
b) Handle calling number appropriately, number can be prohibited or
non-existent.
c) Add calling name if available.
d) Use the diversion counter from DivLegInfo2 (if was present in the
incoming Setup) and increment.

(issue ASTERISK-13410)
Reported by: tomaso
Patches:
     libpri-1.4-2009-01-29-rerouting-0.1.9.patch uploaded by tomaso (license 564)
     (Used as a guide since it no longer will apply.)
     (This patch is unrelated to the issue.)


------------------------------------------------------------------------

http://svn.digium.com/view/libpri?view=rev&revision=1152

By: Digium Subversion (svnbot) 2009-10-15 17:52:20

Repository: libpri
Revision: 1212

U   branches/1.4/pri_facility.c

------------------------------------------------------------------------
r1212 | rmudgett | 2009-10-15 17:34:52 -0500 (Thu, 15 Oct 2009) | 12 lines

Take diverted-to-number from DivLegInfo1 and use it as connected number.

If no connected number is signaled in the CONNECT message we will use the
last diverted to number.

(issue ASTERISK-13410)
Reported by: tomaso
Patches:
     divleginfo1_to_connectednum.patch uploaded by tomaso (license 564)
     (Used as a guide since it no longer will apply.)
     (This patch is unrelated to the issue.)

------------------------------------------------------------------------

http://svn.digium.com/view/libpri?view=rev&revision=1212

By: Richard Mudgett (rmudgett) 2009-10-15 18:40:23

The sorting of the IE done in divleginfo1_to_connectednum.patch was already done earlier.

The Q.SIG alerting name facility patch was already fixed by fabled in 14068 and automerged into 14292.

By: Digium Subversion (svnbot) 2009-10-16 17:55:52

Repository: asterisk
Revision: 224261

_U  trunk/
U   trunk/channels/sig_pri.c

------------------------------------------------------------------------
r224261 | rmudgett | 2009-10-16 15:40:57 -0500 (Fri, 16 Oct 2009) | 25 lines

Merged revisions 224260 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r224260 | rmudgett | 2009-10-16 15:25:23 -0500 (Fri, 16 Oct 2009) | 18 lines
 
 Never released PRI channels when using Busy() or Congestion() dialplan apps.
 
 When the Busy() or Congestion() application is used towards ISDN (an ISDN
 progress is sent), the responding ISDN Disconnect or Release may contain
 the ISDN cause user busy or one of the congestion causes.  In chan_dahdi.c
 these causes will only set the needbusy or needcongestion flags and not
 activate the softhangup procedure.  Unfortunately only the latter can
 interrupt the endless wait loop of Busy()/Congestion().
 
 Result: PRI channels staying in state busy for the rest of asterisk life
 or until the other end times out and forces the call to clear.
 
 (issue ASTERISK-13410)
 Reported by: tomaso
 Patches:
       disc_rel_userbusy.patch uploaded by tomaso (license 564)
       (This patch is unrelated to the issue.)
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=224261

By: Richard Mudgett (rmudgett) 2009-11-09 17:49:24.000-0600

The change in chan_local.patch is effectively implemented in issue ASTERISK-14922.

This is the last of the unrelated issues brought up in this issue.

Do not put any more unrelated issues in this issue.  Create new stand alone issues.

Thanks.

By: Digium Subversion (svnbot) 2010-05-26 11:01:11

Repository: libpri
Revision: 1714

U   branches/1.4/Makefile
A   branches/1.4/doc/
D   branches/1.4/doc/cc_ptmp_agent.fsm
A   branches/1.4/doc/cc_ptmp_agent.fsm
D   branches/1.4/doc/cc_ptmp_agent_flattened.fsm
A   branches/1.4/doc/cc_ptmp_agent_flattened.fsm
D   branches/1.4/doc/cc_ptmp_monitor.fsm
A   branches/1.4/doc/cc_ptmp_monitor.fsm
D   branches/1.4/doc/cc_ptmp_monitor_flattened.fsm
A   branches/1.4/doc/cc_ptmp_monitor_flattened.fsm
D   branches/1.4/doc/cc_ptp_agent.fsm
A   branches/1.4/doc/cc_ptp_agent.fsm
D   branches/1.4/doc/cc_ptp_agent_flattened.fsm
A   branches/1.4/doc/cc_ptp_agent_flattened.fsm
D   branches/1.4/doc/cc_ptp_monitor.fsm
A   branches/1.4/doc/cc_ptp_monitor.fsm
D   branches/1.4/doc/cc_ptp_monitor_flattened.fsm
A   branches/1.4/doc/cc_ptp_monitor_flattened.fsm
D   branches/1.4/doc/cc_qsig_agent.fsm
A   branches/1.4/doc/cc_qsig_agent.fsm
D   branches/1.4/doc/cc_qsig_agent_flattened.fsm
A   branches/1.4/doc/cc_qsig_agent_flattened.fsm
D   branches/1.4/doc/cc_qsig_monitor.fsm
A   branches/1.4/doc/cc_qsig_monitor.fsm
D   branches/1.4/doc/cc_qsig_monitor_flattened.fsm
A   branches/1.4/doc/cc_qsig_monitor_flattened.fsm
U   branches/1.4/libpri.h
U   branches/1.4/pri.c
A   branches/1.4/pri_cc.c
U   branches/1.4/pri_facility.c
U   branches/1.4/pri_facility.h
U   branches/1.4/pri_internal.h
U   branches/1.4/pri_q931.h
U   branches/1.4/prisched.c
U   branches/1.4/q931.c
U   branches/1.4/rose.c
U   branches/1.4/rose.h
A   branches/1.4/rose_etsi_cc.c
U   branches/1.4/rose_internal.h
A   branches/1.4/rose_qsig_cc.c
U   branches/1.4/rosetest.c

------------------------------------------------------------------------
r1714 | rmudgett | 2010-05-26 11:01:10 -0500 (Wed, 26 May 2010) | 28 lines

Add Call Completion Suppplementary Service

Call Completion Supplementary Service (CCSS) added for the following
switch types: ETSI PTMP, ETSI PTP, Q.SIG.  

Specifications:
ETS 300 359 CCBS for PTMP and PTP
ETS 301 065 CCNR for PTMP and PTP
ECMA-186 Call Completion for Q.SIG

Several support services were added to support CC:
Dummy Call Reference.
Q.931 REGISTER message.
Dynamic expansion of the number of available timers (up to 8192).
Enhanced facility message handling.

Current implementation limitations preclude the following:
CC service retention is not supported.
Q.SIG path reservation is not supported.

(closes issue ASTERISK-13410)
Reported by: tomaso
Tested by: rmudgett

JIRA SWP-1493

Review: https://reviewboard.asterisk.org/r/522/

------------------------------------------------------------------------

http://svn.digium.com/view/libpri?view=rev&revision=1714

By: Richard Mudgett (rmudgett) 2010-05-26 11:07:39

The asterisk portion of this feature was merged into trunk -r256528.