X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=cause.c;fp=cause.c;h=42fdb29bb4610adf3c9b29f6b30bd5ca1539047c;hp=c6ca903cd90c0efabc5a1f2bd576db1c36f2aebc;hb=ef3fc1931a2fa82f482d21fb1296735206463d3a;hpb=2746009aca7e00678ad6f5f64da8b208ab635d60 diff --git a/cause.c b/cause.c index c6ca903..42fdb29 100644 --- a/cause.c +++ b/cause.c @@ -373,3 +373,41 @@ char *get_isdn_cause(int cause, int location, int type) return(result); } + +/* + * collect cause for multipoint + * used by Process, Endpoint and Join instance when multiplexing + */ +void collect_cause(int *multicause, int *multilocation, int newcause, int newlocation) +{ + if (newcause == CAUSE_REJECTED) /* call rejected */ + { + *multicause = newcause; + *multilocation = newlocation; + } else + if (newcause==CAUSE_NORMAL && *multicause!=CAUSE_REJECTED) /* reject via hangup */ + { + *multicause = newcause; + *multilocation = newlocation; + } else + if (newcause==CAUSE_BUSY && *multicause!=CAUSE_REJECTED && *multicause!=CAUSE_NORMAL) /* busy */ + { + *multicause = newcause; + *multilocation = newlocation; + } else + if (newcause==CAUSE_OUTOFORDER && *multicause!=CAUSE_BUSY && *multicause!=CAUSE_REJECTED && *multicause!=CAUSE_NORMAL) /* no L1 */ + { + *multicause = newcause; + *multilocation = newlocation; + } else + if (newcause!=CAUSE_NOUSER && *multicause!=CAUSE_OUTOFORDER && *multicause!=CAUSE_BUSY && *multicause!=CAUSE_REJECTED && *multicause!=CAUSE_NORMAL) /* anything but not 18 */ + { + *multicause = newcause; + *multilocation = newlocation; + } else + if (newcause==CAUSE_NOUSER && *multicause==CAUSE_NOUSER) /* cause 18, but no cause yet, use the location */ + { + *multilocation = newlocation; + } +} +