[svn-commits] rmudgett: branch group/issue14068 r962 - /team/group/issue14068/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Jul 27 19:50:14 CDT 2009
Author: rmudgett
Date: Mon Jul 27 19:50:10 2009
New Revision: 962
URL: http://svn.asterisk.org/svn-view/libpri?view=rev&rev=962
Log:
Added subaddress place holder support to protect future ABI compatibility.
Modified:
team/group/issue14068/libpri.h
team/group/issue14068/pri.c
team/group/issue14068/pri_facility.c
team/group/issue14068/pri_internal.h
team/group/issue14068/q931.c
Modified: team/group/issue14068/libpri.h
URL: http://svn.asterisk.org/svn-view/libpri/team/group/issue14068/libpri.h?view=diff&rev=962&r1=961&r2=962
==============================================================================
--- team/group/issue14068/libpri.h (original)
+++ team/group/issue14068/libpri.h Mon Jul 27 19:50:10 2009
@@ -401,12 +401,44 @@
char str[64];
};
+/*!
+ * \note This structure is a place holder for possible future subaddress support
+ * to maintain ABI compatibility.
+ */
+struct pri_party_subaddress {
+ /*! \brief TRUE if the subaddress information is valid/present */
+ int valid;
+ /*!
+ * \brief Subaddress type.
+ * \details
+ * nsap(0),
+ * user_specified(2)
+ */
+ int type;
+ /*!
+ * \brief TRUE if odd number of address signals
+ * \note The odd/even indicator is used when the type of subaddress is
+ * user_specified and the coding is BCD.
+ */
+ int odd_even_indicator;
+ /*! \brief Length of the subaddress data */
+ int length;
+ /*!
+ * \brief Subaddress data with null terminator.
+ * \note The null terminator is a convenience only since the data could be
+ * BCD/binary and thus have a null byte as part of the contents.
+ */
+ char data[32];
+};
+
/*! \brief Information needed to identify an endpoint in a call. */
struct pri_party_id {
/*! \brief Subscriber name */
struct pri_party_name name;
/*! \brief Subscriber phone number */
struct pri_party_number number;
+ /*! \brief Subscriber subaddress */
+ struct pri_party_subaddress subaddress;
};
/*! \brief Connected Line/Party information */
@@ -724,13 +756,13 @@
Set non-isdn to non-zero if you are not connecting to ISDN equipment */
int pri_answer(struct pri *pri, q931_call *call, int channel, int nonisdn);
-/*!
- * \brief Give connected line information to a call
+/*!
+ * \brief Give connected line information to a call
* \note Could be used instead of pri_sr_set_caller_party() before calling pri_setup().
*/
int pri_connected_line_update(struct pri *pri, q931_call *call, const struct pri_party_connected_line *connected);
-/*!
+/*!
* \brief Give redirection information to a call
* \note Could be used instead of pri_sr_set_redirecting_parties() before calling pri_setup().
*/
Modified: team/group/issue14068/pri.c
URL: http://svn.asterisk.org/svn-view/libpri/team/group/issue14068/pri.c?view=diff&rev=962&r1=961&r2=962
==============================================================================
--- team/group/issue14068/pri.c (original)
+++ team/group/issue14068/pri.c Mon Jul 27 19:50:10 2009
@@ -746,7 +746,7 @@
/* fall through */
case PRI_SWITCH_QSIG:
if (call->redirecting.state != Q931_REDIRECTING_STATE_PENDING_TX_DIV_LEG_3
- || strcmp(call->redirecting.to.number.str, call->called_number.str) != 0) {
+ || strcmp(call->redirecting.to.number.str, call->called.number.str) != 0) {
/* immediately send divertingLegInformation1 APDU */
if (rose_diverting_leg_information1_encode(ctrl, call)
|| q931_facility(ctrl, call)) {
Modified: team/group/issue14068/pri_facility.c
URL: http://svn.asterisk.org/svn-view/libpri/team/group/issue14068/pri_facility.c?view=diff&rev=962&r1=961&r2=962
==============================================================================
--- team/group/issue14068/pri_facility.c (original)
+++ team/group/issue14068/pri_facility.c Mon Jul 27 19:50:10 2009
@@ -1757,7 +1757,7 @@
end =
enc_qsig_call_rerouting(ctrl, buffer, buffer + sizeof(buffer),
call->remote_id.number.str, dest, original ? original :
- call->called_number.str, reason);
+ call->called.number.str, reason);
if (!end) {
return -1;
}
Modified: team/group/issue14068/pri_internal.h
URL: http://svn.asterisk.org/svn-view/libpri/team/group/issue14068/pri_internal.h?view=diff&rev=962&r1=961&r2=962
==============================================================================
--- team/group/issue14068/pri_internal.h (original)
+++ team/group/issue14068/pri_internal.h Mon Jul 27 19:50:10 2009
@@ -180,12 +180,56 @@
char str[PRI_MAX_NUMBER_LEN];
};
+/*! \brief Maximum subaddress length plus null terminator */
+#define PRI_MAX_SUBADDRESS_LEN (20 + 1)
+
+#if defined(POSSIBLE_FUTURE_SUBADDRESS_SUPPORT)
+struct q931_party_subaddress {
+ /*! \brief TRUE if the subaddress information is valid/present */
+ unsigned char valid;
+ /*!
+ * \brief Subaddress type.
+ * \details
+ * nsap(0),
+ * user_specified(2)
+ */
+ unsigned char type;
+ /*!
+ * \brief TRUE if odd number of address signals
+ * \note The odd/even indicator is used when the type of subaddress is
+ * user_specified and the coding is BCD.
+ */
+ unsigned char odd_even_indicator;
+ /*! \brief Length of the subaddress data */
+ unsigned char length;
+ /*!
+ * \brief Subaddress data with null terminator.
+ * \note The null terminator is a convenience only since the data could be
+ * BCD/binary and thus have a null byte as part of the contents.
+ */
+ char data[PRI_MAX_SUBADDRESS_LEN];
+};
+#endif /* defined(POSSIBLE_FUTURE_SUBADDRESS_SUPPORT) */
+
+struct q931_party_address {
+ /*! \brief Subscriber phone number */
+ struct q931_party_number number;
+#if defined(POSSIBLE_FUTURE_SUBADDRESS_SUPPORT)
+ /*! \brief Subscriber subaddress */
+ struct q931_party_subaddress subaddress;
+#endif /* defined(POSSIBLE_FUTURE_SUBADDRESS_SUPPORT) */
+};
+
/*! \brief Information needed to identify an endpoint in a call. */
struct q931_party_id {
/*! \brief Subscriber name */
struct q931_party_name name;
/*! \brief Subscriber phone number */
struct q931_party_number number;
+#if defined(POSSIBLE_FUTURE_SUBADDRESS_SUPPORT)
+ /*! \brief Subscriber subaddress */
+ struct q931_party_subaddress subaddress;
+#endif /* defined(POSSIBLE_FUTURE_SUBADDRESS_SUPPORT) */
};
enum Q931_REDIRECTING_STATE {
@@ -383,12 +427,12 @@
struct q931_party_number redirection_number;
/*!
- * \brief Called party number.
- * \note The called_number.str is the accumulated overlap dial digits
+ * \brief Called party address.
+ * \note The called.number.str is the accumulated overlap dial digits
* and enbloc digits.
- * \note The called_number.presentation value is not used.
- */
- struct q931_party_number called_number;
+ * \note The called.number.presentation value is not used.
+ */
+ struct q931_party_address called;
int nonisdn;
int complete; /* no more digits coming */
int newcall; /* if the received message has a new call reference value */
@@ -403,7 +447,7 @@
int useruserprotocoldisc;
char useruserinfo[256];
- char callingsubaddr[256]; /* Calling party subaddress */
+ char callingsubaddr[PRI_MAX_SUBADDRESS_LEN]; /* Calling party subaddress */
long aoc_units; /* Advice of Charge Units */
Modified: team/group/issue14068/q931.c
URL: http://svn.asterisk.org/svn-view/libpri/team/group/issue14068/q931.c?view=diff&rev=962&r1=961&r2=962
==============================================================================
--- team/group/issue14068/q931.c (original)
+++ team/group/issue14068/q931.c Mon Jul 27 19:50:10 2009
@@ -1558,19 +1558,19 @@
return -1;
}
- call->called_number.valid = 1;
- call->called_number.plan = ie->data[0] & 0x7f;
+ call->called.number.valid = 1;
+ call->called.number.plan = ie->data[0] & 0x7f;
if (msgtype == Q931_SETUP) {
- q931_get_number((unsigned char *) call->called_number.str,
- sizeof(call->called_number.str), ie->data + 1, len - 3);
+ q931_get_number((unsigned char *) call->called.number.str,
+ sizeof(call->called.number.str), ie->data + 1, len - 3);
} else if (call->ourcallstate == Q931_CALL_STATE_OVERLAP_RECEIVING) {
/*
* Since we are receiving overlap digits now, we need to append
- * them to any previously received digits in call->called_number.str.
+ * them to any previously received digits in call->called.number.str.
*/
- called_len = strlen(call->called_number.str);
- called_end = call->called_number.str + called_len;
- max_len = (sizeof(call->called_number.str) - 1) - called_len;
+ called_len = strlen(call->called.number.str);
+ called_end = call->called.number.str + called_len;
+ max_len = (sizeof(call->called.number.str) - 1) - called_len;
if (max_len < len - 3) {
called_len = max_len;
} else {
@@ -1588,12 +1588,12 @@
{
size_t datalen;
- if (!call->called_number.valid) {
+ if (!call->called.number.valid) {
return 0;
}
datalen = strlen(call->overlap_digits);
- ie->data[0] = 0x80 | call->called_number.plan;
+ ie->data[0] = 0x80 | call->called.number.plan;
memcpy(ie->data + 1, call->overlap_digits, datalen);
return datalen + (1 + 2);
}
@@ -2940,7 +2940,7 @@
cur->aoc_units = -1;
cur->changestatus = -1;
q931_party_number_init(&cur->redirection_number);
- q931_party_number_init(&cur->called_number);
+ q931_party_number_init(&cur->called.number);
q931_party_id_init(&cur->local_id);
q931_party_id_init(&cur->remote_id);
q931_party_redirecting_init(&cur->redirecting);
@@ -3331,12 +3331,12 @@
/*
* Since we are doing overlap dialing now, we need to accumulate
- * the digits into call->called_number.str.
+ * the digits into call->called.number.str.
*/
- c->called_number.valid = 1;
- if (strlen(c->called_number.str) < sizeof(c->called_number.str) - 1) {
+ c->called.number.valid = 1;
+ if (strlen(c->called.number.str) < sizeof(c->called.number.str) - 1) {
/* There is enough room for the new digit. */
- strcat(c->called_number.str, c->overlap_digits);
+ strcat(c->called.number.str, c->overlap_digits);
}
return send_message(ctrl, c, Q931_INFORMATION, information_ies);
@@ -3783,10 +3783,10 @@
}
if (req->called) {
- c->called_number.valid = 1;
- c->called_number.plan = req->calledplan;
- libpri_copy_string(c->called_number.str, req->called,
- sizeof(c->called_number.str));
+ c->called.number.valid = 1;
+ c->called.number.plan = req->calledplan;
+ libpri_copy_string(c->called.number.str, req->called,
+ sizeof(c->called.number.str));
libpri_copy_string(c->overlap_digits, req->called, sizeof(c->overlap_digits));
} else
return -1;
@@ -4033,7 +4033,7 @@
c->userl3 = -1;
c->rateadaption = -1;
- q931_party_number_init(&c->called_number);
+ q931_party_number_init(&c->called.number);
q931_party_id_init(&c->local_id);
q931_party_id_init(&c->remote_id);
q931_party_redirecting_init(&c->redirecting);
@@ -4435,8 +4435,8 @@
c->redirecting.to.number.valid = 1;
c->redirecting.to.number.presentation =
PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED;
- c->redirecting.to.number.plan = c->called_number.plan;
- libpri_copy_string(c->redirecting.to.number.str, c->called_number.str,
+ c->redirecting.to.number.plan = c->called.number.plan;
+ libpri_copy_string(c->redirecting.to.number.str, c->called.number.str,
sizeof(c->redirecting.to.number.str));
}
@@ -4463,8 +4463,8 @@
ctrl->ev.ring.ani2 = c->ani2;
/* Called party information */
- ctrl->ev.ring.calledplan = c->called_number.plan;
- libpri_copy_string(ctrl->ev.ring.callednum, c->called_number.str, sizeof(ctrl->ev.ring.callednum));
+ ctrl->ev.ring.calledplan = c->called.number.plan;
+ libpri_copy_string(ctrl->ev.ring.callednum, c->called.number.str, sizeof(ctrl->ev.ring.callednum));
/* Original called party information (For backward compatibility) */
libpri_copy_string(ctrl->ev.ring.origcalledname, c->redirecting.orig_called.name.str, sizeof(ctrl->ev.ring.origcalledname));
More information about the svn-commits
mailing list