I need a little help on Originate function, just a little clue, please

I have an asterisk freepbx server that is working excelent and originate function is working too, but cant get it to work on recording file, all call are done ok, but without recording, but if I dial the phone number directly from the phone it record ok.

do i need somethings else for this to work?
originate function is this:

$filename =$extent.’-’.date(“Ymd”).’-’.$date(“Hms”).’-’.$number2;
$mix=1;
fputs($oSocket, “Action: login\r\n”);
fputs($oSocket, “Events: off\r\n”);
fputs($oSocket, “Username: $strUser\r\n”);
fputs($oSocket, “Secret: $strSecret\r\n\r\n”);
fputs($oSocket, “Action: originate\r\n”);
fputs($oSocket, “Channel: $strChannel\r\n”);
fputs($oSocket, “WaitTime: $strWaitTime\r\n”);
fputs($oSocket, “CallerId: $strCallerId\r\n”);
fputs($oSocket, “Exten: $number\r\n”);
fputs($oSocket, “Context: $strContext\r\n”);
fputs($oSocket, “Priority: $strPriority\r\n\r\n”);
fputs($oSocket, “Action: monitor\r\n”);
fputs($oSocket, “Channel: $strChannel\r\n”);
fputs($oSocket, “File: $filename\r\n”);
fputs($oSocket, “Mix: $mix\r\n”);
fputs($oSocket, “Action: Logoff\r\n\r\n”);