aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorroot <root@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-20 03:06:40 +0000
committerroot <root@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-20 03:06:40 +0000
commit7cf9bf79653c952c68bf023499a4c8c2cf87813c (patch)
treebeab219ee88a7c714782fc07df0fb2472b197fc3 /apps
parentb7cbdf521711fc608bd96577965da8963ba735dc (diff)
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@29006 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_queue.c8
-rw-r--r--apps/app_sms.c26
2 files changed, 16 insertions, 18 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 61cf45617..4fd6b5364 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2125,10 +2125,10 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
cur = cur->next;
}
- if (qe->parent->timeout)
- to = qe->parent->timeout * 1000;
- else
- to = -1;
+ if (qe->expire && (!qe->parent->timeout || (qe->expire - now) <= qe->parent->timeout))
+ to = (qe->expire - now) * 1000;
+ else
+ to = (qe->parent->timeout) ? qe->parent->timeout * 1000 : -1;
ring_one(qe, outgoing, &numbusies);
ast_mutex_unlock(&qe->parent->lock);
if (use_weight)
diff --git a/apps/app_sms.c b/apps/app_sms.c
index 4c15cc185..beaf4e2a1 100644
--- a/apps/app_sms.c
+++ b/apps/app_sms.c
@@ -1178,25 +1178,24 @@ static void sms_messagetx(sms_t * h)
static int sms_generate (struct ast_channel *chan, void *data, int len, int samples)
{
struct ast_frame f = { 0 };
- unsigned char waste[AST_FRIENDLY_OFFSET];
+#define MAXSAMPLES 800
#ifdef OUTALAW
- unsigned char buf[800];
+ unsigned char *buf;
#else
- signed short buf[800];
+ short *buf;
#endif
+#define SAMPLE2LEN sizeof(*buf)
sms_t *h = data;
int i;
- if (len > sizeof (buf)) {
- ast_log (LOG_WARNING, "Only doing %d bytes (%d bytes requested)\n", (int)(sizeof (buf) / sizeof (signed short)), len);
- len = sizeof (buf);
-#ifdef OUTALAW
- samples = len;
-#else
- samples = len / 2;
-#endif
+ if (samples > MAXSAMPLES) {
+ ast_log (LOG_WARNING, "Only doing %d samples (%d requested)\n",
+ MAXSAMPLES, samples);
+ samples = MAXSAMPLES;
}
- waste[0] = 0; /* make compiler happy */
+ len = samples * SAMPLE2LEN + AST_FRIENDLY_OFFSET;
+ buf = alloca(len);
+
f.frametype = AST_FRAME_VOICE;
#ifdef OUTALAW
f.subclass = AST_FORMAT_ALAW;
@@ -1206,8 +1205,7 @@ static int sms_generate (struct ast_channel *chan, void *data, int len, int samp
f.datalen = samples * 2;
#endif
f.offset = AST_FRIENDLY_OFFSET;
- f.mallocd = 0;
- f.data = buf;
+ f.data = buf + AST_FRIENDLY_OFFSET;
f.samples = samples;
f.src = "app_sms";
/* create a buffer containing the digital sms pattern */