XBee sleeping but not waking up?

Hello I am using the below code to sleep XBee from Arduino. I connect a wire from digital pin of arduino to pin number 9 of XBee. I also configure XBee from XCTU to make it sleep mode.

The below code sleep the Arduino but not waking up? Anything more to do to wake XBee up

#include <avr/sleep.h>
#define XBEE_sleepPin 6

void setup() {
  Serial.begin(9600);
}

void xbeesleep() {
  Serial.println("sleep");   
 delay (3000); 
  pinMode (XBEE_sleepPin,OUTPUT);    // put XBee to sleep0
  digitalWrite(XBEE_sleepPin,HIGH);  // Setting this pin to LOW turns off the pull up resistor, thus saving precious current
}

void xbeewake() {
  Serial.println("wake");    
  pinMode(XBEE_sleepPin,OUTPUT);   // Set the "wake-up pin" to output
  digitalWrite(XBEE_sleepPin,LOW); // wake-up XBee
  delay(1000); //make sure that XBee is ready
}

int i = 0;
void loop() {
  if (i==0)
    {
     xbeewake();
    }
  else if (i==5)
    {
    xbeesleep();
    }
  if (i<5)
  {
  Serial.println(i);
  }
  i = (i+1) % 10;
  delay(3000);
}

Why isn't the pinMode() done in setup()?

How do you know that the XBee isn't waking up? You don't have the XBee doing anything that I can see, so how do you know that it goes to sleep or wakes up or doesn't?

I tried your code and it seemed to do what it was designed to do. I got:

wake
0
1
2
3
4
sleep
wake
0
1
2
3
4
sleep
wake
0
1
2
3
4
sleep

And pin 6 went on and off.

So what is wrong exactly?

Its working now. I didn't set D7=0; After setting that its sleeping and waking.