Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
585a33ce54 | ||
|
|
404ad38826 | ||
|
|
a1457a9c43 | ||
|
|
998e6ba598 | ||
|
|
cfac266390 | ||
|
|
13beaacc80 | ||
|
|
84b2560da5 | ||
|
|
28553ff8cb | ||
|
|
1a0927ca23 | ||
|
|
de78c8d37f | ||
|
|
cdb844c16b |
61
libpri-1.4.15-summary.html
Normal file
61
libpri-1.4.15-summary.html
Normal file
@@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Release Summary - libpri-1.4.15</title></head>
|
||||
<body>
|
||||
<h1 align="center"><a name="top">Release Summary</a></h1>
|
||||
<h3 align="center">libpri-1.4.15</h3>
|
||||
<h3 align="center">Date: 2014-06-16</h3>
|
||||
<h3 align="center"><asteriskteam@digium.com></h3>
|
||||
<hr/>
|
||||
<h2 align="center">Table of Contents</h2>
|
||||
<ol>
|
||||
<li><a href="#summary">Summary</a></li>
|
||||
<li><a href="#contributors">Contributors</a></li>
|
||||
<li><a href="#commits">Other Changes</a></li>
|
||||
<li><a href="#diffstat">Diffstat</a></li>
|
||||
</ol>
|
||||
<hr/>
|
||||
<a name="summary"><h2 align="center">Summary</h2></a>
|
||||
<center><a href="#top">[Back to Top]</a></center><br/><p>This release includes only bug fixes. The changes included were made only to address problems that have been identified in this release series. Users should be able to safely upgrade to this version if this release series is already in use. Users considering upgrading from a previous release series are strongly encouraged to review the UPGRADE.txt document as well as the CHANGES document for information about upgrading to this release series.</p>
|
||||
<p>The data in this summary reflects changes that have been made since the previous release, libpri-1.4.14.</p>
|
||||
<hr/>
|
||||
<a name="contributors"><h2 align="center">Contributors</h2></a>
|
||||
<center><a href="#top">[Back to Top]</a></center><br/><p>This table lists the people who have submitted code, those that have tested patches, as well as those that reported issues on the issue tracker that were resolved in this release. For coders, the number is how many of their patches (of any size) were committed into this release. For testers, the number is the number of times their name was listed as assisting with testing a patch. Finally, for reporters, the number is the number of issues that they reported that were closed by commits that went into this release.</p>
|
||||
<table width="100%" border="0">
|
||||
<tr>
|
||||
<td width="33%"><h3>Coders</h3></td>
|
||||
<td width="33%"><h3>Testers</h3></td>
|
||||
<td width="33%"><h3>Reporters</h3></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
3 rmudgett<br/>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
1 dcolombo<br/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr/>
|
||||
<a name="commits"><h2 align="center">Commits Not Associated with an Issue</h2></a>
|
||||
<center><a href="#top">[Back to Top]</a></center><br/><p>This is a list of all changes that went into this release that did not directly close an issue from the issue tracker. The commits may have been marked as being related to an issue. If that is the case, the issue numbers are listed here, as well.</p>
|
||||
<table width="100%" border="1">
|
||||
<tr><td><b>Revision</b></td><td><b>Author</b></td><td><b>Summary</b></td><td><b>Issues Referenced</b></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2315">2315</a></td><td>rmudgett</td><td>Fix hole in layer2_persistence option for TE PTMP links.</td>
|
||||
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2318">2318</a></td><td>rmudgett</td><td>libpri: Make TE-PTP mode respond to MDL TEI check requests.</td>
|
||||
<td></td></tr></table>
|
||||
<hr/>
|
||||
<a name="diffstat"><h2 align="center">Diffstat Results</h2></a>
|
||||
<center><a href="#top">[Back to Top]</a></center><br/><p>This is a summary of the changes to the source code that went into this release that was generated using the diffstat utility.</p>
|
||||
<pre>
|
||||
libpri.h | 66 +++++++++++++++++--
|
||||
pri.c | 12 ++-
|
||||
pri_q931.h | 2
|
||||
q921.c | 208 +++++++++++++++++++++++++++++++++++++------------------------
|
||||
q931.c | 38 +++++++----
|
||||
5 files changed, 224 insertions(+), 102 deletions(-)
|
||||
</pre><br/>
|
||||
<hr/>
|
||||
</body>
|
||||
</html>
|
||||
91
libpri-1.4.15-summary.txt
Normal file
91
libpri-1.4.15-summary.txt
Normal file
@@ -0,0 +1,91 @@
|
||||
Release Summary
|
||||
|
||||
libpri-1.4.15
|
||||
|
||||
Date: 2014-06-16
|
||||
|
||||
<asteriskteam@digium.com>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Table of Contents
|
||||
|
||||
1. Summary
|
||||
2. Contributors
|
||||
3. Other Changes
|
||||
4. Diffstat
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Summary
|
||||
|
||||
[Back to Top]
|
||||
|
||||
This release includes only bug fixes. The changes included were made only
|
||||
to address problems that have been identified in this release series.
|
||||
Users should be able to safely upgrade to this version if this release
|
||||
series is already in use. Users considering upgrading from a previous
|
||||
release series are strongly encouraged to review the UPGRADE.txt document
|
||||
as well as the CHANGES document for information about upgrading to this
|
||||
release series.
|
||||
|
||||
The data in this summary reflects changes that have been made since the
|
||||
previous release, libpri-1.4.14.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Contributors
|
||||
|
||||
[Back to Top]
|
||||
|
||||
This table lists the people who have submitted code, those that have
|
||||
tested patches, as well as those that reported issues on the issue tracker
|
||||
that were resolved in this release. For coders, the number is how many of
|
||||
their patches (of any size) were committed into this release. For testers,
|
||||
the number is the number of times their name was listed as assisting with
|
||||
testing a patch. Finally, for reporters, the number is the number of
|
||||
issues that they reported that were closed by commits that went into this
|
||||
release.
|
||||
|
||||
Coders Testers Reporters
|
||||
3 rmudgett 1 dcolombo
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Commits Not Associated with an Issue
|
||||
|
||||
[Back to Top]
|
||||
|
||||
This is a list of all changes that went into this release that did not
|
||||
directly close an issue from the issue tracker. The commits may have been
|
||||
marked as being related to an issue. If that is the case, the issue
|
||||
numbers are listed here, as well.
|
||||
|
||||
+------------------------------------------------------------------------+
|
||||
| Revision | Author | Summary | Issues |
|
||||
| | | | Referenced |
|
||||
|----------+----------+-------------------------------------+------------|
|
||||
| 2315 | rmudgett | Fix hole in layer2_persistence | |
|
||||
| | | option for TE PTMP links. | |
|
||||
|----------+----------+-------------------------------------+------------|
|
||||
| 2318 | rmudgett | libpri: Make TE-PTP mode respond to | |
|
||||
| | | MDL TEI check requests. | |
|
||||
+------------------------------------------------------------------------+
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Diffstat Results
|
||||
|
||||
[Back to Top]
|
||||
|
||||
This is a summary of the changes to the source code that went into this
|
||||
release that was generated using the diffstat utility.
|
||||
|
||||
libpri.h | 66 +++++++++++++++++--
|
||||
pri.c | 12 ++-
|
||||
pri_q931.h | 2
|
||||
q921.c | 208 +++++++++++++++++++++++++++++++++++++------------------------
|
||||
q931.c | 38 +++++++----
|
||||
5 files changed, 224 insertions(+), 102 deletions(-)
|
||||
|
||||
----------------------------------------------------------------------
|
||||
66
libpri.h
66
libpri.h
@@ -1213,6 +1213,7 @@ typedef struct pri_event_setup_ack {
|
||||
int channel;
|
||||
q931_call *call;
|
||||
struct pri_subcommands *subcmds;
|
||||
int progressmask;
|
||||
} pri_event_setup_ack;
|
||||
|
||||
typedef struct pri_event_notify {
|
||||
@@ -1408,8 +1409,17 @@ const char *pri_facility_error2str(int facility_error_code);
|
||||
*/
|
||||
const char *pri_facility_reject2str(int facility_reject_code);
|
||||
|
||||
/* Acknowledge a call and place it on the given channel. Set info to non-zero if there
|
||||
is in-band data available on the channel */
|
||||
/*!
|
||||
* \brief Send the ALERTING message.
|
||||
*
|
||||
* \param pri D channel controller.
|
||||
* \param call Q.931 call leg.
|
||||
* \param channel Encoded channel id to use. If zero do not change channel id.
|
||||
* \param info Nonzero to include a progress ie indicating inband audio available (ie ringback).
|
||||
*
|
||||
* \retval 0 on success.
|
||||
* \retval -1 on error.
|
||||
*/
|
||||
int pri_acknowledge(struct pri *pri, q931_call *call, int channel, int info);
|
||||
|
||||
/* Send a digit in overlap mode */
|
||||
@@ -1419,12 +1429,44 @@ int pri_information(struct pri *pri, q931_call *call, char digit);
|
||||
/* Send a keypad facility string of digits */
|
||||
int pri_keypad_facility(struct pri *pri, q931_call *call, const char *digits);
|
||||
|
||||
/* Answer the incomplete(call without called number) call on the given channel.
|
||||
Set non-isdn to non-zero if you are not connecting to ISDN equipment */
|
||||
/*!
|
||||
* \brief Send the SETUP_ACKNOWLEDGE message.
|
||||
*
|
||||
* \param pri D channel controller.
|
||||
* \param call Q.931 call leg.
|
||||
* \param channel Encoded channel id to use. If zero do not change channel id.
|
||||
* \param nonisdn Nonzero to include a progress ie indicating non-end-to-end-ISDN.
|
||||
*
|
||||
* \retval 0 on success.
|
||||
* \retval -1 on error.
|
||||
*/
|
||||
int pri_need_more_info(struct pri *pri, q931_call *call, int channel, int nonisdn);
|
||||
|
||||
/* Answer(CONNECT) the call on the given channel.
|
||||
Set non-isdn to non-zero if you are not connecting to ISDN equipment */
|
||||
/*!
|
||||
* \brief Send the SETUP_ACKNOWLEDGE message.
|
||||
*
|
||||
* \param ctrl D channel controller.
|
||||
* \param call Q.931 call leg.
|
||||
* \param channel Encoded channel id to use. If zero do not change channel id.
|
||||
* \param nonisdn Nonzero to include a progress ie indicating non-end-to-end-ISDN.
|
||||
* \param inband Nonzero to include a progress ie indicating inband audio available (ie dialtone).
|
||||
*
|
||||
* \retval 0 on success.
|
||||
* \retval -1 on error.
|
||||
*/
|
||||
int pri_setup_ack(struct pri *ctrl, q931_call *call, int channel, int nonisdn, int inband);
|
||||
|
||||
/*!
|
||||
* \brief Send the CONNECT message.
|
||||
*
|
||||
* \param pri D channel controller.
|
||||
* \param call Q.931 call leg.
|
||||
* \param channel Encoded channel id to use. If zero do not change channel id.
|
||||
* \param nonisdn Nonzero to include a progress ie indicating non-end-to-end-ISDN.
|
||||
*
|
||||
* \retval 0 on success.
|
||||
* \retval -1 on error.
|
||||
*/
|
||||
int pri_answer(struct pri *pri, q931_call *call, int channel, int nonisdn);
|
||||
|
||||
/*!
|
||||
@@ -1692,7 +1734,17 @@ int pri_progress(struct pri *pri, q931_call *c, int channel, int info);
|
||||
int pri_progress_with_cause(struct pri *pri, q931_call *c, int channel, int info, int cause);
|
||||
|
||||
#define PRI_PROCEEDING_FULL
|
||||
/* Send call proceeding */
|
||||
/*!
|
||||
* \brief Send the PROCEEDING message.
|
||||
*
|
||||
* \param pri D channel controller.
|
||||
* \param c Q.931 call leg.
|
||||
* \param channel Encoded channel id to use. If zero do not change channel id.
|
||||
* \param info Nonzero to include a progress ie indicating inband audio available.
|
||||
*
|
||||
* \retval 0 on success.
|
||||
* \retval -1 on error.
|
||||
*/
|
||||
int pri_proceeding(struct pri *pri, q931_call *c, int channel, int info);
|
||||
|
||||
/* Enable inband progress when a DISCONNECT is received */
|
||||
|
||||
12
pri.c
12
pri.c
@@ -176,7 +176,7 @@ static void pri_default_timers(struct pri *ctrl, int switchtype)
|
||||
|
||||
ctrl->timers[PRI_TIMER_T200] = 1000; /* Time between SABME's */
|
||||
ctrl->timers[PRI_TIMER_T201] = ctrl->timers[PRI_TIMER_T200];/* Time between TEI Identity Checks (Default same as T200) */
|
||||
ctrl->timers[PRI_TIMER_T202] = 10 * 1000; /* Min time between transmission of TEI Identity request messages */
|
||||
ctrl->timers[PRI_TIMER_T202] = 2 * 1000; /* Min time between transmission of TEI Identity request messages */
|
||||
ctrl->timers[PRI_TIMER_T203] = 10 * 1000; /* Max time without exchanging packets */
|
||||
|
||||
ctrl->timers[PRI_TIMER_T303] = 4 * 1000; /* Length between SETUP retransmissions and timeout */
|
||||
@@ -939,7 +939,15 @@ int pri_need_more_info(struct pri *pri, q931_call *call, int channel, int nonisd
|
||||
if (!pri || !pri_is_call_valid(pri, call)) {
|
||||
return -1;
|
||||
}
|
||||
return q931_setup_ack(pri, call, channel, nonisdn);
|
||||
return q931_setup_ack(pri, call, channel, nonisdn, 0);
|
||||
}
|
||||
|
||||
int pri_setup_ack(struct pri *ctrl, q931_call *call, int channel, int nonisdn, int inband)
|
||||
{
|
||||
if (!ctrl || !pri_is_call_valid(ctrl, call)) {
|
||||
return -1;
|
||||
}
|
||||
return q931_setup_ack(ctrl, call, channel, nonisdn, inband);
|
||||
}
|
||||
|
||||
int pri_answer(struct pri *pri, q931_call *call, int channel, int nonisdn)
|
||||
|
||||
@@ -468,7 +468,7 @@ extern int q931_notify(struct pri *pri, q931_call *call, int channel, int info);
|
||||
|
||||
extern int q931_call_proceeding(struct pri *pri, q931_call *call, int channel, int info);
|
||||
|
||||
extern int q931_setup_ack(struct pri *pri, q931_call *call, int channel, int nonisdn);
|
||||
extern int q931_setup_ack(struct pri *ctrl, q931_call *c, int channel, int nonisdn, int inband);
|
||||
|
||||
extern int q931_information(struct pri *pri, q931_call *call, char digit);
|
||||
|
||||
|
||||
@@ -68,7 +68,10 @@ static void do_channel(int fd)
|
||||
int i=0;
|
||||
|
||||
while ((res = read(fd, buf, READ_SIZE)) > 0 && (i++ < 1000)) {
|
||||
write(fd, buf, res);
|
||||
if (write(fd, buf, res) == -1) {
|
||||
fprintf(stderr, "--!! Failed write: %d\n", errno);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
210
q921.c
210
q921.c
@@ -45,13 +45,19 @@
|
||||
*/
|
||||
//#define RANDOM_DROPS 1
|
||||
|
||||
#define Q921_INIT(link, hf) do { \
|
||||
memset(&(hf),0,sizeof(hf)); \
|
||||
(hf).h.sapi = (link)->sapi; \
|
||||
(hf).h.ea1 = 0; \
|
||||
(hf).h.ea2 = 1; \
|
||||
(hf).h.tei = (link)->tei; \
|
||||
} while (0)
|
||||
#define Q921_INIT(fr, l_sapi, l_tei) \
|
||||
do { \
|
||||
(fr)->h.sapi = l_sapi; \
|
||||
(fr)->h.ea1 = 0; \
|
||||
(fr)->h.ea2 = 1; \
|
||||
(fr)->h.tei = l_tei; \
|
||||
} while (0)
|
||||
|
||||
#define Q921_CLEAR_INIT(fr, l_sapi, l_tei) \
|
||||
do { \
|
||||
memset((fr), 0, sizeof(*(fr))); \
|
||||
Q921_INIT((fr), (l_sapi), (l_tei)); \
|
||||
} while (0)
|
||||
|
||||
static void q921_dump_pri(struct q921_link *link, char direction_tag);
|
||||
static void q921_establish_data_link(struct q921_link *link);
|
||||
@@ -196,17 +202,14 @@ static int q921_transmit(struct pri *ctrl, q921_h *h, int len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void q921_send_tei(struct pri *ctrl, enum q921_tei_identity message, int ri, int ai, int iscommand)
|
||||
static void q921_mdl_send(struct pri *ctrl, enum q921_tei_identity message, int ri, int ai, int iscommand)
|
||||
{
|
||||
q921_u *f;
|
||||
struct q921_link *link;
|
||||
|
||||
link = &ctrl->link;
|
||||
|
||||
if (!(f = calloc(1, sizeof(*f) + 5)))
|
||||
return;
|
||||
|
||||
Q921_INIT(link, *f);
|
||||
Q921_INIT(f, Q921_SAPI_LAYER2_MANAGEMENT, Q921_TEI_GROUP);
|
||||
f->h.c_r = (ctrl->localtype == PRI_NETWORK) ? iscommand : !iscommand;
|
||||
f->ft = Q921_FRAMETYPE_U;
|
||||
f->data[0] = 0x0f; /* Management entity */
|
||||
@@ -216,7 +219,7 @@ static void q921_send_tei(struct pri *ctrl, enum q921_tei_identity message, int
|
||||
f->data[4] = (ai << 1) | 1;
|
||||
if (ctrl->debug & PRI_DEBUG_Q921_STATE) {
|
||||
pri_message(ctrl,
|
||||
"Sending TEI management message %d(%s), TEI=%d\n",
|
||||
"Sending MDL message: %d(%s), TEI=%d\n",
|
||||
message, q921_tei_mgmt2str(message), ai);
|
||||
}
|
||||
q921_transmit(ctrl, (q921_h *)f, 8);
|
||||
@@ -265,7 +268,7 @@ static void t202_expire(void *vlink)
|
||||
|
||||
/* Send TEI request */
|
||||
link->ri = random() % 65535;
|
||||
q921_send_tei(ctrl, Q921_TEI_IDENTITY_REQUEST, link->ri, Q921_TEI_GROUP, 1);
|
||||
q921_mdl_send(ctrl, Q921_TEI_IDENTITY_REQUEST, link->ri, Q921_TEI_GROUP, 1);
|
||||
}
|
||||
|
||||
static void q921_tei_request(struct q921_link *link)
|
||||
@@ -280,8 +283,8 @@ static void q921_tei_remove(struct pri *ctrl, int tei)
|
||||
* Q.921 Section 5.3.2 says we should send the remove message
|
||||
* twice, in case of message loss.
|
||||
*/
|
||||
q921_send_tei(ctrl, Q921_TEI_IDENTITY_REMOVE, 0, tei, 1);
|
||||
q921_send_tei(ctrl, Q921_TEI_IDENTITY_REMOVE, 0, tei, 1);
|
||||
q921_mdl_send(ctrl, Q921_TEI_IDENTITY_REMOVE, 0, tei, 1);
|
||||
q921_mdl_send(ctrl, Q921_TEI_IDENTITY_REMOVE, 0, tei, 1);
|
||||
}
|
||||
|
||||
static void q921_send_dm(struct q921_link *link, int fbit)
|
||||
@@ -291,7 +294,7 @@ static void q921_send_dm(struct q921_link *link, int fbit)
|
||||
|
||||
ctrl = link->ctrl;
|
||||
|
||||
Q921_INIT(link, h);
|
||||
Q921_CLEAR_INIT(&h, link->sapi, link->tei);
|
||||
h.u.m3 = 0; /* M3 = 0 */
|
||||
h.u.m2 = 3; /* M2 = 3 */
|
||||
h.u.p_f = fbit; /* Final set appropriately */
|
||||
@@ -320,7 +323,7 @@ static void q921_send_disc(struct q921_link *link, int pbit)
|
||||
|
||||
ctrl = link->ctrl;
|
||||
|
||||
Q921_INIT(link, h);
|
||||
Q921_CLEAR_INIT(&h, link->sapi, link->tei);
|
||||
h.u.m3 = 2; /* M3 = 2 */
|
||||
h.u.m2 = 0; /* M2 = 0 */
|
||||
h.u.p_f = pbit; /* Poll set appropriately */
|
||||
@@ -349,7 +352,7 @@ static void q921_send_ua(struct q921_link *link, int fbit)
|
||||
|
||||
ctrl = link->ctrl;
|
||||
|
||||
Q921_INIT(link, h);
|
||||
Q921_CLEAR_INIT(&h, link->sapi, link->tei);
|
||||
h.u.m3 = 3; /* M3 = 3 */
|
||||
h.u.m2 = 0; /* M2 = 0 */
|
||||
h.u.p_f = fbit; /* Final set appropriately */
|
||||
@@ -378,7 +381,7 @@ static void q921_send_sabme(struct q921_link *link)
|
||||
|
||||
ctrl = link->ctrl;
|
||||
|
||||
Q921_INIT(link, h);
|
||||
Q921_CLEAR_INIT(&h, link->sapi, link->tei);
|
||||
h.u.m3 = 3; /* M3 = 3 */
|
||||
h.u.m2 = 3; /* M2 = 3 */
|
||||
h.u.p_f = 1; /* Poll bit set */
|
||||
@@ -557,7 +560,7 @@ static void kick_start_link(struct q921_link *link)
|
||||
break;
|
||||
case Q921_ASSIGN_AWAITING_TEI:
|
||||
if (ctrl->debug & PRI_DEBUG_Q921_STATE) {
|
||||
pri_message(ctrl, "Kick starting link when get TEI.\n");
|
||||
pri_message(ctrl, "Kick starting link when awaiting TEI.\n");
|
||||
}
|
||||
q921_setstate(link, Q921_ESTABLISH_AWAITING_TEI);
|
||||
break;
|
||||
@@ -586,6 +589,8 @@ static void restart_timer_expire(void *vlink)
|
||||
link->restart_timer = 0;
|
||||
|
||||
switch (link->state) {
|
||||
case Q921_TEI_UNASSIGNED:
|
||||
case Q921_ASSIGN_AWAITING_TEI:
|
||||
case Q921_TEI_ASSIGNED:
|
||||
/* Try to bring layer 2 up. */
|
||||
kick_start_link(link);
|
||||
@@ -807,7 +812,7 @@ static void q921_reject(struct q921_link *link, int pf)
|
||||
|
||||
ctrl = link->ctrl;
|
||||
|
||||
Q921_INIT(link, h);
|
||||
Q921_CLEAR_INIT(&h, link->sapi, link->tei);
|
||||
h.s.x0 = 0; /* Always 0 */
|
||||
h.s.ss = 2; /* Reject */
|
||||
h.s.ft = 1; /* Frametype (01) */
|
||||
@@ -837,7 +842,7 @@ static void q921_rr(struct q921_link *link, int pbit, int cmd)
|
||||
|
||||
ctrl = link->ctrl;
|
||||
|
||||
Q921_INIT(link, h);
|
||||
Q921_CLEAR_INIT(&h, link->sapi, link->tei);
|
||||
h.s.x0 = 0; /* Always 0 */
|
||||
h.s.ss = 0; /* Receive Ready */
|
||||
h.s.ft = 1; /* Frametype (01) */
|
||||
@@ -1064,7 +1069,7 @@ int q921_transmit_iframe(struct q921_link *link, void *buf, int len, int cr)
|
||||
|
||||
f = calloc(1, sizeof(struct q921_frame) + len + 2);
|
||||
if (f) {
|
||||
Q921_INIT(link, f->h);
|
||||
Q921_INIT(&f->h, link->sapi, link->tei);
|
||||
switch (ctrl->localtype) {
|
||||
case PRI_NETWORK:
|
||||
if (cr)
|
||||
@@ -1394,12 +1399,6 @@ static void t201_expire(void *vctrl)
|
||||
|
||||
ctrl = vctrl;
|
||||
|
||||
if (!ctrl->link.next) {
|
||||
/* No TEI links remain. */
|
||||
ctrl->t201_timer = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Start the TEI check timer. */
|
||||
ctrl->t201_timer =
|
||||
pri_schedule_event(ctrl, ctrl->timers[PRI_TIMER_T201], t201_expire, ctrl);
|
||||
@@ -1460,7 +1459,7 @@ static void t201_expire(void *vctrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
q921_send_tei(ctrl, Q921_TEI_IDENTITY_CHECK_REQUEST, 0, Q921_TEI_GROUP, 1);
|
||||
q921_mdl_send(ctrl, Q921_TEI_IDENTITY_CHECK_REQUEST, 0, Q921_TEI_GROUP, 1);
|
||||
}
|
||||
|
||||
static void q921_tei_check(struct pri *ctrl)
|
||||
@@ -1473,7 +1472,19 @@ static void q921_tei_check(struct pri *ctrl)
|
||||
t201_expire(ctrl);
|
||||
}
|
||||
|
||||
static pri_event *q921_receive_MDL(struct pri *ctrl, q921_u *h, int len)
|
||||
static void q921_mdl_ignore(struct pri *ctrl, q921_u *h, const char *reason)
|
||||
{
|
||||
if (ctrl->debug & PRI_DEBUG_Q921_STATE) {
|
||||
/*
|
||||
* Send out this message in debug modes since it is possible the
|
||||
* user has misconfigured their link for the wrong mode.
|
||||
*/
|
||||
pri_message(ctrl, "Ignoring MDL message: %d(%s) %s\n",
|
||||
h->data[3], q921_tei_mgmt2str(h->data[3]), reason);
|
||||
}
|
||||
}
|
||||
|
||||
static pri_event *q921_mdl_receive(struct pri *ctrl, q921_u *h, int len)
|
||||
{
|
||||
int ri;
|
||||
struct q921_link *sub;
|
||||
@@ -1483,32 +1494,13 @@ static pri_event *q921_receive_MDL(struct pri *ctrl, q921_u *h, int len)
|
||||
int count;
|
||||
int tei;
|
||||
|
||||
if (!BRI_NT_PTMP(ctrl) && !BRI_TE_PTMP(ctrl)) {
|
||||
/*
|
||||
* Some telco switches send out MDL messages even though they
|
||||
* are configured for PTP. Usually they are checking for
|
||||
* assigned TEI's.
|
||||
*/
|
||||
if (ctrl->debug & PRI_DEBUG_Q921_STATE) {
|
||||
/*
|
||||
* Send out this message in debug modes since it is possible the
|
||||
* user has misconfigured their link for the wrong mode.
|
||||
*/
|
||||
pri_message(ctrl, "Not configured for PTMP. Ignoring MDL message: %d(%s)\n",
|
||||
h->data[3], q921_tei_mgmt2str(h->data[3]));
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ctrl->debug & PRI_DEBUG_Q921_STATE) {
|
||||
pri_message(ctrl, "Received MDL message\n");
|
||||
}
|
||||
if (len <= &h->data[0] - (u_int8_t *) h) {
|
||||
pri_error(ctrl, "Received short frame\n");
|
||||
pri_error(ctrl, "Received short MDL frame\n");
|
||||
return NULL;
|
||||
}
|
||||
if (h->data[0] != 0x0f) {
|
||||
pri_error(ctrl, "Received MDL with unsupported management entity %02x\n", h->data[0]);
|
||||
pri_error(ctrl, "Received MDL with unsupported management entity %02x\n",
|
||||
h->data[0]);
|
||||
return NULL;
|
||||
}
|
||||
if (len <= &h->data[4] - (u_int8_t *) h) {
|
||||
@@ -1517,8 +1509,20 @@ static pri_event *q921_receive_MDL(struct pri *ctrl, q921_u *h, int len)
|
||||
}
|
||||
if (h->data[3] != Q921_TEI_IDENTITY_CHECK_RESPONSE
|
||||
&& !(h->data[4] & 0x01)) {
|
||||
pri_error(ctrl, "Received %d(%s) with Ai E bit not set.\n", h->data[3],
|
||||
q921_tei_mgmt2str(h->data[3]));
|
||||
pri_error(ctrl, "Received MDL message: %d(%s) with Ai E bit not set.\n",
|
||||
h->data[3], q921_tei_mgmt2str(h->data[3]));
|
||||
return NULL;
|
||||
}
|
||||
if (ctrl->debug & PRI_DEBUG_Q921_STATE) {
|
||||
pri_message(ctrl, "Received MDL message: %d(%s)\n",
|
||||
h->data[3], q921_tei_mgmt2str(h->data[3]));
|
||||
}
|
||||
if (PTP_MODE(ctrl) && NT_MODE(ctrl)) {
|
||||
/*
|
||||
* We are not managing automatic TEI's in this mode so we can
|
||||
* ignore MDL messages from the CPE.
|
||||
*/
|
||||
q921_mdl_ignore(ctrl, h, "We are in NT-PTP mode.");
|
||||
return NULL;
|
||||
}
|
||||
ri = (h->data[1] << 8) | h->data[2];
|
||||
@@ -1527,13 +1531,14 @@ static pri_event *q921_receive_MDL(struct pri *ctrl, q921_u *h, int len)
|
||||
switch (h->data[3]) {
|
||||
case Q921_TEI_IDENTITY_REQUEST:
|
||||
if (!BRI_NT_PTMP(ctrl)) {
|
||||
q921_mdl_ignore(ctrl, h, "We are not in NT-PTMP mode.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (tei != Q921_TEI_GROUP) {
|
||||
pri_error(ctrl, "Received %s with invalid TEI %d\n",
|
||||
q921_tei_mgmt2str(Q921_TEI_IDENTITY_REQUEST), tei);
|
||||
q921_send_tei(ctrl, Q921_TEI_IDENTITY_DENIED, ri, tei, 1);
|
||||
q921_mdl_send(ctrl, Q921_TEI_IDENTITY_DENIED, ri, tei, 1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1548,7 +1553,7 @@ static pri_event *q921_receive_MDL(struct pri *ctrl, q921_u *h, int len)
|
||||
break;
|
||||
}
|
||||
pri_error(ctrl, "TEI pool exhausted. Reclaiming dead TEIs.\n");
|
||||
q921_send_tei(ctrl, Q921_TEI_IDENTITY_DENIED, ri, Q921_TEI_GROUP, 1);
|
||||
q921_mdl_send(ctrl, Q921_TEI_IDENTITY_DENIED, ri, Q921_TEI_GROUP, 1);
|
||||
q921_tei_check(ctrl);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1565,7 +1570,7 @@ static pri_event *q921_receive_MDL(struct pri *ctrl, q921_u *h, int len)
|
||||
}
|
||||
sub->next = link;
|
||||
q921_setstate(link, Q921_TEI_ASSIGNED);
|
||||
q921_send_tei(ctrl, Q921_TEI_IDENTITY_ASSIGNED, ri, tei, 1);
|
||||
q921_mdl_send(ctrl, Q921_TEI_IDENTITY_ASSIGNED, ri, tei, 1);
|
||||
|
||||
count = 0;
|
||||
for (sub = ctrl->link.next; sub; sub = sub->next) {
|
||||
@@ -1593,6 +1598,7 @@ static pri_event *q921_receive_MDL(struct pri *ctrl, q921_u *h, int len)
|
||||
break;
|
||||
case Q921_TEI_IDENTITY_CHECK_RESPONSE:
|
||||
if (!BRI_NT_PTMP(ctrl)) {
|
||||
/* Silently ignore the message since we never asked for the check. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1640,6 +1646,7 @@ static pri_event *q921_receive_MDL(struct pri *ctrl, q921_u *h, int len)
|
||||
break;
|
||||
case Q921_TEI_IDENTITY_VERIFY:
|
||||
if (!BRI_NT_PTMP(ctrl)) {
|
||||
q921_mdl_ignore(ctrl, h, "We are not in NT-PTMP mode.");
|
||||
return NULL;
|
||||
}
|
||||
if (tei == Q921_TEI_GROUP) {
|
||||
@@ -1650,11 +1657,20 @@ static pri_event *q921_receive_MDL(struct pri *ctrl, q921_u *h, int len)
|
||||
q921_tei_check(ctrl);
|
||||
break;
|
||||
case Q921_TEI_IDENTITY_ASSIGNED:
|
||||
if (NT_MODE(ctrl)) {
|
||||
/* We should not be receiving this message. */
|
||||
q921_mdl_ignore(ctrl, h, "We are the network.");
|
||||
return NULL;
|
||||
}
|
||||
if (!BRI_TE_PTMP(ctrl)) {
|
||||
/*
|
||||
* Silently ignore the message. It must not be for us
|
||||
* since we will never ask for one.
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Assuming we're operating on the specific TEI link here */
|
||||
/* We're operating on the specific TEI link here */
|
||||
link = ctrl->link.next;
|
||||
|
||||
switch (link->state) {
|
||||
@@ -1724,29 +1740,52 @@ static pri_event *q921_receive_MDL(struct pri *ctrl, q921_u *h, int len)
|
||||
}
|
||||
break;
|
||||
case Q921_TEI_IDENTITY_CHECK_REQUEST:
|
||||
if (!BRI_TE_PTMP(ctrl)) {
|
||||
if (NT_MODE(ctrl)) {
|
||||
/* We should not be receiving this message. */
|
||||
q921_mdl_ignore(ctrl, h, "We are the network.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Assuming we're operating on the specific TEI link here */
|
||||
link = ctrl->link.next;
|
||||
if (PTP_MODE(ctrl)) {
|
||||
/*
|
||||
* Some telco switches/devices get very unhappy if we don't
|
||||
* respond to the TEI check request with our permanently
|
||||
* assigned TEI.
|
||||
*/
|
||||
link = &ctrl->link;
|
||||
} else if (BRI_TE_PTMP(ctrl)) {
|
||||
/* We're operating on the specific TEI link here */
|
||||
link = ctrl->link.next;
|
||||
|
||||
if (link->state < Q921_TEI_ASSIGNED) {
|
||||
/* We do not have a TEI. */
|
||||
if (link->state < Q921_TEI_ASSIGNED) {
|
||||
/* We do not have a TEI. */
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
/* Should never get here. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* If it's addressed to the group TEI or to our TEI specifically, we respond */
|
||||
if (tei == Q921_TEI_GROUP || tei == link->tei) {
|
||||
q921_send_tei(ctrl, Q921_TEI_IDENTITY_CHECK_RESPONSE, random() % 65535, link->tei, 1);
|
||||
q921_mdl_send(ctrl, Q921_TEI_IDENTITY_CHECK_RESPONSE, random() % 65535, link->tei, 1);
|
||||
}
|
||||
break;
|
||||
case Q921_TEI_IDENTITY_REMOVE:
|
||||
if (NT_MODE(ctrl)) {
|
||||
/* We should not be receiving this message. */
|
||||
q921_mdl_ignore(ctrl, h, "We are the network.");
|
||||
return NULL;
|
||||
}
|
||||
if (!BRI_TE_PTMP(ctrl)) {
|
||||
/*
|
||||
* Silently ignore the message. If we are TE-PTP our
|
||||
* TEI is permanently assigned and cannot be removed.
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Assuming we're operating on the specific TEI link here */
|
||||
/* We're operating on the specific TEI link here */
|
||||
link = ctrl->link.next;
|
||||
|
||||
if (link->state < Q921_TEI_ASSIGNED) {
|
||||
@@ -1911,7 +1950,9 @@ static void q921_mdl_remove(struct q921_link *link)
|
||||
|
||||
switch (link->state) {
|
||||
case Q921_TEI_ASSIGNED:
|
||||
restart_timer_stop(link);
|
||||
if (mdl_free_me) {
|
||||
restart_timer_stop(link);
|
||||
}
|
||||
/* XXX: deviation! Since we don't have a UI queue, we just discard our I-queue */
|
||||
q921_discard_iqueue(link);
|
||||
q921_setstate(link, Q921_TEI_UNASSIGNED);
|
||||
@@ -2987,27 +3028,32 @@ static pri_event *__q921_receive_qualified(struct q921_link *link, q921_h *h, in
|
||||
|
||||
static pri_event *q921_handle_unmatched_frame(struct pri *ctrl, q921_h *h, int len)
|
||||
{
|
||||
if (h->h.tei < 64) {
|
||||
pri_error(ctrl, "Do not support manual TEI range. Discarding\n");
|
||||
if (!BRI_NT_PTMP(ctrl)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (h->h.tei < Q921_TEI_AUTO_FIRST) {
|
||||
if (ctrl->debug & PRI_DEBUG_Q921_STATE) {
|
||||
pri_message(ctrl, "Manual TEI range is not supported in NT-PTMP mode. Discarding\n");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (h->h.sapi != Q921_SAPI_CALL_CTRL) {
|
||||
pri_error(ctrl, "Message with SAPI other than CALL CTRL is discarded\n");
|
||||
if (ctrl->debug & PRI_DEBUG_Q921_STATE) {
|
||||
pri_message(ctrl, "Message with SAPI other than CALL CTRL is discarded\n");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* If we're NT-PTMP, this means an unrecognized TEI that we'll kill */
|
||||
if (BRI_NT_PTMP(ctrl)) {
|
||||
if (ctrl->debug & PRI_DEBUG_Q921_STATE) {
|
||||
pri_message(ctrl,
|
||||
"Could not find a layer 2 link for received frame with SAPI/TEI of %d/%d.\n",
|
||||
h->h.sapi, h->h.tei);
|
||||
pri_message(ctrl, "Sending TEI release, in order to re-establish TEI state\n");
|
||||
}
|
||||
|
||||
q921_tei_remove(ctrl, h->h.tei);
|
||||
/* This means an unrecognized TEI that we'll kill */
|
||||
if (ctrl->debug & PRI_DEBUG_Q921_STATE) {
|
||||
pri_message(ctrl,
|
||||
"Could not find a layer 2 link for received frame with SAPI/TEI of %d/%d.\n",
|
||||
h->h.sapi, h->h.tei);
|
||||
pri_message(ctrl, "Sending TEI release, in order to re-establish TEI state\n");
|
||||
}
|
||||
q921_tei_remove(ctrl, h->h.tei);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -3031,7 +3077,7 @@ static pri_event *__q921_receive(struct pri *ctrl, q921_h *h, int len)
|
||||
}
|
||||
|
||||
if (h->h.sapi == Q921_SAPI_LAYER2_MANAGEMENT) {
|
||||
return q921_receive_MDL(ctrl, &h->u, len);
|
||||
return q921_mdl_receive(ctrl, &h->u, len);
|
||||
}
|
||||
|
||||
if (h->h.tei == Q921_TEI_GROUP && h->h.sapi != Q921_SAPI_CALL_CTRL) {
|
||||
|
||||
117
q931.c
117
q931.c
@@ -2807,7 +2807,8 @@ static int receive_progress_indicator(int full_ie, struct pri *ctrl, q931_call *
|
||||
{
|
||||
call->progloc = ie->data[0] & 0xf;
|
||||
call->progcode = (ie->data[0] & 0x60) >> 5;
|
||||
switch (call->progress = (ie->data[1] & 0x7f)) {
|
||||
call->progress = (ie->data[1] & 0x7f);
|
||||
switch (call->progress) {
|
||||
case Q931_PROG_CALL_NOT_E2E_ISDN:
|
||||
call->progressmask |= PRI_PROG_CALL_NOT_E2E_ISDN;
|
||||
break;
|
||||
@@ -3084,7 +3085,9 @@ static void q931_apdu_msg_expire(struct pri *ctrl, struct q931_call *call, int m
|
||||
|
||||
static int transmit_progress_indicator(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
|
||||
{
|
||||
int code, mask;
|
||||
int code;
|
||||
int mask;
|
||||
|
||||
/* Can't send progress indicator on GR-303 -- EVER! */
|
||||
if (ctrl->link.next && !ctrl->bri)
|
||||
return 0;
|
||||
@@ -3475,38 +3478,73 @@ static char *pri_causeclass2str(int cause)
|
||||
static void dump_cause(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
|
||||
{
|
||||
int x;
|
||||
int cause_ind = 1;
|
||||
int data_ind = 2;
|
||||
|
||||
pri_message(ctrl,
|
||||
"%c %s (len=%2d) [ Ext: %d Coding: %s (%d) Spare: %d Location: %s (%d)\n",
|
||||
prefix, ie2str(full_ie), len, ie->data[0] >> 7,
|
||||
coding2str((ie->data[0] & 0x60) >> 5), (ie->data[0] & 0x60) >> 5,
|
||||
(ie->data[0] & 0x10) >> 4, loc2str(ie->data[0] & 0xf), ie->data[0] & 0xf);
|
||||
if ((ie->data[0] & 0x80) == 0) {
|
||||
const char *recommendation;
|
||||
|
||||
switch (ie->data[1] & 0x7f) {
|
||||
case 0x00:
|
||||
recommendation = "Q.931";
|
||||
break;
|
||||
case 0x03:
|
||||
recommendation = "X.21";
|
||||
break;
|
||||
case 0x04:
|
||||
recommendation = "X.25";
|
||||
break;
|
||||
case 0x05:
|
||||
recommendation = "Q.1031/Q.1051";
|
||||
break;
|
||||
default:
|
||||
recommendation = "Reserved";
|
||||
break;
|
||||
}
|
||||
pri_message(ctrl, "%c Ext: %d Recommendation: %s (%d)\n",
|
||||
prefix, (ie->data[1] >> 7), recommendation, ie->data[1] & 0x7f);
|
||||
|
||||
cause_ind = 2;
|
||||
data_ind = 3;
|
||||
}
|
||||
pri_message(ctrl, "%c Ext: %d Cause: %s (%d), class = %s (%d) ]\n",
|
||||
prefix, (ie->data[1] >> 7), pri_cause2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f,
|
||||
pri_causeclass2str((ie->data[1] & 0x7f) >> 4), (ie->data[1] & 0x7f) >> 4);
|
||||
if (ie->len < 3)
|
||||
prefix, (ie->data[cause_ind] >> 7), pri_cause2str(ie->data[cause_ind] & 0x7f), ie->data[cause_ind] & 0x7f,
|
||||
pri_causeclass2str((ie->data[cause_ind] & 0x7f) >> 4), (ie->data[cause_ind] & 0x7f) >> 4);
|
||||
if (ie->len <= data_ind) {
|
||||
return;
|
||||
}
|
||||
/* Dump cause data in readable form */
|
||||
switch(ie->data[1] & 0x7f) {
|
||||
switch(ie->data[cause_ind] & 0x7f) {
|
||||
case PRI_CAUSE_IE_NONEXIST:
|
||||
for (x=2;x<ie->len;x++)
|
||||
for (x = data_ind; x < ie->len; x++) {
|
||||
pri_message(ctrl, "%c Cause data %d: %02x (%d, %s IE)\n", prefix, x-1, ie->data[x], ie->data[x], ie2str(ie->data[x]));
|
||||
}
|
||||
break;
|
||||
case PRI_CAUSE_WRONG_CALL_STATE:
|
||||
for (x=2;x<ie->len;x++)
|
||||
for (x = data_ind; x < ie->len; x++) {
|
||||
pri_message(ctrl, "%c Cause data %d: %02x (%d, %s message)\n", prefix, x-1, ie->data[x], ie->data[x], msg2str(ie->data[x]));
|
||||
}
|
||||
break;
|
||||
case PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE:
|
||||
pri_message(ctrl, "%c Cause data:", prefix);
|
||||
for (x=2;x<ie->len;x++)
|
||||
for (x = data_ind; x < ie->len; x++) {
|
||||
pri_message(ctrl, " %02x", ie->data[x]);
|
||||
}
|
||||
pri_message(ctrl, " (Timer T");
|
||||
for (x=2;x<ie->len;x++)
|
||||
for (x = data_ind; x < ie->len; x++) {
|
||||
pri_message(ctrl, "%c", ((ie->data[x] >= ' ') && (ie->data[x] < 0x7f)) ? ie->data[x] : '.');
|
||||
}
|
||||
pri_message(ctrl, ")\n");
|
||||
break;
|
||||
default:
|
||||
for (x=2;x<ie->len;x++)
|
||||
for (x = data_ind; x < ie->len; x++) {
|
||||
pri_message(ctrl, "%c Cause data %d: %02x (%d)\n", prefix, x-1, ie->data[x], ie->data[x]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3515,7 +3553,11 @@ static int receive_cause(int full_ie, struct pri *ctrl, q931_call *call, int msg
|
||||
{
|
||||
call->causeloc = ie->data[0] & 0xf;
|
||||
call->causecode = (ie->data[0] & 0x60) >> 5;
|
||||
call->cause = (ie->data[1] & 0x7f);
|
||||
if (ie->data[0] & 0x80) {
|
||||
call->cause = (ie->data[1] & 0x7f);
|
||||
} else {
|
||||
call->cause = (ie->data[2] & 0x7f);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5574,8 +5616,6 @@ int q931_notify(struct pri *ctrl, q931_call *c, int channel, int info)
|
||||
#ifdef ALERTING_NO_PROGRESS
|
||||
static int call_progress_ies[] = { -1 };
|
||||
#else
|
||||
static int call_progress_with_cause_ies[] = { Q931_CAUSE, Q931_PROGRESS_INDICATOR, -1 };
|
||||
|
||||
static int call_progress_ies[] = { Q931_PROGRESS_INDICATOR, -1 };
|
||||
#endif
|
||||
|
||||
@@ -5605,6 +5645,12 @@ int q931_call_progress(struct pri *ctrl, q931_call *c, int channel, int info)
|
||||
return send_message(ctrl, c, Q931_PROGRESS, call_progress_ies);
|
||||
}
|
||||
|
||||
#ifdef ALERTING_NO_PROGRESS
|
||||
static int call_progress_with_cause_ies[] = { Q931_CAUSE, -1 };
|
||||
#else
|
||||
static int call_progress_with_cause_ies[] = { Q931_CAUSE, Q931_PROGRESS_INDICATOR, -1 };
|
||||
#endif
|
||||
|
||||
int q931_call_progress_with_cause(struct pri *ctrl, q931_call *c, int channel, int info, int cause)
|
||||
{
|
||||
if (c->ourcallstate == Q931_CALL_STATE_CALL_INDEPENDENT_SERVICE) {
|
||||
@@ -5712,9 +5758,14 @@ int q931_alerting(struct pri *ctrl, q931_call *c, int channel, int info)
|
||||
return send_message(ctrl, c, Q931_ALERTING, alerting_ies);
|
||||
}
|
||||
|
||||
static int setup_ack_ies[] = { Q931_CHANNEL_IDENT, Q931_IE_FACILITY, Q931_PROGRESS_INDICATOR, -1 };
|
||||
static int setup_ack_ies[] = {
|
||||
Q931_CHANNEL_IDENT,
|
||||
Q931_IE_FACILITY,
|
||||
Q931_PROGRESS_INDICATOR,
|
||||
-1
|
||||
};
|
||||
|
||||
int q931_setup_ack(struct pri *ctrl, q931_call *c, int channel, int nonisdn)
|
||||
int q931_setup_ack(struct pri *ctrl, q931_call *c, int channel, int nonisdn, int inband)
|
||||
{
|
||||
if (c->ourcallstate == Q931_CALL_STATE_CALL_INDEPENDENT_SERVICE) {
|
||||
/* Cannot send this message when in this state */
|
||||
@@ -5727,12 +5778,20 @@ int q931_setup_ack(struct pri *ctrl, q931_call *c, int channel, int nonisdn)
|
||||
}
|
||||
c->chanflags &= ~FLAG_PREFERRED;
|
||||
c->chanflags |= FLAG_EXCLUSIVE;
|
||||
|
||||
c->progressmask = 0;
|
||||
if (nonisdn && (ctrl->switchtype != PRI_SWITCH_DMS100)) {
|
||||
c->progloc = LOC_PRIV_NET_LOCAL_USER;
|
||||
c->progloc = LOC_PRIV_NET_LOCAL_USER;
|
||||
c->progcode = CODE_CCITT;
|
||||
c->progressmask = PRI_PROG_CALLED_NOT_ISDN;
|
||||
} else
|
||||
c->progressmask = 0;
|
||||
c->progressmask |= PRI_PROG_CALLED_NOT_ISDN;
|
||||
}
|
||||
if (inband) {
|
||||
/* Inband audio is present (i.e. dialtone) */
|
||||
c->progloc = LOC_PRIV_NET_LOCAL_USER;
|
||||
c->progcode = CODE_CCITT;
|
||||
c->progressmask |= PRI_PROG_INBAND_AVAILABLE;
|
||||
}
|
||||
|
||||
UPDATE_OURCALLSTATE(ctrl, c, Q931_CALL_STATE_OVERLAP_RECEIVING);
|
||||
c->peercallstate = Q931_CALL_STATE_OVERLAP_SENDING;
|
||||
c->alive = 1;
|
||||
@@ -5833,7 +5892,7 @@ int q931_connect(struct pri *ctrl, q931_call *c, int channel, int nonisdn)
|
||||
c->chanflags &= ~FLAG_PREFERRED;
|
||||
c->chanflags |= FLAG_EXCLUSIVE;
|
||||
if (nonisdn && (ctrl->switchtype != PRI_SWITCH_DMS100)) {
|
||||
c->progloc = LOC_PRIV_NET_LOCAL_USER;
|
||||
c->progloc = LOC_PRIV_NET_LOCAL_USER;
|
||||
c->progcode = CODE_CCITT;
|
||||
c->progressmask = PRI_PROG_CALLED_NOT_ISDN;
|
||||
} else
|
||||
@@ -7200,6 +7259,7 @@ static int prepare_to_handle_q931_message(struct pri *ctrl, q931_mh *mh, q931_ca
|
||||
c->useruserinfo[0] = '\0';
|
||||
c->cause = -1;
|
||||
/* Fall through */
|
||||
case Q931_SETUP_ACKNOWLEDGE:
|
||||
case Q931_CALL_PROCEEDING:
|
||||
c->progress = -1;
|
||||
c->progressmask = 0;
|
||||
@@ -7246,8 +7306,6 @@ static int prepare_to_handle_q931_message(struct pri *ctrl, q931_mh *mh, q931_ca
|
||||
break;
|
||||
case Q931_STATUS_ENQUIRY:
|
||||
break;
|
||||
case Q931_SETUP_ACKNOWLEDGE:
|
||||
break;
|
||||
case Q931_NOTIFY:
|
||||
c->notify = -1;
|
||||
q931_party_number_init(&c->redirection_number);
|
||||
@@ -8767,6 +8825,18 @@ static int post_handle_q931_message(struct pri *ctrl, struct q931_mh *mh, struct
|
||||
(c->ourcallstate != Q931_CALL_STATE_OVERLAP_SENDING) &&
|
||||
(c->ourcallstate != Q931_CALL_STATE_CALL_DELIVERED) &&
|
||||
(c->ourcallstate != Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING)) {
|
||||
if (mh->msg == Q931_PROGRESS
|
||||
&& c->ourcallstate == Q931_CALL_STATE_ACTIVE
|
||||
&& ctrl->switchtype == PRI_SWITCH_QSIG) {
|
||||
/*
|
||||
* Q.SIG is odd to allow PROGRESS when in the Active state since
|
||||
* the media path is already open. Ignore it since it doesn't
|
||||
* convey anything very useful. Maybe they will stop doing it.
|
||||
*
|
||||
* See ECMA-143 Section 10.1.7.2.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
q931_status(ctrl,c,PRI_CAUSE_WRONG_MESSAGE);
|
||||
break;
|
||||
}
|
||||
@@ -9144,6 +9214,7 @@ static int post_handle_q931_message(struct pri *ctrl, struct q931_mh *mh, struct
|
||||
ctrl->ev.setup_ack.subcmds = &ctrl->subcmds;
|
||||
ctrl->ev.setup_ack.channel = q931_encode_channel(c);
|
||||
ctrl->ev.setup_ack.call = c->master_call;
|
||||
ctrl->ev.setup_ack.progressmask = c->progressmask;
|
||||
|
||||
for (cur = c->apdus; cur; cur = cur->next) {
|
||||
if (!cur->sent && cur->message == Q931_FACILITY) {
|
||||
|
||||
Reference in New Issue
Block a user