diff --git a/libpri.h b/libpri.h index cd83a23..795678e 100755 --- a/libpri.h +++ b/libpri.h @@ -411,6 +411,10 @@ extern void pri_set_debug(struct pri *pri, int debug); /* Get debug parameters on PRI -- see above debug definitions */ extern int pri_get_debug(struct pri *pri); +#define PRI_FACILITY_ENABLE +/* Enable transmission support of Facility IEs on the pri */ +extern void pri_facility_enable(struct pri *pri); + /* Run PRI on the given D-channel, taking care of any events that need to be handled. If block is set, it will block until an event occurs which needs to be handled */ diff --git a/pri.c b/pri.c index 709e8c2..c8baa26 100755 --- a/pri.c +++ b/pri.c @@ -400,6 +400,16 @@ int pri_get_debug(struct pri *pri) return pri->debug; } +void pri_facility_enable(struct pri *pri) +{ + if (!pri) + return; + pri->sendfacility = 1; + if (pri->subchannel) + pri_facility_enable(pri->subchannel); + return; +} + int pri_acknowledge(struct pri *pri, q931_call *call, int channel, int info) { if (!pri || !call) diff --git a/pri_facility.c b/pri_facility.c index b99fc04..80da309 100755 --- a/pri_facility.c +++ b/pri_facility.c @@ -1237,8 +1237,13 @@ extern int pri_call_apdu_queue_cleanup(q931_call *call) extern int pri_call_add_standard_apdus(struct pri *pri, q931_call *call) { + if (!pri->sendfacility) + return 0; + if (pri->switchtype == PRI_SWITCH_QSIG) { /* For Q.SIG it does network and cpe operations */ + /* FIXME: Presumably, it should only send on a redirect */ rose_diverting_leg_information2_encode(pri, call); + add_callername_facility_ies(pri, call, 1); } if (pri->localtype == PRI_NETWORK) { diff --git a/pri_internal.h b/pri_internal.h index f8f18c0..c17fe97 100755 --- a/pri_internal.h +++ b/pri_internal.h @@ -108,6 +108,7 @@ struct pri { #endif unsigned char last_invoke; /* Last ROSE invoke ID */ + unsigned char sendfacility; }; struct pri_sr {