![]() |
anne-marie aublanc (wanadoo) wrote: > hi, > > I don't speak english very well but i read it.... I have read your > messages to the HylaFAQ and the mailing lists about egetty > / vgetty I work with hylafax and an external voice modem.(usrobotics > messages modem) > This modem works with class 1 or class 2.0. When it receives a voice > call, I saw in the log file that it's not recognized like voice but > data... I have try mgetty-sendfax + mgetty-voice. That's ok, it makes > the difference > between fax and voice message. > > I would like use vgetty or anything else with hylafax for my voice messages. > > Anybody can help me? Have you a script vgetty or egetty.... I would > like the script 'config.ttySx' with the vgetty or egetty script > > Thanks and sorry I speak english like a cow the spanish... ;o) Anne > > > > > > ____________________ HylaFAX(tm) Users Mailing List _______________________ > To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi > On UNIX: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null > *To learn about commercial HylaFAX(tm) support, mail > sales@hylafax.org.* Hi Anne, I already wrote to this list about mine solution. It's quite wrecked but it's worked for me. Nobody else reported it's working, but nobody reported they have tried yet. I've recalled some details for Klaus Gebel, who asked for them, and i could now publish them. I think this solution is quite ideologicaly wrong, and has some errors, but, again, it's worked for me. I'll try to summarize all info below. I'm using HylaFAX 4.1.1 and mgetty 1.1.27 on Debian 3.0. I've patched the faxgetty program sources so it could run that famous egetty quite correctly (IMHO). Then i've patched vm (mgetty package) program sources, so it could be called from faxgetty and does not mess with modem/serial line configuration. I've written voice-shell script which answers the phone, plays a message, tries to determine call type, and then returns code needed by faxgetty to distinguish what to do next. I think you could easily change it to do anything you want - like recording voice messages, or playing music or fairy tales by request. I have 2 modems with rockwell chipset and v.253 voice command set. They are connected to ttyS0 and ttyS1, and configured for rtscts at 115200 and Class1. This solution has at least one issue, which i've not tried to solve yet - modem picks phone only after, approximately, 2 rings, and has quite long voice-shell script return time. This is due to subsequent modem configurations/reconfigurations by hylafax and vm, which consume much of the time. You may try to eliminate it, and i think it is possible. Let's proceed to attached files: hylafax-4.1.1-egetty.patch Patch for HylaFAX 4.1.1, apply it by running "patch -p1 < hylafax-4.1.1-egetty.patch" in source directory. You need to change only faxgetty binary with patched version. mgetty-1.1.27-hylafax_egetty.patch Patch for mgetty 1.1.27, apply it by running "patch -p1 < mgetty-1.1.27-hylafax_egetty.patch" in source directory. You need to change only vm binary with patched version. config.ttyS0 HylaFAX modem config excerpts call.sh Voice-shell script, which answers with bi-lingual message, then tries to determine call type by listening to voice-shell messages, and then returns call status code to faxgetty. This script acts as HylaFAX egetty. You need to specify it's path to HylaFAX either in setup.cache (PATHEGETTY) or by changing /etc/hylafax/egetty-link symlink (if you have one). mgetty.config mgetty config excerpts (for general modem and fax handling) voice.conf mgetty voice subsystem config excerpts (for voice modem handling). You may have to change sound compression and speed, and various gain settings, so your modem may not support mine's. Particulary such a high DTE-DCE speed (115200) is required because of mentioned uncompressed sound stream requirements. I must say, "i'm pretty new to linux" as many are now, so excuse me for possible uncompetency. All the Best to All. Nick. P.S. Sorry for poor English, again, and bloated email too:) I hope this info would be useful for somebody. Comments and corrections are appreciated.
diff -ur hylafax-4.1.1/faxd/ClassModem.c++ hylafax-4.1.1-egetty_patched/faxd/ClassModem.c++ --- hylafax-4.1.1/faxd/ClassModem.c++ Sun Feb 3 03:04:29 2002 +++ hylafax-4.1.1-egetty_patched/faxd/ClassModem.c++ Wed Dec 11 16:14:17 2002 @@ -254,9 +254,10 @@ } CallType -ClassModem::answerCall(AnswerType atype, fxStr& emsg) +ClassModem::answerCall(AnswerType atype, fxStr& emsg, bool adaptive) { CallType ctype = CALLTYPE_ERROR; + bool adapted=false; /* * If the request has no type-specific commands * to use, then just use the normal commands @@ -268,8 +269,10 @@ case ANSTYPE_DATA: answerCmd = conf.answerDataCmd; break; case ANSTYPE_VOICE: answerCmd = conf.answerVoiceCmd; break; } - if (answerCmd == "") + if (answerCmd == "") { answerCmd = conf.answerAnyCmd; + adapted = (atype==ANSTYPE_ANY && adaptive); // ??? ANSTYPE_ANY or * ??? + } if (atCmd(answerCmd, AT_NOTHING)) { ctype = answerResponse(emsg); if (ctype == CALLTYPE_UNKNOWN) { @@ -287,7 +290,7 @@ }; ctype = unknownCall[atype]; } - answerCallCmd(ctype); + if(!answerCallCmd(ctype,adapted)) ctype=CALLTYPE_ERROR; } return (ctype); } @@ -299,17 +302,30 @@ * modems that, for example, require a fixed baud rate * and flow control scheme when receiving fax. */ -void -ClassModem::answerCallCmd(CallType ctype) +bool +ClassModem::answerCallCmd(CallType ctype, bool adapted) { fxStr beginCmd; switch (ctype) { - case CALLTYPE_FAX: beginCmd = conf.answerFaxBeginCmd; break; - case CALLTYPE_DATA: beginCmd = conf.answerDataBeginCmd; break; - case CALLTYPE_VOICE:beginCmd = conf.answerVoiceBeginCmd; break; + case CALLTYPE_FAX: + beginCmd = + adapted && conf.adaptedAnswerFaxBeginCmd != "" ? + conf.adaptedAnswerFaxBeginCmd : conf.answerFaxBeginCmd; + break; + case CALLTYPE_DATA: + beginCmd = + adapted && conf.adaptedAnswerDataBeginCmd != "" ? + conf.adaptedAnswerDataBeginCmd : conf.answerDataBeginCmd; + break; + case CALLTYPE_VOICE: + beginCmd = + adapted && conf.adaptedAnswerVoiceBeginCmd != "" ? + conf.adaptedAnswerVoiceBeginCmd : conf.answerVoiceBeginCmd; + break; } if (beginCmd != "") - (void) atCmd(beginCmd); + return atCmd(beginCmd,AT_OK,conf.answerResponseTimeout); + return true; } /* @@ -870,8 +886,8 @@ case ESC_WAITFOR: // wait for response resp = (u_char) cmd[++i]; if (resp != AT_NOTHING) { - // XXX check return? - (void) waitFor(resp, ms); // XXX ms + // XXX check return!!! + if(!waitFor(resp, ms)) return (false); // XXX ms respPending = false; } break; diff -ur hylafax-4.1.1/faxd/ClassModem.h hylafax-4.1.1-egetty_patched/faxd/ClassModem.h --- hylafax-4.1.1/faxd/ClassModem.h Sat Feb 2 23:03:09 2002 +++ hylafax-4.1.1-egetty_patched/faxd/ClassModem.h Wed Dec 11 15:58:12 2002 @@ -308,8 +308,8 @@ * at any time in this procedure. */ virtual bool waitForRings(u_int rings, CallType&, CallerID&); - virtual CallType answerCall(AnswerType, fxStr& emsg); - virtual void answerCallCmd(CallType); + virtual CallType answerCall(AnswerType, fxStr& emsg, bool adaptive=false); + virtual bool answerCallCmd(CallType, bool adapted=false); }; inline long ClassModem::getDataTimeout() const { return dataTimeout; } inline const fxStr& ClassModem::getModel() const { return modemModel; } diff -ur hylafax-4.1.1/faxd/Getty.c++ hylafax-4.1.1-egetty_patched/faxd/Getty.c++ --- hylafax-4.1.1/faxd/Getty.c++ Thu Nov 14 14:30:16 2002 +++ hylafax-4.1.1-egetty_patched/faxd/Getty.c++ Fri Nov 15 19:49:45 2002 @@ -165,7 +165,9 @@ * stdio streams should be hooked to the tty * and the modem descriptor should be closed. */ + /* +++ [NICK] +++ setupSession(fd); + --- [NICK] --- */ /* * If this getty is not being started from init * then pass a restricted environment. Otherwise diff -ur hylafax-4.1.1/faxd/ModemConfig.c++ hylafax-4.1.1-egetty_patched/faxd/ModemConfig.c++ --- hylafax-4.1.1/faxd/ModemConfig.c++ Fri Feb 15 06:55:06 2002 +++ hylafax-4.1.1-egetty_patched/faxd/ModemConfig.c++ Wed Dec 11 16:10:41 2002 @@ -80,6 +80,9 @@ { "modemanswerfaxbegincmd", &ModemConfig::answerFaxBeginCmd }, { "modemanswerdatabegincmd", &ModemConfig::answerDataBeginCmd }, { "modemanswervoicebegincmd", &ModemConfig::answerVoiceBeginCmd }, +{ "modemadaptedanswerfaxbegincmd", &ModemConfig::adaptedAnswerFaxBeginCmd }, +{ "modemadaptedanswerdatabegincmd", &ModemConfig::adaptedAnswerDataBeginCmd }, +{ "modemadaptedanswervoicebegincmd", &ModemConfig::adaptedAnswerVoiceBeginCmd }, { "modemresetcmds", &ModemConfig::resetCmds }, { "modemdialcmd", &ModemConfig::dialCmd, "ATDT%s" }, { "modemnoflowcmd", &ModemConfig::noFlowCmd }, diff -ur hylafax-4.1.1/faxd/ModemConfig.h hylafax-4.1.1-egetty_patched/faxd/ModemConfig.h --- hylafax-4.1.1/faxd/ModemConfig.h Fri Feb 15 06:55:06 2002 +++ hylafax-4.1.1-egetty_patched/faxd/ModemConfig.h Wed Dec 11 16:00:06 2002 @@ -87,6 +87,9 @@ fxStr answerDataBeginCmd; // cmd to start inbound data session fxStr answerFaxBeginCmd; // cmd to start inbound fax session fxStr answerVoiceBeginCmd; // cmd to start inbound voice session + fxStr adaptedAnswerDataBeginCmd; // cmd to start inbound adapted data session + fxStr adaptedAnswerFaxBeginCmd; // cmd to start inbound adapted fax session + fxStr adaptedAnswerVoiceBeginCmd; // cmd to start inbound adapted voice session fxStr sendBeginCmd; // cmd to start outbound session fxStr class0Cmd; // cmd for setting Class 0 fxStr classQueryCmd; // cmd for getting modem services diff -ur hylafax-4.1.1/faxd/ModemServer.c++ hylafax-4.1.1-egetty_patched/faxd/ModemServer.c++ --- hylafax-4.1.1/faxd/ModemServer.c++ Thu Nov 14 14:30:16 2002 +++ hylafax-4.1.1-egetty_patched/faxd/ModemServer.c++ Wed Dec 11 16:11:51 2002 @@ -759,10 +759,10 @@ bool ModemServer::modemWaitForRings(u_int rings, CallType& type, CallerID& cid) { return modem->waitForRings(rings, type, cid); } -CallType ModemServer::modemAnswerCall(AnswerType atype, fxStr& emsg) - { return modem->answerCall(atype, emsg); } -void ModemServer::modemAnswerCallCmd(CallType ctype) - { modem->answerCallCmd(ctype); } +CallType ModemServer::modemAnswerCall(AnswerType atype, fxStr& emsg, bool adaptive) + { return modem->answerCall(atype, emsg, adaptive); } +bool ModemServer::modemAnswerCallCmd(CallType ctype, bool adapted) + { return modem->answerCallCmd(ctype, adapted); } void ModemServer::modemHangup() { modem->hangup(); } BaudRate ModemServer::getModemRate() const { return baudRates[curRate]; } diff -ur hylafax-4.1.1/faxd/ModemServer.h hylafax-4.1.1-egetty_patched/faxd/ModemServer.h --- hylafax-4.1.1/faxd/ModemServer.h Sun Jun 13 11:41:04 1999 +++ hylafax-4.1.1-egetty_patched/faxd/ModemServer.h Wed Dec 11 16:06:49 2002 @@ -150,8 +150,8 @@ bool modemStopOutput(); // modem driver interfaces bool modemWaitForRings(u_int rings, CallType&, CallerID&); - CallType modemAnswerCall(AnswerType, fxStr&); - void modemAnswerCallCmd(CallType); + CallType modemAnswerCall(AnswerType, fxStr&, bool adaptive=false); + bool modemAnswerCallCmd(CallType, bool adapted=false); void modemFlushInput(); void modemHangup(); // server state and related control interfaces diff -ur hylafax-4.1.1/faxd/faxGettyApp.c++ hylafax-4.1.1-egetty_patched/faxd/faxGettyApp.c++ --- hylafax-4.1.1/faxd/faxGettyApp.c++ Fri Feb 15 07:31:02 2002 +++ hylafax-4.1.1-egetty_patched/faxd/faxGettyApp.c++ Wed Dec 11 16:05:51 2002 @@ -318,7 +318,7 @@ advanceRotary = false; } else { // NB: answer based on ctype, not atype - ctype = modemAnswerCall(ctype, emsg); + ctype = modemAnswerCall(ctype, emsg, adaptiveAnswer); callResolved = processCall(ctype, emsg, cid); } } else if (atype == ClassModem::ANSTYPE_ANY) { @@ -417,14 +417,20 @@ */ ctype = runGetty("EXTERN GETTY", OSnewEGetty, egettyArgs, emsg, lockExternCalls, true); - if (ctype == ClassModem::CALLTYPE_DONE) // NB: call completed - return (true); - if (ctype != ClassModem::CALLTYPE_ERROR) - modemAnswerCallCmd(ctype); + switch(ctype) + { + case ClassModem::CALLTYPE_DONE: + return (true); + case ClassModem::CALLTYPE_ERROR: + return (false); + default: + ctype = modemAnswerCall(ctype, emsg, adaptiveAnswer); + break; + } } else emsg = "External getty use is not permitted"; } else - ctype = modemAnswerCall(atype, emsg); + ctype = modemAnswerCall(atype, emsg, adaptiveAnswer); callResolved = processCall(ctype, emsg, cid); return (callResolved); }
diff -ur mgetty-1.1.27/voice/include/voice.h mgetty-1.1.27-IDC_5614BXLVR_Plus-hylafax_egetty/voice/include/voice.h --- mgetty-1.1.27/voice/include/voice.h Sat Sep 29 01:10:04 2001 +++ mgetty-1.1.27-IDC_5614BXLVR_Plus-hylafax_egetty/voice/include/voice.h Thu Dec 5 17:52:59 2002 @@ -87,6 +87,7 @@ extern int voice_shell_linger; extern char voice_config_file[VOICE_BUF_LEN]; extern char *DevID; +extern TIO hylafax_egetty_tio; extern TIO tio_save; extern TIO voice_tio; @@ -117,7 +118,10 @@ extern int voice_analyze(char *buffer, char *expected_answers, int exact_match); #define voice_answer_phone() voice_modem->answer_phone() -#define voice_beep(a,b) voice_modem->beep(a,b) +/* +++++++++ [NICK] +++++++++ */ +/*#define voice_beep(a,b) voice_modem->beep(a,b)*/ +#define voice_beep(a,b) ((a>0)&&(b>0)?voice_modem->beep(a,b):OK) +/* --------- [NICK] --------- */ extern int voice_check_for_input(void); extern int voice_close_device(void); extern int voice_command(char *command, char *expected_answers); diff -ur mgetty-1.1.27/voice/libvoice/close.c mgetty-1.1.27-IDC_5614BXLVR_Plus-hylafax_egetty/voice/libvoice/close.c --- mgetty-1.1.27/voice/libvoice/close.c Thu Sep 10 01:07:27 1998 +++ mgetty-1.1.27-IDC_5614BXLVR_Plus-hylafax_egetty/voice/libvoice/close.c Thu Dec 5 17:56:47 2002 @@ -19,6 +19,9 @@ return(FAIL); }; + /* +++ [NICK] +++ */ + tcsetattr(voice_fd,TCSANOW,&hylafax_egetty_tio); + /* --- [NICK] --- */ close(voice_fd); voice_fd = NO_VOICE_FD; rmlocks(); diff -ur mgetty-1.1.27/voice/libvoice/open.c mgetty-1.1.27-IDC_5614BXLVR_Plus-hylafax_egetty/voice/libvoice/open.c --- mgetty-1.1.27/voice/libvoice/open.c Thu Sep 10 01:07:32 1998 +++ mgetty-1.1.27-IDC_5614BXLVR_Plus-hylafax_egetty/voice/libvoice/open.c Thu Dec 5 18:02:28 2002 @@ -10,6 +10,8 @@ #include "../include/voice.h" +TIO hylafax_egetty_tio; + int voice_open_device(void) { char *voice_tty_start; @@ -61,6 +63,9 @@ if (voice_fd != NO_VOICE_FD) { + /* +++ [NICK] +++ */ + tcgetattr(voice_fd,&hylafax_egetty_tio); + /* --- [NICK] --- */ DevID = malloc(strlen(voice_tty) + 1); strcpy(DevID, voice_tty); lprintf(L_MESG, "reading port %s configuration from config file %s", diff -ur mgetty-1.1.27/voice/libvoice/shell.c mgetty-1.1.27-IDC_5614BXLVR_Plus-hylafax_egetty/voice/libvoice/shell.c --- mgetty-1.1.27/voice/libvoice/shell.c Wed Aug 8 01:07:08 2001 +++ mgetty-1.1.27-IDC_5614BXLVR_Plus-hylafax_egetty/voice/libvoice/shell.c Wed Dec 11 13:40:31 2002 @@ -48,7 +48,7 @@ else { int shell_stderr_fd; - sprintf( log_file_name, cvd.voice_shell_log.d.p, DevID ); + sprintf( log_file_name, cvd.voice_shell_log.d.p, strncmp( DevID, "/dev/", 5 ) ? DevID : DevID+5 ); shell_stderr_fd = open(log_file_name, O_WRONLY | O_CREAT | O_APPEND); diff -ur mgetty-1.1.27/voice/vm/main.c mgetty-1.1.27-IDC_5614BXLVR_Plus-hylafax_egetty/voice/vm/main.c --- mgetty-1.1.27/voice/vm/main.c Fri Apr 13 15:01:12 2001 +++ mgetty-1.1.27-IDC_5614BXLVR_Plus-hylafax_egetty/voice/vm/main.c Fri Dec 6 12:41:20 2002 @@ -423,7 +423,7 @@ if (getenv("VOICE_PID") == NULL) { - voice_set_device(NO_DEVICE); +//[NICK] voice_set_device(NO_DEVICE); voice_mode_off(); voice_close_device(); };
GettyArgs: %l EGettyArgs: "-l %l" PollLockWait: 10 # ModemType: Class1 ModemRate: 115200 # rate for DCE-DTE communication ModemFlowControl: rtscts # ModemResetCmds: ATS32=0S33=0 ModemSoftResetCmdDelay: 0 ModemNoFlowCmd: AT&K0 # setup no flow control ModemHardFlowCmd: AT&K3 # setup hardware flow control ModemSoftFlowCmd: AT&K4 # setup software flow control ModemSetupDTRCmd: AT&D2 # setup so DTR drop resets modem ModemSetupDCDCmd: AT&C1 # setup so DCD reflects carrier (or not) # ModemMfrQueryCmd: !Rockwell ModemModelQueryCmd: !RC288DPi ModemRevQueryCmd: ATI3 # product information # ModemDialCmd: ATDT%s # T for tone dialing ModemWaitTimeCmd: ATS7=40 # AdaptiveAnswer: yes # enable adaptive answer AnswerRotary: "extern" # ModemAnswerCmd: "ATM1E0V1Q0X4&D2&C1;&K3;+FCLASS=0;+FAE=1;A" ModemAnswerFaxCmd: "ATM1E0V1Q0X4&D2&C1;&K3;+FCLASS=1;A" ModemAnswerDataCmd: "ATM1E0V1Q0X4&D2&C1;&K3;+FCLASS=0;A" # ModemAdaptedAnswerFaxBeginCmd: "<waitfor:CONNECT>" ModemAdaptedAnswerDataBeginCmd: "ATO\n<waitfor:CONNECT>" # Class1RecvIdentTimer: 25000 # timeout fax answer in 25 secs ModemAnswerResponseTimeout: 60000
debug 4 speed 38400 issue-file /etc/issue.mgetty port ttyS0 direct y toggle-dtr n blocking y speed 115200 port ttyS1 direct y toggle-dtr n blocking y speed 115200
# part generic voice_log_level 3 voice_shell_log /var/log/vgetty_voice_shell.%s voice_dir /var/spool/voice phone_owner root phone_group voice phone_mode 0660 message_flag_file .flag receive_dir incoming message_dir messages message_list Index backup_message standard.rmd port_speed 115200 #! voice_shell /bin/sh #! port_timeout 10 dial_timeout 90 command_delay 100 dtmf_len 30 dtmf_threshold 40 dtmf_wait 7 ignore_fax_dle false raw_data false rec_compression 0 rec_speed 8000 rec_silence_len 70 rec_silence_threshold 128 rec_remove_silence false rec_max_len 300 rec_min_len 0 do_hard_flow true #! beep_frequency 933 beep_length 0 max_tries 3 retry_delay 5 watchdog_timeout 60 receive_gain 0 transmit_gain -1 enable_command_echo false poll_interval 10 # program vm ring_report_delay 0 voice_devices ttyS0:ttyS1 #! dialout_timeout 90 ringback_goes_away 70 ringback_never_came 100 # port ttyS0 # port ttyS1