Arduino Mega with Sim900

Recently I bought Sim900a module and Arduino Mega 2560 to run my old code for sending sms and call, but now there is a problem as I am unable to send sms or either call, my code is attached below.





#include <SoftwareSerial.h>
SoftwareSerial gsm(2,3);
void setup()
{
gsm.begin(9600); // Setting the baud rate of GSM Module
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
delay(100);
}
void loop()
{
if (Serial.available()>0)
switch(Serial.read())
{
case 's':
Send();
break;
case 'r':
Recieve();
break;
case 'S':
Send();
break;
case 'R':
Recieve();
break;
}
if (gsm.available()>0)
Serial.write(gsm.read());
}
void Send()
{
Serial.print("Sending");
gsm.println("AT+CMGF=1");
delay(1000);
gsm.println("AT+CMGS=\"+xxxxxxxxxxxx\"\r"); // Replace x with mobile number
delay(1000);
gsm.println("Hello I am GSM modem!!!");// The SMS text you want to send
delay(100);
gsm.println((char)26); // ASCII code of CTRL+Z
delay(1000);
}
void Recieve()
{
Serial.print("Receiving");
gsm.println("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS
delay(1000);
}