Index: libpri.h =================================================================== --- libpri.h (revision 801) +++ libpri.h (working copy) @@ -639,6 +639,7 @@ int pri_sr_set_called(struct pri_sr *sr, char *called, int calledplan, int complete); int pri_sr_set_caller(struct pri_sr *sr, char *caller, char *callername, int callerplan, int callerpres); int pri_sr_set_redirecting(struct pri_sr *sr, char *num, int plan, int pres, int reason); +int pri_sr_set_authcode(struct pri_sr *sr, char *authcode); #define PRI_USER_USER_TX /* Set the user user field. Warning! don't send binary data accross this field */ void pri_sr_set_useruser(struct pri_sr *sr, const char *userchars); Index: pri.c =================================================================== --- pri.c (revision 801) +++ pri.c (working copy) @@ -936,6 +936,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) { sr->caller = caller; Index: q931.c =================================================================== --- q931.c (revision 801) +++ q931.c (working copy) @@ -479,6 +479,42 @@ } else pri_message(pri, " ]\n"); } +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->callednum[0]) { + /* Send called number */ + for (i = 0; i < strlen(call->callednum); i += 32) { + q931_keypad_facility(pri, call, &call->callednum[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[] = { @@ -491,7 +527,7 @@ static FUNC_DUMP(dump_restart_indicator) { - pri_message(pri, "%c Restart Indentifier (len=%2d) [ Ext: %d Spare: %d Resetting %s (%d) ]\n", + pri_message(pri, "%c Restart Identifier (len=%2d) [ Ext: %d Spare: %d Resetting %s (%d) ]\n", prefix, len, (ie->data[0] & 0x80) >> 7, (ie->data[0] & 0x78) >> 3, ri2str(ie->data[0] & 0x7), ie->data[0] & 0x7); } @@ -2168,7 +2204,7 @@ { 1, Q931_IE_REDIRECTION_NUMBER, "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 }, @@ -3134,6 +3170,7 @@ c->chanflags = FLAG_PREFERRED; if (req->caller) { libpri_copy_string(c->callernum, req->caller, sizeof(c->callernum)); + libpri_copy_string(c->authcode, req->authcode, sizeof(c->authcode)); c->callerplan = req->callerplan; if (req->callername) libpri_copy_string(c->callername, req->callername, sizeof(c->callername)); Index: pri_internal.h =================================================================== --- pri_internal.h (revision 801) +++ pri_internal.h (working copy) @@ -147,6 +147,7 @@ int callerpres; char *called; int calledplan; + char *authcode; int userl1; int numcomplete; char *redirectingnum; @@ -240,6 +241,7 @@ char callednum[256]; /* Called Number */ 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 */