I have created a console application that connects to my modem using AT Commands. I am able to dial a number and it works fine.

I want to transfer a call to a different number, and I am unable to achieve this. The modem first dials the number 5052, drops the line and then dials 5056. I am using the hook-flash option that is used to transfer the call but it is not working, instead it is dropping and initiating a new call.

SerialPort port = new SerialPort("COM3", 115200);
port.ReadTimeout = 5000;
port.NewLine = "\r";
port.WriteLine("ATZ"); // reset the modem
port.ReadTo("OK\r\n"); // wait for "OK" from modem

port.WriteLine("ATDTW5052@"); // dial number with dialtone
port.WriteLine("ATDT!5056"); // dial number with dialtone

string response = port.ReadTo("\r").Trim(); // read until first newline