[asterisk-commits] mmichelson: branch mmichelson/features_config r389961 - /team/mmichelson/feat...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue May 28 16:04:31 CDT 2013
Author: mmichelson
Date: Tue May 28 16:04:27 2013
New Revision: 389961
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389961
Log:
Get the pickup extension in a more thread-safe manner.
Modified:
team/mmichelson/features_config/channels/chan_dahdi.c
team/mmichelson/features_config/channels/chan_mgcp.c
team/mmichelson/features_config/channels/chan_misdn.c
team/mmichelson/features_config/channels/chan_unistim.c
team/mmichelson/features_config/channels/sig_analog.c
Modified: team/mmichelson/features_config/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/channels/chan_dahdi.c?view=diff&rev=389961&r1=389960&r2=389961
==============================================================================
--- team/mmichelson/features_config/channels/chan_dahdi.c (original)
+++ team/mmichelson/features_config/channels/chan_dahdi.c Tue May 28 16:04:27 2013
@@ -10137,7 +10137,7 @@
return 0;
}
-static int canmatch_featurecode(struct ast_features_pickup_config *pickup_cfg, const char *exten)
+static int canmatch_featurecode(const char *pickupexten, const char *exten)
{
int extlen = strlen(exten);
@@ -10145,7 +10145,7 @@
return 1;
}
- if (extlen < strlen(pickup_cfg->pickupexten) && !strncmp(pickup_cfg->pickupexten, exten, extlen)) {
+ if (extlen < strlen(pickupexten) && !strncmp(pickupexten, exten, extlen)) {
return 1;
}
/* hardcoded features are *60, *67, *69, *70, *72, *73, *78, *79, *82, *0 */
@@ -10192,6 +10192,7 @@
int idx;
struct ast_format tmpfmt;
RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+ const char *pickupexten;
ast_mutex_lock(&ss_thread_lock);
ss_thread_count++;
@@ -10211,9 +10212,12 @@
ast_hangup(chan);
goto quit;
}
+
ast_channel_lock(chan);
pickup_cfg = ast_get_chan_features_pickup_config(chan);
+ pickupexten = ast_strdupa(pickup_cfg->pickupexten);
ast_channel_unlock(chan);
+
if (p->dsp)
ast_dsp_digitreset(p->dsp);
switch (p->sig) {
@@ -10580,7 +10584,7 @@
memset(exten, 0, sizeof(exten));
timeout = firstdigittimeout;
- } else if (!strcmp(exten, pickup_cfg->pickupexten)) {
+ } else if (!strcmp(exten, pickupexten)) {
/* Scan all channels and see if there are any
* ringing channels that have call groups
* that equal this channels pickup group
@@ -10712,7 +10716,7 @@
}
} else if (!ast_canmatch_extension(chan, ast_channel_context(chan), exten, 1,
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))
- && !canmatch_featurecode(pickup_cfg, exten)) {
+ && !canmatch_featurecode(pickupexten, exten)) {
ast_debug(1, "Can't match %s from '%s' in context %s\n", exten,
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "<Unknown Caller>"),
ast_channel_context(chan));
Modified: team/mmichelson/features_config/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/channels/chan_mgcp.c?view=diff&rev=389961&r1=389960&r2=389961
==============================================================================
--- team/mmichelson/features_config/channels/chan_mgcp.c (original)
+++ team/mmichelson/features_config/channels/chan_mgcp.c Tue May 28 16:04:27 2013
@@ -2973,11 +2973,13 @@
int getforward = 0;
int loop_pause = 100;
RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+ const char *pickupexten;
len = strlen(p->dtmf_buf);
ast_channel_lock(chan);
pickup_cfg = ast_get_chan_features_pickup_config(chan);
+ pickupexten = ast_strdupa(pickup_cfg->pickupexten);
ast_channel_unlock(chan);
while (len < AST_MAX_EXTENSION - 1) {
@@ -3071,7 +3073,7 @@
len = 0;
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
timeout = firstdigittimeout;
- } else if (!strcmp(p->dtmf_buf, pickup_cfg->pickupexten)) {
+ } else if (!strcmp(p->dtmf_buf, pickupexten)) {
/* Scan all channels and see if any there
* ringing channqels with that have call groups
* that equal this channels pickup group
Modified: team/mmichelson/features_config/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/channels/chan_misdn.c?view=diff&rev=389961&r1=389960&r2=389961
==============================================================================
--- team/mmichelson/features_config/channels/chan_misdn.c (original)
+++ team/mmichelson/features_config/channels/chan_misdn.c Tue May 28 16:04:27 2013
@@ -10073,6 +10073,8 @@
if (ch->state == MISDN_WAITING4DIGS) {
RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+ const char *pickupexten;
+
/* Ok, incomplete Setup, waiting till extension exists */
if (ast_strlen_zero(bc->info_dad) && ! ast_strlen_zero(bc->keypad)) {
chan_misdn_log(1, bc->port, " --> using keypad as info\n");
@@ -10084,10 +10086,11 @@
ast_channel_lock(ch->ast);
pickup_cfg = ast_get_chan_features_pickup_config(ch->ast);
+ pickupexten = ast_strdupa(pickup_cfg->pickupexten);
ast_channel_unlock(ch->ast);
/* Check for Pickup Request first */
- if (!strcmp(ast_channel_exten(ch->ast), pickup_cfg->pickupexten)) {
+ if (!strcmp(ast_channel_exten(ch->ast), pickupexten)) {
if (ast_pickup_call(ch->ast)) {
hangup_chan(ch, bc);
} else {
@@ -10176,6 +10179,7 @@
int im;
int append_msn = 0;
RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+ const char *pickupexten;
if (ch) {
switch (ch->state) {
@@ -10233,6 +10237,7 @@
ast_channel_lock(chan);
pickup_cfg = ast_get_chan_features_pickup_config(chan);
+ pickupexten = ast_strdupa(pickup_cfg->pickupexten);
ast_channel_unlock(chan);
if ((exceed = add_in_calls(bc->port))) {
@@ -10326,7 +10331,7 @@
}
/* Check for Pickup Request first */
- if (!strcmp(ast_channel_exten(chan), pickup_cfg->pickupexten)) {
+ if (!strcmp(ast_channel_exten(chan), pickupexten)) {
if (!ch->noautorespond_on_setup) {
/* Sending SETUP_ACK */
misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE);
Modified: team/mmichelson/features_config/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/channels/chan_unistim.c?view=diff&rev=389961&r1=389960&r2=389961
==============================================================================
--- team/mmichelson/features_config/channels/chan_unistim.c (original)
+++ team/mmichelson/features_config/channels/chan_unistim.c Tue May 28 16:04:27 2013
@@ -3088,6 +3088,8 @@
s->device->selected = -1;
if (!sub->owner) { /* A call is already in progress ? */
RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+ const char *pickupexten;
+
c = unistim_new(sub, AST_STATE_DOWN, NULL); /* No, starting a new one */
if (!sub->rtp) { /* Need to start RTP before calling ast_pbx_run */
start_rtp(sub);
@@ -3095,11 +3097,13 @@
if (c) {
ast_channel_lock(c);
pickup_cfg = ast_get_chan_features_pickup_config(c);
+ pickupexten = ast_strdupa(pickup_cfg->pickupexten);
ast_channel_unlock(c);
} else {
pickup_cfg = ast_get_chan_features_pickup_config(NULL);
- }
- if (c && !strcmp(s->device->phone_number, pickup_cfg->pickupexten)) {
+ pickupexten = ast_strdupa(pickup_cfg->pickupexten);
+ }
+ if (c && !strcmp(s->device->phone_number, pickupexten)) {
if (unistimdebug) {
ast_verb(0, "Try to pickup in unistim_new\n");
}
Modified: team/mmichelson/features_config/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/channels/sig_analog.c?view=diff&rev=389961&r1=389960&r2=389961
==============================================================================
--- team/mmichelson/features_config/channels/sig_analog.c (original)
+++ team/mmichelson/features_config/channels/sig_analog.c Tue May 28 16:04:27 2013
@@ -1709,13 +1709,13 @@
#define ANALOG_NEED_MFDETECT(p) (((p)->sig == ANALOG_SIG_FEATDMF) || ((p)->sig == ANALOG_SIG_FEATDMF_TA) || ((p)->sig == ANALOG_SIG_E911) || ((p)->sig == ANALOG_SIG_FGC_CAMA) || ((p)->sig == ANALOG_SIG_FGC_CAMAMF) || ((p)->sig == ANALOG_SIG_FEATB))
-static int analog_canmatch_featurecode(struct ast_features_pickup_config *pickup_cfg, const char *exten)
+static int analog_canmatch_featurecode(const char *pickupexten, const char *exten)
{
int extlen = strlen(exten);
if (!extlen) {
return 1;
}
- if (extlen < strlen(pickup_cfg->pickupexten) && !strncmp(pickup_cfg->pickupexten, exten, extlen)) {
+ if (extlen < strlen(pickupexten) && !strncmp(pickupexten, exten, extlen)) {
return 1;
}
/* hardcoded features are *60, *67, *69, *70, *72, *73, *78, *79, *82, *0 */
@@ -1756,6 +1756,7 @@
int idx;
struct ast_callid *callid;
RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+ const char *pickupexten;
analog_increase_ss_count();
@@ -1789,6 +1790,7 @@
ast_channel_lock(chan);
pickup_cfg = ast_get_chan_features_pickup_config(chan);
+ pickupexten = ast_strdupa(pickup_cfg->pickupexten);
ast_channel_unlock(chan);
analog_dsp_reset_and_flush_digits(p);
@@ -2195,7 +2197,7 @@
memset(exten, 0, sizeof(exten));
timeout = analog_firstdigittimeout;
- } else if (!strcmp(exten, pickup_cfg->pickupexten)) {
+ } else if (!strcmp(exten, pickupexten)) {
/* Scan all channels and see if there are any
* ringing channels that have call groups
* that equal this channels pickup group
@@ -2339,7 +2341,7 @@
}
} else if (!ast_canmatch_extension(chan, ast_channel_context(chan), exten, 1,
ast_channel_caller(chan)->id.number.valid ? ast_channel_caller(chan)->id.number.str : NULL)
- && !analog_canmatch_featurecode(pickup_cfg, exten)) {
+ && !analog_canmatch_featurecode(pickupexten, exten)) {
ast_debug(1, "Can't match %s from '%s' in context %s\n", exten,
ast_channel_caller(chan)->id.number.valid && ast_channel_caller(chan)->id.number.str
? ast_channel_caller(chan)->id.number.str : "<Unknown Caller>",
More information about the asterisk-commits
mailing list