[asterisk-commits] mmichelson: branch group/issue8824 r183820 - in /team/group/issue8824: apps/ ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Mar 23 16:14:00 CDT 2009
Author: mmichelson
Date: Mon Mar 23 16:13:56 2009
New Revision: 183820
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=183820
Log:
Address more of Russell's comments on review 201.
Modified:
team/group/issue8824/apps/app_queue.c
team/group/issue8824/channels/chan_misdn.c
team/group/issue8824/channels/chan_sip.c
team/group/issue8824/funcs/func_connectedline.c
team/group/issue8824/funcs/func_redirecting.c
team/group/issue8824/main/callerid.c
team/group/issue8824/main/channel.c
Modified: team/group/issue8824/apps/app_queue.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/apps/app_queue.c?view=diff&rev=183820&r1=183819&r2=183820
==============================================================================
--- team/group/issue8824/apps/app_queue.c (original)
+++ team/group/issue8824/apps/app_queue.c Mon Mar 23 16:13:56 2009
@@ -630,7 +630,7 @@
time_t lastcall;
struct call_queue *lastqueue;
struct member *member;
- int update_connectedline;
+ unsigned int update_connectedline:1;
struct ast_party_connected_line connected;
};
@@ -2441,7 +2441,12 @@
(*busies)++;
return 0;
}
-
+
+ ast_channel_lock(tmp->chan);
+ while (ast_channel_trylock(qe->chan)) {
+ CHANNEL_DEADLOCK_AVOIDANCE(tmp->chan);
+ }
+
if (qe->cancel_answered_elsewhere) {
ast_set_flag(tmp->chan, AST_FLAG_ANSWERED_ELSEWHERE);
}
@@ -2478,7 +2483,6 @@
tmp->chan->adsicpe = qe->chan->adsicpe;
/* Inherit context and extension */
- ast_channel_lock(qe->chan);
macrocontext = pbx_builtin_getvar_helper(qe->chan, "MACRO_CONTEXT");
ast_string_field_set(tmp->chan, dialcontext, ast_strlen_zero(macrocontext) ? qe->chan->context : macrocontext);
macroexten = pbx_builtin_getvar_helper(qe->chan, "MACRO_EXTEN");
@@ -2486,13 +2490,14 @@
ast_copy_string(tmp->chan->exten, macroexten, sizeof(tmp->chan->exten));
else
ast_copy_string(tmp->chan->exten, qe->chan->exten, sizeof(tmp->chan->exten));
- ast_channel_unlock(qe->chan);
/* Place the call, but don't wait on the answer */
if ((res = ast_call(tmp->chan, location, 0))) {
/* Again, keep going even if there's an error */
ast_debug(1, "ast call on peer returned %d\n", res);
ast_verb(3, "Couldn't call %s\n", tmp->interface);
+ ast_channel_unlock(tmp->chan);
+ ast_channel_unlock(qe->chan);
do_hang(tmp);
(*busies)++;
update_status(qe->parent, tmp->member, ast_device_state(tmp->member->state_interface));
@@ -2520,6 +2525,8 @@
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
ast_verb(3, "Called %s\n", tmp->interface);
}
+ ast_channel_unlock(tmp->chan);
+ ast_channel_unlock(qe->chan);
update_status(qe->parent, tmp->member, ast_device_state(tmp->member->state_interface));
return 1;
@@ -2828,9 +2835,12 @@
if (o->connected.id.number) {
ast_connected_line_update(in, &o->connected);
} else if (o->update_connectedline) {
- ast_party_connected_line_collect_caller(&connected_caller, &o->chan->cid);
+ ast_channel_lock(o->chan);
+ ast_copy_caller_to_connected(&connected_caller, &o->chan->cid);
+ ast_channel_unlock(o->chan);
connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
ast_connected_line_update(in, &connected_caller);
+ ast_party_connected_line_free(&connected_caller);
}
}
peer = o;
@@ -2872,6 +2882,10 @@
o->stillgoing = 0;
numnochan++;
} else {
+ ast_channel_lock(o->chan);
+ while (ast_channel_trylock(in)) {
+ CHANNEL_DEADLOCK_AVOIDANCE(o->chan);
+ }
ast_channel_inherit_variables(in, o->chan);
ast_channel_datastore_inherit(in, o->chan);
@@ -2902,6 +2916,8 @@
do_hang(o);
numnochan++;
}
+ ast_channel_unlock(in);
+ ast_channel_unlock(o->chan);
}
/* Hangup the original channel now, in case we needed it */
ast_hangup(winner);
@@ -2919,9 +2935,12 @@
if (o->connected.id.number) {
ast_connected_line_update(in, &o->connected);
} else if (o->update_connectedline) {
- ast_party_connected_line_collect_caller(&connected_caller, &o->chan->cid);
+ ast_channel_lock(o->chan);
+ ast_copy_caller_to_connected(&connected_caller, &o->chan->cid);
+ ast_channel_unlock(o->chan);
connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
ast_connected_line_update(in, &connected_caller);
+ ast_party_connected_line_free(&connected_caller);
}
}
peer = o;
Modified: team/group/issue8824/channels/chan_misdn.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/channels/chan_misdn.c?view=diff&rev=183820&r1=183819&r2=183820
==============================================================================
--- team/group/issue8824/channels/chan_misdn.c (original)
+++ team/group/issue8824/channels/chan_misdn.c Mon Mar 23 16:13:56 2009
@@ -611,10 +611,10 @@
case NUMTYPE_ABBREVIATED:
str = "Abbreviated";
break;
- } /* end switch */
+ }
return str;
-} /* end misdn_to_str_ton() */
+}
@@ -657,10 +657,10 @@
case NUMTYPE_ABBREVIATED:
ast_number_type = NUMTYPE_ABBREVIATED << 4;
break;
- } /* end switch */
+ }
return ast_number_type;
-} /* end misdn_to_ast_ton() */
+}
@@ -703,10 +703,10 @@
case NUMTYPE_ABBREVIATED:
number_type = NUMTYPE_ABBREVIATED;
break;
- } /* end switch */
+ }
return number_type;
-} /* end ast_to_misdn_ton() */
+}
@@ -749,10 +749,10 @@
case NUMPLAN_PRIVATE:
str = "Private";
break;
- } /* end switch */
+ }
return str;
-} /* end misdn_to_str_plan() */
+}
@@ -795,10 +795,10 @@
case NUMPLAN_PRIVATE:
ast_number_plan = NUMPLAN_PRIVATE;
break;
- } /* end switch */
+ }
return ast_number_plan;
-} /* end misdn_to_ast_plan() */
+}
@@ -841,10 +841,10 @@
case NUMPLAN_PRIVATE:
number_plan = NUMPLAN_PRIVATE;
break;
- } /* end switch */
+ }
return number_plan;
-} /* end ast_to_misdn_plan() */
+}
@@ -878,10 +878,10 @@
default:
str = "Unknown";
break;
- } /* end switch */
+ }
return str;
-} /* end misdn_to_str_pres() */
+}
@@ -910,10 +910,10 @@
case 2:
presentation = AST_PRES_UNAVAILABLE;
break;
- } /* end switch */
+ }
return presentation;
-} /* end misdn_to_ast_pres() */
+}
@@ -942,10 +942,10 @@
case AST_PRES_UNAVAILABLE:
presentation = 2;
break;
- } /* end switch */
+ }
return presentation;
-} /* end ast_to_misdn_pres() */
+}
@@ -983,10 +983,10 @@
default:
str = "Unknown";
break;
- } /* end switch */
+ }
return str;
-} /* end misdn_to_str_screen() */
+}
@@ -1019,10 +1019,10 @@
case 3:
screening = AST_PRES_NETWORK_NUMBER;
break;
- } /* end switch */
+ }
return screening;
-} /* end misdn_to_ast_screen() */
+}
@@ -1055,10 +1055,10 @@
case AST_PRES_NETWORK_NUMBER:
screening = 3;
break;
- } /* end switch */
+ }
return screening;
-} /* end ast_to_misdn_screen() */
+}
@@ -1100,9 +1100,9 @@
if (misdn_reason_table[index].ast == ast) {
return misdn_reason_table[index].q931;
}
- } /* end for */
+ }
return mISDN_REDIRECTING_REASON_UNKNOWN;
-} /* end ast_to_misdn_reason() */
+}
@@ -1149,10 +1149,10 @@
case mISDN_REDIRECTING_REASON_CALL_FWD:
ast = AST_REDIRECTING_REASON_UNCONDITIONAL;
break;
- } /* end switch */
+ }
return ast;
-} /* end misdn_to_ast_reason() */
+}
@@ -1183,7 +1183,7 @@
if (allowed_bearers_array[index].cap == cap) {
return allowed_bearers_array[index].display;
}
- } /* end for */
+ }
return "Unknown Bearer";
}
@@ -1302,7 +1302,7 @@
}
memcpy(str_main, str_prefix, len_prefix);
str_main[len_prefix + len_main] = 0;
-} /* end misdn_prefix_string() */
+}
@@ -1347,11 +1347,11 @@
default:
/* Type-of-number does not have a prefix that can be added. */
return;
- } /* end switch */
+ }
misdn_cfg_get(port, type_prefix, num_prefix, sizeof(num_prefix));
misdn_prefix_string(num_prefix, number, size);
-} /* end misdn_add_number_prefix() */
+}
static void export_aoc_vars(int originator, struct ast_channel *ast, struct misdn_bchannel *bc)
{
@@ -3081,7 +3081,7 @@
}
debug_numtype(bc->port, bc->caller.number_type, "LTON");
}
-} /* end misdn_update_connected_line() */
+}
@@ -3105,7 +3105,7 @@
bc->redirecting.from.number_type = ast_to_misdn_ton(ast->redirecting.from.number_type);
bc->redirecting.from.number_plan = ast_to_misdn_plan(ast->redirecting.from.number_type);
bc->redirecting.reason = ast_to_misdn_reason(ast->redirecting.reason);
-} /* end misdn_copy_redirecting_from_ast() */
+}
/*****************************/
@@ -5440,7 +5440,7 @@
break;
}
}
- } /* end for */
+ }
if (i == ARRAY_LEN(allowed_bearers_array)) {
/* We did not find the bearer capability */
chan_misdn_log(0, bc->port, "Bearer capability not allowed: %s(%d)\n",
Modified: team/group/issue8824/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/channels/chan_sip.c?view=diff&rev=183820&r1=183819&r2=183820
==============================================================================
--- team/group/issue8824/channels/chan_sip.c (original)
+++ team/group/issue8824/channels/chan_sip.c Mon Mar 23 16:13:56 2009
@@ -944,7 +944,7 @@
*
* The core defines a bunch of constants used to define
* redirecting reasons. This provides a translation table
- * between those and the strings which may be present in
+ * between those and the strings which may be present in
* a SIP Diversion header
*/
static const struct sip_reasons {
@@ -9029,7 +9029,10 @@
return 0;
}
-/*! \brief Add Remote-Party-ID header to SIP message */
+/*!
+ * \pre if p->owner exists, it must be locked
+ * \brief Add Remote-Party-ID header to SIP message
+ */
static int add_rpid(struct sip_request *req, struct sip_pvt *p)
{
char tmp[256];
Modified: team/group/issue8824/funcs/func_connectedline.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/funcs/func_connectedline.c?view=diff&rev=183820&r1=183819&r2=183820
==============================================================================
--- team/group/issue8824/funcs/func_connectedline.c (original)
+++ team/group/issue8824/funcs/func_connectedline.c Mon Mar 23 16:13:56 2009
@@ -67,9 +67,9 @@
<para>Gets or sets Connected Line data on the channel. Possible values
for the <replaceable>source</replaceable> datatype are:</para>
<enumlist>
- <enum name="answer">Normal Call Answering</enum>
- <enum name="transfer_alerting">Call Transfer(Alerting)</enum>
- <enum name="transfer_active">Call Transfer(Active)</enum>
+ <enum name="answer"><para>Normal Call Answering</para></enum>
+ <enum name="transfer_alerting"><para>Call Transfer(Alerting)</para></enum>
+ <enum name="transfer_active"><para>Call Transfer(Active)</para></enum>
</enumlist>
</description>
</function>
Modified: team/group/issue8824/funcs/func_redirecting.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/funcs/func_redirecting.c?view=diff&rev=183820&r1=183819&r2=183820
==============================================================================
--- team/group/issue8824/funcs/func_redirecting.c (original)
+++ team/group/issue8824/funcs/func_redirecting.c Mon Mar 23 16:13:56 2009
@@ -69,7 +69,7 @@
<enum name = "pres" />
<enum name = "reason" />
<enum name = "count" />
- </enumlis>
+ </enumlist>
</parameter>
<parameter name="i">
<para>If set, this will prevent the channel from sending out protocol
@@ -80,18 +80,18 @@
<para>Gets or sets Redirecting data on the channel. The allowable values
for the <replaceable>reason</replaceable> field are the following:</para>
<enumlist>
- <enum name = "unknown">Unknown</enum>
- <enum name = "cfb">Call Forwarding Busy</enum>
- <enum name = "cfnr">Call Forwarding No Reply</enum>
- <enum name = "unavailable">Callee is Unavailable</enum>
- <enum name = "time_of_day">Time of Day</enum>
- <enum name = "dnd">Do Not Disturb</enum>
- <enum name = "deflection">Call Deflection</enum>
- <enum name = "follow_me">Follow Me</enum>
- <enum name = "out_of_order">Called DTE Out-Of-Order</enum>
- <enum name = "away">Callee is Away</enum>
- <enum name = "cf_dte">Call Forwarding By The Called DTE</enum>
- <enum name = "cfu">Call Forwarding Unconditional</enum>
+ <enum name = "unknown"><para>Unknown</para></enum>
+ <enum name = "cfb"><para>Call Forwarding Busy</para></enum>
+ <enum name = "cfnr"><para>Call Forwarding No Reply</para></enum>
+ <enum name = "unavailable"><para>Callee is Unavailable</para></enum>
+ <enum name = "time_of_day"><para>Time of Day</para></enum>
+ <enum name = "dnd"><para>Do Not Disturb</para></enum>
+ <enum name = "deflection"><para>Call Deflection</para></enum>
+ <enum name = "follow_me"><para>Follow Me</para></enum>
+ <enum name = "out_of_order"><para>Called DTE Out-Of-Order</para></enum>
+ <enum name = "away"><para>Callee is Away</para></enum>
+ <enum name = "cf_dte"><para>Call Forwarding By The Called DTE</para></enum>
+ <enum name = "cfu"><para>Call Forwarding Unconditional</para></enum>
</enumlist>
</description>
</function>
Modified: team/group/issue8824/main/callerid.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/main/callerid.c?view=diff&rev=183820&r1=183819&r2=183820
==============================================================================
--- team/group/issue8824/main/callerid.c (original)
+++ team/group/issue8824/main/callerid.c Mon Mar 23 16:13:56 2009
@@ -1129,10 +1129,10 @@
if (!strcasecmp(pres_types[index].name, data)) {
return pres_types[index].value;
}
- } /* end for */
+ }
return -1;
-} /* end ast_parse_caller_presentation() */
+}
/*!
* \brief Convert caller ID pres value to explanatory string
@@ -1147,10 +1147,10 @@
if (pres_types[index].value == data) {
return pres_types[index].description;
}
- } /* end for */
+ }
return "unknown";
-} /* end ast_describe_caller_presentation() */
+}
/*!
* \brief Convert caller ID pres value to text code
@@ -1165,10 +1165,10 @@
if (pres_types[index].value == data) {
return pres_types[index].name;
}
- } /* end for */
+ }
return "unknown";
-} /* end ast_named_caller_presentation() */
+}
@@ -1208,10 +1208,10 @@
if (!strcasecmp(redirecting_reason_types[index].name, data)) {
return redirecting_reason_types[index].value;
}
- } /* end for */
+ }
return -1;
-} /* end ast_redirecting_reason_parse() */
+}
@@ -1225,10 +1225,10 @@
if (redirecting_reason_types[index].value == data) {
return redirecting_reason_types[index].description;
}
- } /* end for */
+ }
return "not-known";
-} /* end ast_redirecting_reason_describe() */
+}
@@ -1242,10 +1242,10 @@
if (redirecting_reason_types[index].value == data) {
return redirecting_reason_types[index].name;
}
- } /* end for */
+ }
return "not-known";
-} /* end ast_redirecting_reason_name() */
+}
@@ -1279,10 +1279,10 @@
if (!strcasecmp(connected_line_source_types[index].name, data)) {
return connected_line_source_types[index].value;
}
- } /* end for */
+ }
return -1;
-} /* end ast_connected_line_source_parse() */
+}
@@ -1296,10 +1296,10 @@
if (connected_line_source_types[index].value == data) {
return connected_line_source_types[index].description;
}
- } /* end for */
+ }
return "not-known";
-} /* end ast_connected_line_source_describe() */
+}
@@ -1313,7 +1313,7 @@
if (connected_line_source_types[index].value == data) {
return connected_line_source_types[index].name;
}
- } /* end for */
+ }
return "not-known";
-} /* end ast_connected_line_source_name() */
+}
Modified: team/group/issue8824/main/channel.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/main/channel.c?view=diff&rev=183820&r1=183819&r2=183820
==============================================================================
--- team/group/issue8824/main/channel.c (original)
+++ team/group/issue8824/main/channel.c Mon Mar 23 16:13:56 2009
@@ -1329,7 +1329,7 @@
init->name = NULL;
init->number_type = 0; /* Unknown */
init->number_presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
-} /* end ast_party_id_init() */
+}
@@ -1363,7 +1363,7 @@
dest->number_type = src->number_type;
dest->number_presentation = src->number_presentation;
-} /* end ast_party_id_copy() */
+}
@@ -1392,7 +1392,7 @@
init->name = NULL;
init->number_type = guide->number_type;
init->number_presentation = guide->number_presentation;
-} /* end ast_party_id_set_init() */
+}
@@ -1430,7 +1430,7 @@
dest->number_type = src->number_type;
dest->number_presentation = src->number_presentation;
-} /* end ast_party_id_set() */
+}
@@ -1455,7 +1455,7 @@
ast_free(doomed->name);
doomed->name = NULL;
}
-} /* end ast_party_id_free() */
+}
@@ -1508,7 +1508,7 @@
dest->ani2 = src->ani2;
#endif
-} /* end ast_party_caller_copy() */
+}
@@ -1520,7 +1520,7 @@
init->ani = NULL;
init->ani2 = 0;
init->source = AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN;
-} /* end ast_party_connected_line_init() */
+}
@@ -1542,7 +1542,7 @@
dest->ani2 = src->ani2;
dest->source = src->source;
-} /* end ast_party_connected_line_copy() */
+}
@@ -1554,7 +1554,7 @@
init->ani = NULL;
init->ani2 = guide->ani2;
init->source = guide->source;
-} /* end ast_party_connected_line_set_init() */
+}
void ast_party_connected_line_set(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src)
@@ -1584,7 +1584,7 @@
connected->ani = cid->cid_ani;
connected->ani2 = cid->cid_ani2;
connected->source = AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN;
-} /* end ast_party_connected_line_collect_caller() */
+}
@@ -1598,7 +1598,7 @@
ast_free(doomed->ani);
doomed->ani = NULL;
}
-} /* end ast_party_connected_line_free() */
+}
@@ -1615,7 +1615,7 @@
ast_party_id_copy(&dest->to, &src->to);
dest->count = src->count;
dest->reason = src->reason;
-} /* end ast_party_redirecting_copy() */
+}
@@ -1627,7 +1627,7 @@
ast_party_id_set_init(&init->to, &guide->to);
init->count = guide->count;
init->reason = guide->reason;
-} /* end ast_party_redirecting_set_init() */
+}
@@ -1638,7 +1638,7 @@
{
ast_party_id_free(&doomed->from);
ast_party_id_free(&doomed->to);
-} /* end ast_party_redirecting_free() */
+}
@@ -3385,7 +3385,7 @@
default:
break;
- } /* end switch */
+ }
if (chan->tech->indicate) {
/* See if the channel driver can handle this condition. */
res = chan->tech->indicate(chan, condition, data, datalen);
@@ -5929,7 +5929,7 @@
dest->ani2 = src->ani2;
#endif
-} /* end ast_copy_caller_to_connected() */
+}
@@ -5974,7 +5974,7 @@
dest->ani2 = src->ani2;
#endif
-} /* end ast_copy_connected_to_caller() */
+}
@@ -5990,7 +5990,7 @@
ast_channel_lock(chan);
ast_party_connected_line_set(&chan->connected, connected);
ast_channel_unlock(chan);
-} /* end ast_set_connected_line() */
+}
@@ -6075,7 +6075,7 @@
pos += sizeof(value);
return pos;
-} /* end ast_build_connected_line_data() */
+}
@@ -6146,11 +6146,11 @@
default:
ast_log(LOG_DEBUG, "Unknown connected line element: %u (%u)\n", (unsigned) ie_id, (unsigned) ie_len);
break;
- } /* end switch */
- } /* end for */
+ }
+ }
return 0;
-} /* end ast_parse_connected_line_data() */
+}
@@ -6167,7 +6167,7 @@
}
ast_indicate_data(chan, AST_CONTROL_CONNECTED_LINE, data, datalen);
-} /* end ast_connected_line_update() */
+}
@@ -6184,7 +6184,7 @@
}
ast_queue_control_data(chan, AST_CONTROL_CONNECTED_LINE, data, datalen);
-} /* end ast_queue_connected_line_update() */
+}
@@ -6217,7 +6217,7 @@
chan->redirecting.count = redirecting->count;
ast_channel_unlock(chan);
-} /* end ast_set_redirecting() */
+}
@@ -6359,7 +6359,7 @@
pos += sizeof(value);
return pos;
-} /* end ast_build_redirecting_data() */
+}
@@ -6472,11 +6472,11 @@
default:
ast_log(LOG_DEBUG, "Unknown redirecting element: %u (%u)\n", (unsigned) ie_id, (unsigned) ie_len);
break;
- } /* end switch */
- } /* end for */
+ }
+ }
return 0;
-} /* end ast_parse_redirecting_data() */
+}
@@ -6493,7 +6493,7 @@
}
ast_indicate_data(chan, AST_CONTROL_REDIRECTING, data, datalen);
-} /* end ast_redirecting_update() */
+}
@@ -6510,5 +6510,5 @@
}
ast_queue_control_data(chan, AST_CONTROL_REDIRECTING, data, datalen);
-} /* end ast_queue_redirecting_update() */
-
+}
+
More information about the asterisk-commits
mailing list