5 lines PSTN for 2 companies. How to tell wich one is called

Hello every one,

I’m setting up an asterisk box for my two very-small companies. I want to have only 5 lines for the two of them, and to share them for inbound and outbound. I asked the phone company if is possible to have “two unique numbers” in 5 lines. They toldme “i will check out but i’m pretty sure we can”.

So I’m supposing they can, and I was wondering if there is a way to get than number so I can redirect the call to the apropiate digital asistant.

Wich one would be the variable?

Thanks in advance for your help.

Most likely they will use some type of DID service and send you the number that was called more info here