You may try to send the following AT command to your modem: "AT+CGPADDR=1".
If your modem is connected to COM port (assume to port "COM1"), the code may looks as follows:
SerialPort port = new SerialPort("COM1");
port.DataReceived += new SerialDataReceivedEventHandler(ProcessReceivedData);
port.Open();
port.Write("AT+CGPADDR=1");
and the SerialDataReceivedEvent handler:
private static void ProcessReceivedData(Object sender, SerialDataReceivedEventArgs e)
{
SerialPort port = (SerialPort)sender;
string response = port.ReadExisting();
Console.WriteLine(response);
}
It should work if your system currently does not use the modem (otherwise, port is busy and you'll get UnauthorizedAccessException).