Summary:ASTERISK-13210: [patch] COLP/CONP support in QSIG
Reporter:Norbert Reinartz (nreinartz)Labels:
Date Opened:2008-12-12 07:42:22.000-0600Date Closed:2009-08-18 19:00:45
Versions:Frequency of
Environment:Attachments:( 0) asterisk-issue14068-2009-01-30-colpconp-0.1.5.patch
( 1) asterisk-issue8824-2008-12-10-colpconp-0.1.0.patch
( 2) libpri-1.4-2008-12-10-colpconp-0.1.0.patch
( 3) libpri-1.4-2008-12-12-colpconp-0.1.0.patch
( 4) libpri-issue14068-2009-01-30-colpconp-0.1.5.patch
Description:There's work in progress at Digium to implement COLP/CONP in asterisk team branch issue8824 http://svn.digium.com/view/asterisk/team/group/issue8824.
Connected line and number presentation now is also supported in ISDN/QSIG by two patchfiles attached to this issue.

The number and line presentation not only works for simple calls (for called and calling party number) but also for call diversion and call transfer.
This means divertingLegInformation1, divertingLegInformation2, divertingLegInformation3, callTransferComplete, callTransferActive, CalledName, ... are supported in QSIG.
It has been tested with HiPath 3000 V4.0 and HICOM 300.

libpri-1.4-2008-12-10-colpconp-0.1.0.patch adds COLP/CONP support to libpri-1.4 branch. This patch includes lots of new functions for QSIG apdu encoding and decoding and also fixes some bugs related to QSIG encoding/encoding.

asterisk-issue8824-2008-12-10-colpconp-0.1.0.patch is used to patch chan_dahdi.c in asterisk-issue8824.
Comments:By: Timo Teräs (fabled) 2009-01-10 01:44:02.000-0600

I implemented parts of this previously (see bug 0012357). But this looks like a more complete implementation. I had some of these features also on my long to-do list, but I've been busy with other matters. I'll give this a test spin soon.

By: Timo Teräs (fabled) 2009-01-12 05:29:11.000-0600

I fixed call state checking in pri_connected_line_update() to be aware of Q931_CALL_STATE_INCOMING_CALL_PROCEEDING and changed the many ifs to switch (and s/callStauts/callStatus/g). Also couple of white space clean ups.

I'm still having problems to get callTransferComplete working. The message is received correctly e.g. logs show:
 Got CT-Complete, callStauts = alerting(1)
 CT-Complete, sending facility/CMD_REDIRECTING (<name>/<number>)

But for some odd reason it's not handled/forwarded by chan_dahdi.c. Any ideas what might be causing this?

By: Timo Teräs (fabled) 2009-01-12 06:14:46.000-0600

Found the problem with transfer updates. It is broke when native bridging is active: dahdi_bridge() returns on control frame and ast_bridge_call() seems to eat the connected line id updates.
So I made it like: HiPath->QSIG->*->IAX->*->QSIG->HiPath, and now the callTransferComplete when transferring to answered call seems to work. When transferring to call in ringing state it does not work as expected: HiPath first sends callTransferComplete which is mangled by Asterisk to divertingLegInformation1 and divertingLegInformation3 messages. On answer, HiPath further sends callTransferActive which gets translated to callTransferComplete (this actually updates my phone). But I think the intial converstion to divertingLegInformation messages is incorrect; furthermore pri_redirecting_update() wants to send divertingLegInfo3 in ALERTING messages which will never occurs as the original call is already answered.

By: Norbert Reinartz (nreinartz) 2009-01-14 04:35:05.000-0600

Fabled, thanks for your testing and your input. I primarily tested QSIG against SIP with our asterisk media-gateway but I see there is some work to do to make
QSIG->QSIG running.
I'm planning to test HiPath->QSIG->*->QSIG->HiPath first. There shouldn't be to much to do. First of all pri_redirecting_update() needs some call state checking to differ in actions for call transfer and call diversion.

By: Richard Mudgett (rmudgett) 2009-01-19 14:31:30.000-0600

Created the following branches:

and applied the latest patch files above to the branches.

By: Norbert Reinartz (nreinartz) 2009-01-30 11:16:07.000-0600

I had a look at pri_redirecting_update(). It now checks the state to differ between call transfer and call diversion.
Call transfer in ringing state now should work: If Hipath sends call transfer in scenario HiPath->QSIG->*->QSIG->HiPath, this results in a call transfer complete to the 2nd Hipath. There is more work to do, but I'm very busy with other matters at the moment.
Meanwhile some other bugs (resulting in crashes) are fixed and I want to give the fixes back to this issue.
I attached 2 patch files:
- asterisk-issue14068-2009-01-30-colpconp-0.1.5.patch
- libpri-issue14068-2009-01-30-colpconp-0.1.5.patch

By: Richard Mudgett (rmudgett) 2009-01-30 16:40:42.000-0600

Applied the two new patch files to the respective work in progress branches.

By: Timo Teräs (fabled) 2009-03-17 06:54:56

Tested some basic cases and they seem to work. I did notice that under some compiler settings I get an error at rose_presented_number_unscreened_encode(), case PRES_UNAVAILABLE: ASN1_FIXUP() line that array is accessed out of bounds.

I think the ASN1_FIXUP() is not correct there, since ASN1_PUSH() is not called earlier. The ASN1_FIXUP() call should be just deleted there, right?

By: Richard Mudgett (rmudgett) 2009-03-17 16:40:36

You are correct.  I have removed the erroneous ASN1_FIXUP() since the component tag is implicit and not explicit.

By: Alec Davis (alecdavis) 2009-04-07 05:09:54

All of this work seems to be related to Asterisk providing a QSIG network, and QSIG pinx's as CPE's to Asterisk.

What about turning this around;
    Asterisk SiteA <-> QSIG (Network) QSIG <-> Asterisk SiteB
We have JTEC equipment that provides a QSIG network between our sites (currently 4), and have Asterisk deployed at 2 sites as a QSIG CPE. The main issue for us, is calls trombone between sites if they are transferred back to the orignal site, "QSIG - Call Path Replacement".

A simple test setup might be 2 Asterisk boxes connected back to back, with an E1/T1 card, one configured as QSIG CPE and the other QSIG NET.
    Asterisk SiteA QSIG-NET <-> QSIG-CPE Asterisk SiteB
Then initiate a call from SiteA->SiteB, then from SiteB transfer back to SiteA, ideally no calls should exist on the E1/T1 circuit after the transfer.

If it helps for testing, I have available to me a couple of spare Jtec's (J5000 VX Exchanges) equipped with multiple QSIG ISDN E1 cards, and a couple of Digium E1 cards.

By: Richard Mudgett (rmudgett) 2009-06-15 14:37:51

Development for chan_dahdi/libpri COLP functionality is complete and ready for testing.
The code is available in the following SVN branches:
asterisk/team/group/issue14068 (trunk level code)

The code implements the Q.SIG and ETSI(EuroIsdn) PTP/PTMP COLP functionality in issue8824 that was recently merged to trunk.

By: Thomas Arimont (tomaso) 2009-08-06 09:32:14

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 14068 branch too: sig_pri.c)
For a fix please make sure that in function sig_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);

ast_channel_queue_connected_line_update(owner, &ast_connected);

Thomas Arimont

By: Richard Mudgett (rmudgett) 2009-08-06 10:29:38

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) sig_pri/chan_dahdi private lock.
3) channel lock
The function sig_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:39:03

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

By: Digium Subversion (svnbot) 2009-08-18 18:54:03

Repository: libpri
Revision: 982

U   branches/1.4/Makefile
U   branches/1.4/libpri.h
U   branches/1.4/pri.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/q931.c
U   branches/1.4/rose.c
U   branches/1.4/rose.h
A   branches/1.4/rose_etsi_diversion.c
A   branches/1.4/rose_etsi_ect.c
U   branches/1.4/rose_internal.h
U   branches/1.4/rosetest.c

r982 | rmudgett | 2009-08-18 18:54:03 -0500 (Tue, 18 Aug 2009) | 11 lines

Add COLP support to libpri for ETSI PTP, ETSI PTMP, and Q.SIG.

Add Connected Line Presentation (COLP) support to chan_dahdi/libpri as an
addition to issue 8824.  This is the libpri portion.  COLP support is now
available for ETSI PTP, ETSI PTMP, and Q.SIG with this patch.

(closes issue ASTERISK-13210)
Tested by: rmudgett

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



By: Digium Subversion (svnbot) 2009-08-18 18:54:26

Repository: asterisk
Revision: 213007

U   trunk/CHANGES
U   trunk/channels/sig_pri.c
U   trunk/channels/sig_pri.h

r213007 | rmudgett | 2009-08-18 18:54:25 -0500 (Tue, 18 Aug 2009) | 12 lines

Add COLP support to chan_dahdi/sig_pri.

Add Connected Line Presentation (COLP) support to chan_dahdi/libpri as an
addition to issue 8824.  This is the chan_dahdi/sig_pri portion.  COLP
support is now available for any switch for which libpri supports COLP
(currently ETSI PTP, ETSI PTMP, and Q.SIG) with this patch.

(closes issue ASTERISK-13210)
Tested by: rmudgett

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



By: Digium Subversion (svnbot) 2009-08-18 19:00:44

Repository: asterisk
Revision: 213008

_U  branches/1.6.2/

r213008 | rmudgett | 2009-08-18 19:00:43 -0500 (Tue, 18 Aug 2009) | 18 lines

Blocked revisions 213007 via svnmerge

 r213007 | rmudgett | 2009-08-18 18:53:55 -0500 (Tue, 18 Aug 2009) | 12 lines
 Add COLP support to chan_dahdi/sig_pri.
 Add Connected Line Presentation (COLP) support to chan_dahdi/libpri as an
 addition to issue 8824.  This is the chan_dahdi/sig_pri portion.  COLP
 support is now available for any switch for which libpri supports COLP
 (currently ETSI PTP, ETSI PTMP, and Q.SIG) with this patch.
 (closes issue ASTERISK-13210)
 Tested by: rmudgett
 Review: https://reviewboard.asterisk.org/r/340/