Index: libpri.h =================================================================== --- libpri.h (revision 1150) +++ libpri.h (working copy) @@ -841,6 +841,7 @@ int pri_sr_set_channel(struct pri_sr *sr, int channel, int exclusive, int nonisdn); int pri_sr_set_bearer(struct pri_sr *sr, int transmode, int userl1); int pri_sr_set_called(struct pri_sr *sr, char *called, int calledplan, int complete); +int pri_sr_set_authcode(struct pri_sr *sr, char *authcode); /*! * \brief Set the caller party ID information in the call SETUP record. Index: pri.c =================================================================== --- pri.c (revision 1150) +++ pri.c (working copy) @@ -1206,6 +1206,12 @@ return 0; } +int pri_sr_set_authcode(struct pri_sr *sr, char *authcode) +{ + sr->authcode = authcode; + return 0; +} + int pri_sr_set_caller(struct pri_sr *sr, char *caller, char *callername, int callerplan, int callerpres) { q931_party_id_init(&sr->caller); Index: q931.c =================================================================== --- q931.c (revision 1150) +++ q931.c (working copy) @@ -923,6 +923,42 @@ } } +static FUNC_RECV(receive_info_request) +{ + int type = ie->data[0] & 0x7f; + int i; + if (type == 1 && call->authcode[0]) { + /* Send authorization code */ + for (i = 0; i < strlen(call->authcode); i += 32) { + q931_keypad_facility(pri, call, &call->authcode[i]); + } + } else if (type == 2 && call->called.number.str[0]) { + /* Send called number */ + for (i = 0; i < strlen(call->called.number.str); i += 32) { + q931_keypad_facility(pri, call, &call->called.number.str[i]); + } + } else if (type == 3) { + pri_message(pri, "Don't know how to send terminal identification\n"); + } else { + pri_message(pri, "Unrecognized information request: %d\n", type); + } + return 0; +} + +static FUNC_DUMP(dump_info_request) +{ + /* Only 0-3 are defined */ + int type = ie->data[0] & 0x7f; + + pri_message(pri, "%c Information request %s for %s\n", + prefix, (ie->data[0] & 0x80) ? "prompt" : "complete", + type == 0 ? "unknown" : + type == 1 ? "authorization code" : + type == 2 ? "address digits" : + type == 3 ? "terminal identification" : + "reserved (illegal request)"); +} + static char *ri2str(int ri) { static struct msgtype ris[] = { @@ -2834,7 +2870,7 @@ { 1, Q931_IE_REDIRECTION_NUMBER, "Redirection Number", dump_redirection_number, receive_redirection_number, transmit_redirection_number }, { 1, Q931_IE_REDIRECTION_SUBADDR, "Redirection Subaddress" }, { 1, Q931_IE_FEATURE_ACTIVATE, "Feature Activation" }, - { 1, Q931_IE_INFO_REQUEST, "Feature Request" }, + { 1, Q931_IE_INFO_REQUEST, "Information Request", dump_info_request, receive_info_request }, { 1, Q931_IE_FEATURE_IND, "Feature Indication" }, { 1, Q931_IE_SEGMENTED_MSG, "Segmented Message" }, { 1, Q931_IE_CALL_IDENTITY, "Call Identity", dump_call_identity }, @@ -3952,6 +3988,9 @@ q931_party_id_fixup(ctrl, &c->redirecting.to); q931_party_id_fixup(ctrl, &c->redirecting.orig_called); } + if (req->authcode) { + libpri_copy_string(c->authcode, req->authcode, sizeof(c->authcode)); + } if (req->called.number.valid) { c->called = req->called; Index: pri_internal.h =================================================================== --- pri_internal.h (revision 1150) +++ pri_internal.h (working copy) @@ -288,6 +288,7 @@ struct q931_party_redirecting redirecting; struct q931_party_id caller; struct q931_party_address called; + char *authcode; int userl1; int numcomplete; int cis_call; @@ -440,6 +441,7 @@ int nonisdn; int complete; /* no more digits coming */ int newcall; /* if the received message has a new call reference value */ + char authcode[64]; /*!< Accounting code, if requested */ int retranstimer; /* Timer for retransmitting DISC */ int t308_timedout; /* Whether t308 timed out once */