New TenantID feature doesn't seem to set CDR for incoming calls

I noticed the new TenantID feature blogged about at Tenant ID, a Flexible Asterisk Tool ⋆ Asterisk and found this would be a useful feature for us, as we have tenants and want the tenantID to show up in CDRs, and currently use a workaround by setting a custom CDR field.

I was able to get this working well for outgoing calls, via setting the tenantID in the pjsip.conf. That winds up in our newly created tenantID column in our CDRs.

However, I’m not able to get the tenantID to show up in the CDR for incoming calls. In this case I’m setting the tenantID in the dialplan, since I won’t know who the tenant is until I can look up who owns the DID in the dialplan. So I do something like this:

same => n,Set(CHANNEL(tenantid)=${companyID})

(companyID is set previously)

However, this doesn’t show up in my DB. Furthermore, this returns blank:

same => n,NoOp(tenantID: ${CDR(tenantid)})

NoOp(tenantID: )

I’ve also tried setting the CDR explicitly,

same => n,Set(CDR(tenantid)=${CHANNEL(tenantid)})

Which when I query CDR, shows up:

NoOp(tenantID: uatTest)

But doesn’t show in my DB column in CDR, it’s still null.

Just to repeat, this all works perfectly for an outgoing call, when tenantID is set in my pjsip.conf for an outgoing call, DB column and all.

It’s just not terribly useful to us unless we can get the tenantID into all calls, outgoing, incoming, fax, etc. I think I followed the blog entry correctly, but otherwise can’t get this feature to work.

Any help is appreciated. Thanks.

Hey there, would you mind creating an issue on GitHub (https://github.com/asterisk/asterisk/issues) for this? We’ll triage it further from there.

Done [bug]: New TenantID feature doesn't seem to set CDR for incoming calls · Issue #1259 · asterisk/asterisk · GitHub

Is their anything else to try? We’ve opened up a number of issues over the years, 99% of which just wind up in a black hole and are never heard from again. I think this was added by Digium, but I expect the feature is so new, few might have tried using it in CDRs.

It’s a nice feature, and we’d like to use it but AFAK it seems to be broken.

I was the author of this feature :slight_smile: so it is fairly new and current. I will be taking a look at it when I can, probably first thing tomorrow. Further communication will be done on the issue so we can get an idea of what’s going on, and then once we have a resolution, it can be posted back here for reference. It definitely should work for that scenario, so thank you for taking the time to create the issue!