--- q931.c 2004-09-15 05:09:13.000000000 -0600 +++ q931.c 2004-09-24 05:26:48.242073024 -0600 @@ -64,7 +64,7 @@ { Q931_SEGMENT, "SEGMENT" }, { Q931_CONGESTION_CONTROL, "CONGESTION CONTROL" }, { Q931_INFORMATION, "INFORMATION" }, - { Q931_FACILITY, "FACILITY" }, + { Q931_FACILITY, "FACILITY", { Q931_IE_FACILITY } }, { Q931_NOTIFY, "NOTIFY", { Q931_IE_NOTIFY_IND } }, /* Call Management */ @@ -756,6 +756,7 @@ { PRES_PROHIB_USER_NUMBER_PASSED_SCREEN, "Presentation prohibited, user number passed network screening" }, { PRES_PROHIB_USER_NUMBER_FAILED_SCREEN, "Presentation prohibited, user number failed network screening" }, { PRES_PROHIB_NETWORK_NUMBER, "Presentation prohibited of network provided number" }, + { PRES_NUMBER_NOT_AVAILABLE, "Presentation Prohibited, number not available" }, }; return code2str(pres, press, sizeof(press) / sizeof(press[0])); } @@ -1066,6 +1067,82 @@ return 0; } +static FUNC_SEND(transmit_facility) +{ + /* EXPERIMENTAL: function to transmit Calling Party Name Display Facility message*/ + /* This feature is only supported for switchtype NI2 and 5ESS*/ + int display_len = 0; + switch(msgtype) { + case Q931_SETUP: + if ((pri->switchtype != PRI_SWITCH_NI1) && strlen(call->callername)) { + display_len = strlen(call->callername); + if(pri->switchtype != PRI_SWITCH_EUROISDN_E1) { + switch ( PRES_ALLOWED_NETWORK_NUMBER ) { + case PRES_ALLOWED_USER_NUMBER_NOT_SCREENED: + case PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN: + case PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN: + case PRES_ALLOWED_NETWORK_NUMBER: + /* presentation is allowed - build the Facility IE - this is an UGLY hack*/ + ie->data[0] = 0x9f; /* Service Discriminator: Network Extension */ + ie->data[1] = 0x8b; /* Component Type: Interpretation*/ + ie->data[2] = 0x01; /* Component Length: one byte*/ + ie->data[3] = 0x00; /* Component Value: Discard Unrecognized Invoke Components*/ + ie->data[4] = 0xa1; /* Component Type: Invoke */ + ie->data[5] = display_len + 8; /* Component Length: Total size of Invoke component */ + ie->data[6] = 0x02; /* Invoke ID Tag: Universal Integer */ + ie->data[7] = 0x01; /* Invoke ID Length: one byte */ + ie->data[8] = 0x01; /* Invoke ID Value: one */ + ie->data[9] = 0x02; /* Invoke Operation Tag: Universal Integer */ + ie->data[10] = 0x01; /* Invoke Operation Length: one byte */ + ie->data[11] = 0x00; /* Invoke Operation Value: Calling Name */ + ie->data[12] = 0x80; /* Invoke Argument Tag: Context-Specific NamePresentationAllowedSimple */ + ie->data[13] = display_len; /* Invoke Argument Length: length of Caller Name Data*/ + memcpy(ie->data + 14, call->callername, strlen(call->callername)); + return 16 + strlen(call->callername); /* return length of data in IE */ + break; + default: + /* Presentation is restricted */ + ie->data[0] = 0x9f; /* Service Discriminator: Network Extension */ + ie->data[1] = 0x8b; /* Component Type: Interpretation*/ + ie->data[2] = 0x01; /* Component Length: one byte*/ + ie->data[3] = 0x00; /* Component Value: Discard Unrecognized Invoke Components*/ + ie->data[4] = 0xa1; /* Component Type: Invoke */ + ie->data[5] = 0x08; /* Component Length: Total size of Invoke component */ + ie->data[6] = 0x02; /* Invoke ID Tag: Universal Integer */ + ie->data[7] = 0x01; /* Invoke ID Length: one byte */ + ie->data[8] = 0x00; /* Invoke ID Value: zero */ + ie->data[9] = 0x02; /* Invoke Operation Tag: Universal Integer */ + ie->data[10] = 0x01; /* Invoke Operation Length: one byte */ + ie->data[11] = 0x00; /* Invoke Operation Value: Calling Name */ + ie->data[12] = 0x87; /* Invoke Argument Tag: Context-Specific NamePresentationRestrictedNull */ + ie->data[13] = 0x00; /* Invoke Argument Length: length of Caller Name Data*/ + return 0x10; + } + } + } else { + /* Calling Party Name is not available */ + ie->data[0] = 0x9f; /* Service Discriminator: Network Extension */ + ie->data[1] = 0x8b; /* Component Type: Interpretation*/ + ie->data[2] = 0x01; /* Component Length: one byte*/ + ie->data[3] = 0x00; /* Component Value: Discard Unrecognized Invoke Components*/ + ie->data[4] = 0xa1; /* Component Type: A0 = general A1 = Invoke A2 = Return Result A3 = Return Error */ + ie->data[5] = 0x08; /* Component Length: Total size of Invoke component */ + ie->data[6] = 0x02; /* Invoke ID Tag: Universal Integer */ + ie->data[7] = 0x01; /* Invoke ID Length: one byte */ + ie->data[8] = 0x00; /* Invoke ID Value: zero */ + ie->data[9] = 0x02; /* Invoke Operation Tag: Universal Integer */ + ie->data[10] = 0x01; /* Invoke Operation Length: one byte */ + ie->data[11] = 0x00; /* Invoke Operation Value: Calling Name */ + ie->data[12] = 0x84; /* Invoke Argument Tag: Context-Specific NameNotAvailable */ + ie->data[13] = 0x00; /* Invoke Argument Length: length of Caller Name Data*/ + return 0x10; + } + return 0; + default: + return 0; + } +} + static FUNC_SEND(transmit_progress_indicator) { /* Can't send progress indicator on GR-303 -- EVER! */ @@ -1457,7 +1536,7 @@ { Q931_LOW_LAYER_COMPAT, "Low-layer Compatibility" }, { Q931_HIGH_LAYER_COMPAT, "High-layer Compatibility" }, { Q931_PACKET_SIZE, "Packet Size" }, - { Q931_IE_FACILITY, "Facility" , dump_facility, receive_facility }, + { Q931_IE_FACILITY, "Facility" , dump_facility, receive_facility, transmit_facility }, { Q931_IE_REDIRECTION_NUMBER, "Redirection Number" }, { Q931_IE_REDIRECTION_SUBADDR, "Redirection Subaddress" }, { Q931_IE_FEATURE_ACTIVATE, "Feature Activation" }, @@ -2182,7 +2261,7 @@ return 0; } -static int setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, Q931_PROGRESS_INDICATOR, Q931_NETWORK_SPEC_FAC, Q931_DISPLAY, +static int setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, Q931_IE_FACILITY, Q931_PROGRESS_INDICATOR, Q931_NETWORK_SPEC_FAC, Q931_DISPLAY, Q931_CALLING_PARTY_NUMBER, Q931_CALLED_PARTY_NUMBER, Q931_SENDING_COMPLETE, Q931_IE_ORIGINATING_LINE_INFO, -1 }; static int gr303_setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, -1 };