Problem communicating GSM Shield (SIM900) via USSD

Hello!

I am struggling to communicate a SIM900 GSM module via AT USSD command using a Arduino UNO. Using the similar wiring/settings, I was able to send/receive SMS and make/receive Phone Calls. To make a USSD command, I have used “SoftwareSerial” and “SIM900.h (GSM Shield Library)” libraries as shown below with a part of my code:

//Library used

#include <SoftwareSerial.h>
#include <SIM900.h>

void setup()
{
  gsm.begin(9600);
  Serial.begin(9600);
  gsm.SimpleWriteln("AT+IPR=9600"); // Not to autobaud
  Serial.println("USSD COMMAND DIALER");
  delay(1000);

  // Start GSM connection
  if (gsm.begin(9600))
      Serial.println("\nStatus = READY");
  else Serial.println("\nStatus = IDLE");
  delay (1000);
   Serial.println("Waiting for USSD Command");
}

void loop(){
sendReadUssd();
}

//This is the function I am using to send/read USSD command/response

void sendReadUssd(){

  gsm.SimpleWriteln(F("AT + CUSD = 1,\"#21#\",0\r\n"));
  delay(5000);

  char response[200];
  gsm.read(response,200);
  Serial.println(response);
}

This is the response I’m getting:

Please wait while we execute the command…
Starting read…
Waiting for Data…
OK

OK

+CUSD: 2

Done…

OK

OK

+CUSD: 2
_��;�o�������}.���)����^s���7[�uﵛ_�����ewϧ�z��9�;]��O�����j���

I was expecting a response like: “Call Forwarding Service Disabled”.

I have tried following alternatives:

  1. Switched baud rate between 4800 - 115200
  2. Increasing the delay within the sendReadUssd function
  3. Just used the ‘SoftwareSerial’ library (creating an instances like: SIM900 (2, 3))

I’d really appreciate if someone can give any pointers.

Thank you!