Just so I understand the problem:
You have two voip providers and each has their own DID. You have then set an inbound rule for each to forward the call to your extension. You can see the caller id but do not know which line they called and you want to know that at the phone?
The easiest way to do that is to create 2 ring groups, one for each line (and give them a meaningful name for you = e.g Voip1, Voip2 or CompanyA, CompanyB).
Add the extension(s) in a Ring All strategy to each group.
Forward each line to their respective ring group.
In the Settings page for 3cx check the box to append the group name to caller id and choose to append or prepend (we prefer prepend).
Now it will work and show GroupName:CallerID on the phone in prepend or CallerID:GroupName in append