How to connect ESP32 to Arduino + HC-06 via Bluetooth?

I tried this code running on Arduino + HC-06

And it works fine with the smartphone app connected to Bluetooth device called HC-06, and PIN 1234.

I would like to make an ESP32 Bluetooth controller for it. I tried the official code for Bluetooth classic: arduino-esp32/SerialToSerialBTM.ino at master · espressif/arduino-esp32 · GitHub

Of course, I changed the variables:

String MACadd = "20:16:04:11:65:21";
uint8_t address[6] = {0x20, 0x16, 0x04, 0x11, 0x65, 0x21};
String name = "HC-06";
char *pin = "1234";

& try to lower the Serial connection


But that didn't help!