[asterisk-commits] russell: branch russell/chan_refcount r104671 - in /team/russell/chan_refcoun...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Feb 27 11:42:43 CST 2008
Author: russell
Date: Wed Feb 27 11:42:42 2008
New Revision: 104671
URL: http://svn.digium.com/view/asterisk?view=rev&rev=104671
Log:
resolve, reset
Modified:
team/russell/chan_refcount/ (props changed)
team/russell/chan_refcount/apps/app_chanspy.c
team/russell/chan_refcount/channels/chan_sip.c
team/russell/chan_refcount/main/features.c
team/russell/chan_refcount/main/file.c
team/russell/chan_refcount/main/loader.c
Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
automerge = *
Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.
Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Feb 27 11:42:42 2008
@@ -1,1 +1,1 @@
-/trunk:1-104106,104108-104556
+/trunk:1-104106,104108-104659
Modified: team/russell/chan_refcount/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_chanspy.c?view=diff&rev=104671&r1=104670&r2=104671
==============================================================================
--- team/russell/chan_refcount/apps/app_chanspy.c (original)
+++ team/russell/chan_refcount/apps/app_chanspy.c Wed Feb 27 11:42:42 2008
@@ -488,7 +488,10 @@
if (peer == prev)
break;
- if (peer == chan)
+ if (ast_check_hangup(chan))
+ break;
+
+ if (peer == chan) {
continue;
if (ast_test_flag(flags, OPTION_BRIDGED) && !ast_bridged_channel(peer))
@@ -585,6 +588,8 @@
peer = NULL;
}
}
+ if (res == -1 || ast_check_hangup(chan))
+ break;
}
exit:
Modified: team/russell/chan_refcount/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/channels/chan_sip.c?view=diff&rev=104671&r1=104670&r2=104671
==============================================================================
--- team/russell/chan_refcount/channels/chan_sip.c (original)
+++ team/russell/chan_refcount/channels/chan_sip.c Wed Feb 27 11:42:42 2008
@@ -20527,7 +20527,6 @@
}
peer = build_peer(cat, gen, ast_variable_browse(ucfg, cat), 0);
if (peer) {
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "SIP/%s", peer->name);
ASTOBJ_CONTAINER_LINK(&peerl, peer);
unref_peer(peer);
peer_count++;
@@ -20596,7 +20595,6 @@
if (is_peer) {
peer = build_peer(cat, ast_variable_browse(cfg, cat), NULL, 0);
if (peer) {
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "SIP/%s", peer->name);
ASTOBJ_CONTAINER_LINK(&peerl, peer);
unref_peer(peer);
peer_count++;
Modified: team/russell/chan_refcount/main/features.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/features.c?view=diff&rev=104671&r1=104670&r2=104671
==============================================================================
--- team/russell/chan_refcount/main/features.c (original)
+++ team/russell/chan_refcount/main/features.c Wed Feb 27 11:42:42 2008
@@ -254,7 +254,7 @@
}
}
-static struct ast_channel *ast_feature_request_and_dial(struct ast_channel *caller, struct ast_channel *transferee, const char *type, int format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, int igncallerstate);
+static struct ast_channel *ast_feature_request_and_dial(struct ast_channel *caller, struct ast_channel *transferee, const char *type, int format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, int igncallerstate, const char *language);
/*!
* \brief bridge the call
@@ -1058,7 +1058,7 @@
l = strlen(xferto);
snprintf(xferto + l, sizeof(xferto) - l, "@%s/n", transferer_real_context); /* append context */
newchan = ast_feature_request_and_dial(transferer, transferee, "Local", ast_best_codec(transferer->nativeformats),
- xferto, atxfernoanswertimeout, &outstate, transferer->cid.cid_num, transferer->cid.cid_name, 1);
+ xferto, atxfernoanswertimeout, &outstate, transferer->cid.cid_num, transferer->cid.cid_name, 1, transferer->language);
if (!ast_check_hangup(transferer)) {
/* Transferer is up - old behaviour */
@@ -1159,14 +1159,14 @@
ast_log(LOG_NOTICE, "We're trying to call %s/%s\n", transferer_tech, transferer_name);
newchan = ast_feature_request_and_dial(transferee, NULL, transferer_tech, ast_best_codec(transferee->nativeformats),
- transferer_name, atxfernoanswertimeout, &outstate, transferee->cid.cid_num, transferee->cid.cid_name, 0);
+ transferer_name, atxfernoanswertimeout, &outstate, transferee->cid.cid_num, transferee->cid.cid_name, 0, transferer->language);
while (!newchan && !atxferdropcall && tries < atxfercallbackretries) {
/* Trying to transfer again */
ast_autoservice_start(transferee);
ast_indicate(transferee, AST_CONTROL_HOLD);
newchan = ast_feature_request_and_dial(transferer, transferee, "Local", ast_best_codec(transferer->nativeformats),
- xferto, atxfernoanswertimeout, &outstate, transferer->cid.cid_num, transferer->cid.cid_name, 1);
+ xferto, atxfernoanswertimeout, &outstate, transferer->cid.cid_num, transferer->cid.cid_name, 1, transferer->language);
if (ast_autoservice_stop(transferee) < 0) {
if (newchan)
ast_hangup(newchan);
@@ -1178,7 +1178,7 @@
ast_safe_sleep(transferee, atxferloopdelay);
ast_debug(1, "Trying to callback...\n");
newchan = ast_feature_request_and_dial(transferee, NULL, transferer_tech, ast_best_codec(transferee->nativeformats),
- transferer_name, atxfernoanswertimeout, &outstate, transferee->cid.cid_num, transferee->cid.cid_name, 0);
+ transferer_name, atxfernoanswertimeout, &outstate, transferee->cid.cid_num, transferee->cid.cid_name, 0, transferer->language);
}
tries++;
}
@@ -1685,7 +1685,7 @@
* \todo XXX Check - this is very similar to the code in channel.c
* \return always a channel
*/
-static struct ast_channel *ast_feature_request_and_dial(struct ast_channel *caller, struct ast_channel *transferee, const char *type, int format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, int igncallerstate)
+static struct ast_channel *ast_feature_request_and_dial(struct ast_channel *caller, struct ast_channel *transferee, const char *type, int format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, int igncallerstate, const char *language)
{
int state = 0;
int cause = 0;
@@ -1694,9 +1694,10 @@
struct ast_channel *monitor_chans[2];
struct ast_channel *active_channel;
int res = 0, ready = 0;
-
+
if ((chan = ast_request(type, format, data, &cause))) {
ast_set_callerid(chan, cid_num, cid_name, cid_num);
+ ast_string_field_set(chan, language, language);
ast_channel_inherit_variables(caller, chan);
pbx_builtin_setvar_helper(chan, "TRANSFERERNAME", caller->name);
if (!chan->cdr) {
Modified: team/russell/chan_refcount/main/file.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/file.c?view=diff&rev=104671&r1=104670&r2=104671
==============================================================================
--- team/russell/chan_refcount/main/file.c (original)
+++ team/russell/chan_refcount/main/file.c Wed Feb 27 11:42:42 2008
@@ -467,33 +467,37 @@
* which on success is filled with the matching filename.
*/
static int fileexists_core(const char *filename, const char *fmt, const char *preflang,
- char *buf, int buflen)
+ char *buf, int buflen)
{
int res = -1;
int langlen; /* length of language string */
const char *c = strrchr(filename, '/');
int offset = c ? c - filename + 1 : 0; /* points right after the last '/' */
- if (preflang == NULL)
+ if (preflang == NULL) {
preflang = "";
+ }
langlen = strlen(preflang);
- if (buflen < langlen + strlen(filename) + 2) {
- ast_log(LOG_WARNING, "buffer too small\n");
- buf[0] = '\0'; /* set to empty */
- buf = alloca(langlen + strlen(filename) + 2); /* room for everything */
- }
- if (buf == NULL)
+ if (buflen < langlen + strlen(filename) + 4) {
+ ast_log(LOG_WARNING, "buffer too small, allocating larger buffer\n");
+ buf = alloca(langlen + strlen(filename) + 4); /* room for everything */
+ }
+
+ if (buf == NULL) {
return 0;
- buf[0] = '\0';
+ }
+
for (;;) {
if (ast_language_is_prefix) { /* new layout */
if (langlen) {
strcpy(buf, preflang);
buf[langlen] = '/';
strcpy(buf + langlen + 1, filename);
- } else
- strcpy(buf, filename); /* first copy the full string */
+ } else {
+ strcpy(buf, "en/"); /* English - fallback if no file found in preferred language */
+ strcpy(buf + 3, filename);
+ }
} else { /* old layout */
strcpy(buf, filename); /* first copy the full string */
if (langlen) {
@@ -503,15 +507,19 @@
}
}
res = ast_filehelper(buf, NULL, fmt, ACTION_EXISTS);
- if (res > 0) /* found format */
+ if (res > 0) { /* found format */
break;
- if (langlen == 0) /* no more formats */
+ }
+ if (langlen == 0) { /* no more formats */
break;
- if (preflang[langlen] == '_') /* we are on the local suffix */
+ }
+ if (preflang[langlen] == '_') { /* we are on the local suffix */
langlen = 0; /* try again with no language */
- else
+ } else {
langlen = (c = strchr(preflang, '_')) ? c - preflang : 0;
- }
+ }
+ }
+
return res;
}
Modified: team/russell/chan_refcount/main/loader.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/loader.c?view=diff&rev=104671&r1=104670&r2=104671
==============================================================================
--- team/russell/chan_refcount/main/loader.c (original)
+++ team/russell/chan_refcount/main/loader.c Wed Feb 27 11:42:42 2008
@@ -930,10 +930,10 @@
resource has changed */
struct loadupdate *m;
- AST_LIST_LOCK(&module_list);
+ AST_LIST_LOCK(&updaters);
AST_LIST_TRAVERSE(&updaters, m, entry)
m->updater();
- AST_LIST_UNLOCK(&module_list);
+ AST_LIST_UNLOCK(&updaters);
}
int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *like),
@@ -978,9 +978,9 @@
return -1;
tmp->updater = v;
- AST_LIST_LOCK(&module_list);
+ AST_LIST_LOCK(&updaters);
AST_LIST_INSERT_HEAD(&updaters, tmp, entry);
- AST_LIST_UNLOCK(&module_list);
+ AST_LIST_UNLOCK(&updaters);
return 0;
}
@@ -989,7 +989,7 @@
{
struct loadupdate *cur;
- AST_LIST_LOCK(&module_list);
+ AST_LIST_LOCK(&updaters);
AST_LIST_TRAVERSE_SAFE_BEGIN(&updaters, cur, entry) {
if (cur->updater == v) {
AST_LIST_REMOVE_CURRENT(entry);
@@ -997,7 +997,7 @@
}
}
AST_LIST_TRAVERSE_SAFE_END;
- AST_LIST_UNLOCK(&module_list);
+ AST_LIST_UNLOCK(&updaters);
return cur ? 0 : -1;
}
More information about the asterisk-commits
mailing list