Problem with arduino uno and sim 900:incoming call and get together in a sketch

Hi there! :slight_smile:
My goal is to run a "get" after receiving a phone call.
I took as a cue the following sketch that works properly :

#include "SIM900.h"
#include <SoftwareSerial.h>
//We don't need the http functions. So we can disable the next line.
//#include "inetGSM.h"
#include "sms.h"
#include "call.h"

//To change pins for Software Serial, use the two lines in GSM.cpp.

//GSM Shield for Arduino
//www.open-electronics.org
//this code is based on the example of Arduino Labs.

//Simple sketch to check if an incoming call is from an authorized
//number and in this case, send to this number an SMS with the value
//of a digital input.

//We have to create the classes for SMSs and calls.
CallGSM call;
SMSGSM sms;

char number[20];
byte stat=0;
int value=0;
int pin=1;
char value_str[5];

void setup() 
{
  pinMode(pin,INPUT);
  //Serial connection.
  Serial.begin(9600);
  Serial.println("GSM Shield testing.");
  //Start configuration of shield with baudrate.
  //For http uses is raccomanded to use 4800 or slower.
  if (gsm.begin(2400))
    Serial.println("\nstatus=READY");
  else Serial.println("\nstatus=IDLE");
};

void loop() 
{
  //Chekcs status of call
  stat=call.CallStatusWithAuth(number,0,0);
  //If the incoming call is from an authorized number
   if(stat==CALL_INCOM_VOICE_AUTH){
    //Hang up the call.
    call.HangUp();
    delay(2000);
    //Check the value of the input.
    value=digitalRead(1);
    //Convert the int to a string.
    itoa(value,value_str,10);
    //Send an SMS to the previous number with
    //the value read previously.
    sms.SendSMS(number,value_str);
  }
  delay(1000);
};

I modified the code to execute the "get" instead of sending a text message(sms).

#include "SIM900.h"
#include <SoftwareSerial.h>
#include "inetGSM.h"
//#include "sms.h"
#include "call.h"

//To change pins for Software Serial, use the two lines in GSM.cpp.

//GSM Shield for Arduino
//www.open-electronics.org
//this code is based on the example of Arduino Labs.

//Simple sketch to start a connection as client.

InetGSM inet;
CallGSM call;
//SMSGSM sms;

char msg[50];
int numdata;
char inSerial[50];
int i=0;
boolean started=true;
int pin=1;
byte stat=0;
char number[20];


void setup() 
{
  pinMode(pin,INPUT);
  //Serial connection.
  Serial.begin(9600);
  Serial.println("GSM Shield testing.");
  //Start configuration of shield with baudrate.
  //For http uses is raccomanded to use 4800 or slower.
  if (gsm.begin(4800)){
    Serial.println("\nstatus=READY");

  }
  else Serial.println("\nstatus=IDLE");
  
};

void loop() 
{

 stat=call.CallStatusWithAuth(number,0,0);
 //If the incoming call is from an authorized number
  //saved on SIM in the positions range from 1 to 3.
  if(stat==CALL_INCOM_VOICE_AUTH){
  //Hang up the call.
    call.HangUp();
    delay(2000);
    started=true;
              if(started){
                started=false;
//                //GPRS attach, put in order APN, username and password.
//                //If no needed auth let them blank.
               if (inet.attachGPRS("wap.tim.it", "", ""))
                  Serial.println("status=ATTACHED");
                else Serial.println("status=ERROR");
                delay(1000);
//                
//                //Read IP address.
                gsm.SimpleWriteln("AT+CIFSR");
                delay(5000);
//                //Read until serial buffer is empty.
                gsm.WhileSimpleRead();
//              
//                //TCP Client GET, send a GET request to the server and
//                //save the reply.
              numdata=inet.httpGET("www.google.com", 80, "/", msg, 50);
//                //Print the results.
                Serial.println("\nNumber of data received:");
                Serial.println(numdata);  
             
                Serial.println(msg); 
          
              }
  }
  delay(1000);
};

Unfortunately on the serial monitor appear a series of "g".
If I try to comment on the party who is responsible for receiving the call, "get" runs, contrary if I try to comment on
inet.attachGPRS and hence get, the code that takes care of waiting calls is executed.
Is it possible to run both the two activities together, as is the case for the sketch waiting calls and sending text messages.
A help would be invaluable.

Hi which shield are you using?

I found it pretty challenging to get the GPRS to start working as expected. I had good luck with the seeed studio unit, and just received the open electronics board and shield. I used the seeed library, FWIW.

If I were you, I'd focus on just getting the GPRS connection going and verifying that it works. Then, get the Arduino to parse the get response correctly. Finally, combine your "if called, do x" front end with the GPRS portion. Make them separate programs that can be called from "loop()".

Hey open-electronics, thanks for getting that module to me and all the info you have published. I'm not a fan of your GIF signature, however. The rest of the forum here is without like eye-candy advertisements and I hope you don't set a precedent.

In our library we are workinkg for GPRS connection,
please check
http://code.google.com/p/gsm-shield-arduino/

I got GPRS working just fine. If I have time later, I'll post what I used.

As libraries go, I think the biggest thing / obstacle that a library would be great for is the following: Parse Post and Gets for the user (i.e. details like content-length) automatically so the user only has to specify a URL, a content-type, and a payload (String format?). For example, a particular GET would dump the content of the web-site response into a string, allowing the user to only focus on the String being returned.

For me, a big part of getting it all right related to the GPRS connection setup commands. I googled quite a bit and read the GPRS section of the SIM900 manual a couple of times before I got fairly flawless connections each time I attempted one.