[asterisk-commits] rmudgett: branch 1.6.2 r182409 - in /branches/1.6.2: ./ channels/chan_dahdi.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Mar 16 21:02:06 CDT 2009
Author: rmudgett
Date: Mon Mar 16 21:02:03 2009
New Revision: 182409
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=182409
Log:
Merged revisions 182408 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r182408 | rmudgett | 2009-03-16 20:54:53 -0500 (Mon, 16 Mar 2009) | 8 lines
OPENR2 uses an incorrect string value if the extension delimiter is not present.
* Fixed OPENR2 using an incorrect string value if the extension
delimiter is not present in the Dial() function. This was fixed for
SS7 and PRI in trunk -r172400.
* Made OPENR2 stripmsd behavior the same as the SS7, PRI, and others.
* Removed trailing whitespace that appeared with OPENR2.
........
Modified:
branches/1.6.2/ (props changed)
branches/1.6.2/channels/chan_dahdi.c
Propchange: branches/1.6.2/
------------------------------------------------------------------------------
--- trunk-merged (original)
+++ trunk-merged Mon Mar 16 21:02:03 2009
@@ -1,1 +1,1 @@
-/trunk:1-182359
+/trunk:1-182359,182408
Modified: branches/1.6.2/channels/chan_dahdi.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.2/channels/chan_dahdi.c?view=diff&rev=182409&r1=182408&r2=182409
==============================================================================
--- branches/1.6.2/channels/chan_dahdi.c (original)
+++ branches/1.6.2/channels/chan_dahdi.c Mon Mar 16 21:02:03 2009
@@ -467,7 +467,7 @@
struct dahdi_pvt *pvts[MAX_CHANNELS]; /*!< Member channel pvt structs */
int numchans; /*!< Number of channels in this R2 block */
int monitored_count; /*!< Number of channels being monitored */
- ast_mutex_t monitored_count_lock; /*!< lock access to the counter */
+ ast_mutex_t monitored_count_lock; /*!< lock access to the counter */
ast_cond_t do_monitor; /*!< Condition to wake up the monitor thread when there's work to do */
};
@@ -492,9 +492,9 @@
};
/* malloc'd array of malloc'd r2links */
-static struct dahdi_mfcr2 **r2links;
+static struct dahdi_mfcr2 **r2links;
/* how many r2links have been malloc'd */
-static int r2links_count = 0;
+static int r2links_count = 0;
#endif /* HAVE_OPENR2 */
@@ -1615,14 +1615,14 @@
const char *double_answer = pbx_builtin_getvar_helper(p->owner, "MFCR2_DOUBLE_ANSWER");
int wants_double_answer = ast_true(double_answer) ? 1 : 0;
if (!double_answer) {
- /* this still can result in double answer if the channel context
+ /* this still can result in double answer if the channel context
* was configured that way */
res = openr2_chan_answer_call(p->r2chan);
} else if (wants_double_answer) {
res = openr2_chan_answer_call_with_mode(p->r2chan, OR2_ANSWER_DOUBLE);
} else {
res = openr2_chan_answer_call_with_mode(p->r2chan, OR2_ANSWER_SIMPLE);
- }
+ }
#else
res = openr2_chan_answer_call(p->r2chan);
#endif
@@ -1768,7 +1768,7 @@
p->channel, p->exten, p->context);
openr2_chan_disconnect_call(r2chan, OR2_CAUSE_UNALLOCATED_NUMBER);
return;
- }
+ }
if (!p->mfcr2_accept_on_offer) {
/* The user wants us to start the PBX thread right away without accepting the call first */
c = dahdi_new(p, AST_STATE_RING, 1, SUB_REAL, DAHDI_LAW_ALAW, 0);
@@ -1778,7 +1778,7 @@
the call or reject it and detect the tone off condition of the other end, all of this
will be done in the PBX thread now */
return;
- }
+ }
ast_log(LOG_WARNING, "Unable to create PBX channel in DAHDI channel %d\n", p->channel);
openr2_chan_disconnect_call(r2chan, OR2_CAUSE_OUT_OF_ORDER);
} else if (p->mfcr2_charge_calls) {
@@ -1819,13 +1819,13 @@
if (p->mfcr2_answer_pending) {
ast_log(LOG_DEBUG, "Answering MFC/R2 call after accepting it on chan %d\n", openr2_chan_get_number(r2chan));
dahdi_r2_answer(p);
- }
+ }
return;
- }
+ }
c = dahdi_new(p, AST_STATE_RING, 1, SUB_REAL, DAHDI_LAW_ALAW, 0);
if (c) {
dahdi_r2_update_monitor_count(p->mfcr2, 0);
- /* chan_dahdi will take care of reading from now on in the PBX thread, tell the
+ /* chan_dahdi will take care of reading from now on in the PBX thread, tell the
library to forget about it */
openr2_chan_disable_read(r2chan);
return;
@@ -1834,12 +1834,12 @@
/* failed to create the channel, bail out and report it as an out of order line */
openr2_chan_disconnect_call(r2chan, OR2_CAUSE_OUT_OF_ORDER);
return;
- }
+ }
/* this is an outgoing call, no need to launch the PBX thread, most likely we're in one already */
ast_log(LOG_NOTICE, "Call accepted on forward channel %d\n", p->channel);
p->subs[SUB_REAL].needringing = 1;
p->dialing = 0;
- /* chan_dahdi will take care of reading from now on in the PBX thread, tell the
+ /* chan_dahdi will take care of reading from now on in the PBX thread, tell the
library to forget about it */
openr2_chan_disable_read(r2chan);
}
@@ -3541,28 +3541,29 @@
#ifdef HAVE_OPENR2
if (p->mfcr2) {
openr2_calling_party_category_t chancat;
- int strip = p->stripmsd;
int callres = 0;
+
c = strchr(dest, '/');
if (c) {
c++;
} else {
- c = dest;
+ c = "";
}
if (!p->hidecallerid) {
l = ast->cid.cid_num;
} else {
l = NULL;
}
- if (strlen(c) < strip) {
- ast_log(LOG_WARNING, "Destiny number '%s' is shorter than stripmsd(%d)? hum, you should fix that. Assuming stripmsd = 0\n", c, strip);
- strip = 0;
+ if (strlen(c) < p->stripmsd) {
+ ast_log(LOG_WARNING, "Number '%s' is shorter than stripmsd (%d)\n", c, p->stripmsd);
+ ast_mutex_unlock(&p->lock);
+ return -1;
}
p->dialing = 1;
ast_channel_lock(ast);
chancat = dahdi_r2_get_channel_category(ast);
ast_channel_unlock(ast);
- callres = openr2_chan_make_call(p->r2chan, l, (c + strip), chancat);
+ callres = openr2_chan_make_call(p->r2chan, l, (c + p->stripmsd), chancat);
if (-1 == callres) {
ast_mutex_unlock(&p->lock);
ast_log(LOG_ERROR, "unable to make new MFC/R2 call!\n");
@@ -4301,7 +4302,7 @@
r2cause = OR2_CAUSE_NORMAL_CLEARING;
break;
}
- ast_log(LOG_DEBUG, "dahdi_ast_cause_to_r2_cause returned %d/%s for ast cause %d\n",
+ ast_log(LOG_DEBUG, "dahdi_ast_cause_to_r2_cause returned %d/%s for ast cause %d\n",
r2cause, openr2_proto_get_disconnect_string(r2cause), cause);
return r2cause;
}
@@ -4490,7 +4491,7 @@
if ((bpres = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SET_BUFINFO, &bi)) < 0) {
ast_log(LOG_WARNING, "Channel '%s' unable to revert faxbuffer policy: %s\n", ast->name, strerror(errno));
}
- p->faxbuffersinuse = 0;
+ p->faxbuffersinuse = 0;
}
law = DAHDI_LAW_DEFAULT;
@@ -5625,7 +5626,7 @@
.numbufs = p->faxbuf_no
};
int res;
-
+
if ((res = ioctl(p->subs[idx].dfd, DAHDI_SET_BUFINFO, &bi)) < 0) {
ast_log(LOG_WARNING, "Channel '%s' unable to set faxbuffer policy, reason: %s\n", ast->name, strerror(errno));
} else {
@@ -5763,7 +5764,7 @@
case DAHDI_EVENT_DIALCOMPLETE:
#ifdef HAVE_OPENR2
if ((p->sig & SIG_MFCR2) && p->r2chan && ast->_state != AST_STATE_UP) {
- /* we don't need to do anything for this event for R2 signaling
+ /* we don't need to do anything for this event for R2 signaling
if the call is being setup */
break;
}
@@ -6771,10 +6772,10 @@
p->subs[idx].f.subclass = AST_CONTROL_ANSWER;
ast_mutex_unlock(&p->lock);
return &p->subs[idx].f;
- }
+ }
#ifdef HAVE_OPENR2
if (p->mfcr2 && openr2_chan_get_read_enabled(p->r2chan)) {
- /* openr2 took care of reading and handling any event
+ /* openr2 took care of reading and handling any event
(needanswer, needbusy etc), if we continue we will read()
twice, lets just return a null frame. This should only
happen when openr2 is dialing out */
@@ -7122,7 +7123,7 @@
/* if this is an R2 call and the call is not yet accepted, we don't want the
tone indications to mess up with the MF tones */
return 0;
- }
+ }
#endif
if (idx == SUB_REAL) {
switch (condition) {
@@ -9817,7 +9818,7 @@
{
struct dahdi_mfcr2 *new_r2link = NULL;
struct dahdi_mfcr2 **new_r2links = NULL;
- /* this function is called just when starting up and no monitor threads have been launched,
+ /* this function is called just when starting up and no monitor threads have been launched,
no need to lock monitored_count member */
if (!r2links_count || (r2links[r2links_count - 1]->monitored_count == R2_LINK_CAPACITY)) {
new_r2link = ast_calloc(1, sizeof(**r2links));
@@ -9846,8 +9847,8 @@
char logdir[OR2_MAX_PATH];
int threshold = 0;
int snres = 0;
- r2_link->protocol_context = openr2_context_new(NULL, &dahdi_r2_event_iface,
- &dahdi_r2_transcode_iface, conf->mfcr2.variant, conf->mfcr2.max_ani,
+ r2_link->protocol_context = openr2_context_new(NULL, &dahdi_r2_event_iface,
+ &dahdi_r2_transcode_iface, conf->mfcr2.variant, conf->mfcr2.max_ani,
conf->mfcr2.max_dnis);
if (!r2_link->protocol_context) {
return -1;
@@ -10058,7 +10059,7 @@
return NULL;
}
r2_link->pvts[r2_link->numchans++] = tmp;
- tmp->r2chan = openr2_chan_new_from_fd(r2_link->protocol_context,
+ tmp->r2chan = openr2_chan_new_from_fd(r2_link->protocol_context,
tmp->subs[SUB_REAL].dfd,
NULL, NULL);
if (!tmp->r2chan) {
@@ -11897,7 +11898,7 @@
if ((res < 0) && (errno != EINTR)) {
ast_log(LOG_ERROR, "going out, poll failed: %s\n", strerror(errno));
break;
- }
+ }
/* do we want to allow to cancel while processing events? */
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate);
for (i = 0; i < mfcr2->numchans; i++) {
@@ -13970,7 +13971,7 @@
if (channo != -1) {
ast_cli(a->fd, "MFC/R2 debugging set to '%s' for channel %d.\n", a->argv[3], p->channel);
break;
- }
+ }
}
if ((channo != -1) && !p) {
ast_cli(a->fd, "MFC/R2 channel %d not found.\n", channo);
@@ -14021,7 +14022,7 @@
ast_cli(a->fd, "MFC/R2 call files disabled for channel %d.\n", p->channel);
}
break;
- }
+ }
}
if ((channo != -1) && !p) {
ast_cli(a->fd, "MFC/R2 channel %d not found.\n", channo);
@@ -14068,7 +14069,7 @@
ast_mutex_unlock(&p->lock);
if (channo != -1) {
break;
- }
+ }
}
if ((channo != -1) && !p) {
ast_cli(a->fd, "MFC/R2 channel %d not found.\n", channo);
@@ -14108,7 +14109,7 @@
ast_mutex_unlock(&p->lock);
if (channo != -1) {
break;
- }
+ }
}
if ((channo != -1) && !p) {
ast_cli(a->fd, "MFC/R2 channel %d not found.\n", channo);
@@ -16727,7 +16728,7 @@
confp->mfcr2.category = openr2_proto_get_category(v->value);
if (OR2_CALLING_PARTY_CATEGORY_UNKNOWN == confp->mfcr2.category) {
confp->mfcr2.category = OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER;
- ast_log(LOG_WARNING, "Invalid MFC/R2 caller category '%s' at line %d. Using national subscriber as default.\n",
+ ast_log(LOG_WARNING, "Invalid MFC/R2 caller category '%s' at line %d. Using national subscriber as default.\n",
v->value, v->lineno);
}
} else if (!strcasecmp(v->name, "mfcr2_logging")) {
More information about the asterisk-commits
mailing list