Fix. Make channel uuid optional in email.

This needs for example if fax server could not create outgoing channel.
This commit is contained in:
Alexey Melnichuk 2015-11-30 15:36:11 +03:00
parent 6fa7dcfa30
commit 29c4421592
1 changed files with 7 additions and 2 deletions

View File

@ -292,11 +292,14 @@
$mailer_error = $mail->ErrorInfo; $mailer_error = $mail->ErrorInfo;
echo "Mailer Error: ".$mailer_error."\n\n"; echo "Mailer Error: ".$mailer_error."\n\n";
$call_uuid = $headers["X-FusionPBX-Call-UUID"];
// log/store message in database for review // log/store message in database for review
$email_uuid = uuid(); $email_uuid = uuid();
$sql = "insert into v_emails ( "; $sql = "insert into v_emails ( ";
$sql .= "email_uuid, "; $sql .= "email_uuid, ";
$sql .= "call_uuid, "; if ($call_uuid) {
$sql .= "call_uuid, ";
}
$sql .= "domain_uuid, "; $sql .= "domain_uuid, ";
$sql .= "sent_date, "; $sql .= "sent_date, ";
$sql .= "type, "; $sql .= "type, ";
@ -304,7 +307,9 @@
$sql .= "email "; $sql .= "email ";
$sql .= ") values ( "; $sql .= ") values ( ";
$sql .= "'".$email_uuid."', "; $sql .= "'".$email_uuid."', ";
$sql .= "'".$headers["X-FusionPBX-Call-UUID"]."', "; if ($call_uuid) {
$sql .= "'".$call_uuid."', ";
}
$sql .= "'".$headers["X-FusionPBX-Domain-UUID"]."', "; $sql .= "'".$headers["X-FusionPBX-Domain-UUID"]."', ";
$sql .= "now(),"; $sql .= "now(),";
$sql .= "'".$headers["X-FusionPBX-Email-Type"]."', "; $sql .= "'".$headers["X-FusionPBX-Email-Type"]."', ";