?
Solved

Perl, Expect Fax modem problem

Posted on 2003-02-25
2
Medium Priority
?
404 Views
Last Modified: 2013-12-27
I'm trying to use the mon dialin.monitor to make sure that our hylafax server is running. (It sometimes hangs for no reason)  I don't know what I need the script to Expect to be returned upon the connect to the fax server.  It waits for a connect but return a NO CARRIER.  It doesn't seem to respond to the fax servers request for a speed change.  Any clues would be appreciated.  Code and logs follow

Expect code for connect check:

   print $s "ATDT$NUMBER\r";
#    $s->expect(0);
#       $s->exp_before();
   ($matched_pattern_position, $error,$successfully_matching_string,
           $before_match,$after_match) =
           $s->expect ($DIAL_TIMEOUT, "CONNECT", "BUSY", "NO CARRIER", "NO DIALTONE");

if ($error eq "1:TIMEOUT") {
       unlock_modem;
       return "timeout waiting for connection [$before_match] [$after_match]";
   } elsif (!defined $matched_pattern_position) {
       unlock_modem;
       return "no pattern matched waiting for connection";
   } elsif ($matched_pattern_position != 1) {
       unlock_modem;
       return "no connection: $successfully_matching_string";
   }
   $s->clear_accum;



Output on client side:

dialing and waiting for carrier
Beginning expect from handle id(3).
Accumulator: ''
Expect timeout time: 60 seconds.
expect: Pty=handle id(3), time=1046199201, loop_time=60
expect: handle handle id(3) ready.
expect: read 8 byte(s) from handle id(3).
NO CARexpect: handle handle id(3) ready.
expect: read 6 byte(s) from handle id(3).
Matched pattern 3 ('NO CARRIER')!
       Before match string: '\r\015'
       Match string: 'NO CARRIER'
       After match string: '\r\015'
Returning from expect successfully.
Accumulator: '\r\015'
This is the matched pattern 3
This is the error
This is the success NO CARRIER
This is before the match
This is after the match
       unlocking modem



This is the hylafax log of the connection:

Feb 25 13:01:52.55: [ 6712]: SESSION BEGIN 00000785 19995551212
Feb 25 13:01:52.55: [ 6712]: HylaFAX (tm) Version 4.1.5
Feb 25 13:01:52.55: [ 6712]: MODEM set XON/XOFF/FLUSH: input ignored, output disabled
Feb 25 13:01:52.55: [ 6712]: <-- [13:AT+FCLASS=1A\r]
Feb 25 13:01:58.12: [ 6712]: --> [7:CONNECT]
Feb 25 13:01:58.12: [ 6712]: ANSWER: FAX CONNECTION  DEVICE '/dev/ttyS0'
Feb 25 13:01:58.12: [ 6712]: MODEM input buffering enabled
Feb 25 13:01:58.12: [ 6712]: RECV FAX: begin
Feb 25 13:01:58.12: [ 6712]: MODEM input buffering disabled
Feb 25 13:01:58.12: [ 6712]: <-- data [23]
Feb 25 13:01:58.12: [ 6712]: <-- data [2]
Feb 25 13:01:58.16: [ 6712]: --> [7:CONNECT]
Feb 25 13:01:58.16: [ 6712]: <-- data [10]
Feb 25 13:01:58.16: [ 6712]: <-- data [2]
Feb 25 13:02:00.10: [ 6712]: --> [2:OK]
Feb 25 13:02:00.10: [ 6712]: <-- [9:AT+FRH=3\r]
Feb 25 13:02:03.20: [ 6712]: --> [0:]
Feb 25 13:02:03.20: [ 6712]: MODEM <Empty line>
Feb 25 13:02:03.20: [ 6712]: MODEM TIMEOUT: waiting for v.21 carrier
Feb 25 13:02:03.20: [ 6712]: <-- data [1]
Feb 25 13:02:03.21: [ 6712]: --> [2:OK]

**************** --> Following repeated 5 times
Feb 25 13:02:16.67: [ 6712]: DELAY 1500 ms
Feb 25 13:02:18.17: [ 6712]: <-- [9:AT+FTH=3\r]
Feb 25 13:02:18.21: [ 6712]: --> [7:CONNECT]
Feb 25 13:02:18.21: [ 6712]: <-- data [23]
Feb 25 13:02:18.21: [ 6712]: <-- data [2]
Feb 25 13:02:18.24: [ 6712]: --> [7:CONNECT]
Feb 25 13:02:18.24: [ 6712]: <-- data [10]
Feb 25 13:02:18.24: [ 6712]: <-- data [2]
Feb 25 13:02:20.29: [ 6712]: --> [2:OK]
Feb 25 13:02:20.29: [ 6712]: <-- [9:AT+FRH=3\r]
Feb 25 13:02:23.39: [ 6712]: --> [0:]
Feb 25 13:02:23.39: [ 6712]: MODEM <Empty line>
Feb 25 13:02:23.39: [ 6712]: MODEM TIMEOUT: waiting for v.21 carrier
Feb 25 13:02:23.39: [ 6712]: <-- data [1]
Feb 25 13:02:23.40: [ 6712]: --> [2:OK]
******************************--> repeat done

Feb 25 13:02:36.86: [ 6712]: RECV FAX: No answer (T.30 T1 timeout)
Feb 25 13:02:36.86: [ 6712]: RECV FAX: end
Feb 25 13:02:36.86: [ 6712]: SESSION END


Here is the stty init string

$s->exp_stty ("9600", "cs8", "crtscts", "-parenb", "-cstopb");
0
Comment
Question by:bkern
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
rickisme earned 1500 total points
ID: 8022657
I sure am no expert on this kind of stuff but in reviewing the info it is clear to me that the receiving station is not acknowledgeing the attempt to connect and is timing out the send string.  I have had similar problems with other type systems and on several occassions have found the the final reset command was not present so "basically" after booting or seeing the first attempt it never does a complete reset so all attempts have this timeout problem.  It does appear that the send is going through and the reset on the sending side is OK as it repeatidly tries to resend.  If you have the manual on the software you might want to check to see if the reset command is being issued as the final (or first) string command to the downline systems(dependant upon your setup) after boot or initial attempt.  

Will the hylafax server allow you to do basic ping testing between systems?  It may be the best way to isolate the problem.  

Lord knows this will be a challenge... better you than me <g>.  Good Luck and God Bless, Rick.  >>I use to think I was a Tech... then I read this <bwg>.
0
 

Author Comment

by:bkern
ID: 8748988
Still haven't managed to get this working, it kind of fell through the cracks.  Upgrading to a modem that never locks up was an even easier solution!
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you with short command examples how to obtain a packet footprint of all traffic flowing thru your Juniper device running ScreenOS. I do not know the exact firmware requirement, but I think the fprofile command is availab…
#Citrix #Citrix Netscaler #HTTP Compression #Load Balance
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question