[asterisk-r2] Bug in openr2?

Daniel A. Veiga dveiga at advtechnology.com.ar
Wed May 6 07:26:23 CDT 2009


I'm getting a bunch of warnings like this:

[May  6 08:51:00] WARNING[6810]: chan_dahdi.c:990
dahdi_r2_get_channel_category: Invalid category specified 'National
Subscriber' for chan DAHDI/27-1, using default National Subscriber

Looking into the code I found the problem is the variable
MFCR2_CATEGORY gets dahdi_r2_get_channel_category() with the value
"National Subscriber'. So, when this function calls
open_r2_proto_get_category() to convert that string into the category
id, it fails because even though the match is case insensitive it has a
space in the middle instead of an undescore. In other words the value
should have been 'NATIONAL_SUBSCRIBER' instead of 'National
Subscriber'.

I tried to determine where the value of MFCR2_CATEGORY was initialized
and found it was in dahdi_new. It is initialized calling
openr2_proto_get_category_string().

The problem I believe we have is libopenr2 is not consistent with the
names of the categories. If you convert category id
OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER to string using
openr2_proto_get_category_string() and back again to id using
open_r2_proto_get_category() you get OR2_CALLING_PARTY_CATEGORY_UNKNOWN
instead of the expected OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER.

At this point I imagined including
Set(MFCR2_CATEGORY=NATIONAL_SUBSCRIBER) in my dialplan would bypass the
problem, but it didn't. I don't know why yet, but I have a lot of
traffic and cannot test any further. Anyhow, I believe it is just
bypassing the problem, that should be solved in openr2. I can change it
in r2proto.c and send a patch, but would like to listen from your
comments before.

Bye,





More information about the asterisk-r2 mailing list