record (monitor to a file) the inbound audio of incoming calls up until the point that those calls are answered. In other words, only record up until the point the dial()
command finishes executing and a call is either connected/bridged or sent somewhere else (like voicemail).

The
dial()
command should look something like this:
exten => 300,n,Dial(SIP/110,30,itTm(stdmusic)M(answered^${CHANNEL}))

The macro should look something like this:
[macro-answered]
exten => s,1,AGI(stop_monitor.agi,${ARG1})

The
stop_monitor.agi
script should look something like this:
#!/usr/bin/php -q
<?php
$channel = $argv[1];
$socket = fsockopen("localhost","5038", $errno, $errstr, 2);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: <AMI username>\r\n");
fputs($socket, "Secret: <AMI password>\r\n\r\n");
fputs($socket, "Action: StopMonitor\r\n");
fputs($socket, "Channel: $channel\r\n\r\n");
fputs($socket, "Action: Logoff\r\n\r\n");
$wrets=fgets($socket,128);
while (!feof($socket)) { $wrets .= fread($socket, 8192); }
fclose($socket);
?>
https://community.asterisk.org/t/record-during-dial-unusual-problem-requires-creative-solution/65974
No hay comentarios:
Publicar un comentario