Hello all!
Anybody knows how to email about missed calls from CallCenter queue?
When Source number abandoned a call, i need to receive email with his phone number.
Not sure if the OP is even following this thread anymore... I was originally thinking of a way to handle this through the dialplan but then came up with a much simpler idea of evaluating CDR data and capturing any cancel events during the http post event.
From the FS wiki for mod_callcenter: "If we get a hangup from the caller before talking to an agent, the CC-Cause will be 'Cancel'."
I added the bit of code below to v_xml_cdr_import.php and was able to receive an email notification if I called into a call center and then hangup before my call is answered. This was not tested in a production environment and would need more work so as not to hard code the email variables and would also need to handle multiple domains, but it did work as a proof of concept.
//if call center variable cc_cause == Cancel then send email notification
if (strlen($xml->variables->cc_clause) == "cancel") {
// Place code here to send an email notification
require_once "resources/phpmailer/class.phpmailer.php";
require_once "resources/phpmailer/class.smtp.php";
$mail = new PHPMailer;
//Enable SMTP debugging.
$mail->SMTPDebug = 3;
//Set PHPMailer to use SMTP.
$mail->isSMTP();
//Set SMTP host name
$mail->Host = "smtp.gmail.com";
//Set this to true if SMTP host requires authentication to send email
$mail->SMTPAuth = true;
//Provide username and password
$mail->Username = "xxxxxx@gmail.com";
$mail->Password = "xxxxxx";
//If SMTP requires TLS encryption then set it
$mail->SMTPSecure = "tls";
//Set TCP port to connect to
$mail->Port = 587;
$mail->From = "xxxxxx@gmail.com";
$mail->FromName = "Call Center PBX";
$mail->addAddress("xxxxxx@yahoo.com", "Name");
$mail->isHTML(false);
$mail->Subject = "Missed Call";
$mail->Body = "<i>A call was abandoned in the call center</i>";
$mail->AltBody = "This is the plain text version of the email content";
//Send the email and optionally save results to log or post to database
if(!$mail->send())
{
// Handle errors here
// echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
// echo "Message has been sent successfully";
}
}
Sorry for bringing this back from the dead. I tried jsteel's code and it does work. First thing is that I receive the email for each missed call in call center twice but I have no clue why. Then I am trying to modify it a bit so I can receive in the body of the email the number of the caller so I can call him back but every variable I use it returns empty.
For example I try in the body:
Simply:
- make a new Dialplan entry
- copy the below
- fill in the 'To' and 'From' fields
- set the exit transfer action to go to you voicemail, or whatever you want.
- set the exit of your call center to go to this new dialplan