Skip to content

Commit

Permalink
Help-36774: created a converter core library: kazoo_convert (2600hz#4904
Browse files Browse the repository at this point in the history
)

* Created kazoo_convert core lib for file conversion

* added tests for converter

* Added stdlib for running commands safely

* Added docs

* Updaed travis to work with new deps

* Make apis

* Moved conversion to cb_faxes from fax_worker

* updaed fax app to remove conversions in fax worker, added maintenance to migrate

* update notify cause people use that

* updated teletype to use converter

* Fixed spell checker wrecking binary files, migrate file_cache_path, mkdocs updated

* make fmt again

make fmt

* Moved normalize_content_types to kz_mime since its shared between crossbar and fax now

* Fixed fax_init crashing on newly initialized system

* Fixed bugs found in qa testing

* Output for converter should be binary not path

* make fmt

* Testing migration

* Testing related cleanup

* Fixed bug in cb_faxes, cleaned up content-type discovery

* fmt fix

* Fixed dialyzer warning

* Updated views to make the filtering simpler

* Fixed fax maintenance not fetching doc

* Fixed missing return in view

* Fixed doc not getting page saved in api_fax

* Fixed docs

* force view migration on fax_init

* fixed a bug with invalid extension on email attachments

* Tweaking fax convert commands to preserve image fidelity

* Updated docs to match the tweaked commands

* Fixed invalid escape in json

* ugh

* Cleaned up docs

* updated converter commands

* make fmt

* Cleaned up command names and maintenance commands

* fixed docs

* make apis

* Fix docs

* Fixed PR comments

* Changes requeted on PR

* Make fmt

* Moved migrate_pending_faxes call to handle_cast in fax_monitor

* fixed file size match in tests

* refresh_viwes

* Delete fax file after sending

* Fixed some environmental issues with tiffs

* migrate in another process

* fix edoc

* Fixed errant line

* Redesigned how attachments are handled

* Better attachment handling

* fixed error

* fixed circle stuff

* mk fmt

* fixed invalid clause

* Fixed failing tests

* fixed tests

* fixed test

* Updated crossbar api to download pdf, changed teletype config source

* fixed ci issues

* Fixed all review changes

make fmt

* Fixed dialyzer things

* better error in cb_faxes

* removed needless case

* added missing field to doc
  • Loading branch information
swysor authored and lazedo committed Jul 17, 2018
1 parent bdd3491 commit 6fec11c
Show file tree
Hide file tree
Showing 52 changed files with 3,341 additions and 803 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ addons:
apt:
packages:
- xsltproc
- libreoffice
- libtiff-tools
- ghostscript

cache:
apt: true
Expand Down
126 changes: 80 additions & 46 deletions applications/crossbar/priv/api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -29262,6 +29262,21 @@
"description": "fax smtp sessions",
"type": "integer"
},
"store_fax_pdf": {
"default": true,
"description": "store the post processed fax document",
"type": "boolean"
},
"store_fax_tiff": {
"default": true,
"description": "store a pdf copy of the post processed fax document",
"type": "boolean"
},
"store_url_document": {
"default": true,
"description": "store the document url result in the database",
"type": "boolean"
},
"wait_for_fax_timeout_ms": {
"default": 3600000,
"description": "fax wait for fax timeout in milliseconds",
Expand Down Expand Up @@ -29544,59 +29559,78 @@
"system_config.kazoo_convert": {
"description": "Schema for kazoo_convert system_config",
"properties": {
"convert_command_timeout": {
"default": 120000,
"description": "kazoo_convert convert_command_timeout",
"type": "integer"
},
"convert_image_command": {
"default": "convert $FROM -resample 204x98 -units PixelsPerInch -compress group4 -size 1728x1078 $TO",
"description": "kazoo_convert convert_image_command",
"type": "string"
},
"convert_openoffice_command": {
"default": "libreoffice --headless --convert-to pdf $FROM --outdir $WORKDIR 2>&1 |egrep 'parser error|Error' && exit 1 || exit 0",
"description": "kazoo_convert convert_openoffice_command",
"type": "string"
},
"convert_pdf_command": {
"default": "/usr/bin/gs -q -r204x98 -g1728x1078 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=tiffg4 -sOutputFile=$TO -- $FROM",
"description": "kazoo_convert convert_pdf_command",
"type": "string"
},
"convert_tiff_command": {
"default": "tiff2pdf -o $TO $FROM",
"description": "kazoo_convert convert_tiff_command",
"type": "string"
},
"enable_openoffice": {
"default": true,
"description": "kazoo_convert enable_openoffice",
"type": "boolean"
"fax": {
"properties": {
"attachment_format": {
"default": "pdf",
"description": "Format to use for receipt email messages and api responses",
"type": "string"
},
"convert_command_timeout": {
"default": 120000,
"description": "Timeout value in ms for how long a convert command can run before being killed",
"type": "integer"
},
"convert_image_command": {
"default": "convert $FROM -resample 204x98 -units PixelsPerInch -resize 1728x1078\\! -compress group4 $TO",
"description": "The command to resample a tiff file to a fax compatible format or convert a supported image/* format to a tiff",
"type": "string"
},
"convert_openoffice_command": {
"default": "libreoffice --headless --convert-to pdf $FROM --outdir $WORKDIR 2>&1 |egrep 'parser error|Error' && exit 1 || exit 0",
"description": "The command to convert open office documents to pdf",
"type": "string"
},
"convert_pdf_command": {
"default": "/usr/bin/gs -q -r204x98 -g1728x1078 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=tiffg4 -sOutputFile=$TO -- $FROM",
"description": "The command to convert pdf documents to tiff",
"type": "string"
},
"convert_tiff_command": {
"default": "tiff2pdf -o $TO $FROM",
"description": "The command to convert a tiff file to PDF",
"type": "string"
},
"enable_openoffice": {
"default": true,
"description": "Enables the conversion of openoffice compatible documents",
"type": "boolean"
},
"large_tiff_command": {
"default": "convert $FROM -resample 204x98 -units PixelsPerInch -resize 1728\\!x1078 -compress group4 $TO",
"description": "The command to convert large tiffs to standard dimensions",
"type": "string"
},
"serialize_openoffice": {
"default": true,
"description": "Enable Serialization of openoffice compatible document conversions",
"type": "boolean"
},
"small_tiff_command": {
"default": "convert $FROM -gravity center -resample 204x98 -units PixelsPerInch -extent 1728x1078 -compress group4 $TO",
"description": "The command to convert small tiffs to a fax compatible format",
"type": "string"
},
"validate_pdf_command": {
"default": "gs -dNOPAUSE -dBATCH -sDEVICE=nullpage $FILE",
"description": "The command to verify a PDF file is valid",
"type": "string"
},
"validate_tiff_command": {
"default": "tiffinfo $FILE",
"description": "The command to verify a TIFF file is valid",
"type": "string"
}
}
},
"fax_converter": {
"default": "fax_converter",
"description": "kazoo_convert fax_converter",
"description": "Module to use for fax related file conversions",
"type": "string"
},
"file_cache_path": {
"default": "/tmp/",
"description": "kazoo_convert file_cache_path",
"type": "string"
},
"serialize_openoffice": {
"default": true,
"description": "kazoo_convert serialize_openoffice",
"type": "boolean"
},
"validate_pdf_command": {
"default": "gs -dNOPAUSE -dBATCH -sDEVICE=nullpage $FROM",
"description": "kazoo_convert validate_pdf_command",
"type": "string"
},
"validate_tiff_command": {
"default": "tiff2pdf -o $TO $FROM",
"description": "kazoo_convert validate_tiff_command",
"description": "The default working directory to use when converting files",
"type": "string"
}
},
Expand Down
15 changes: 15 additions & 0 deletions applications/crossbar/priv/couchdb/schemas/system_config.fax.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,21 @@
"description": "fax smtp sessions",
"type": "integer"
},
"store_fax_pdf": {
"default": true,
"description": "store the post processed fax document",
"type": "boolean"
},
"store_fax_tiff": {
"default": true,
"description": "store a pdf copy of the post processed fax document",
"type": "boolean"
},
"store_url_document": {
"default": true,
"description": "store the document url result in the database",
"type": "boolean"
},
"wait_for_fax_timeout_ms": {
"default": 3600000,
"description": "fax wait for fax timeout in milliseconds",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,78 @@
"_id": "system_config.kazoo_convert",
"description": "Schema for kazoo_convert system_config",
"properties": {
"convert_command_timeout": {
"default": 120000,
"description": "kazoo_convert convert_command_timeout",
"type": "integer"
},
"convert_image_command": {
"default": "convert $FROM -resample 204x98 -units PixelsPerInch -compress group4 -size 1728x1078 $TO",
"description": "kazoo_convert convert_image_command",
"type": "string"
},
"convert_openoffice_command": {
"default": "libreoffice --headless --convert-to pdf $FROM --outdir $WORKDIR 2>&1 |egrep 'parser error|Error' && exit 1 || exit 0",
"description": "kazoo_convert convert_openoffice_command",
"type": "string"
},
"convert_pdf_command": {
"default": "/usr/bin/gs -q -r204x98 -g1728x1078 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=tiffg4 -sOutputFile=$TO -- $FROM",
"description": "kazoo_convert convert_pdf_command",
"type": "string"
},
"convert_tiff_command": {
"default": "tiff2pdf -o $TO $FROM",
"description": "kazoo_convert convert_tiff_command",
"type": "string"
},
"enable_openoffice": {
"default": true,
"description": "kazoo_convert enable_openoffice",
"type": "boolean"
"fax": {
"properties": {
"attachment_format": {
"default": "pdf",
"description": "Format to use for receipt email messages and api responses",
"type": "string"
},
"convert_command_timeout": {
"default": 120000,
"description": "Timeout value in ms for how long a convert command can run before being killed",
"type": "integer"
},
"convert_image_command": {
"default": "convert $FROM -resample 204x98 -units PixelsPerInch -resize 1728x1078\\! -compress group4 $TO",
"description": "The command to resample a tiff file to a fax compatible format or convert a supported image/* format to a tiff",
"type": "string"
},
"convert_openoffice_command": {
"default": "libreoffice --headless --convert-to pdf $FROM --outdir $WORKDIR 2>&1 |egrep 'parser error|Error' && exit 1 || exit 0",
"description": "The command to convert open office documents to pdf",
"type": "string"
},
"convert_pdf_command": {
"default": "/usr/bin/gs -q -r204x98 -g1728x1078 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=tiffg4 -sOutputFile=$TO -- $FROM",
"description": "The command to convert pdf documents to tiff",
"type": "string"
},
"convert_tiff_command": {
"default": "tiff2pdf -o $TO $FROM",
"description": "The command to convert a tiff file to PDF",
"type": "string"
},
"enable_openoffice": {
"default": true,
"description": "Enables the conversion of openoffice compatible documents",
"type": "boolean"
},
"large_tiff_command": {
"default": "convert $FROM -resample 204x98 -units PixelsPerInch -resize 1728\\!x1078 -compress group4 $TO",
"description": "The command to convert large tiffs to standard dimensions",
"type": "string"
},
"serialize_openoffice": {
"default": true,
"description": "Enable Serialization of openoffice compatible document conversions",
"type": "boolean"
},
"small_tiff_command": {
"default": "convert $FROM -gravity center -resample 204x98 -units PixelsPerInch -extent 1728x1078 -compress group4 $TO",
"description": "The command to convert small tiffs to a fax compatible format",
"type": "string"
},
"validate_pdf_command": {
"default": "gs -dNOPAUSE -dBATCH -sDEVICE=nullpage $FILE",
"description": "The command to verify a PDF file is valid",
"type": "string"
},
"validate_tiff_command": {
"default": "tiffinfo $FILE",
"description": "The command to verify a TIFF file is valid",
"type": "string"
}
}
},
"fax_converter": {
"default": "fax_converter",
"description": "kazoo_convert fax_converter",
"description": "Module to use for fax related file conversions",
"type": "string"
},
"file_cache_path": {
"default": "/tmp/",
"description": "kazoo_convert file_cache_path",
"type": "string"
},
"serialize_openoffice": {
"default": true,
"description": "kazoo_convert serialize_openoffice",
"type": "boolean"
},
"validate_pdf_command": {
"default": "gs -dNOPAUSE -dBATCH -sDEVICE=nullpage $FROM",
"description": "kazoo_convert validate_pdf_command",
"type": "string"
},
"validate_tiff_command": {
"default": "tiff2pdf -o $TO $FROM",
"description": "kazoo_convert validate_tiff_command",
"description": "The default working directory to use when converting files",
"type": "string"
}
},
Expand Down
Loading

0 comments on commit 6fec11c

Please sign in to comment.