     isGettingDigit = false;
     if (isTalking) {
       isTalking = false;
+      gsmVoiceCall.hangCall();
     }
   }
 }
 
 void rotatingHandler(telephone::ButtonState buttonState) {
-  if (isGettingPhoneNumber) {
+  if (isHeadsetUp) {
     isGettingDigit = buttonState == PRESSED;
     if (isGettingDigit) {
       digitValue = 0;

const int ASTERISK_PIN = A3;
const int NUMBER_SIGN_PIN = A4;
const int PLUS_PIN = A5;
const int LED_PIN = 13;
const int AUTO_START_GSM_PIN = 8;

Button buttonHandset(0, 1023);

  pinMode(ASTERISK_PIN, INPUT);
  pinMode(NUMBER_SIGN_PIN, INPUT);
  pinMode(PLUS_PIN, INPUT);
  pinMode(AUTO_START_GSM_PIN, OUTPUT);
  delay(100);
  digitalWrite(AUTO_START_GSM_PIN, HIGH);
