Record incoming calls from PHP script

Hi,
I develop a script in PHP to generate calls with asterisk (click2dial), and on my freePBX I have enabled always recording incoming and outgoing calls, but when I generate call from the c2c the script this not record. My PHP script have the next code:

$oSocket = fsockopen($this->host, 5038) or die(“error”);

if ($oSocket)
{
fputs($oSocket, “Action: loginrn”;
fputs($oSocket, “Events: offrn”;
fputs($oSocket, “Username: c2c rn”;
fputs($oSocket, “Secret: c2c rnrn”;
fputs($oSocket, “Action: originatern”;
fputs($oSocket, "Channel: ".$strChannel.“rn”;
fputs($oSocket, “WaitTime: 30 rn”;
fputs($oSocket, "CallerId: ".$strCallerId.“rn”;
fputs($oSocket, "Exten: ".$strExten.“rn”;
fputs($oSocket, “Context: from-internal rn”;
fputs($oSocket, “Priority: 1rnrn”;
fputs($oSocket, “Action: Logoffrnrn”;
fclose($oSocket);
}

file manager.conf have:

[c2c]
secret = c2c
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user

file extensions_custom.conf have:

include => record-c2dial

[record-c2dial]
exten => _.,1,Answer
exten => .,n,Set(date=${STRFTIME(${EPOCH},%Y-%m-%d%H-%M-%S)})
exten => _.,n,MixMonitor(c2dial-${date}-${EXTEN}.wav)
exten => _.,n,Goto(from-internal,${EXTEN},1)

its odd because the incoming and outgoing calls if recorded, but the calls generate from click to dial, no.

I hope someone can help me.

Sorry for my english level.

http://www.freepbx.org/forum/freepbx/installation/originate-function-call-problem

thanks mickecarlsson,
But, i need record calls when are generate from Clic2Dial, Agree into my manager.conf the word originate but this not work.

[c2c]
secret = c2c
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user,originate
write = system,call,log,verbose,command,agent,user,originate