edge lab LIVE! starts Tuesday in Munich. Grab a workshop seat and take home the board you build on. Code FRIEND-HACKSTER saves 20%. () Learn more!
jegatheesan
Published © GPL3+

Customer Care IVR Using DTMF

You can make your own small hotel menu with low cost. One time investment because only incoming call.

AdvancedFull instructions provided2,070
Customer Care IVR Using DTMF

Things used in this project

Hardware components

DTMF Board
×1
Mobile head set with mic
×1
Computer with speakers
×1

Software apps and online services

Arduino IDE
Arduino IDE
Microsoft Visual basic6

Story

Read more

Code

Customercare.ino

Arduino
#include <LGSM.h>

#define PINNUMBER ""

char numtel[20];           // buffer for the incoming call

int checkpin=12;
int datapin1=8;
int datapin2=9;
int datapin3=10;
int datapin4=11;
int buttonpress=0;
int numberpress=0;

int callstatus;

void setup()
{  
  pinMode(checkpin, INPUT);
  pinMode(datapin1, INPUT);
  pinMode(datapin2, INPUT);
  pinMode(datapin3, INPUT);
  pinMode(datapin4, INPUT);  

  callstatus=0;
  
  Serial.begin(9600);
  boolean notConnected = true;
  LVoiceCall.hangCall();
}

void loop()
{  
  switch (LVoiceCall.getVoiceCallStatus()) 
  {
    case TALKING: 
      callstatus=3;
      dtmfdetect();
      break;    
    case IDLE_CALL: 
      if (callstatus!=1)
      {
        callstatus=1;
        Serial.println("O");          
      }
      break;
    case RECEIVINGCALL: 
      callstatus=2;
      Serial.println("S");
      LVoiceCall.retrieveCallingNumber(numtel, 20);
      LVoiceCall.answerCall();         
      break;
  }
}

void dtmfdetect()
{
  if (digitalRead(checkpin) == HIGH && buttonpress==0) {
    buttonpress=1;
  }else if (digitalRead(checkpin) == LOW && buttonpress==1) {
    buttonpress=0;    
    numberpress=0;
    if(digitalRead(datapin1) == HIGH)
    {
      numberpress=numberpress+1;
    }
    if(digitalRead(datapin2) == HIGH)
    {
      numberpress=numberpress+2;
    }    
    if(digitalRead(datapin3) == HIGH)
    {
      numberpress=numberpress+4;
    }        
    if(digitalRead(datapin4) == HIGH)
    {
      numberpress=numberpress+8;
    }            
    Serial.println(numberpress);          
  }
}

Credits

jegatheesan
18 projects • 68 followers
Simply A Mechatronics Lover.

Comments