Fixed mbcico ISDN modem aftercall function
This commit is contained in:
parent
f5132ca7a0
commit
2a01693438
@ -33,6 +33,8 @@ v0.35.02 22-Jun-2002
|
||||
|
||||
mbcico:
|
||||
Implemented nodes special outbound boxes.
|
||||
Corrected a problem with getting modem aftercall info for ISDN
|
||||
modems.
|
||||
|
||||
mbout:
|
||||
Implemented nodes special outbound boxes.
|
||||
|
@ -94,7 +94,7 @@ int portopen(faddr *addr)
|
||||
}
|
||||
}
|
||||
|
||||
WriteError("No call method available");
|
||||
WriteError("No call method available, maybe missing parameters");
|
||||
return ST_PORTERR;
|
||||
}
|
||||
|
||||
@ -270,10 +270,17 @@ int call(faddr *addr)
|
||||
closetcp();
|
||||
} else {
|
||||
hangup();
|
||||
if (rc == 0)
|
||||
aftercall();
|
||||
localport();
|
||||
closeport();
|
||||
if (strlen(modem.info)) {
|
||||
/*
|
||||
* If mode info string defined, open port again to get
|
||||
* the aftercall information. Mostly used with ISDN.
|
||||
*/
|
||||
portopen(addr);
|
||||
aftercall();
|
||||
closeport();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
IsDoing("NoCall");
|
||||
|
@ -44,8 +44,7 @@
|
||||
char *tranphone(char *Phone)
|
||||
{
|
||||
static char trp[21];
|
||||
char buf[21];
|
||||
char *p;
|
||||
char buf[21], *p;
|
||||
int ln, i, j;
|
||||
|
||||
if (Phone == NULL)
|
||||
@ -150,14 +149,10 @@ void almhdl(int sig)
|
||||
|
||||
|
||||
|
||||
int expect_str(int, char *);
|
||||
int expect_str(int timeout, char *Phone)
|
||||
int expect_str(int, int, char *);
|
||||
int expect_str(int timeout, int aftermode, char *Phone)
|
||||
{
|
||||
int matched = FALSE;
|
||||
int smatch = FALSE;
|
||||
int ematch = FALSE;
|
||||
int ioerror = FALSE;
|
||||
int i, rc;
|
||||
int matched = FALSE, smatch = FALSE, ematch = FALSE, ioerror = FALSE, i, rc;
|
||||
char inbuf[256];
|
||||
unsigned char ch = '\0';
|
||||
int eol = FALSE;
|
||||
@ -190,6 +185,9 @@ int expect_str(int timeout, char *Phone)
|
||||
}
|
||||
|
||||
inbuf[i] = '\0';
|
||||
if (aftermode && strcmp(inbuf, (char *)"OK\r") && strcmp(inbuf, (char *)"\r"))
|
||||
Syslog('+', "chat: rcv \"%s\"", printable(inbuf, 0));
|
||||
else
|
||||
Syslog('c', "chat: rcv \"%s\"", printable(inbuf, 0));
|
||||
|
||||
for (i = 0; (i < 10) && !matched; i++)
|
||||
@ -241,12 +239,12 @@ int expect_str(int timeout, char *Phone)
|
||||
* The phone number must be full international notation unless the \D
|
||||
* macro is in the dial command.
|
||||
*/
|
||||
int chat(char *Send, int timeout, char *Phone)
|
||||
int chat(char *Send, int timeout, int aftermode, char *Phone)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if ((rc = send_str(Send, Phone)) == 0)
|
||||
rc = expect_str(timeout, Phone);
|
||||
rc = expect_str(timeout, aftermode, Phone);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
#ifndef _CHAT_H
|
||||
#define _CHAT_H
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
char *tranphone(char *);
|
||||
int chat(char *, int, char *);
|
||||
int chat(char *, int, int, char *);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -60,7 +60,7 @@ int initmodem(void)
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
if (strlen(modem.init[i]))
|
||||
if (chat(modem.init[i], CFG.timeoutreset, NULL)) {
|
||||
if (chat(modem.init[i], CFG.timeoutreset, FALSE, NULL)) {
|
||||
WriteError("dial: could not reset the modem");
|
||||
return 1;
|
||||
}
|
||||
@ -82,20 +82,20 @@ int dialphone(char *Phone)
|
||||
rc = 0;
|
||||
if (strlen(nodes.phone[0])) {
|
||||
if (strlen(nodes.dial))
|
||||
rc = chat(nodes.dial, CFG.timeoutconnect, nodes.phone[0]);
|
||||
rc = chat(nodes.dial, CFG.timeoutconnect, FALSE, nodes.phone[0]);
|
||||
else
|
||||
rc = chat(modem.dial, CFG.timeoutconnect, nodes.phone[0]);
|
||||
rc = chat(modem.dial, CFG.timeoutconnect, FALSE, nodes.phone[0]);
|
||||
if ((rc == 0) && strlen(nodes.phone[1])) {
|
||||
if (strlen(nodes.dial))
|
||||
rc = chat(nodes.dial, CFG.timeoutconnect, nodes.phone[1]);
|
||||
rc = chat(nodes.dial, CFG.timeoutconnect, FALSE, nodes.phone[1]);
|
||||
else
|
||||
rc = chat(modem.dial, CFG.timeoutconnect, nodes.phone[1]);
|
||||
rc = chat(modem.dial, CFG.timeoutconnect, FALSE, nodes.phone[1]);
|
||||
}
|
||||
} else {
|
||||
if (strlen(nodes.dial))
|
||||
rc = chat(nodes.dial, CFG.timeoutconnect, Phone);
|
||||
rc = chat(nodes.dial, CFG.timeoutconnect, FALSE, Phone);
|
||||
else
|
||||
rc = chat(modem.dial, CFG.timeoutconnect, Phone);
|
||||
rc = chat(modem.dial, CFG.timeoutconnect, FALSE, Phone);
|
||||
}
|
||||
|
||||
if (rc) {
|
||||
@ -118,7 +118,7 @@ int hangup()
|
||||
FLUSHIN();
|
||||
FLUSHOUT();
|
||||
if (strlen(modem.hangup))
|
||||
chat(modem.hangup, CFG.timeoutreset, NULL);
|
||||
chat(modem.hangup, CFG.timeoutreset, FALSE, NULL);
|
||||
|
||||
if (carrier) {
|
||||
c_end = time(NULL);
|
||||
@ -152,15 +152,12 @@ int hangup()
|
||||
|
||||
|
||||
|
||||
int aftercall()
|
||||
void aftercall()
|
||||
{
|
||||
if (strlen(modem.info)) {
|
||||
Syslog('d', "Reading link stat (aftercall)");
|
||||
FLUSHIN();
|
||||
FLUSHOUT();
|
||||
chat(modem.info, CFG.timeoutreset, NULL);
|
||||
}
|
||||
return 0;
|
||||
chat(modem.info, CFG.timeoutreset, TRUE, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
#ifndef _DIAL_H
|
||||
#define _DIAL_H
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
int dialphone(char *);
|
||||
int hangup(void);
|
||||
int aftercall(void);
|
||||
|
||||
void aftercall(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user