Using Asterisk manager to monitor the calls!

Hello, Guys:
I have a problem in monitoring the calls by using Asterisk Manager. when this code is run, there is nothing in /var/spool/asterisk/monitor. it shoud have a file with .gsm or wav. My code is like this as follow:

$asterisk_ip = "";
  $socket = fsockopen($asterisk_ip,"5038", $errno, $errstr, $timeout);
   fputs($socket, "Action: Login\r\n");
     fputs($socket, "UserName: myasterisk\r\n");
    fputs($socket, "Secret: mycode\r\n\r\n");
      // echo $wrets;
     fputs($socket, "Action: Monitor\r\n" );
       fputs($socket, "Channel: SIP/$num\r\n" );
     fputs($socket, "File: $num\r\n" );
     fputs($socket, "Mix: 1\r\n" );

if anyone knows this, please help me!