Please do further testing/review and give comments and suggest cleanup, etc.
This bug is only tripped if all of the following are true:
a) fax send fails
b) email notification of fax failure also fails
c) Other?
how to test
- have a 100% working fax to email setup.
- Change Advanced->defaults->email and set the port to be something invalid.
- e.g. smtp port 9999 is invalid
- send a test fax to something without a fax
- e.g. I just faxed my own DID which does NOT have fax answering
- each time the phone rings answer...wait 5 seconds, and then hang up
- note: it will retry sending the fax 5 times so repeat the above.
- on the last try it will give up, and try to send the failure email
- the email will fail (bad port) and then it will insert the failed email into v_emails
- the insert will fail and nothing in v_emails
Error was caused by trying to insert '' into the domain_uuid field.
'' is invalid in a uuid field, but null is okay.
The null is caused by no x-headers being passed. So these two fields end up null:
$headers["X-FusionPBX-Domain-UUID"]
$headers["X-FusionPBX-Email-Type"]
Ignoring unset/uninitialized variables hides bugs.
Fix: feed the X-Header in the calling lua code.
test:
- enable all errors
- go to log view page
expected result:
- no warnings/notify/errors
actual result:
Notice: Undefined index: ln in /var/www/fusionpbx/app/log_viewer/log_viewer.php on line 48
Notice: Undefined index: ord in /var/www/fusionpbx/app/log_viewer/log_viewer.php on line 51
Notice: Undefined index: fs in /var/www/fusionpbx/app/log_viewer/log_viewer.php on line 54
Notice: Undefined index: a in /var/www/fusionpbx/app/log_viewer/log_viewer.php on line 57
Notice: Undefined index: filter in /var/www/fusionpbx/app/log_viewer/log_viewer.php on line 81
Notice: Undefined variable: byte_count in /var/www/fusionpbx/app/log_viewer/log_viewer.php on line 221
Notice: Use of undefined constant color - assumed 'color' in /var/www/fusionpbx/app/log_viewer/log_viewer.php on line 246
Notice: Use of undefined constant font - assumed 'font' in /var/www/fusionpbx/app/log_viewer/log_viewer.php on line 246
Notice: Undefined variable: line_num in /var/www/fusionpbx/app/log_viewer/log_viewer.php on line 270