Index: libpri.h =================================================================== RCS file: /usr/cvsroot/libpri/libpri.h,v retrieving revision 1.56 diff -u -r1.56 libpri.h --- libpri.h 29 Jun 2005 21:28:23 -0000 1.56 +++ libpri.h 7 Jul 2005 11:39:18 -0000 @@ -298,6 +298,7 @@ int e; int channel; /* Channel requested */ int callingpres; /* Presentation of Calling CallerID */ + int callingplanani; /* Dialing plan of Calling entity ANI */ int callingplan; /* Dialing plan of Calling entity */ char callingani[256]; /* Calling ANI */ char callingnum[256]; /* Calling number */ @@ -305,17 +306,17 @@ int calledplan; /* Dialing plan of Called number */ int ani2; /* ANI II */ char callednum[256]; /* Called number */ - char redirectingnum[256]; /* Redirecting number */ - char redirectingname[256]; /* Redirecting name */ - int redirectingreason; /* Reason for redirect */ - char useruserinfo[256]; /* User->User info */ + char redirectingnum[256]; /* Redirecting number */ + char redirectingname[256]; /* Redirecting name */ + int redirectingreason; /* Reason for redirect */ + char useruserinfo[256]; /* User->User info */ int flexible; /* Are we flexible with our channel selection? */ int cref; /* Call Reference Number */ int ctype; /* Call type (see PRI_TRANS_CAP_* */ - int layer1; /* User layer 1 */ + int layer1; /* User layer 1 */ int complete; /* Have we seen "Complete" i.e. no more number? */ q931_call *call; /* Opaque call pointer */ - char callingsubaddr[256]; /* Calling parties subaddress */ + char callingsubaddr[256]; /* Calling parties subaddress */ int progress; int progressmask; char origcalledname[256]; Index: pri_internal.h =================================================================== RCS file: /usr/cvsroot/libpri/pri_internal.h,v retrieving revision 1.25 diff -u -r1.25 pri_internal.h --- pri_internal.h 21 Jun 2005 22:47:39 -0000 1.25 +++ pri_internal.h 7 Jul 2005 11:39:18 -0000 @@ -199,16 +199,17 @@ int sugcallstate; /* Status call state */ int callerplan; + int callerplanani; int callerpres; /* Caller presentation */ char callerani[256]; /* Caller */ char callernum[256]; char callername[256]; - char digitbuf[64]; /* Buffer for digits that come in KEYPAD_FACILITY */ + char digitbuf[64]; /* Buffer for digits that come in KEYPAD_FACILITY */ int ani2; /* ANI II */ - int calledplan; + int calledplan; int nonisdn; char callednum[256]; /* Called Number */ int complete; /* no more digits coming */ @@ -226,11 +227,11 @@ /* Filled in cases of multiple diversions */ int origcalledplan; int origcalledpres; - int origredirectingreason; /* Original reason for redirect (in cases of multiple redirects) */ + int origredirectingreason; /* Original reason for redirect (in cases of multiple redirects) */ char origcalledname[256]; /* Original name of person being called */ - char origcallednum[256]; /* Orignal number of person being called */ + char origcallednum[256]; /* Orignal number of person being called */ - int useruserprotocoldisc; + int useruserprotocoldisc; char useruserinfo[256]; char callingsubaddr[256]; /* Calling parties sub address */ Index: q931.c =================================================================== RCS file: /usr/cvsroot/libpri/q931.c,v retrieving revision 1.133 diff -u -r1.133 q931.c --- q931.c 29 Jun 2005 17:27:03 -0000 1.133 +++ q931.c 7 Jul 2005 11:39:19 -0000 @@ -913,18 +913,12 @@ { u_int8_t *data; size_t length; - int extbit; - call->callerplan = ie->data[0] & 0x7f; - extbit = (ie->data[0] >> 7) & 0x01; - - if (extbit) { + if (ie->data[0] & 0x80) { data = ie->data + 1; length = len - 3; - call->callerpres = 0; /* PI presentation allowed - SI user-provided, not screened */ - } - else { + call->callerpres = 0; /* PI presentation allowed SI user-provided, not screened */ + } else { data = ie->data + 2; length = len - 4; call->callerpres = ie->data[1] & 0x7f; @@ -933,15 +927,17 @@ if (call->callerpres == PRES_ALLOWED_NETWORK_NUMBER || call->callerpres == PRES_PROHIB_NETWORK_NUMBER) { q931_get_number((u_int8_t *)call->callerani, sizeof(call->callerani), data, length); + call->callerplanani = ie->data[0] & 0x7f; - /* - * Copy ANI to Caller*ID if Caller*ID is not already set - */ - if (!*call->callernum) + if (!*call->callernum) { /*Copy ANI to CallerID if CallerID is not already set */ libpri_copy_string(call->callernum, call->callerani, sizeof(call->callernum)); - } - else + call->callerplan = call->callerplanani; + } + + } else { q931_get_number((u_int8_t *)call->callernum, sizeof(call->callernum), data, length); + call->callerplan = ie->data[0] & 0x7f; + } return 0; } @@ -3171,20 +3167,23 @@ c->callernum[0] = '\0'; c->callednum[0] = '\0'; c->callername[0] = '\0'; - c->redirectingplan = -1; - c->redirectingpres = -1; - c->redirectingreason = -1; - c->origcalledplan = -1; - c->origcalledpres = -1; - c->origredirectingreason = -1; + c->callerani[0] = '\0'; + c->callerplanani = -1; + c->redirectingplan = -1; + c->redirectingpres = -1; + c->redirectingreason = -1; + c->origcalledplan = -1; + c->origcalledpres = -1; + c->origredirectingreason = -1; c->redirectingnum[0] = '\0'; c->origcallednum[0] = '\0'; c->redirectingname[0] = '\0'; c->origcalledname[0] = '\0'; - c->useruserprotocoldisc = -1; + c->useruserprotocoldisc = -1; c->useruserinfo[0] = '\0'; c->complete = 0; c->nonisdn = 0; + c->aoc_units = -1; /* Fall through */ case Q931_CONNECT: case Q931_ALERTING: @@ -3381,6 +3380,7 @@ pri->ev.ring.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16); pri->ev.ring.callingpres = c->callerpres; pri->ev.ring.callingplan = c->callerplan; + pri->ev.ring.callingplanani = c->callerplanani; pri->ev.ring.ani2 = c->ani2; libpri_copy_string(pri->ev.ring.callingani, c->callerani, sizeof(pri->ev.ring.callingani)); libpri_copy_string(pri->ev.ring.callingnum, c->callernum, sizeof(pri->ev.ring.callingnum));