Problem with SIM800L and USSD code

Hello. I want to check the account status, for this purpose I send the AT command from the serial port AT + CUSD = 1, "* 101 #", after a few seconds I receive a reply to the serial port. The problem appears when I want to check the account status in this way: altsoftserial.print ("AT + CUSD = 1, \" * 101 # \ ""); On the serial port, I see that the command came out, but I don't get any feedback. Only when I reset the arduino does the reply appear on the serial port.

This situation is shown in the serial port screan: |500x196

I marked the moment of resetting the arduino with a red line

Where is the mistake? Please help.

I put the part of the code responsible for communication with SIM800L

void loop()
  char c;

  while (Serial.available()) {
    c =;
  while (altSerial.available()) {
    c =;
    textMessage = altSerial.readString();
    if(textMessage.indexOf("Pozostalo Ci")>=0){
      stanKontaLcd = textMessage;
      lcd.print(stanKontaLcd.substring(14, 29));
      lcd.print(stanKontaLcd.substring(46, 60));


void skonta(){
altSerial.print("AT+CUSD=1, \"*101#\"");

I use Arduino Nano (atmega328p) and ide 1.8 and AltSoftSerial library

Now to check balance using a two step process, you have to first enable the command USSD command response using command AT+CUSD=1 followed by \r\n or carriage return.