[libpri-commits] rmudgett: branch rmudgett/facility r1202 - /team/rmudgett/facility/
SVN commits to the libpri project
libpri-commits at lists.digium.com
Wed Oct 14 11:55:51 CDT 2009
Author: rmudgett
Date: Wed Oct 14 11:55:47 2009
New Revision: 1202
URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1202
Log:
Added ability to send/receive keypad digits in the SETUP message.
Merge changes in team/rmudgett/deflection branch up to -r1201
Modified:
team/rmudgett/facility/libpri.h
team/rmudgett/facility/pri.c
team/rmudgett/facility/pri_internal.h
team/rmudgett/facility/q931.c
Modified: team/rmudgett/facility/libpri.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/facility/libpri.h?view=diff&rev=1202&r1=1201&r2=1202
==============================================================================
--- team/rmudgett/facility/libpri.h (original)
+++ team/rmudgett/facility/libpri.h Wed Oct 14 11:55:47 2009
@@ -651,6 +651,7 @@
int origredirectingreason;
int reversecharge;
struct pri_subcommands *subcmds;
+ char keypad_digits[64]; /* Keypad digits in the SETUP message. */
} pri_event_ring;
typedef struct pri_event_hangup {
@@ -973,6 +974,16 @@
void pri_sr_set_redirecting_parties(struct pri_sr *sr, const struct pri_party_redirecting *redirecting);
/*! \note Use pri_sr_set_redirecting_parties() instead to pass more precise redirecting information. */
int pri_sr_set_redirecting(struct pri_sr *sr, char *num, int plan, int pres, int reason);
+
+/*!
+ * \brief Set the keypad digits in the call SETUP record.
+ *
+ * \param sr New call SETUP record.
+ * \param keypad_digits Keypad digits to send.
+ *
+ * \return Nothing
+ */
+void pri_sr_set_keypad_digits(struct pri_sr *sr, const char *keypad_digits);
#define PRI_USER_USER_TX
/* Set the user user field. Warning! don't send binary data accross this field */
Modified: team/rmudgett/facility/pri.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/facility/pri.c?view=diff&rev=1202&r1=1201&r2=1202
==============================================================================
--- team/rmudgett/facility/pri.c (original)
+++ team/rmudgett/facility/pri.c Wed Oct 14 11:55:47 2009
@@ -1309,6 +1309,11 @@
sr->reversecharge = requested;
}
+void pri_sr_set_keypad_digits(struct pri_sr *sr, const char *keypad_digits)
+{
+ sr->keypad_digits = keypad_digits;
+}
+
void pri_hold_enable(struct pri *ctrl, int enable)
{
ctrl = PRI_MASTER(ctrl);
Modified: team/rmudgett/facility/pri_internal.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/facility/pri_internal.h?view=diff&rev=1202&r1=1201&r2=1202
==============================================================================
--- team/rmudgett/facility/pri_internal.h (original)
+++ team/rmudgett/facility/pri_internal.h Wed Oct 14 11:55:47 2009
@@ -295,6 +295,7 @@
int cis_call;
int cis_auto_disconnect;
const char *useruserinfo;
+ const char *keypad_digits;
int transferable;
int reversecharge;
};
Modified: team/rmudgett/facility/q931.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/facility/q931.c?view=diff&rev=1202&r1=1201&r2=1202
==============================================================================
--- team/rmudgett/facility/q931.c (original)
+++ team/rmudgett/facility/q931.c Wed Oct 14 11:55:47 2009
@@ -4158,6 +4158,7 @@
Q931_PROGRESS_INDICATOR,
Q931_NETWORK_SPEC_FAC,
Q931_DISPLAY,
+ Q931_IE_KEYPAD_FACILITY,
Q931_REVERSE_CHARGE_INDIC,
Q931_CALLING_PARTY_NUMBER,
Q931_CALLED_PARTY_NUMBER,
@@ -4180,6 +4181,7 @@
Q931_BEARER_CAPABILITY,
Q931_CHANNEL_IDENT,
Q931_IE_FACILITY,
+ Q931_IE_KEYPAD_FACILITY,
Q931_CALLING_PARTY_NUMBER,
Q931_CALLED_PARTY_NUMBER,
Q931_SENDING_COMPLETE,
@@ -4238,8 +4240,22 @@
int q931_setup(struct pri *ctrl, q931_call *c, struct pri_sr *req)
{
int res;
-
-
+
+ if (!req->called.number.valid && (!req->keypad_digits || !req->keypad_digits[0])) {
+ /* No called number or keypad digits to send. */
+ return -1;
+ }
+
+ c->called = req->called;
+ libpri_copy_string(c->overlap_digits, req->called.number.str, sizeof(c->overlap_digits));
+
+ if (req->keypad_digits) {
+ libpri_copy_string(c->keypad_digits, req->keypad_digits,
+ sizeof(c->keypad_digits));
+ } else {
+ c->keypad_digits[0] = '\0';
+ }
+
c->transcapability = req->transmode;
c->transmoderate = TRANS_MODE_64_CIRCUIT;
if (!req->userl1)
@@ -4279,12 +4295,6 @@
q931_party_id_fixup(ctrl, &c->redirecting.to);
q931_party_id_fixup(ctrl, &c->redirecting.orig_called);
}
-
- if (req->called.number.valid) {
- c->called = req->called;
- libpri_copy_string(c->overlap_digits, req->called.number.str, sizeof(c->overlap_digits));
- } else
- return -1;
if (req->useruserinfo)
libpri_copy_string(c->useruserinfo, req->useruserinfo, sizeof(c->useruserinfo));
@@ -5098,6 +5108,13 @@
q931_party_id_init(&c->remote_id);
q931_party_redirecting_init(&c->redirecting);
+ /*
+ * 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';
+
c->useruserprotocoldisc = -1;
c->useruserinfo[0] = '\0';
c->complete = 0;
@@ -6074,6 +6091,9 @@
libpri_copy_string(ctrl->ev.ring.useruserinfo, c->useruserinfo, sizeof(ctrl->ev.ring.useruserinfo));
c->useruserinfo[0] = '\0';
+
+ libpri_copy_string(ctrl->ev.ring.keypad_digits, c->keypad_digits,
+ sizeof(ctrl->ev.ring.keypad_digits));
ctrl->ev.ring.flexible = ! (c->chanflags & FLAG_EXCLUSIVE);
ctrl->ev.ring.cref = c->cr;
More information about the libpri-commits
mailing list