aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-11-09 00:48:38 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-11-09 00:48:38 +0000
commit207f53f3c6a9568c6367df85e2a8b17ebf8592ab (patch)
treed2e1fcfa762b0a38af8956bb713387c4547bc9ae
parent341f177d5addf71ee4f6221607370789808ced78 (diff)
issue #3360 plus related fix
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7037 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xChangeLog3
-rwxr-xr-xchannels/chan_iax2.c2
-rwxr-xr-xchannels/chan_zap.c30
3 files changed, 26 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 94d53e98d..c065c915f 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2005-11-08 Kevin P. Fleming <kpfleming@digium.com>
+ * channels/chan_zap.c (zt_request): return AST_CAUSE_CONGESTION when a group-channel is requested and the group exists but all channels are busy (issue #3360, related fix)
+ * channels/chan_iax2.c (create_addr): treat UNREACHABLE as AST_CAUSE_UNREGISTERED so that it will generate CHANUNAVAIL from app_dial (issue #3360)
+
* res/res_features.c (ast_bridge_call_thread_launch): set SCHED_RR separately from thread creation, so it won't fail when running as non-root (issue #5601, different fix)
* pbx.c (pbx_builtin_pushvar_helper): add new API function for setting variables that can exist multiple times (issue #2720)
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 1cb7587de..093a4c231 100755
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -2753,7 +2753,7 @@ static int create_addr(const char *peername, struct sockaddr_in *sin, struct cre
}
/* if the peer is being monitored and is currently unreachable, return failure */
- if (peer->maxms && (peer->lastms > peer->maxms)) {
+ if (peer->maxms && ((peer->lastms > peer->maxms) || (peer->lastms < 0))) {
if (ast_test_flag(peer, IAX_TEMPONLY))
destroy_peer(peer);
return -1;
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index d9a7b4771..e4b64cc6b 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -7236,16 +7236,22 @@ static struct zt_pvt *mkintf(int channel, int signalling, int radio, struct zt_p
return tmp;
}
-static inline int available(struct zt_pvt *p, int channelmatch, int groupmatch, int *busy)
+static inline int available(struct zt_pvt *p, int channelmatch, int groupmatch, int *busy, int *channelmatched, int *groupmatched)
{
int res;
ZT_PARAMS par;
/* First, check group matching */
- if ((p->group & groupmatch) != groupmatch)
- return 0;
+ if (groupmatch) {
+ if ((p->group & groupmatch) != groupmatch)
+ return 0;
+ *groupmatched = 1;
+ }
/* Check to see if we have a channel match */
- if ((channelmatch > 0) && (p->channel != channelmatch))
- return 0;
+ if (channelmatch) {
+ if (p->channel != channelmatch)
+ return 0;
+ *channelmatched = 1;
+ }
/* We're at least busy at this point */
if (busy) {
if ((p->sig == SIG_FXOKS) || (p->sig == SIG_FXOLS) || (p->sig == SIG_FXOGS))
@@ -7428,6 +7434,8 @@ static struct ast_channel *zt_request(const char *type, int format, void *data,
#endif
struct zt_pvt *exit, *start, *end;
ast_mutex_t *lock;
+ int channelmatched = 0;
+ int groupmatched = 0;
/* Assume we're locking the iflock */
lock = &iflock;
@@ -7528,7 +7536,8 @@ static struct ast_channel *zt_request(const char *type, int format, void *data,
#if 0
ast_verbose("name = %s, %d, %d, %d\n",p->owner ? p->owner->name : "<none>", p->channel, channelmatch, groupmatch);
#endif
- if (p && available(p, channelmatch, groupmatch, &busy)) {
+
+ if (p && available(p, channelmatch, groupmatch, &busy, &channelmatched, &groupmatched)) {
if (option_debug)
ast_log(LOG_DEBUG, "Using channel %d\n", p->channel);
if (p->inalarm)
@@ -7619,8 +7628,13 @@ next:
}
ast_mutex_unlock(lock);
restart_monitor();
- if (callwait || (!tmp && busy))
- *cause = AST_CAUSE_BUSY;
+ if (channelmatched) {
+ if (callwait || (!tmp && busy))
+ *cause = AST_CAUSE_BUSY;
+ } else if (groupmatched) {
+ *cause = AST_CAUSE_CONGESTION;
+ }
+
return tmp;
}