Capture and expose the Reverse Charging Indication IE on ISDN PRI.

(issue #13760)
Reported by: mrgabu
Patches:
      20090619_libpri_1.4.patch uploaded by seanbright (license 71)
Tested by: seanbright, pruonckk

Review: https://reviewboard.asterisk.org/r/291/


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@885 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
Sean Bright 2009-06-24 18:19:24 +00:00
parent 64fd25fcac
commit 7092459702
3 changed files with 15 additions and 1 deletions

View File

@ -421,6 +421,7 @@ typedef struct pri_event_ring {
char origcallednum[256]; char origcallednum[256];
int callingplanorigcalled; /* Dialing plan of Originally Called Number */ int callingplanorigcalled; /* Dialing plan of Originally Called Number */
int origredirectingreason; int origredirectingreason;
int reversecharge;
} pri_event_ring; } pri_event_ring;
typedef struct pri_event_hangup { typedef struct pri_event_hangup {
@ -708,6 +709,7 @@ void pri_enslave(struct pri *master, struct pri *slave);
#define PRI_REDIRECTING_REASON #define PRI_REDIRECTING_REASON
#define PRI_AOC_UNITS #define PRI_AOC_UNITS
#define PRI_ANI #define PRI_ANI
#define PRI_REVERSECHARGE_SUPPORT
/* Send notification */ /* Send notification */
int pri_notify(struct pri *pri, q931_call *c, int channel, int info); int pri_notify(struct pri *pri, q931_call *c, int channel, int info);

View File

@ -272,6 +272,7 @@ struct q931_call {
q931_call *bridged_call; /* Pointer to other leg of bridged call (Used by Q.SIG when eliminating tromboned calls) */ q931_call *bridged_call; /* Pointer to other leg of bridged call (Used by Q.SIG when eliminating tromboned calls) */
int changestatus; /* SERVICE message changestatus */ int changestatus; /* SERVICE message changestatus */
int reversecharge; /* Reverse charging indication */
}; };
extern int pri_schedule_event(struct pri *pri, int ms, void (*function)(void *data), void *data); extern int pri_schedule_event(struct pri *pri, int ms, void (*function)(void *data), void *data);

13
q931.c
View File

@ -2143,6 +2143,16 @@ static void dump_transit_count(int full_ie, struct pri *ctrl, q931_ie *ie, int l
pri_message(ctrl, "Count=%d (0x%02x)\n", ie->data[0] & 0x1f, ie->data[0] & 0x1f); pri_message(ctrl, "Count=%d (0x%02x)\n", ie->data[0] & 0x1f, ie->data[0] & 0x1f);
} }
static void dump_reverse_charging_indication(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
{
pri_message(ctrl, "%c Reverse Charging Indication (len=%02d): %d\n", prefix, len, ie->data[0] & 0x7);
}
static int receive_reverse_charging_indication(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
{
call->reversecharge = ie->data[0] & 0x7;
return 0;
}
static struct ie ies[] = { static struct ie ies[] = {
/* Codeset 0 - Common */ /* Codeset 0 - Common */
@ -2160,7 +2170,7 @@ static struct ie ies[] = {
{ 1, Q931_BINARY_PARAMETERS, "Packet-layer Binary Parameters" }, { 1, Q931_BINARY_PARAMETERS, "Packet-layer Binary Parameters" },
{ 1, Q931_WINDOW_SIZE, "Packet-layer Window Size" }, { 1, Q931_WINDOW_SIZE, "Packet-layer Window Size" },
{ 1, Q931_CLOSED_USER_GROUP, "Closed User Group" }, { 1, Q931_CLOSED_USER_GROUP, "Closed User Group" },
{ 1, Q931_REVERSE_CHARGE_INDIC, "Reverse Charging Indication" }, { 1, Q931_REVERSE_CHARGE_INDIC, "Reverse Charging Indication", dump_reverse_charging_indication, receive_reverse_charging_indication },
{ 1, Q931_CALLING_PARTY_NUMBER, "Calling Party Number", dump_calling_party_number, receive_calling_party_number, transmit_calling_party_number }, { 1, Q931_CALLING_PARTY_NUMBER, "Calling Party Number", dump_calling_party_number, receive_calling_party_number, transmit_calling_party_number },
{ 1, Q931_CALLING_PARTY_SUBADDR, "Calling Party Subaddress", dump_calling_party_subaddr, receive_calling_party_subaddr }, { 1, Q931_CALLING_PARTY_SUBADDR, "Calling Party Subaddress", dump_calling_party_subaddr, receive_calling_party_subaddr },
{ 1, Q931_CALLED_PARTY_NUMBER, "Called Party Number", dump_called_party_number, receive_called_party_number, transmit_called_party_number }, { 1, Q931_CALLED_PARTY_NUMBER, "Called Party Number", dump_called_party_number, receive_called_party_number, transmit_called_party_number },
@ -3784,6 +3794,7 @@ static int post_handle_q931_message(struct pri *ctrl, struct q931_mh *mh, struct
ctrl->ev.ring.redirectingreason = c->redirectingreason; ctrl->ev.ring.redirectingreason = c->redirectingreason;
ctrl->ev.ring.progress = c->progress; ctrl->ev.ring.progress = c->progress;
ctrl->ev.ring.progressmask = c->progressmask; ctrl->ev.ring.progressmask = c->progressmask;
ctrl->ev.ring.reversecharge = c->reversecharge;
return Q931_RES_HAVEEVENT; return Q931_RES_HAVEEVENT;
case Q931_ALERTING: case Q931_ALERTING:
if (c->newcall) { if (c->newcall) {