Use both GSM_SMS and GSMVoiceCall

Hello,

My code :

// include the GSM library
#include <GSM.h>

// PIN Number for the SIM
#define PINNUMBER ""

// initialize the library instances
GSM gsmAccess;
//GSM_SMS sms;
GSMVoiceCall vcs;
// Array to hold the number a SMS is retreived from
char senderNumber[20];
// Array to hold the number for the incoming call
char numtel[20];

void setup() {
// put your setup code here, to run once:
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("gsmserver|message|SERIAL READY");
// connection state
boolean notConnected = true;

// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while (notConnected) {
if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
notConnected = false;
} else {
Serial.println("gsmserver|message|GSM MODEM NOT CONNECTING");
delay(1000);
}
}
// This makes sure the modem correctly reports incoming events
vcs.hangCall();
Serial.println("gsmserver|message|GSM SERVER READY");

}

void loop() {
// put your main code here, to run repeatedly:
// Check the status of the voice call
char c;
switch (vcs.getvoiceCallStatus()) {
case IDLE_CALL: // Nothing is happening

break;

case RECEIVINGCALL: // Yes! Someone is calling us

// Serial.println("RECEIVING CALL");

// Retrieve the calling number
vcs.retrieveCallingNumber(numtel, 20);

// Print the calling number
Serial.print("gsmserver|command|receivecall|");
Serial.println(numtel);

// Answer the call, establish the call
// vcs.answerCall();
break;

case TALKING: // In this case the call would be established

Serial.println("TALKING. Press enter to hang up.");
while (Serial.read() != '\n') {
delay(100);
}
vcs.hangCall();
Serial.println("Hanging up and waiting for the next call.");
break;
}
// If there are any SMSs available()
/*
if (sms.available()) {
Serial.print("gsmserver|command|receivesms|");

// Get remote number
sms.remoteNumber(senderNumber, 20);
Serial.print(senderNumber);
Serial.print("|");

// An example of message disposal
// Any messages starting with # should be discarded
if (sms.peek() == '#') {
Serial.println("Discarded SMS");
sms.flush();
}

// Read message bytes and print them
while (c = sms.read()) {
Serial.print(c);
}

Serial.println("");

// Delete message from modem memory
sms.flush();
//Serial.println("MESSAGE DELETED");
}*/

delay(1000);

}

It is a combination of the recievecall and recievesms example.
When I use both GSM_SMS and GSM_voicecall classes, the program doens't show GSM SERVER READY.
When i command out GSM_SMS and command out the functions from the sms (like example here on top) then it workes?

It seems like I can't receive calls and receive sms at the same time?

Somebody who can help?

Greets John

Hey,

Nobody?
Strange that nobody who has bought the arduino GSM shield, never used sms and voicecall on the same arduino?

Greets

John

these classes were made by you (arduino), strange that nobody can help me with this problem.

greets John

hi,

I am using both VoiceCall and SMS but a little bit differently:

...
switch (vcs.getvoiceCallStatus()) // IDLE_CALL, CALLING, RECEIVINGCALL, TALKING
  {
    case IDLE_CALL: // Nothing is happening

      // Check if there are any SMSs available()
      Serial.println("IDLE_CALL ----->sms.available()");
      if (sms.available())
      {
        Serial.println("Message received from:");
        ...    // here processing SMS
       }
       break;
       ...

Cecking if SMS is available and processing is located in "case IDLE_CALL".
I don't know if this is the essential difference, but it works.

I would expect that your code also is working, but :confused:

SupArdu