Record incoming calls from PHP script

carlosnuel's picture

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.


__________________


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

http://www.freepbx.org/forum/

mickecarlsson's picture

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


__________________

Mikael Carlsson
(I am off-line, tinkering with my Chevy and my radios, don't know when I will be back)


thanks mickecarlsson, But, i

carlosnuel's picture

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