Soporte & Consultoria

Soporte Remoto y Consultoria skype : ambiorixg12.
Nota no se brinda ningun tipo de consulta o soporte fuera del blog de forma gratuita

martes, 24 de octubre de 2017

freepbx extensions_override_freepbx.conf saving on a DB

  1. [from-internal] save Vm on  DB ;save recording  on inbound
  2. exten=>h,1,Noop(${VM_MESSAGEFILE}   )
  3. same=>n,System(php /var/www/html/voicemail/insert.php ${VM_MESSAGEFILE} )
  4. ;same=>n,Set(CDR(accountcode)=00000)
  5. ;same=>n,Set(CDR(userfield)=222)
  6. same=>n,hangup()

  1. [macro-dialout-trunk] ;save recording  on outbound
  2. include => macro-dialout-trunk-custom
  3. exten => s,1,Set(DIAL_TRUNK=${ARG1})
  4. exten=>s,n,Set(CDR(userfield)=${MIXMONITOR_FILENAME});; code ${EPOCH},,%Y%m%d-%H%M%S)}
  5. [from-did-direct]
  6. exten=>h,1,Set(CDR(userfield)=${MIXMONITOR_FILENAME}) ;save recording  on inbound


PHP

<?php


$db_values=array();

$filename=$argv[1].".txt";
   // echo "$filename  path  <br><br>";
$vm_prop=file($filename);
foreach($vm_prop as $key=>$value) {
//echo" $key => $value<br>";
$db_values[]=$value;
}
print_r($db_values);


function clean($var) {
$var=stristr($var, '=');
$var=str_replace ("=" ,"",$var);

return $var;

}
$path=$argv[1].".wav";
//$path=str_replace("txt","wav",$path);
$origmailbox=clean($db_values[4]);
$duration=clean($db_values[16]);
$callerchan=clean($db_values[10]);
$callerid=clean($db_values[11]);
$origdate=clean($db_values[12]);



$link = mysqli_connect("localhost", "asteriskuser", "amp109", "asteriskcdrdb");

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}


$query = "INSERT INTO `voicemails` (`id`, `origmailbox`, `context`, `macrocontext`, `exten`, `rdnis`, `priority`, `callerchan`, `callerid`, `origdate`, `origtime`, `category`, `duration`, `path`) VALUES (NULL, '$origmailbox', 'context', 'macro-context-1', 'exten', 'rdsi', 'prio', '$callerchan', '$callerid', '$origdate', 'origtime', 'categ', '$duration', '$path')";


if(mysqli_query($link, $query)) {

printf ("New Record has id %d.\n", mysqli_insert_id($link));
}

else {

 printf("Error: %s\n", mysqli_error($link));

}
/* close connection */
mysqli_close($link);
?>


No hay comentarios:

Publicar un comentario