How to find the inbound caller ID on a AGI script?

I have two PJSIP trunks that don’t send the DDI number, they are also from the same SIP providers.
I want to distinguish between them to dial different extensions based on the inbound caller ID.
I am thinking of giving them the same context, but with the inbound caller ID… make it call different extensions or ring groups.
Is there are way to do this ?
I am using FPBX-12.0.76.2(13.1).

Have you look through the variables passed to the script?

http://www.voip-info.org/wiki/view/Asterisk+AGI

Yes, but there is nothing given here or even in the extension files related to inbound caller ID.

I had to do something like this to get my DADHI lines to go to different extensions. The way I did it was set up custom contexts for each line that set the DID number and then continued on to from-pstn.

I tried that, but both the numbers are from the same provider. So, when I call, the latest context is taken by the system. If my providers were different, it would work.