From: Michael R Sweet Date: Wed, 21 Sep 2022 18:32:33 +0000 (-0400) Subject: Map destination-uris to phone and faxPrefix options (Issue #459) X-Git-Tag: v2.4.3~123 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37d6d3775dbd3efe475d0be5ce47a5533e7440ee;p=thirdparty%2Fcups.git Map destination-uris to phone and faxPrefix options (Issue #459) --- diff --git a/scheduler/job.c b/scheduler/job.c index 58d1443895..b83ea64856 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -3872,6 +3872,23 @@ get_options(cupsd_job_t *job, /* I - Job */ num_pwgppds = cupsAddOption("OutputOrder", "Reverse", num_pwgppds, &pwgppds); } + /* + * Map destination-uris value... + */ + + if ((job->printer->type & CUPS_PRINTER_FAX) && (attr = ippFindAttribute(job->attrs, "destination-uris", IPP_TAG_BEGIN_COLLECTION)) != NULL) + { + ipp_t *ipp = ippGetCollection(attr, 0); // Collection value + const char *destination_uri = ippGetString(ippFindAttribute(ipp, "destination-uri", IPP_TAG_URI), 0, NULL); + const char *pre_dial_string = ippGetString(ippFindAttribute(ipp, "pre-dial-string", IPP_TAG_TEXT), 0, NULL); + + if (destination_uri && !strncmp(destination_uri, "tel:", 4)) + num_pwgppds = cupsAddOption("phone", destination_uri + 4, num_pwgppds, &pwgppds); + + if (pre_dial_string) + num_pwgppds = cupsAddOption("faxPrefix", pre_dial_string, num_pwgppds, &pwgppds); + } + /* * Figure out how much room we need... */