email messed call from queue

Status
Not open for further replies.

Nikolay

New Member
May 18, 2017
2
0
1
38
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.
 

jsteel

New Member
Feb 9, 2017
28
3
3
54
I am not sure if this can be done without a custom script in the dialplan. Have you tried anything yet?
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,070
577
113
look at the one for regular missed call notification, you may be able to cobble something together from that.
 

jsteel

New Member
Feb 9, 2017
28
3
3
54
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";
}
}
 
Last edited:
  • Like
Reactions: abelitouci

v.miskos

New Member
Sep 5, 2018
5
0
1
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:
Code:
$mail->Body = "Missed Call from: " .strlen($xml->variables->effective_caller_id_number);

Whatever variable I put there it returns empty.

Any ideas?
 

jsteel

New Member
Feb 9, 2017
28
3
3
54
This is what is available for a cancel event. Taken from: https://freeswitch.org/confluence/display/FREESWITCH/mod_callcenter#EVENTS

Event-Subclass: callcenter::info
Event-Name: CUSTOM
CC-Queue: support@default
CC-Action: member-queue-end
CC-Member-Joined-Time: 9000
CC-Member-Leaving-Time: 10050
CC-Cause: Cancel
CC-Cancel-Reason: TIMEOUT
CC-Member-UUID: 453324f8-3424-4322-4242362fd23d
CC-Member-Session-UUID: e260ffd0-a731-11df-9341-e7d9456f8886
CC-Member-CID-Name: Marc O Robinson
CC-Member-CID-Number: 5145551212
 

v.miskos

New Member
Sep 5, 2018
5
0
1
I already tried with them as well but it returns 0 or 1, here is an example:
Code:
$mail->Body = "Missed Call from: " . strlen($xml->variables->CC-Member-CID-Number);
and result is:
Code:
Missed Call from: 1


I also made a couple more tests. Strange this is if I change the first if like this:
Code:
if (strlen($xml->variables->cc_clause) == "blahblah") {
I still get the email notification for the missed call.

Also if the available variable from cancel event is "CC-Cause" why in the first if it is "cc_clause"? Why the "l" character there?
 
Last edited:

JamesBorne

Active Member
Jan 24, 2019
294
57
28
Australia
missed calls from CallCenter queue
I've done something similar to this.

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

1558050203474.png
 
Status
Not open for further replies.