I have a bunch of CDR records in the mysql database “asteriskcdrdb” on a FreePBX system. There is a DAHDI trunk defined in FreePBX which uses the “gN” identifier to make calls. So in this setup the trunk is roughly equivalent to a DAHDI logical group. I
want to know, given a CDR, which logical group (and therefore, trunk) was used to place the call, or was used to receive the call.
In Asterisk 1.6 and lower, the DAHDI channel encoded the B channel, as in DAHDI/aaa-bbb where aaa was the ISDN B channel. Since, as far as I can see, the logical group groups channels together, the strategy was to ask Asterisk for the dahdi groups, list the B channels, and fetch the records that referenced those B channels.
In Asterisk 1.8, this no longer works. Since the DAHDI channel name no longer references a B channel ( https://issues.asterisk.org/jira/browse/ASTERISK-17229) I can no longer extract the B channel to associate a particular CDR with a particular logical group, Though, I am not particularly interested in the B channel, except as a means to build the association.
Is there a way to guess the logical group given the standard CDR fields? All of the strategies I can think of require adding new fields to asteriskcdrdb, which does nothing to help me with the CDR records already written.
The strategies for future association involve using the dialplan to capture CHANNEL(dahdi_span/dahdi_channel/dahdi_type) and writing this information in additional fields in asteriskcdrdb. However, some field to inform the logical group would be more useful for me.