Support for more than one controller added.
This commit is contained in:
parent
8d0f68cb48
commit
a58d36ec6e
|
@ -1,5 +1,5 @@
|
||||||
.\" manual page [] for capiplugin 2.3
|
.\" manual page [] for capiplugin 2.3
|
||||||
.\" $Id: capiplugin.8,v 1.11 2004/07/27 18:06:54 armin Exp $
|
.\" $Id: capiplugin.8,v 1.12 2004/10/06 15:29:20 calle Exp $
|
||||||
.\" SH section heading
|
.\" SH section heading
|
||||||
.\" SS subsection heading
|
.\" SS subsection heading
|
||||||
.\" LP paragraph
|
.\" LP paragraph
|
||||||
|
@ -281,6 +281,11 @@ For point-to-multipoint \fI<controller specification>\fR is only the
|
||||||
CAPI 2.0 controller number, default is 1.
|
CAPI 2.0 controller number, default is 1.
|
||||||
For point-to-point, specify \fI<controller number>\fR,\fI<ddi>\fR,\fI<length of internal numbers\>
|
For point-to-point, specify \fI<controller number>\fR,\fI<ddi>\fR,\fI<length of internal numbers\>
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B controller[1-3] \fI<controller specification>
|
||||||
|
Like option \fIcontroller\fR.
|
||||||
|
Used to specify more than one controller
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B coso caller
|
.B coso caller
|
||||||
No callback is done, the costs are assigned to the caller.
|
No callback is done, the costs are assigned to the caller.
|
||||||
|
@ -310,11 +315,23 @@ Default value is 60 seconds.
|
||||||
List of phone numbers to monitor for calls, separated by commas.
|
List of phone numbers to monitor for calls, separated by commas.
|
||||||
If this option is not set, the value of option \fImsn\fR is used.
|
If this option is not set, the value of option \fImsn\fR is used.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B inmsn[1-3] \fI<msn>
|
||||||
|
List of phone numbers to monitor for calls on controller specified
|
||||||
|
by option \fIcontroller[1-3]\fR, separated by commas.
|
||||||
|
If this option is not set, the value of option \fImsn[1-3]\fR is used.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B msn \fI<msn>
|
.B msn \fI<msn>
|
||||||
Phone number used to make outgoing calls. Also used for incoming calls
|
Phone number used to make outgoing calls. Also used for incoming calls
|
||||||
if option \fIinmsn\fR is not set.
|
if option \fIinmsn\fR is not set.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B msn[1-3] \fI<msn>
|
||||||
|
Phone number used to make outgoing calls on controller specified
|
||||||
|
by option \fIcontroller[1-3]\fR. Also used for incoming calls
|
||||||
|
if option \fIinmsn[1-3]\fR is not set.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B number \fI<phone numbers>
|
.B number \fI<phone numbers>
|
||||||
List of phone numbers to call, separated by commas.
|
List of phone numbers to call, separated by commas.
|
||||||
|
@ -326,6 +343,11 @@ See option \fIdialmax\fR.
|
||||||
.B numberprefix \fI<prefix>
|
.B numberprefix \fI<prefix>
|
||||||
phone number to dial to access an outside line. For example, \fInumberprefix 0\fR.
|
phone number to dial to access an outside line. For example, \fInumberprefix 0\fR.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B numberprefix[1-3] \fI<prefix>
|
||||||
|
phone number to dial to access an outside line for controller
|
||||||
|
specified by option \fIcontroller[1-3]\fR. For example, \fInumberprefix1 0\fR.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B protocol \fIhdlc\fR | \fIx75\fR | \fIv42bis\fR | \fImodem\fR | \fIanalogmodem\fR | \fIv110async\fR | \fIv120async\fR
|
.B protocol \fIhdlc\fR | \fIx75\fR | \fIv42bis\fR | \fImodem\fR | \fIanalogmodem\fR | \fIv110async\fR | \fIv120async\fR
|
||||||
ISDN protocol to use. With \fIhdlc\fR and \fIadskpppoe\fR,
|
ISDN protocol to use. With \fIhdlc\fR and \fIadskpppoe\fR,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* capiconnect.c - pppd plugin to make ISDN connections over CAPI2.0
|
* capiconnect.c - pppd plugin to make ISDN connections over CAPI2.0
|
||||||
*
|
*
|
||||||
* Copyright 2000 Carsten Paeth (calle@calle.in-berlin.de)
|
* Copyright 2000-2004 Carsten Paeth (calle@calle.in-berlin.de)
|
||||||
* Copyright 2000 AVM GmbH Berlin (info@avm.de)
|
* Copyright 2000-2004 AVM GmbH Berlin (info@avm.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -27,12 +27,14 @@
|
||||||
#include <linux/if.h>
|
#include <linux/if.h>
|
||||||
|
|
||||||
|
|
||||||
static char *revision = "$Revision: 1.35 $";
|
static char *revision = "$Revision: 1.36 $";
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
#define AVMADSLPARAMFILE "/etc/drdsl/adsl.conf"
|
#define AVMADSLPARAMFILE "/etc/drdsl/adsl.conf"
|
||||||
|
|
||||||
|
#define DIM(array) (sizeof(array)/sizeof((array)[0]))
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "patchlevel.h"
|
#include "patchlevel.h"
|
||||||
|
@ -91,25 +93,33 @@ static unsigned applid;
|
||||||
#define CIPMASK_VOICE (CM(1)|CM(4)|CM(5)|CM(16)|CM(26))
|
#define CIPMASK_VOICE (CM(1)|CM(4)|CM(5)|CM(16)|CM(26))
|
||||||
#define CIPMASK_DATA (CM(2)|CM(3))
|
#define CIPMASK_DATA (CM(2)|CM(3))
|
||||||
static unsigned long cipmask = CIPMASK_ALL;
|
static unsigned long cipmask = CIPMASK_ALL;
|
||||||
static int controller = 1;
|
|
||||||
static capi_contrinfo cinfo = { 0 , 0, 0 };
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
static char *opt_controller;
|
static char *opt_controller[4];
|
||||||
|
|
||||||
|
static struct contrparams {
|
||||||
|
int controller;
|
||||||
|
capi_contrinfo cinfo;
|
||||||
|
char *opt_numberprefix;
|
||||||
|
char *opt_msn;
|
||||||
|
char *opt_inmsn;
|
||||||
|
STRINGLIST *inmsns;
|
||||||
|
} contrparams[4] = {
|
||||||
|
{ 1, { 0, 0, 0 } },
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct contrparams *actcontroller = &contrparams[0];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* numbers
|
* numbers
|
||||||
*/
|
*/
|
||||||
static char *opt_numberprefix = 0;
|
|
||||||
static char *opt_number = 0;
|
static char *opt_number = 0;
|
||||||
static char *opt_callbacknumber = 0;
|
static char *opt_callbacknumber = 0;
|
||||||
static char *opt_msn = 0;
|
|
||||||
static char *opt_inmsn = 0;
|
|
||||||
static char *opt_cli = 0;
|
static char *opt_cli = 0;
|
||||||
static STRINGLIST *numbers;
|
static STRINGLIST *numbers;
|
||||||
static STRINGLIST *callbacknumbers;
|
static STRINGLIST *callbacknumbers;
|
||||||
static STRINGLIST *clis;
|
static STRINGLIST *clis;
|
||||||
static STRINGLIST *inmsns;
|
|
||||||
/*
|
/*
|
||||||
* protocol
|
* protocol
|
||||||
*/
|
*/
|
||||||
|
@ -172,30 +182,93 @@ static int optvoicecallwakeup(void) { return opt_voicecallwakeup = 1; }
|
||||||
static int optavmadsl(void) { return opt_avmadsl = 1; }
|
static int optavmadsl(void) { return opt_avmadsl = 1; }
|
||||||
|
|
||||||
static option_t my_options[] = {
|
static option_t my_options[] = {
|
||||||
|
|
||||||
|
/* controller */
|
||||||
|
|
||||||
{
|
{
|
||||||
"controller", o_string, &opt_controller,
|
"controller", o_string, &opt_controller[0],
|
||||||
"capi controller specification"
|
"capi controller specification"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"numberprefix", o_string, &contrparams[0].opt_numberprefix,
|
||||||
|
"prefix for number"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"msn", o_string, &contrparams[0].opt_msn,
|
||||||
|
"number to call from"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inmsn", o_string, &contrparams[0].opt_inmsn,
|
||||||
|
"called number for incoming calls"
|
||||||
|
},
|
||||||
|
|
||||||
|
/* controller1 */
|
||||||
|
|
||||||
|
{
|
||||||
|
"controller1", o_string, &opt_controller[1],
|
||||||
|
"capi controller specification"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"numberprefix1", o_string, &contrparams[1].opt_numberprefix,
|
||||||
|
"prefix for number"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"msn1", o_string, &contrparams[1].opt_msn,
|
||||||
|
"number to call from"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inmsn1", o_string, &contrparams[1].opt_inmsn,
|
||||||
|
"called number for incoming calls"
|
||||||
|
},
|
||||||
|
|
||||||
|
/* controller2 */
|
||||||
|
|
||||||
|
{
|
||||||
|
"controller2", o_string, &opt_controller[2],
|
||||||
|
"capi controller specification"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"numberprefix2", o_string, &contrparams[2].opt_numberprefix,
|
||||||
|
"prefix for number"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"msn2", o_string, &contrparams[2].opt_msn,
|
||||||
|
"number to call from"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inmsn2", o_string, &contrparams[2].opt_inmsn,
|
||||||
|
"called number for incoming calls"
|
||||||
|
},
|
||||||
|
|
||||||
|
/* controller3 */
|
||||||
|
|
||||||
|
{
|
||||||
|
"controller3", o_string, &opt_controller[3],
|
||||||
|
"capi controller specification"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"numberprefix3", o_string, &contrparams[3].opt_numberprefix,
|
||||||
|
"prefix for number"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"msn3", o_string, &contrparams[3].opt_msn,
|
||||||
|
"number to call from"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inmsn3", o_string, &contrparams[3].opt_inmsn,
|
||||||
|
"called number for incoming calls"
|
||||||
|
},
|
||||||
|
|
||||||
|
/* */
|
||||||
|
|
||||||
{
|
{
|
||||||
"number", o_string, &opt_number,
|
"number", o_string, &opt_number,
|
||||||
"number to call (may be comma separated)"
|
"number to call (may be comma separated)"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"numberprefix", o_string, &opt_numberprefix,
|
|
||||||
"prefix for number"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"msn", o_string, &opt_msn,
|
|
||||||
"number to call from"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"protocol", o_string, &opt_proto,
|
"protocol", o_string, &opt_proto,
|
||||||
"protocol x75, hdlc, modem, adslpppoe"
|
"protocol x75, hdlc, modem, adslpppoe"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"inmsn", o_string, &opt_inmsn,
|
|
||||||
"called number for incoming calls"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"cli", o_string, &opt_cli,
|
"cli", o_string, &opt_cli,
|
||||||
"calling number for incoming calls (may be comma separated list)"
|
"calling number for incoming calls (may be comma separated list)"
|
||||||
|
@ -264,6 +337,23 @@ static option_t my_options[] = {
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------- */
|
||||||
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
static int nextcontroller(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < DIM(contrparams); i++) {
|
||||||
|
if (&contrparams[i] <= actcontroller)
|
||||||
|
continue;
|
||||||
|
if (contrparams[i].controller == 0)
|
||||||
|
continue;
|
||||||
|
actcontroller = &contrparams[i];
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* -------- Handle leased lines (CAPI-Bundling) ----------------------- */
|
/* -------- Handle leased lines (CAPI-Bundling) ----------------------- */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
@ -367,6 +457,7 @@ static int channels2capi20(char *teln, unsigned char *AdditionalInfo)
|
||||||
static void plugin_check_options(void)
|
static void plugin_check_options(void)
|
||||||
{
|
{
|
||||||
static int init = 0;
|
static int init = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (init)
|
if (init)
|
||||||
return;
|
return;
|
||||||
|
@ -379,7 +470,7 @@ static void plugin_check_options(void)
|
||||||
die(1);
|
die(1);
|
||||||
} else {
|
} else {
|
||||||
dbglog("using default adsl parameters");
|
dbglog("using default adsl parameters");
|
||||||
if (!opt_controller) opt_controller = "2";
|
if (!opt_controller[0]) opt_controller[0] = "2";
|
||||||
opt_proto = "adslpppoe";
|
opt_proto = "adslpppoe";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -458,13 +549,13 @@ static void plugin_check_options(void)
|
||||||
channels2capi20(opt_channels, AdditionalInfo);
|
channels2capi20(opt_channels, AdditionalInfo);
|
||||||
if (opt_number)
|
if (opt_number)
|
||||||
option_error("capiplugin: option number ignored");
|
option_error("capiplugin: option number ignored");
|
||||||
if (opt_numberprefix)
|
if (contrparams[0].opt_numberprefix)
|
||||||
option_error("capiplugin: option numberprefix ignored");
|
option_error("capiplugin: option numberprefix ignored");
|
||||||
if (opt_callbacknumber)
|
if (opt_callbacknumber)
|
||||||
option_error("capiplugin: option callbacknumber ignored");
|
option_error("capiplugin: option callbacknumber ignored");
|
||||||
if (opt_msn)
|
if (contrparams[0].opt_msn)
|
||||||
option_error("capiplugin: option msn ignored");
|
option_error("capiplugin: option msn ignored");
|
||||||
if (opt_inmsn)
|
if (contrparams[0].opt_inmsn)
|
||||||
option_error("capiplugin: option inmsn ignored");
|
option_error("capiplugin: option inmsn ignored");
|
||||||
/*
|
/*
|
||||||
* dialout
|
* dialout
|
||||||
|
@ -492,35 +583,42 @@ static void plugin_check_options(void)
|
||||||
/*
|
/*
|
||||||
* controller
|
* controller
|
||||||
*/
|
*/
|
||||||
if (opt_controller) {
|
for (i = 0; i < DIM(opt_controller); i++) {
|
||||||
STRINGLIST *parsed_controller = 0;
|
if (opt_controller[i]) {
|
||||||
STRINGLIST *sl;
|
STRINGLIST *parsed_controller = 0;
|
||||||
char *tmp;
|
STRINGLIST *sl;
|
||||||
memset(&cinfo, 0, sizeof(cinfo));
|
char *tmp;
|
||||||
parsed_controller = stringlist_split(opt_controller, " \t,");
|
memset(&contrparams[i].cinfo, 0, sizeof(capi_contrinfo));
|
||||||
sl = parsed_controller;
|
parsed_controller = stringlist_split(opt_controller[i], " \t,");
|
||||||
if (!sl) goto illcontr;
|
sl = parsed_controller;
|
||||||
tmp = sl->s;
|
if (!sl) goto illcontr;
|
||||||
controller = strtol(sl->s, &tmp, 10);
|
tmp = sl->s;
|
||||||
if (tmp == sl->s || *tmp) goto illcontr;
|
contrparams[i].controller = strtol(sl->s, &tmp, 10);
|
||||||
if (sl->next) {
|
if (tmp == sl->s || *tmp) goto illcontr;
|
||||||
sl = sl->next;
|
if (sl->next) {
|
||||||
cinfo.ddi = strdup(sl->s);
|
|
||||||
if (cinfo.ddi == 0)
|
|
||||||
goto illcontr;
|
|
||||||
if (sl->next && sl->next->s) {
|
|
||||||
sl = sl->next;
|
sl = sl->next;
|
||||||
cinfo.ndigits = strtol(sl->s, &tmp, 10);
|
contrparams[i].cinfo.ddi = strdup(sl->s);
|
||||||
if (tmp == sl->s || *tmp) {
|
if (contrparams[i].cinfo.ddi == 0)
|
||||||
stringlist_free(&parsed_controller);
|
goto illcontr;
|
||||||
goto illcontr;
|
if (sl->next && sl->next->s) {
|
||||||
|
sl = sl->next;
|
||||||
|
contrparams[i].cinfo.ndigits = strtol(sl->s, &tmp, 10);
|
||||||
|
if (tmp == sl->s || *tmp) {
|
||||||
|
stringlist_free(&parsed_controller);
|
||||||
|
goto illcontr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
stringlist_free(&parsed_controller);
|
||||||
stringlist_free(&parsed_controller);
|
} else {
|
||||||
} else {
|
memset(&contrparams[i].cinfo, 0, sizeof(capi_contrinfo));
|
||||||
memset(&cinfo, 0, sizeof(cinfo));
|
contrparams[i].controller = 1;
|
||||||
controller = 1;
|
}
|
||||||
|
continue;
|
||||||
|
illcontr:
|
||||||
|
option_error("capiplugin: illegal controller specification \"%s\"",
|
||||||
|
opt_controller[i]);
|
||||||
|
die(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -546,9 +644,11 @@ static void plugin_check_options(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opt_inmsn) {
|
for (i = 0; i < DIM(contrparams); i++) {
|
||||||
stringlist_free(&inmsns);
|
if (contrparams[i].opt_inmsn) {
|
||||||
inmsns = stringlist_split(opt_inmsn, " \t,");
|
stringlist_free(&contrparams[i].inmsns);
|
||||||
|
contrparams[i].inmsns = stringlist_split(contrparams[i].opt_inmsn, " \t,");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -585,9 +685,9 @@ static void plugin_check_options(void)
|
||||||
option_error("capiplugin: option cbnumber not alloed with protocol adslpppoe");
|
option_error("capiplugin: option cbnumber not alloed with protocol adslpppoe");
|
||||||
die(1);
|
die(1);
|
||||||
}
|
}
|
||||||
if (opt_inmsn) {
|
if (contrparams[0].opt_inmsn) {
|
||||||
option_error("capiplugin: option inmsn ignored");
|
option_error("capiplugin: option inmsn ignored");
|
||||||
opt_inmsn = 0;
|
contrparams[0].opt_inmsn = 0;
|
||||||
}
|
}
|
||||||
if (opt_cli) {
|
if (opt_cli) {
|
||||||
option_error("capiplugin: option cli ignored");
|
option_error("capiplugin: option cli ignored");
|
||||||
|
@ -619,13 +719,6 @@ static void plugin_check_options(void)
|
||||||
B1Config[6] = (opt_vci >> 8) & 0xff;
|
B1Config[6] = (opt_vci >> 8) & 0xff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
illcontr:
|
|
||||||
option_error("capiplugin: illegal controller specification \"%s\"",
|
|
||||||
opt_controller);
|
|
||||||
die(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
@ -932,6 +1025,7 @@ static void setupincoming_for_demand(void)
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
int serrno;
|
int serrno;
|
||||||
int sock_fd;
|
int sock_fd;
|
||||||
|
int i;
|
||||||
|
|
||||||
nwakeuppackets = 0;
|
nwakeuppackets = 0;
|
||||||
if ((sock_fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
|
if ((sock_fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
|
||||||
|
@ -964,7 +1058,11 @@ static void setupincoming_for_demand(void)
|
||||||
gwipaddr = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr;
|
gwipaddr = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr;
|
||||||
|
|
||||||
close(sock_fd);
|
close(sock_fd);
|
||||||
(void) capiconn_listen(ctx, controller, cipmask, 0);
|
for (i = 0; i < DIM(contrparams); i++) {
|
||||||
|
if (contrparams[i].controller == 0)
|
||||||
|
continue;
|
||||||
|
(void) capiconn_listen(ctx, contrparams[i].controller, cipmask, 0);
|
||||||
|
}
|
||||||
info("capiplugin: waiting for demand wakeup ...");
|
info("capiplugin: waiting for demand wakeup ...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1034,24 +1132,32 @@ static void wakeupdemand(void)
|
||||||
static void init_capiconn(void)
|
static void init_capiconn(void)
|
||||||
{
|
{
|
||||||
static int init = 0;
|
static int init = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (init)
|
if (init)
|
||||||
return;
|
return;
|
||||||
init = 1;
|
init = 1;
|
||||||
|
|
||||||
if (capiconn_addcontr(ctx, controller, &cinfo) != CAPICONN_OK) {
|
for (i = 0; i < DIM(contrparams); i++) {
|
||||||
(void)capiconn_freecontext(ctx);
|
if (contrparams[i].controller == 0)
|
||||||
(void)capi20_release(applid);
|
continue;
|
||||||
fatal("capiplugin: add controller %d failed", controller);
|
if (capiconn_addcontr(ctx, contrparams[i].controller, &contrparams[i].cinfo) != CAPICONN_OK) {
|
||||||
return;
|
(void)capiconn_freecontext(ctx);
|
||||||
|
(void)capi20_release(applid);
|
||||||
|
fatal("capiplugin: add controller %d failed", contrparams[i].controller);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (contrparams[i].cinfo.ddi)
|
||||||
|
dbglog("capiplugin: contr=%d ddi=\"%s\" n=%d",
|
||||||
|
contrparams[i].controller, contrparams[i].cinfo.ddi, contrparams[i].cinfo.ndigits);
|
||||||
|
else
|
||||||
|
dbglog("capiplugin: contr=%d", contrparams[i].controller);
|
||||||
|
}
|
||||||
|
for (i = 0; i < DIM(contrparams); i++) {
|
||||||
|
if (contrparams[i].controller == 0)
|
||||||
|
continue;
|
||||||
|
(void) capiconn_listen(ctx, contrparams[i].controller, 0, 0);
|
||||||
}
|
}
|
||||||
if (cinfo.ddi)
|
|
||||||
dbglog("capiplugin: contr=%d ddi=\"%s\" n=%d",
|
|
||||||
controller, cinfo.ddi, cinfo.ndigits);
|
|
||||||
else
|
|
||||||
dbglog("capiplugin: contr=%d", controller);
|
|
||||||
|
|
||||||
(void) capiconn_listen(ctx, controller, 0, 0);
|
|
||||||
handlemessages();
|
handlemessages();
|
||||||
add_fd(capi20_fileno(applid));
|
add_fd(capi20_fileno(applid));
|
||||||
setup_timeout();
|
setup_timeout();
|
||||||
|
@ -1096,8 +1202,13 @@ static void disconnectall(void)
|
||||||
{
|
{
|
||||||
time_t t;
|
time_t t;
|
||||||
CONN *p;
|
CONN *p;
|
||||||
|
int i;
|
||||||
|
|
||||||
(void) capiconn_listen(ctx, controller, 0, 0);
|
for (i = 0; i < DIM(contrparams); i++) {
|
||||||
|
if (contrparams[i].controller == 0)
|
||||||
|
continue;
|
||||||
|
(void) capiconn_listen(ctx, contrparams[i].controller, 0, 0);
|
||||||
|
}
|
||||||
for (p = connections; p; p = p->next) {
|
for (p = connections; p; p = p->next) {
|
||||||
if (p->inprogress || p->isconnected) {
|
if (p->inprogress || p->isconnected) {
|
||||||
p->isconnected = p->inprogress = 0;
|
p->isconnected = p->inprogress = 0;
|
||||||
|
@ -1162,6 +1273,16 @@ static int was_no_reject(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int try_next_controller(void)
|
||||||
|
{
|
||||||
|
switch (dreason) {
|
||||||
|
case 0x3301: /* Protocol error layer 1 (broken line or B-channel removed by signalling protocol */
|
||||||
|
case 0x34a2: /* No circuit / channel available */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* -------- disconnect handler ---------------------------------------- */
|
/* -------- disconnect handler ---------------------------------------- */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
@ -1177,12 +1298,12 @@ static void disconnected(capi_connection *cp,
|
||||||
return;
|
return;
|
||||||
conn_forget(cp);
|
conn_forget(cp);
|
||||||
switch (p->type) {
|
switch (p->type) {
|
||||||
case CONNTYPE_OUTGOING:
|
|
||||||
case CONNTYPE_INCOMING:
|
case CONNTYPE_INCOMING:
|
||||||
break;
|
break;
|
||||||
case CONNTYPE_IGNORE:
|
case CONNTYPE_IGNORE:
|
||||||
case CONNTYPE_REJECT:
|
case CONNTYPE_REJECT:
|
||||||
return;
|
return;
|
||||||
|
case CONNTYPE_OUTGOING:
|
||||||
case CONNTYPE_FOR_CALLBACK:
|
case CONNTYPE_FOR_CALLBACK:
|
||||||
dreason = reason;
|
dreason = reason;
|
||||||
break;
|
break;
|
||||||
|
@ -1205,10 +1326,28 @@ static void incoming(capi_connection *cp,
|
||||||
char *callednumber,
|
char *callednumber,
|
||||||
char *callingnumber)
|
char *callingnumber)
|
||||||
{
|
{
|
||||||
|
struct contrparams *ctlp = 0;
|
||||||
STRINGLIST *p;
|
STRINGLIST *p;
|
||||||
char *s;
|
char *s;
|
||||||
|
int i;
|
||||||
|
|
||||||
info("capiplugin: incoming call: %s (0x%x)", conninfo(cp), cipvalue);
|
for (i = 0; i < DIM(contrparams); i++) {
|
||||||
|
if (contrparams[i].controller == 0)
|
||||||
|
continue;
|
||||||
|
if (contrparams[i].controller != (int)contr)
|
||||||
|
continue;
|
||||||
|
ctlp = &contrparams[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
info("capiplugin: incoming call(%u): %s (0x%x)", contr, conninfo(cp), cipvalue);
|
||||||
|
if (!ctlp) {
|
||||||
|
info("capiplugin: ignoring call, controller %u not found ??",
|
||||||
|
contr);
|
||||||
|
conn_remember(cp, CONNTYPE_IGNORE);
|
||||||
|
(void) capiconn_ignore(cp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (conn_incoming_exists()) {
|
if (conn_incoming_exists()) {
|
||||||
info("capiplugin: ignoring call, incoming connection exists");
|
info("capiplugin: ignoring call, incoming connection exists");
|
||||||
|
@ -1217,24 +1356,24 @@ static void incoming(capi_connection *cp,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_inmsn) {
|
if (ctlp->opt_inmsn) {
|
||||||
for (p = inmsns; p; p = p->next) {
|
for (p = ctlp->inmsns; p; p = p->next) {
|
||||||
if ( (s = strstr(callednumber, p->s)) != 0
|
if ( (s = strstr(callednumber, p->s)) != 0
|
||||||
&& strcmp(s, p->s) == 0)
|
&& strcmp(s, p->s) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!p) {
|
if (!p) {
|
||||||
info("capiplugin: ignoring call, msn %s not in \"%s\"",
|
info("capiplugin: ignoring call, msn %s not in \"%s\"",
|
||||||
callednumber, opt_inmsn);
|
callednumber, ctlp->opt_inmsn);
|
||||||
conn_remember(cp, CONNTYPE_IGNORE);
|
conn_remember(cp, CONNTYPE_IGNORE);
|
||||||
(void) capiconn_ignore(cp);
|
(void) capiconn_ignore(cp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (opt_msn) {
|
} else if (ctlp->opt_msn) {
|
||||||
if ( (s = strstr(callednumber, opt_msn)) == 0
|
if ( (s = strstr(callednumber, ctlp->opt_msn)) == 0
|
||||||
|| strcmp(s, opt_msn) != 0) {
|
|| strcmp(s, ctlp->opt_msn) != 0) {
|
||||||
info("capiplugin: ignoring call, msn mismatch (%s != %s)",
|
info("capiplugin: ignoring call, msn mismatch (%s != %s)",
|
||||||
opt_msn, callednumber);
|
ctlp->opt_msn, callednumber);
|
||||||
conn_remember(cp, CONNTYPE_IGNORE);
|
conn_remember(cp, CONNTYPE_IGNORE);
|
||||||
(void) capiconn_ignore(cp);
|
(void) capiconn_ignore(cp);
|
||||||
return;
|
return;
|
||||||
|
@ -1339,7 +1478,11 @@ static void incoming(capi_connection *cp,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
callback:
|
callback:
|
||||||
(void) capiconn_listen(ctx, controller, 0, 0);
|
for (i = 0; i < DIM(contrparams); i++) {
|
||||||
|
if (contrparams[i].controller == 0)
|
||||||
|
continue;
|
||||||
|
(void) capiconn_listen(ctx, contrparams[i].controller, 0, 0);
|
||||||
|
}
|
||||||
dbglog("capiplugin: rejecting call: %s (0x%x)", conninfo(cp), cipvalue);
|
dbglog("capiplugin: rejecting call: %s (0x%x)", conninfo(cp), cipvalue);
|
||||||
conn_remember(cp, CONNTYPE_REJECT);
|
conn_remember(cp, CONNTYPE_REJECT);
|
||||||
capiconn_reject(cp);
|
capiconn_reject(cp);
|
||||||
|
@ -1383,8 +1526,11 @@ accept:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
conn_remember(cp, CONNTYPE_INCOMING);
|
conn_remember(cp, CONNTYPE_INCOMING);
|
||||||
(void) capiconn_listen(ctx, controller, 0, 0);
|
for (i = 0; i < DIM(contrparams); i++) {
|
||||||
return;
|
if (contrparams[i].controller == 0)
|
||||||
|
continue;
|
||||||
|
(void) capiconn_listen(ctx, contrparams[i].controller, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
@ -1420,8 +1566,12 @@ static void connected(capi_connection *cp, _cstruct NCPI)
|
||||||
fatal("capiplugin: failed to get tty devname - %s (%d)",
|
fatal("capiplugin: failed to get tty devname - %s (%d)",
|
||||||
strerror(serrno), serrno);
|
strerror(serrno), serrno);
|
||||||
}
|
}
|
||||||
if (access(tty, 0) != 0 && errno == ENOENT) {
|
retry = 0;
|
||||||
|
while (access(tty, 0) != 0 && errno == ENOENT) {
|
||||||
|
if (++retry > 4) {
|
||||||
fatal("capiplugin: tty %s doesn't exist - CAPI Filesystem Support not enabled in kernel or not mounted ?", tty);
|
fatal("capiplugin: tty %s doesn't exist - CAPI Filesystem Support not enabled in kernel or not mounted ?", tty);
|
||||||
|
}
|
||||||
|
sleep(1);
|
||||||
}
|
}
|
||||||
info("capiplugin: using %s: %s", tty, conninfo(cp));
|
info("capiplugin: using %s: %s", tty, conninfo(cp));
|
||||||
strcpy(devnam, tty);
|
strcpy(devnam, tty);
|
||||||
|
@ -1459,13 +1609,14 @@ void chargeinfo(capi_connection *cp, unsigned long charge, int inunits)
|
||||||
/* -------- tranfer capi message to CAPI ------------------------------ */
|
/* -------- tranfer capi message to CAPI ------------------------------ */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
void put_message(unsigned appid, unsigned char *msg)
|
int put_message(unsigned appid, unsigned char *msg)
|
||||||
{
|
{
|
||||||
unsigned err;
|
unsigned err;
|
||||||
err = capi20_put_message (appid, msg);
|
err = capi20_put_message (appid, msg);
|
||||||
if (err && !exiting)
|
if (err && !exiting)
|
||||||
fatal("capiplugin: putmessage(appid=%d) - %s 0x%x",
|
fatal("capiplugin: putmessage(appid=%d) - %s 0x%x",
|
||||||
appid, capi_info2str(err), err);
|
appid, capi_info2str(err), err);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
@ -1501,71 +1652,71 @@ static capi_connection *setupconnection(char *num, int awaitingreject)
|
||||||
char number[256];
|
char number[256];
|
||||||
|
|
||||||
snprintf(number, sizeof(number), "%s%s",
|
snprintf(number, sizeof(number), "%s%s",
|
||||||
opt_numberprefix ? opt_numberprefix : "", num);
|
actcontroller->opt_numberprefix ? actcontroller->opt_numberprefix : "", num);
|
||||||
|
|
||||||
if (proto == PROTO_HDLC) {
|
if (proto == PROTO_HDLC) {
|
||||||
cp = capiconn_connect(ctx,
|
cp = capiconn_connect(ctx,
|
||||||
controller, /* contr */
|
actcontroller->controller, /* contr */
|
||||||
2, /* cipvalue */
|
2, /* cipvalue */
|
||||||
opt_channels ? 0 : number,
|
opt_channels ? 0 : number,
|
||||||
opt_channels ? 0 : opt_msn,
|
opt_channels ? 0 : actcontroller->opt_msn,
|
||||||
0, 1, 0,
|
0, 1, 0,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
opt_channels ? AdditionalInfo : 0,
|
opt_channels ? AdditionalInfo : 0,
|
||||||
0);
|
0);
|
||||||
} else if (proto == PROTO_X75) {
|
} else if (proto == PROTO_X75) {
|
||||||
cp = capiconn_connect(ctx,
|
cp = capiconn_connect(ctx,
|
||||||
controller, /* contr */
|
actcontroller->controller, /* contr */
|
||||||
2, /* cipvalue */
|
2, /* cipvalue */
|
||||||
opt_channels ? 0 : number,
|
opt_channels ? 0 : number,
|
||||||
opt_channels ? 0 : opt_msn,
|
opt_channels ? 0 : actcontroller->opt_msn,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
opt_channels ? AdditionalInfo : 0,
|
opt_channels ? AdditionalInfo : 0,
|
||||||
0);
|
0);
|
||||||
} else if (proto == PROTO_V42BIS) {
|
} else if (proto == PROTO_V42BIS) {
|
||||||
cp = capiconn_connect(ctx,
|
cp = capiconn_connect(ctx,
|
||||||
controller, /* contr */
|
actcontroller->controller, /* contr */
|
||||||
2, /* cipvalue */
|
2, /* cipvalue */
|
||||||
opt_channels ? 0 : number,
|
opt_channels ? 0 : number,
|
||||||
opt_channels ? 0 : opt_msn,
|
opt_channels ? 0 : actcontroller->opt_msn,
|
||||||
0, 8, 0,
|
0, 8, 0,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
opt_channels ? AdditionalInfo : 0,
|
opt_channels ? AdditionalInfo : 0,
|
||||||
0);
|
0);
|
||||||
} else if (proto == PROTO_MODEM) {
|
} else if (proto == PROTO_MODEM) {
|
||||||
cp = capiconn_connect(ctx,
|
cp = capiconn_connect(ctx,
|
||||||
controller, /* contr */
|
actcontroller->controller, /* contr */
|
||||||
4, /* cipvalue */
|
4, /* cipvalue */
|
||||||
opt_channels ? 0 : number,
|
opt_channels ? 0 : number,
|
||||||
opt_channels ? 0 : opt_msn,
|
opt_channels ? 0 : actcontroller->opt_msn,
|
||||||
8, 1, 0,
|
8, 1, 0,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
opt_channels ? AdditionalInfo : 0,
|
opt_channels ? AdditionalInfo : 0,
|
||||||
0);
|
0);
|
||||||
} else if (proto == PROTO_V110_ASYNC) {
|
} else if (proto == PROTO_V110_ASYNC) {
|
||||||
cp = capiconn_connect(ctx,
|
cp = capiconn_connect(ctx,
|
||||||
controller, /* contr */
|
actcontroller->controller, /* contr */
|
||||||
2, /* cipvalue */
|
2, /* cipvalue */
|
||||||
opt_channels ? 0 : number,
|
opt_channels ? 0 : number,
|
||||||
opt_channels ? 0 : opt_msn,
|
opt_channels ? 0 : actcontroller->opt_msn,
|
||||||
2, 1, 0,
|
2, 1, 0,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
opt_channels ? AdditionalInfo : 0,
|
opt_channels ? AdditionalInfo : 0,
|
||||||
0);
|
0);
|
||||||
} else if (proto == PROTO_V120_ASYNC) {
|
} else if (proto == PROTO_V120_ASYNC) {
|
||||||
cp = capiconn_connect(ctx,
|
cp = capiconn_connect(ctx,
|
||||||
controller, /* contr */
|
actcontroller->controller, /* contr */
|
||||||
2, /* cipvalue */
|
2, /* cipvalue */
|
||||||
opt_channels ? 0 : number,
|
opt_channels ? 0 : number,
|
||||||
opt_channels ? 0 : opt_msn,
|
opt_channels ? 0 : actcontroller->opt_msn,
|
||||||
0, 9, 0,
|
0, 9, 0,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
opt_channels ? AdditionalInfo : 0,
|
opt_channels ? AdditionalInfo : 0,
|
||||||
0);
|
0);
|
||||||
} else if (proto == PROTO_ADSLPPPOE) {
|
} else if (proto == PROTO_ADSLPPPOE) {
|
||||||
cp = capiconn_connect(ctx,
|
cp = capiconn_connect(ctx,
|
||||||
controller, /* contr */
|
actcontroller->controller, /* contr */
|
||||||
2, /* cipvalue */
|
2, /* cipvalue */
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -1577,7 +1728,7 @@ static capi_connection *setupconnection(char *num, int awaitingreject)
|
||||||
0);
|
0);
|
||||||
} else if (proto == PROTO_ADSLPPPOA || proto == PROTO_ADSLPPPOALLC) {
|
} else if (proto == PROTO_ADSLPPPOA || proto == PROTO_ADSLPPPOALLC) {
|
||||||
cp = capiconn_connect(ctx,
|
cp = capiconn_connect(ctx,
|
||||||
controller, /* contr */
|
actcontroller->controller, /* contr */
|
||||||
2, /* cipvalue */
|
2, /* cipvalue */
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -1589,10 +1740,10 @@ static capi_connection *setupconnection(char *num, int awaitingreject)
|
||||||
0);
|
0);
|
||||||
} else if (proto == PROTO_ANALOGMODEM) {
|
} else if (proto == PROTO_ANALOGMODEM) {
|
||||||
cp = capiconn_connect(ctx,
|
cp = capiconn_connect(ctx,
|
||||||
controller, /* contr */
|
actcontroller->controller, /* contr */
|
||||||
4, /* cipvalue */
|
4, /* cipvalue */
|
||||||
opt_channels ? 0 : number,
|
opt_channels ? 0 : number,
|
||||||
opt_channels ? 0 : opt_msn,
|
opt_channels ? 0 : actcontroller->opt_msn,
|
||||||
7, 7, 7,
|
7, 7, 7,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
opt_channels ? AdditionalInfo : 0,
|
opt_channels ? AdditionalInfo : 0,
|
||||||
|
@ -1689,6 +1840,7 @@ static void makeconnection(STRINGLIST *numbers)
|
||||||
do {
|
do {
|
||||||
for (p = numbers; p; p = p->next) {
|
for (p = numbers; p; p = p->next) {
|
||||||
if (retry || p != numbers) {
|
if (retry || p != numbers) {
|
||||||
|
again:
|
||||||
t = time(0)+opt_redialdelay;
|
t = time(0)+opt_redialdelay;
|
||||||
do {
|
do {
|
||||||
handlemessages();
|
handlemessages();
|
||||||
|
@ -1706,6 +1858,10 @@ static void makeconnection(STRINGLIST *numbers)
|
||||||
if (conn_find(cp)) {
|
if (conn_find(cp)) {
|
||||||
info("capiplugin: pppd status %d, disconnecting ...", status);
|
info("capiplugin: pppd status %d, disconnecting ...", status);
|
||||||
dodisconnect(cp);
|
dodisconnect(cp);
|
||||||
|
} else if (try_next_controller()) {
|
||||||
|
if (nextcontroller())
|
||||||
|
goto again;
|
||||||
|
die(status);
|
||||||
} else {
|
} else {
|
||||||
die(status);
|
die(status);
|
||||||
}
|
}
|
||||||
|
@ -1745,6 +1901,7 @@ static void makeconnection_with_callback(void)
|
||||||
STRINGLIST *p;
|
STRINGLIST *p;
|
||||||
time_t t;
|
time_t t;
|
||||||
int retry = 0;
|
int retry = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
for (p = numbers; p; p = p->next) {
|
for (p = numbers; p; p = p->next) {
|
||||||
|
@ -1772,10 +1929,17 @@ again:
|
||||||
if (conn_isconnected(cp)) {
|
if (conn_isconnected(cp)) {
|
||||||
dodisconnect(cp);
|
dodisconnect(cp);
|
||||||
fatal("capiplugin: callback failed - other party answers the call (no reject)");
|
fatal("capiplugin: callback failed - other party answers the call (no reject)");
|
||||||
|
} else if (try_next_controller()) {
|
||||||
|
if (nextcontroller())
|
||||||
|
goto again;
|
||||||
} else if (was_no_reject()) {
|
} else if (was_no_reject()) {
|
||||||
goto again;
|
goto again;
|
||||||
} else {
|
} else {
|
||||||
(void) capiconn_listen(ctx, controller, cipmask, 0);
|
for (i = 0; i < DIM(contrparams); i++) {
|
||||||
|
if (contrparams[i].controller == 0)
|
||||||
|
continue;
|
||||||
|
(void) capiconn_listen(ctx, contrparams[i].controller, cipmask, 0);
|
||||||
|
}
|
||||||
info("capiplugin: waiting for callback...");
|
info("capiplugin: waiting for callback...");
|
||||||
|
|
||||||
/* Wait for server calling back */
|
/* Wait for server calling back */
|
||||||
|
@ -1783,7 +1947,11 @@ again:
|
||||||
do {
|
do {
|
||||||
handlemessages();
|
handlemessages();
|
||||||
if (status != EXIT_OK) {
|
if (status != EXIT_OK) {
|
||||||
(void) capiconn_listen(ctx, controller, 0, 0);
|
for (i = 0; i < DIM(contrparams); i++) {
|
||||||
|
if (contrparams[i].controller == 0)
|
||||||
|
continue;
|
||||||
|
(void) capiconn_listen(ctx, contrparams[i].controller, 0, 0);
|
||||||
|
}
|
||||||
die(status);
|
die(status);
|
||||||
}
|
}
|
||||||
} while (!conn_incoming_connected() && time(0) < t);
|
} while (!conn_incoming_connected() && time(0) < t);
|
||||||
|
@ -1828,20 +1996,34 @@ static void makecallback(void)
|
||||||
static void waitforcall(void)
|
static void waitforcall(void)
|
||||||
{
|
{
|
||||||
int try = 0;
|
int try = 0;
|
||||||
(void) capiconn_listen(ctx, controller, cipmask, 0);
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < DIM(contrparams); i++) {
|
||||||
|
if (contrparams[i].controller == 0)
|
||||||
|
continue;
|
||||||
|
(void) capiconn_listen(ctx, contrparams[i].controller, cipmask, 0);
|
||||||
|
}
|
||||||
info("capiplugin: waiting for incoming call ...");
|
info("capiplugin: waiting for incoming call ...");
|
||||||
|
|
||||||
do {
|
do {
|
||||||
handlemessages();
|
handlemessages();
|
||||||
if (status != EXIT_OK) {
|
if (status != EXIT_OK) {
|
||||||
(void) capiconn_listen(ctx, controller, 0, 0);
|
for (i = 0; i < DIM(contrparams); i++) {
|
||||||
|
if (contrparams[i].controller == 0)
|
||||||
|
continue;
|
||||||
|
(void)capiconn_listen(ctx, contrparams[i].controller, 0, 0);
|
||||||
|
}
|
||||||
die(status);
|
die(status);
|
||||||
}
|
}
|
||||||
if (conn_incoming_inprogress()) try=1;
|
if (conn_incoming_inprogress()) try=1;
|
||||||
if (try && !conn_incoming_inprogress()) {
|
if (try && !conn_incoming_inprogress()) {
|
||||||
try = 0;
|
try = 0;
|
||||||
if (!conn_incoming_connected()) {
|
if (!conn_incoming_connected()) {
|
||||||
(void) capiconn_listen(ctx, controller, cipmask, 0);
|
for (i = 0; i < DIM(contrparams); i++) {
|
||||||
|
if (contrparams[i].controller == 0)
|
||||||
|
continue;
|
||||||
|
(void)capiconn_listen(ctx, contrparams[i].controller, cipmask, 0);
|
||||||
|
}
|
||||||
info("capiplugin: waiting for incoming call ...");
|
info("capiplugin: waiting for incoming call ...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1929,7 +2111,7 @@ static int capi_new_phase_hook(int phase)
|
||||||
status = EXIT_OK;
|
status = EXIT_OK;
|
||||||
plugin_check_options();
|
plugin_check_options();
|
||||||
init_capiconn();
|
init_capiconn();
|
||||||
if (opt_inmsn || opt_cli) {
|
if (contrparams[0].opt_inmsn || opt_cli) {
|
||||||
if (wakeupnow)
|
if (wakeupnow)
|
||||||
wakeupdemand();
|
wakeupdemand();
|
||||||
setupincoming_for_demand();
|
setupincoming_for_demand();
|
||||||
|
|
Loading…
Reference in New Issue