[svn-commits] rmudgett: branch group/issue14292 r815 - /team/group/issue14292/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri May 22 17:21:42 CDT 2009
Author: rmudgett
Date: Fri May 22 17:21:38 2009
New Revision: 815
URL: http://svn.asterisk.org/svn-view/libpri?view=rev&rev=815
Log:
Merged revisions 813 via svnmerge from
https://origsvn.digium.com/svn/libpri/team/group/issue14068
........
r813 | rmudgett | 2009-05-22 16:56:52 -0500 (Fri, 22 May 2009) | 5 lines
Reworked keypad facility and overlap dialing for COLP.
Overlap dialing would always clear the called_number.str. COLP and future
supplementary services need the complete called number.
........
Modified:
team/group/issue14292/ (props changed)
team/group/issue14292/pri_internal.h
team/group/issue14292/q931.c
Propchange: team/group/issue14292/
------------------------------------------------------------------------------
automerge = *
Propchange: team/group/issue14292/
------------------------------------------------------------------------------
--- issue14292-integrated (original)
+++ issue14292-integrated Fri May 22 17:21:38 2009
@@ -1,1 +1,1 @@
-/team/group/issue14068:1-810
+/team/group/issue14068:1-814
Modified: team/group/issue14292/pri_internal.h
URL: http://svn.asterisk.org/svn-view/libpri/team/group/issue14292/pri_internal.h?view=diff&rev=815&r1=814&r2=815
==============================================================================
--- team/group/issue14292/pri_internal.h (original)
+++ team/group/issue14292/pri_internal.h Fri May 22 17:21:38 2009
@@ -333,9 +333,13 @@
/* QSIG cc infos (receive) */
struct pri_subcommands subcmds;
- char keypad_digits[64]; /* Buffer for digits that come in KEYPAD_FACILITY */
-
int ani2; /* ANI II */
+
+ /*! Buffer for digits that come in KEYPAD_FACILITY */
+ char keypad_digits[32 + 1];
+
+ /*! Current dialed digits to be sent or just received. */
+ char overlap_digits[PRI_MAX_NUMBER_LEN];
/* BUGBUG need to check usage of elements in caller_id */
struct q931_party_id caller_id;
@@ -343,9 +347,12 @@
/* BUGBUG need to check usage of elements in called_name */
struct q931_party_name called_name;
- /*! \note called_number.presentation is not used */
-/* BUGBUG need to check usage of elements in called_number */
-/* BUGBUG Overlap dialing cannot wipe the called_number.str. It needs to append and also put the digits in the keypad_digits. */
+ /*!
+ * \brief Called party number.
+ * \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;
int nonisdn;
int complete; /* no more digits coming */
Modified: team/group/issue14292/q931.c
URL: http://svn.asterisk.org/svn-view/libpri/team/group/issue14292/q931.c?view=diff&rev=815&r1=814&r2=815
==============================================================================
--- team/group/issue14292/q931.c (original)
+++ team/group/issue14292/q931.c Fri May 22 17:21:38 2009
@@ -1284,10 +1284,37 @@
static int receive_called_party_number(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
{
+ size_t called_len;
+ size_t max_len;
+ char *called_end;
+
+ if (len < 3) {
+ return -1;
+ }
+
call->called_number.status = Q931_PARTY_DATA_STATUS_CHANGED;
call->called_number.plan = ie->data[0] & 0x7f;
- /* copy digits to call->called_number.str */
- q931_get_number((unsigned char *) call->called_number.str, sizeof(call->called_number.str), ie->data + 1, len - 3);
+ if (msgtype == Q931_SETUP) {
+ 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.
+ */
+ 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 {
+ called_len = len - 3;
+ }
+ strncat(called_end, (char *) ie->data + 1, called_len);
+ }
+
+ q931_get_number((unsigned char *) call->overlap_digits, sizeof(call->overlap_digits),
+ ie->data + 1, len - 3);
return 0;
}
@@ -1300,9 +1327,9 @@
}
call->called_number.status = Q931_PARTY_DATA_STATUS_VALID;
- datalen = strlen(call->called_number.str);
+ datalen = strlen(call->overlap_digits);
ie->data[0] = 0x80 | call->called_number.plan;
- memcpy(ie->data + 1, call->called_number.str, datalen);
+ memcpy(ie->data + 1, call->overlap_digits, datalen);
return datalen + (1 + 2);
}
@@ -1812,16 +1839,8 @@
int sublen;
sublen = strlen(call->keypad_digits);
-
- if (sublen > 32) {
- sublen = 32;
- call->keypad_digits[32] = '\0';
- }
-
if (sublen) {
- libpri_copy_string((char *)ie->data, (char *)call->keypad_digits, sizeof(call->keypad_digits));
- /* Make sure we clear the field */
- call->keypad_digits[0] = '\0';
+ libpri_copy_string((char *) ie->data, call->keypad_digits, sizeof(call->keypad_digits));
return sublen + 2;
} else
return 0;
@@ -3013,14 +3032,23 @@
return send_message(pri, cur, Q931_STATUS, status_ies);
}
-static int information_ies[] = { Q931_IE_KEYPAD_FACILITY, Q931_CALLED_PARTY_NUMBER, -1 };
+static int information_ies[] = { Q931_CALLED_PARTY_NUMBER, -1 };
int q931_information(struct pri *pri, q931_call *c, char digit)
{
-/* BUGBUG this needs to be reexamined. */
+ c->overlap_digits[0] = digit;
+ c->overlap_digits[1] = '\0';
+
+ /*
+ * Since we are doing overlap dialing now, we need to accumulate
+ * the digits into call->called_number.str.
+ */
c->called_number.status = Q931_PARTY_DATA_STATUS_CHANGED;
- c->called_number.str[0] = digit;
- c->called_number.str[1] = '\0';
+ 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);
+ }
+
return send_message(pri, c, Q931_INFORMATION, information_ies);
}
@@ -3463,6 +3491,7 @@
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;
@@ -3904,7 +3933,12 @@
c->channelno = -1;
break;
case Q931_INFORMATION:
- c->called_number.str[0] = '\0';
+ /*
+ * Make sure that keypad and overlap digit buffers are empty in
+ * case they are not in the message.
+ */
+ c->keypad_digits[0] = '\0';
+ c->overlap_digits[0] = '\0';
break;
case Q931_STATUS_ENQUIRY:
break;
@@ -4674,15 +4708,12 @@
pri->ev.digit.call = c;
pri->ev.digit.channel = c->channelno | (c->ds1no << 8);
libpri_copy_string(pri->ev.digit.digits, c->keypad_digits, sizeof(pri->ev.digit.digits));
- /* Make sure we clear it out before we return */
- c->keypad_digits[0] = '\0';
return Q931_RES_HAVEEVENT;
}
pri->ev.e = PRI_EVENT_INFO_RECEIVED;
pri->ev.ring.call = c;
pri->ev.ring.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
-/* BUGBUG need to redo overlap dialing. */
- libpri_copy_string(pri->ev.ring.callednum, c->called_number.str, sizeof(pri->ev.ring.callednum));
+ libpri_copy_string(pri->ev.ring.callednum, c->overlap_digits, sizeof(pri->ev.ring.callednum));
libpri_copy_string(pri->ev.ring.callingsubaddr, c->callingsubaddr, sizeof(pri->ev.ring.callingsubaddr));
pri->ev.ring.complete = c->complete; /* this covers IE 33 (Sending Complete) */
return Q931_RES_HAVEEVENT;
More information about the svn-commits
mailing list