summaryrefslogtreecommitdiff
path: root/channels/chan_misdn.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2012-10-05 18:42:14 +0000
committerRichard Mudgett <rmudgett@digium.com>2012-10-05 18:42:14 +0000
commit79baef5bbd71c0f77a633c85ebff4f7c2f11456f (patch)
tree9d98da2c05fa7d567efa8cd65f5f69b65f95cef6 /channels/chan_misdn.c
parent90f8c90b10c483be3064920bc8839af516212561 (diff)
Merged revisions 374515-374535 from
https://origsvn.digium.com/svn/asterisk/be/branches/C.3-bier ................ r374515 | rmudgett | 2012-10-04 17:52:36 -0500 (Thu, 04 Oct 2012) | 10 lines chan_misdn: Remove some deadcode * Made setup_bc() static. Patches: patch1_unused-code.diff (license #6372) patch uploaded by Guenther Kelleter Modified JIRA ABE-2882 ................ r374516 | rmudgett | 2012-10-04 18:01:01 -0500 (Thu, 04 Oct 2012) | 7 lines chan_misdn: Remove unused bchan states Patches: patch2_unused-states.diff (license #6372) patch uploaded by Guenther Kelleter JIRA ABE-2882 ................ r374517 | rmudgett | 2012-10-04 18:17:51 -0500 (Thu, 04 Oct 2012) | 16 lines chan_misdn: Remove unnecessary null pointer checks and checks for stack->nt * cleanup_bc() is always called with valid bc (or it would've crashed before). * Value of stack->nt is known in advance at some places. * Rename handle_event() to handle_event_te(), handle_frm() to handle_frm_te(). Patches: patch3_checks.diff (license #6372) patch uploaded by Guenther Kelleter Modified JIRA ABE-2882 ................ r374518 | rmudgett | 2012-10-04 18:21:59 -0500 (Thu, 04 Oct 2012) | 7 lines chan_misdn: Fix spelling in log messages Patches: patch4_spelling.diff (license #6372) patch uploaded by Guenther Kelleter JIRA ABE-2882 ................ r374519 | rmudgett | 2012-10-04 18:31:59 -0500 (Thu, 04 Oct 2012) | 15 lines chan_misdn: Don't cleanup a bc twice. In handle_frm_te() after calling misdn_lib_send_event(bc, EVENT_RELEASE_COMPLETE) bc is emptied, cleaned and set not in use, although misdn_lib_send_event() already did the same. This is bad. When it's not in use we are not allowed to touch it. * Moved log message in front of the resulting actions and fixed it to match the case. Patches: patch5_bccleanup.diff (license #6372) patch uploaded by Guenther Kelleter JIRA ABE-2882 ................ r374520 | rmudgett | 2012-10-04 18:43:56 -0500 (Thu, 04 Oct 2012) | 12 lines chan_misdn: Fix memory leaks, bc, chan not cleaned up etc., really bad stuff. * Fix return codes of cb_events() for EVENT_SETUP to use caller's cleanup mechanisms. * Move cl_queue_chan() call after bearer check. Patches: patch6_leaks.diff (license #6372) patch uploaded by Guenther Kelleter JIRA ABE-2882 ................ r374521 | rmudgett | 2012-10-04 18:48:38 -0500 (Thu, 04 Oct 2012) | 11 lines chan_misdn: We must initialize cause on sending a DISCONNECT. We must initialize cause on sending a DISCONNECT, so it is later correctly indicated to ast_channel in case the answer (RELEASE/RELEASE_COMPLETE) does not include one. Patches: patch7_hangupcause.diff (license #6372) patch uploaded by Guenther Kelleter JIRA ABE-2882 ................ r374522 | rmudgett | 2012-10-04 19:03:56 -0500 (Thu, 04 Oct 2012) | 7 lines chan_misdn: Remove unused code for upqueue Patches: patch8_unused-upqueue.diff (license #6372) patch uploaded by Guenther Kelleter JIRA ABE-2882 ................ r374523 | rmudgett | 2012-10-04 19:11:50 -0500 (Thu, 04 Oct 2012) | 7 lines chan_misdn: Improve debugging (port number, messages fixed, dups removed) Patches: patch9_debug.diff (license #6372) patch uploaded by Guenther Kelleter JIRA ABE-2882 ................ r374533 | rmudgett | 2012-10-05 12:17:18 -0500 (Fri, 05 Oct 2012) | 8 lines chan_misdn: Better debug: we can print_bc_info even if there's no ast leg. Patches: patch10_debug-bc-2.diff (license #6372) patch uploaded by Guenther Kelleter Modified. JIRA ABE-2882 ................ r374534 | rmudgett | 2012-10-05 12:34:10 -0500 (Fri, 05 Oct 2012) | 16 lines chan_misdn: setup_bc() is called too early for an incoming SETUP on TE. This prevents the B channel from being setup for HDLC mode when requested by the bearer capability and config option hdlc=yes. It violates ETS300102 Ch.5.2.3.2: "The user, in any case, must not connect to the channel until a CONNECT ACKNOWLEDGE message has been received." * Call setup_bc() on receipt of CONNECT_ACKNOWLEGDE for PTMP, and on first response to SETUP for PTP. Patches: abe-2881-2.diff (license #6372) patch uploaded by Guenther Kelleter Modified. JIRA ABE-2881 ................ r374535 | rmudgett | 2012-10-05 12:41:05 -0500 (Fri, 05 Oct 2012) | 2 lines chan_misdn: Remove some more deadcode. ................ ........ Merged revisions 374536 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 374537 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 374538 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_misdn.c')
-rw-r--r--channels/chan_misdn.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index 5a36e9365..2f93d0989 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -4189,7 +4189,7 @@ static void print_bc_info(int fd, struct chan_list *help, struct misdn_bchannel
#endif
" --> notone : rx %d tx:%d\n"
" --> bc_hold: %d\n",
- ast_channel_name(help->ast),
+ ast ? ast_channel_name(ast) : "",
help->l3id,
help->addr,
bc->addr,
@@ -4245,7 +4245,6 @@ static char *handle_cli_misdn_show_channels(struct ast_cli_entry *e, int cmd, st
continue;
}
ast_cli(a->fd, "bc with pid:%d has no Ast Leg\n", bc->pid);
- continue;
}
if (misdn_debug[0] > 2) {
@@ -6965,7 +6964,7 @@ static int misdn_indication(struct ast_channel *ast, int cond, const void *data,
return -1;
}
- chan_misdn_log(5, p->bc->port, "* IND : Indication [%d] on %s\n\n", cond, ast_channel_name(ast));
+ chan_misdn_log(5, p->bc->port, "* IND : Indication [%d] on %s\n", cond, ast_channel_name(ast));
switch (cond) {
case AST_CONTROL_BUSY:
@@ -8181,7 +8180,7 @@ static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char
tmp = ast_channel_alloc(1, state, cid_num, cid_name, "", exten, "", linkedid, 0, "%s/%s%d-u%d", misdn_type, c ? "" : "tmp", chan_offset + c, glob_channel++);
if (tmp) {
- chan_misdn_log(2, 0, " --> * NEW CHANNEL dialed:%s caller:%s\n", exten, callerid);
+ chan_misdn_log(2, port, " --> * NEW CHANNEL dialed:%s caller:%s\n", exten, callerid);
ast_best_codec(cap, &tmpfmt);
ast_format_cap_add(ast_channel_nativeformats(tmp), &prefformat);
@@ -8419,14 +8418,13 @@ static int pbx_start_chan(struct chan_list *ch)
static void hangup_chan(struct chan_list *ch, struct misdn_bchannel *bc)
{
- int port;
+ int port = bc->port;
if (!ch) {
- cb_log(1, 0, "Cannot hangup chan, no ch\n");
+ cb_log(1, port, "Cannot hangup chan, no ch\n");
return;
}
- port = bc->port;
cb_log(5, port, "hangup_chan called\n");
if (ch->need_hangup) {
@@ -10203,7 +10201,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
ch = chan_list_init(ORG_MISDN);
if (!ch) {
chan_misdn_log(-1, bc->port, "cb_events: malloc for chan_list failed!\n");
- return 0;
+ return RESPONSE_RELEASE_SETUP;
}
ch->bc = bc;
@@ -10222,9 +10220,8 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
}
if (!chan) {
chan_list_unref(ch, "Failed to create a new channel");
- misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
- ast_log(LOG_ERROR, "cb_events: misdn_new failed !\n");
- return 0;
+ ast_log(LOG_ERROR, "cb_events: misdn_new failed!\n");
+ return RESPONSE_RELEASE_SETUP;
}
if ((exceed = add_in_calls(bc->port))) {
@@ -10283,9 +10280,6 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
break;
}
- /** queue new chan **/
- cl_queue_chan(ch);
-
if (!strstr(ch->allowed_bearers, "all")) {
int i;
@@ -10305,15 +10299,17 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
/* We did not find the bearer capability */
chan_misdn_log(0, bc->port, "Bearer capability not allowed: %s(%d)\n",
bearer2str(bc->capability), bc->capability);
- bc->out_cause = AST_CAUSE_INCOMPATIBLE_DESTINATION;
ch->state = MISDN_EXTCANTMATCH;
- misdn_lib_send_event(bc, EVENT_RELEASE_COMPLETE);
chan_list_unref(ch, "BC not allowed, releasing call");
- return RESPONSE_OK;
+ bc->out_cause = AST_CAUSE_INCOMPATIBLE_DESTINATION;
+ return RESPONSE_RELEASE_SETUP;
}
}
+ /** queue new chan **/
+ cl_queue_chan(ch);
+
if (bc->fac_in.Function != Fac_None) {
misdn_facility_ie_handler(event, bc, ch);
}
@@ -12759,7 +12755,7 @@ static void chan_misdn_log(int level, int port, char *tmpl, ...)
char port_buf[8];
if (!(0 <= port && port <= max_ports)) {
- ast_log(LOG_WARNING, "cb_log called with out-of-range port number! (%d)\n", port);
+ ast_log(LOG_WARNING, "chan_misdn_log called with out-of-range port number! (%d)\n", port);
port = 0;
level = -1;
} else if (!(level == -1