GSM shield takes a lot of time

Hi,

I am writing to you because I can't find where the problem is. I explain, I want to send data from an Arduino Mega 2560 to a server. I'm using the Arduino GSM shield v2 with integrated antenna. The problem is that it takes a lot of time to connect to the GSM network and to the GPRS network.
I am trying to use the example "GSMWebClient" from the GSM library. The program gets stuck when the shield try to connect to the GSM network, at this line :

(gsmAccess.begin(PINNUMBER) == GSM_READY) & (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD) == GPRS_READY)

I success to connect only around one time overs twenty. The pin code is correct as well as the apn. With my phone, I can reach network easily and I capture 4G.
I put a wire between pin 2 and 10, like said in the documentation for using the GSM shield with an Arduino Mega, I tried to change the power supply.

I don't know what to do next, I have no idea at all.

Do you have any answers to give me please ?

Thanks for your reading !

On this topic https://www.arduino.cc/en/Guide/GSMShieldLeonardoMega, they also advise to bend the male header attached to pin 2 on the GSM shield to the side so it does not connect to the Mega.

Did you also tried this kind of sketch:

#include <SoftwareSerial.h>
SoftwareSerial gprs(10, 3);

void setup()
{
  Serial.begin(19200);
  gprs.begin(19200);
}

void loop()
{
  if (gprs.available()) Serial.write(gprs.read());
  if (Serial.available()) gprs.write(Serial.read());
}

and send the AT commands on the serial console

AT
OK  // The module is responding

AT+CPIN?  //Check CPIN
+CPIN: READY    // SIM card is unlocked
+CPIN: SIM PIN  // PIN number is required
OK

AT+CPIN="XXXX"   // if PIN is required (replace XXXX by your number)
OK

AT+CGATT?  // Check the module is attached to the network
+CGATT: 1
OK

AT+CIPSHUT // Destroy PDP context
OK

AT+CSTT="apn","user","password"  // Create PDP context with your provider
OK

AT+CIICR  // Bring up the GPRS connection
OK

AT+CIFSR // Get your IP
xxx.xxx.xxx.xxx