DestControlInfo::DestControlInfo(const DestControlInfo& other)
: pattern(other.pattern)
, rejectNotice(other.rejectNotice)
+ , modem(other.modem)
, tod(other.tod)
, args(other.args)
{
{
if (streq(tag, "rejectnotice")) {
rejectNotice = value;
+ } else if (streq(tag, "modem")) {
+ modem = value;
} else if (streq(tag, "maxconcurrentjobs")) {
maxConcurrentJobs = getNumber(value);
setDefined(DCI_MAXCONCURRENTJOBS);
return rejectNotice;
}
+const fxStr&
+DestControlInfo::getModem() const
+{
+ return modem;
+}
+
time_t
DestControlInfo::nextTimeToSend(time_t t) const
{
u_int maxDials; // max times to dial the phone
u_int maxTries; // max transmit attempts
fxStr rejectNotice; // if set, reject w/ this notice
+ fxStr modem; // if set, try with it
TimeOfDay tod; // time of day restrictions
fxStr args; // arguments for subprocesses
u_int getMaxDials() const;
u_int getMaxTries() const;
const fxStr& getRejectNotice() const;
+ const fxStr& getModem() const;
time_t nextTimeToSend(time_t) const;
const fxStr& getArgs() const;
};
* work associated with the specified job.
*/
Modem*
-Modem::findModem(const Job& job)
+Modem::findModem(const Job& job, const DestControlInfo& dci)
{
RegEx* c = ModemGroup::find(job.device);
if (c) {
+ const fxStr& mdci = dci.getModem();
+ RegEx* cdci = mdci != "" ? ModemGroup::find(mdci) : NULL;
+ int loops = 2;
+
/*
- * Job is assigned to a class of modems; search
- * the set of modems in the class according to
- * the order specified (if any order is specified).
+ * At first try to find modem strictly (suitable to job and destination rules)
+ * Then try to find modem not strictly (suitable to job rules only)
*/
- for (ModemIter iter(list); iter.notDone(); iter++) {
- Modem& modem = iter;
- if (modem.getState() != Modem::READY)
- continue;
- if (c->Find(modem.devID) && modem.isCapable(job)) {
- /*
- * Move modem to the end of the priority group
- */
+ for (int i = 0 ; i < loops ; i++) {
+ /*
+ * Job is assigned to a class of modems; search
+ * the set of modems in the class according to
+ * the order specified (if any order is specified).
+ */
+ for (ModemIter iter(list); iter.notDone(); iter++) {
+ Modem& modem = iter;
+ if (c->Find(modem.devID) && modem.isCapable(job)) {
+ if (i == 0) {
+ if (cdci) { // destination assigned to a class of modems
+ if (!cdci->Find(modem.devID))
+ continue;
+ } else if (mdci != "") { // destination assigned to an explicit modem
+ if (mdci != modem.devID)
+ continue;
+ }
+ loops = 1; // there is a strictly suitable modem
+ }
+
+ if (modem.getState() != Modem::READY) {
+ continue;
+ }
- modem.remove();
+ /*
+ * Move modem to the end of the priority group
+ */
- if (!list.isEmpty()) {
- ModemIter iter(list);
+ modem.remove();
- for ( ; iter.notDone(); iter++) {
- if (iter.modem().priority > modem.priority)
- break;
- }
- modem.insert(iter.modem());
- } else
- modem.insert(list);
+ if (!list.isEmpty()) {
+ ModemIter iter(list);
+
+ for ( ; iter.notDone(); iter++) {
+ if (iter.modem().priority > modem.priority)
+ break;
+ }
+ modem.insert(iter.modem());
+ } else
+ modem.insert(list);
- return (&modem);
+ return (&modem);
+ }
}
}
} else {
static Modem& getModemByID(const fxStr& id);
static Modem* modemExists(const fxStr& id);
- static Modem* findModem(const Job& job);
+ static Modem* findModem(const Job& job, const DestControlInfo& dci);
bool assign(Job&); // assign modem
void release(); // release modem
job.remove(); // remove from run queue
delayJob(job, *req, "Delayed by time-of-day restrictions", tts);
delete req;
- } else if (assignModem(job)) {
+ } else if (assignModem(job, dci)) {
job.remove(); // remove from run queue
/*
* We have a modem and have assigned it to the
* use from faxgetty processes.
*/
bool
-faxQueueApp::assignModem(Job& job)
+faxQueueApp::assignModem(Job& job, const DestControlInfo& dci)
{
fxAssert(job.modem == NULL, "Assigning modem to job that already has one");
bool retryModemLookup;
do {
retryModemLookup = false;
- Modem* modem = Modem::findModem(job);
+ Modem* modem = Modem::findModem(job, dci);
if (modem) {
if (modem->assign(job)) {
Trigger::post(Trigger::MODEM_ASSIGN, *modem);
fxStr canonicalizePhoneNumber(const fxStr& ds);
// modem support
void scanForModems();
- bool assignModem(Job& job);
+ bool assignModem(Job& job, const DestControlInfo&);
void releaseModem(Job& job);
void notifyModemWedged(Modem&);
void pollForModemLock(Modem& modem);
MaxDials integer \s-1\fIunlimited\fP\s+1 max phone calls to make to transmit a job
MaxSendPages integer \s-1\fIunlimited\fP\s+1 max pages to permit in a send
MaxTries integer \s-13\s+1 max attempts to transmit a job
+Modem string \s-1Any\s+1 ModemGroup to use for destination
RejectNotice string \- rejection notice for transmit job
TimeOfDay string \s-1Any\s+1 default time-of-day restrictions
.fi
.PP
The
+.B Modem
+parameter controls which
+.B ModemGroup
+is used in sending faxes to the destination. If the user
+assigns a
+.B ModemGroup
+for a specific job where all modems are outside of this
+.B ModemGroup
+matching a destination, then the value of
+.B Modem
+is overridden by the user's assignment. Likewise, if the user
+assigns a
+.B ModemGroup
+for a specific job where some, but not all, of the modems are
+included in this
+.B ModemGroup
+matching a destination, then the value of
+.B Modem
+is overridden by the inclusive set of modems found in both.
+.PP
+The
.B RejectNotice
parameter controls whether or not to reject
jobs to the destination.