My CND program does not work properly...

Gert Doering (gert@greenie.muc.de)
Mon, 7 Jun 1999 22:40:41 +0200


Hi,

(BTW: please leave mgetty@muc.de on the CC:)

On Mon, Jun 07, 1999 at 09:27:35PM +0200, Thorbjoern List wrote:
> After I put in this line into my mgetty.config
> 
> 	msn-list 1 2 3 4 9

OK, what this does is "map the target MSN to distinctive RING numbers".

> I get
> 
> 	06/07 21:24:04 yS0  wfr: waiting for ``RING''
> 	06/07 21:24:04 yS0   got: [0a]FM:40731313 TO:32961169[0d]
> 	06/07 21:24:04 yS0    CND: FM:40731313 TO:32961169
> 	06/07 21:24:04 yS0    CND: found: 40731313 TO:32961169
> 	06/07 21:24:04 yS0  ZyXEL: 'FM:40731313 TO:32961169'
> 	06/07 21:24:04 yS0   MSN: '32961169'
> 	06/07 21:24:04 yS0    match: '1'
> 	06/07 21:24:04 yS0    match: '2'

It will now match the MSN 32961169 to each of this numbers, matching
"right-to-left".

> 	06/07 21:24:04 yS0    match: '3'
> 	06/07 21:24:04 yS0    match: '4'
> 	06/07 21:24:04 yS0    match: '9'
> 	06/07 21:24:04 yS0   wfr: rc=0, drn=5

MSN number 5 is "9", so this matches, and distinctive ring number is 
now set to "5" (so that people that do not have dist.RING but that *do*
have ISDN can use vgetty's distinctive RING features).

[..]
> 	06/07 21:24:23 yS0    CND: RING
> 	06/07 21:24:23 yS0   wfr: rc=0, drn=5
> 	06/07 21:24:23 yS0   CND: program "/usr/local/bin/check.cnd ttyS0 '40731313' '' 5 '32961169' >/dev/console 2>&1 </dev/null"
> 	06/07 21:24:24 yS0   CND: rc=0x0

Interesting indeed.  You have found a bug, now I "just" have to figure out
what happens... :-)

Ah.  Got it.  Please find the following lines in "ring.c", about line 48:

    if ( msn_list == NULL ) return 0;

    CalledNr = safedup(string);                 /* save away */

and change their order to:

    CalledNr = safedup(string);                 /* save away */

    if ( msn_list == NULL ) return 0;           /* nothing to match against */

... and then it should work even if no msn_list is set.

Thanks for finding this bug before I release 1.1.21, and not afterwards.

> Why does this work? 

I'm not yet sure.

> What does the msn-list parameter do?

Maps MSNs to distinctive RINGs.

> And why do I get 5 now instead of 0 in <dist-ring-nr.> in

See above - the 5th MSN in the list was matched.

> 	check.cnd <tty> <CallerID> <Name> <dist-ring-nr.> <Called Nr.>
> 
> Because it 'match'es five times?

Because the 5th one matched, yes.

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             gert@greenie.muc.de
fax: +49-89-35655025                        gert.doering@physik.tu-muenchen.de