* Set the local subscriber identification.
*/
void
-Class1Modem::setLID(const fxStr& number, bool now)
+Class1Modem::setLID(const fxStr& number)
{
encodeTSI(lid, number);
}
bool faxService(bool enableV34); // switch to fax mode
bool reset(long ms); // reset modem
bool ready(long ms); // ready modem
- void setLID(const fxStr& number, bool now = false); // set local id string
+ void setLID(const fxStr& number); // set local id string
bool supportsPolling() const; // modem capability
};
#endif /* _CLASS1_ */
else
group3opts &= ~GROUP3OPT_FILLBITS;
atCmd(crCmd); // enable receiving
- /*
- * Must do this here instead of above because the
- * station identifier isn't normally setup until
- * the caller invokes us.
- */
- class2Cmd(lidCmd, lid); // local station identifier
/*
* Enable adaptive-answer support. If we're configured,
* we'll act like getty and initiate a login session if
bool
Class2Modem::faxService(bool enableV34)
{
- return setupClass2Parameters() && class2Cmd(lidCmd, lid);
+ return setupClass2Parameters();
}
bool
* length is 20 characters (per the spec).
*/
void
-Class2Modem::setLID(const fxStr& number, bool now)
+Class2Modem::setLID(const fxStr& number)
{
lid.resize(0);
for (u_int i = 0, n = number.length(); i < n; i++) {
}
if (lid.length() > 20)
lid.resize(20);
- if (now) class2Cmd(lidCmd, lid); // for DynamicLocalID
+ class2Cmd(lidCmd, lid); // for DynamicLocalID
}
/*
// miscellaneous
bool faxService(bool enableV34); // switch to fax mode
bool reset(long ms); // reset modem
- void setLID(const fxStr& number, bool now = false); // set local id string
+ void setLID(const fxStr& number); // set local id string
bool supportsPolling() const; // modem capability
int lastByte;
};
bool isFaxModem() const;
// configuration controls
- virtual void setLID(const fxStr& number, bool now = false) = 0;
+ virtual void setLID(const fxStr& number) = 0;
u_int getCapabilities() const;
// methods for querying modem capabilities
virtual bool supports2D() const;
* modem (e.g. for Class 2-style modems).
*/
void
-FaxServer::setLocalIdentifier(const fxStr& lid, bool now)
+FaxServer::setLocalIdentifier(const fxStr& lid)
{
ServerConfig::setLocalIdentifier(lid);
if (modem)
- modem->setLID(lid, now);
+ modem->setLID(lid);
}
const fxStr& FaxServer::getLocalIdentifier() const { return (localIdentifier); }
fxStr getModemCapabilities() const;
void readConfig(const fxStr& filename);
- void setLocalIdentifier(const fxStr& lid, bool now = false);
+ void setLocalIdentifier(const fxStr& lid);
void sendFax(FaxRequest&, FaxMachineInfo&, FaxAcctInfo&, u_int&);
bool recvFax(const CallerID& cid);
quote | cid.number | enquote | quote | getModemDevice() | enquote);
fxStr localid = "";
int pipefd[2], idlength, status;
- char dlid[21]; // max CSI size (20) plus '\0'
+ char line[1024];
pipe(pipefd);
pid_t pid = fork();
switch (pid) {
Sys::close(pipefd[1]);
execl("/bin/sh", "sh", "-c", (const char*) cmd, (char*) NULL);
sleep(1);
- exit(0);
+ exit(1);
default:
Sys::close(pipefd[1]);
- idlength = Sys::read(pipefd[0], dlid, sizeof(dlid));
- Sys::waitpid(pid, status);
- if (status != 0)
- logError("Bad exit status %#o for \'%s\'", status, (const char*) cmd);
- localid = fxStr(dlid, idlength-1);
- FaxServer::setLocalIdentifier(localid, true); // Class 2 must issue command
+ {
+ FILE* fd = fdopen(pipefd[0], "r");
+ while (fgets(line, sizeof (line)-1, fd)){
+ line[strlen(line)-1]='\0'; // Nuke \n at end of line
+ (void) readConfigItem(line);
+ }
+ Sys::waitpid(pid, status);
+ if (status != 0)
+ logError("Bad exit status %#o for \'%s\'", status, (const char*) cmd);
+ }
break;
}
- traceServer("ANSWER: LOCAL ID '%s'", (const char*) localid);
}
if (ctype != ClassModem::CALLTYPE_UNKNOWN) {
/*
DestControls\(S1 string \- per-destination controls file
DeviceMode octal \s-10600\s+1 protection mode to use for modem device
DialStringRules\(S2 string \- dial string rules file
-DynamicLocalID string \- script for dynamic configuration of local ID
+DynamicLocalID string \- script for dynamic receive configuration
FAXNumber string \- facsimile modem phone number
FaxRcvdCmd string \s-1bin/faxrcvd\s+1 notification script for received facsimile
GettyArgs string \- arguments passed to getty program
.BR etc/dialrules .
.TP
.B DynamicLocalID
-The pathname of the optional shell script, e.g. ``etc/localid'', that replaces
-.B LocalIdentifier
+The pathname of the optional shell script, e.g. ``etc/localid'', that
+makes dynamic configuration changes, i.e., to
+.B LocalIdentifier,
based on CIDName, CIDNumber, and device ID. The script is passed those
three values as the first, second, and third parameters ($1, $2, $3),
respectively when answering an incoming call. The script can then
perform local processing as desired to send on standard output the
-value with which to replace
-.B LocalIdentifier.
+configuration items to change in a ``parameter:value'' format, i.e.
+``LocalIdentifier: +1.800.555.1212''. If there are multiple parameters
+to be changed, then each item must be on its own line.
This is commonly used to dynamically alter the local identification
-of systems which use DID/DNIS.
+of systems which use DID/DNIS, but it can also be used to allow different
+modem configurations for different senders.
Note that this script must be marked as executable by the faxgetty process.
.TP
.B FAXNumber