Archive for July, 2009

libisdn: ASN.1

This has been on my ToDo list for a while now. Decoding works so far, but i’ll have to change things a bit to get encoding working too. Sample output:

successfully decoded ASN.1 BER data
duration 0 seconds, 102419 nanoseconds

===================================== ASN.1 =====================================

context specific element, tag: 1
{
        integer:        757
        oid:            0.4.0.745.1.3
        sequence
        {
                context specific element, tag: 1
                {
                        context specific element, tag: 0, size: 4 octets
                              [ 31 30 30 31 ]
                }
                context specific element, tag: 2
                {
                        enumerated:     0
                }
                context specific element, tag: 3
                {
                        integer:        0
                }
                context specific element, tag: 4
                {
                        context specific element, tag: 0, size: 4 octets
                              [ 31 30 30 31 ]
                }
                context specific element, tag: 6
                {
                        sequence
                        {
                                integer:        0
                                enumerated:     0
                        }
                }
        }
}

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

This is an MWI Indication Invocation call sent from the ISDN phone on my desk to the OpenZAP NT it is connected to.

libisdn: call information dumping

Still have to change a couple of things here to get it working with the “api” interface of the OpenZAP module, but this is what it looks like right now:

API CALL [oz(isdn dump 1 calls)] output:
+OK call information dumped to log      

2009-07-07 23:55:22.500881 [DEBUG] Span:1 Information of all active calls:
==================================== Calldump ===================================
* CRV:  76 (0x76)                                                                
        Global call:   No                                                        
        Direction:     Inbound                                                   
        State:         258 'Overlap sending'
        L4 User data:  0x24632e0
        Timer:         T302, timeout in: 14372 ms, expire count: 0
        Events queued: 0
-----------------------------------------------------------------[  1 call(s) ]--

Command to get this output (debug loglevel!): oz isdn dump <span id> calls


libisdn: advanced error reporting, part 1

Just a short update on libisdn (the current name of the OpenZAP ISDN stack), before i fall asleep

This is how IE errors will be reported as of now, if you’ve turned on debug loglevel (i’m only abusing ERR for the pretty red color):

2009-07-07 01:02:25.848853 [ERR] Span:1 Message parser error(s)
=================== Errors reported for message -   5 (0x05) ===================
* IE id:  24 (0x18), name: "N/A", size:   3, offset:   9

  [01]  error message: Size invalid
        diagnostic:    Message element is either too small or too large
        details:       expected size: 3 - 0 octet(s)
        octets:
                |-{9}-> 18 01 83

---------------------------------------------------------------[  1 error(s) ]--

I’m going to add some more information (IE / Message names / Call info) in the future. Next step is to change parts of the message decoding function to relax some of the IE checks or, if possible, skip decoding a faulty IE so we can still check them all and report multiple issues in one report. Another thing we can add now is diagnostic information in Cause IEs sent to the other side (e.g. ID of the invalid IE in a message).

UPDATE: Some minor modifications to the output format:

2009-07-07 21:52:55.38692 [DEBUG] Span:1 Q931Umes[Q.931 NT][5]() returned -3002
2009-07-07 21:52:55.38692 [ERR] Span:1 Message parser error(s)
=================== Errors reported for message -   5 (0x05) ===================
* IE id:   4 (0x04), name: "N/A", size:   5, offset:   4

  <01>  error message: Not allowed here
        description:   Message element is not allowed in this state/message
        details:       N/A
        raw octets:
              [ 04 03 80 90 a3 ]

---------------------------------------------------------------[  1 error(s) ]--