X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=cause.c;h=c1514dadf6c022b31773ef8a3684c42f9852aa08;hp=c6ca903cd90c0efabc5a1f2bd576db1c36f2aebc;hb=034d3a91404addedc1c7a3494862c79532b0b878;hpb=2ed0fee489c37a6e2d4473f6185ebbe3e746ac11 diff --git a/cause.c b/cause.c index c6ca903..c1514da 100644 --- a/cause.c +++ b/cause.c @@ -9,10 +9,13 @@ ** ** \*****************************************************************************/ -#include "stdio.h" -#include "sys/types.h" -#include "string.h" -#include "main.h" +#include +#include +#include +#include +#include "macro.h" +#include "cause.h" +#include "extension.h" struct isdn_cause isdn_cause[128] = { /********************************* - **/ /*38*/ @@ -92,8 +95,8 @@ struct isdn_cause isdn_cause[128] = { "" }, { /*37*/ "", "" }, - { /*38*/ "", - "" }, + { /*38*/ "Network out of order", + "Netz ausser Betrieb" }, { /*39*/ "", "" }, { /*40*/ "", @@ -337,8 +340,7 @@ char *get_isdn_cause(int cause, int location, int type) if (cause<0 || cause>127) cause = 0; - switch(type) - { + switch(type) { case DISPLAY_CAUSE_NUMBER: SPRINT(result, "Cause %d", cause); break; @@ -373,3 +375,39 @@ 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, use the location */ + *multilocation = newlocation; + } else + if (*multicause==0) { /* no cause yet, use newcause (should be 18) */ + *multicause = newcause; + *multilocation = newlocation; + } +} +