Mobile Number of the Caller

Hello I am creating an IVR.
When a caller from his mobile(using GSM) Asterisk dialplan is redirecting the call to the AGI.
How can I know the mobile number of the caller and how to pass that number(variable name) to AGI?

You need to ask the person who wrote the dialplan, probably the FreePBX people, at freepbx.org/.

However, if you are not getting caller ID,the problem probably lies with your netowrk operator/ITSP.

I am creating the dialplan.I have made my own asterisk server.I want to know who has called the asterisk server so that I can pass the number as a variable from dialplan to my agi server.

Moreover
Suppose I have three sip registered peers who are set to the same context.
How to know which one has called?

If the CALLERID is transmitted by the network opeerators in the chain You should ffind it in CALLERID(num).
Handling different sip peers in one context and gathering which one was used is easy when You’re able to define a special extension upon peer registration. (Have a look at the registry/Callbackextension-Syntax for sip.conf).