[asterisk-dev] Libpri and Optional Bearer Capability Octet 5 (proposed patch attached)

Travis Schafer TSchafer at carsoncity.k12.mi.us
Wed Dec 3 23:49:44 CST 2008


Thanks for your time,
 
I have a PRI running between an Asterisk box and a Polycom MGC-50 MCU. When the MGC places an H.320 call (ISDN Video Conferencing), the bearer capability information element of the setup message may or may not contain octet 5, depending on wether the conference is set to use 64K B-Channels or 56K B-Channels (octet 5 is absent for conferences utilizing 64K B-Channels).
 
Accord to page Note 6 on page 60 of Q.931 (May 1998), octet 5 may be omitted in certain situations:
 
If the transfer mode is "circuit mode", and if the information transfer capability is "unrestricted
digital information" or "restricted digital information", and if the user information layer 1 protocol is to be identified only to the addressed entity octet 5 shall be omitted. If the transfer mode is packet mode, octet 5 may be omitted. Otherwise, octet 5 shall be present.
 
A trace of an example 64K B-Channel call is provided below:
 
< Protocol Discriminator: Q.931 (8)  len=41
< Call Ref: len= 2 (reference 23/0x17) (Originator)
< Message type: SETUP (5)
< [04 02 88 90]
< Bearer Capability (len= 4) [ Ext: 1  Q.931 Std: 0  Info transfer capability: Unrestricted digital information (8)
<                              Ext: 1  Trans mode/rate: 64kbps, circuit-mode (16)
< [18 03 a9 83 97]
< Channel ID (len= 5) [ Ext: 1  IntID: Implicit  PRI  Spare: 0  Exclusive  Dchan: 0
<                        ChanSel: As indicated in following octets
<                       Ext: 1  Coding: 0  Number Specified  Channel Type: 3
<                       Ext: 1  Channel: 23 ]
< [6c 0b a1 39 38 39 35 38 34 33 31 33 38]
< Calling Number (len=13) [ Ext: 1  TON: National Number (2)  NPI: ISDN/Telephony Numbering Plan (E.164/E.163) (1)
<                           Presentation: Presentation permitted, user number not screened (0)  '9895843138' ]
< [70 0c a1 31 39 37 38 32 39 32 32 38 35 33]
< Called Number (len=14) [ Ext: 1  TON: National Number (2)  NPI: ISDN/Telephony Numbering Plan (E.164/E.163) (1)  '19782922853' ]
 
The problem is that on the *outbound* leg of the call, IE 4 octet 5 is present, though it has an "undefined" value. As a result, the upstream switch kicks back the call with cause 100...
 
> Protocol Discriminator: Q.931 (8)  len=47
> Call Ref: len= 2 (reference 8/0x8) (Originator)
> Message type: SETUP (5)
> [04 03 88 90 bf]
> Bearer Capability (len= 5) [ Ext: 1  Q.931 Std: 0  Info transfer capability: Unrestricted digital information (8)
>                              Ext: 1  Trans mode/rate: 64kbps, circuit-mode (16)
>                                User information layer 1: Unknown (63)
> [18 03 a9 83 97]
> Channel ID (len= 5) [ Ext: 1  IntID: Implicit  PRI  Spare: 0  Exclusive  Dchan: 0
>                        ChanSel: As indicated in following octets
>                       Ext: 1  Coding: 0  Number Specified  Channel Type: 3
>                       Ext: 1  Channel: 23 ]
> [1e 02 80 83]
> Progress Indicator (len= 4) [ Ext: 1  Coding: CCITT (ITU) standard (0)  0: 0  Location: User (0)
>                               Ext: 1  Progress Description: Calling equipment is non-ISDN. (3) ]
> [6c 0c 21 80 39 38 39 35 38 34 33 31 33 38]
> Calling Number (len=14) [ Ext: 0  TON: National Number (2)  NPI: ISDN/Telephony Numbering Plan (E.164/E.163) (1)
>                           Presentation: Presentation permitted, user number not screened (0)  '9895843138' ]
> [70 0c 80 31 39 37 38 32 39 32 32 38 35 33]
> Called Number (len=14) [ Ext: 1  TON: Unknown Number Type (0)  NPI: Unknown Number Plan (0)  '19782922853' ]
q931.c:3100 q931_setup: call 32776 on channel 23 enters state 1 (Call Initiated)
    -- Called G1/19782922853
< Protocol Discriminator: Q.931 (8)  len=10
< Call Ref: len= 2 (reference 8/0x8) (Terminator)
< Message type: RELEASE COMPLETE (90)
< [08 03 82 e4 04]
< Cause (len= 5) [ Ext: 1  Coding: CCITT (ITU) standard (0)  Spare: 0  Location: Public network serving the local user (2)
<                  Ext: 1  Cause: Invalid information element contents (100), class = Protocol Error (e.g. unknown message) (6) ]
<              Cause data 1: 04 (4)
-- Processing IE 8 (cs0, Cause)
q931.c:3732 q931_receive: call 32776 on channel 23 enters state 0 (Null)
    -- Channel 0/23, span 1 got hangup, cause 100
NEW_HANGUP DEBUG: Calling q931_hangup, ourstate Null, peerstate Null
NEW_HANGUP DEBUG: Destroying the call, ourstate Null, peerstate Null
    -- Hungup 'DAHDI/23-1'
  == Everyone is busy/congested at this time (1:0/0/1)
  == Auto fallthrough, channel 'DAHDI/124-1' status is 'CHANUNAVAIL'
    -- Channel 0/4, span 6 got hangup request, cause 16
    -- Hungup 'DAHDI/124-1'
Note that the cause data is IE 4. Additionally, if I force libpri to omit IE 4 octet 5 for all calls with "Unrestricted Digital" transfer capability... the cause 100 problem goes away.
 
The simple fix, obviously, would be to omit octet 5 from IE 4 for all calls with unrestricted (or restricted) digital transfer capability. This won't work... since there are times when IE 4 Octet 5 *should* be present for restricted and unrestricted digital calls. A good example of this would be a conference utilizing 56K B-Channels:
 
< Protocol Discriminator: Q.931 (8)  len=43
< Call Ref: len= 2 (reference 29/0x1D) (Originator)
< Message type: SETUP (5)
< [04 04 88 90 21 8f]
< Bearer Capability (len= 6) [ Ext: 1  Q.931 Std: 0  Info transfer capability: Unrestricted digital information (8)
<                              Ext: 1  Trans mode/rate: 64kbps, circuit-mode (16)
<                                User information layer 1: V.110 Rate Adaption (33)
<                                Async: 0, Negotiation: 0, User rate: Unknown (0xf)
< [18 03 a9 83 86]
< Channel ID (len= 5) [ Ext: 1  IntID: Implicit  PRI  Spare: 0  Exclusive  Dchan: 0
<                        ChanSel: As indicated in following octets
<                       Ext: 1  Coding: 0  Number Specified  Channel Type: 3
<                       Ext: 1  Channel: 6 ]
< [6c 0b a1 39 38 39 35 38 34 33 31 33 38]
< Calling Number (len=13) [ Ext: 1  TON: National Number (2)  NPI: ISDN/Telephony Numbering Plan (E.164/E.163) (1)
 
In this case, Asterisk doesn't set IE 4 octet 5 for the outbound leg:
 
> Protocol Discriminator: Q.931 (8)  len=47
> Call Ref: len= 2 (reference 11/0xB) (Originator)
> Message type: SETUP (5)
> [04 03 88 90 bf]
> Bearer Capability (len= 5) [ Ext: 1  Q.931 Std: 0  Info transfer capability: Unrestricted digital information (8)
>                              Ext: 1  Trans mode/rate: 64kbps, circuit-mode (16)
>                                User information layer 1: Unknown (63)
> [18 03 a9 83 97]
> Channel ID (len= 5) [ Ext: 1  IntID: Implicit  PRI  Spare: 0  Exclusive  Dchan: 0
>                        ChanSel: As indicated in following octets
>                       Ext: 1  Coding: 0  Number Specified  Channel Type: 3
>                       Ext: 1  Channel: 23 ]
> [1e 02 80 83]
> Progress Indicator (len= 4) [ Ext: 1  Coding: CCITT (ITU) standard (0)  0: 0  Location: User (0)
>                               Ext: 1  Progress Description: Calling equipment is non-ISDN. (3) ]
> [6c 0c 21 80 39 38 39 35 38 34 33 31 33 38]
> Calling Number (len=14) [ Ext: 0  TON: National Number (2)  NPI: ISDN/Telephony Numbering Plan (E.164/E.163) (1)
>                           Presentation: Presentation permitted, user number not screened (0)  '9895843138' ]
> [70 0c 80 31 39 37 38 32 39 32 32 38 35 33]
> Called Number (len=14) [ Ext: 1  TON: Unknown Number Type (0)  NPI: Unknown Number Plan (0)  '19782922853' ]
So, basically, the primary issue is that Asterisk doesn't copy layer 1 capabilities from the inbound leg of a call to the outbound leg of a call. I am aware that there is a patch for this (10217) that is pretty close... and I'd like to try to extend that patch to use channel datastores, as well as handle the case where IE 4 octet 5 should be absent.
 
However, to handle the "absent octet 5" case, I'd need to test the inbound channel to see if IE4 octet 5 was present there. I can't think of a good way to do this with the present libpri (though I'm probably missing something obvious); if IE 4 octet 5 is missing, the userl1 member of the q931_call structure is left un-initialized (which makes sense).
 
My thinking was that either a "fake" user layer 1 value could be added to mark Octet 5 as absent, or another member... an "octet 5 absent" flag... could be added to q931_call. Adding a flag to q931_call seemed like the best option. I've attached a proposed patch.
 
Am I headed in the right direction?
 
Thanks,
 
--TS
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20081204/15f0aace/attachment-0001.htm 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libpri_handle_no_userl1.patch
Url: http://lists.digium.com/pipermail/asterisk-dev/attachments/20081204/15f0aace/attachment-0001.txt 


More information about the asterisk-dev mailing list