]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
fix queue URL passing (bug #3543)
authorRussell Bryant <russell@russellbryant.com>
Tue, 10 May 2005 03:28:01 +0000 (03:28 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 10 May 2005 03:28:01 +0000 (03:28 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@5615 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_dial.c
channel.c
channels/chan_agent.c
channels/chan_local.c
channels/iax2-parser.c
frame.c

index 8d3436edc72eddde60319f3f1284248846de7e91..75a6f404d4065765430630676167830188f928ad 100755 (executable)
@@ -113,6 +113,7 @@ struct localuser {
        int allowdisconnect_in;
        int allowdisconnect_out;
        int forcecallerid;
+       int noforwardhtml;
        struct localuser *next;
 };
 
@@ -134,7 +135,7 @@ static void hanguptree(struct localuser *outgoing, struct ast_channel *exception
 
 #define AST_MAX_WATCHERS 256
 
-static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localuser *outgoing, int *to, int *allowredir_in, int *allowredir_out, int *allowdisconnect_in, int *allowdisconnect_out, int *sentringing, char *status, size_t statussize)
+static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localuser *outgoing, int *to, int *allowredir_in, int *allowredir_out, int *allowdisconnect_in, int *allowdisconnect_out, int *noforwardhtml, int *sentringing, char *status, size_t statussize)
 {
        struct localuser *o;
        int found;
@@ -207,6 +208,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
                                        *allowredir_out = o->allowredirect_out;
                                        *allowdisconnect_in = o->allowdisconnect_in;
                                        *allowdisconnect_out = o->allowdisconnect_out;
+                                       *noforwardhtml = o->noforwardhtml;
                                }
                        } else if (o->chan && (o->chan == winner)) {
                                if (!ast_strlen_zero(o->chan->call_forward)) {
@@ -301,6 +303,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
                                                                *allowredir_out = o->allowredirect_out;
                                                                *allowdisconnect_in = o->allowdisconnect_in;
                                                                *allowdisconnect_out = o->allowdisconnect_out;
+                                                               *noforwardhtml = o->noforwardhtml;
                                                        }
                                                        break;
                                                case AST_CONTROL_BUSY:
@@ -343,7 +346,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
                                                        /* Ignore going off hook */
                                                        break;
                                                case -1:
-                                                       if (!outgoing->ringbackonly && !outgoing->musiconhold) {
+                                                       if (!outgoing->ringbackonly || !outgoing->musiconhold) {
                                                                if (option_verbose > 2)
                                                                        ast_verbose( VERBOSE_PREFIX_3 "%s stopped sounds\n", o->chan->name);
                                                                ast_indicate(in, -1);
@@ -361,7 +364,10 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
                                                                !(outgoing->ringbackonly || outgoing->musiconhold)) {
                                                if (ast_write(in, f))
                                                        ast_log(LOG_WARNING, "Unable to forward image\n");
+                                       } else if (single && (f->frametype == AST_FRAME_HTML) && !outgoing->noforwardhtml) {
+                                               ast_channel_sendhtml(in, f->subclass, f->data, f->datalen);
                                        }
+                                               
                                        ast_frfree(f);
                                } else {
                                        in->hangupcause = o->chan->hangupcause;
@@ -397,6 +403,10 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
                                ast_frfree(f);
                                return NULL;
                        }
+
+                       if (single && f && (f->frametype == AST_FRAME_HTML) && !outgoing->noforwardhtml)
+                               ast_channel_sendhtml(outgoing->chan, f->subclass, f->data, f->datalen);
+
                        if (single && ((f->frametype == AST_FRAME_VOICE) || (f->frametype == AST_FRAME_DTMF)))  {
                                if (ast_write(outgoing->chan, f))
                                        ast_log(LOG_WARNING, "Unable to forward voice\n");
@@ -425,6 +435,7 @@ static int dial_exec(struct ast_channel *chan, void *data)
        int allowredir_out=0;
        int allowdisconnect_in=0;
        int allowdisconnect_out=0;
+       int noforwardhtml=0;
        int hasmacro = 0;
        int privacy=0;
        int announce=0;
@@ -730,6 +741,9 @@ static int dial_exec(struct ast_channel *chan, void *data)
                        if (strchr(transfer, 'f'))
                                tmp->forcecallerid = 1;
                        else    tmp->forcecallerid = 0;
+                       if (url)
+                               tmp->noforwardhtml = 1;
+                       else    tmp->noforwardhtml = 0;
                }
                strncpy(numsubst, number, sizeof(numsubst)-1);
                /* If we're dialing by extension, look at the extension to know what to dial */
@@ -884,7 +898,7 @@ static int dial_exec(struct ast_channel *chan, void *data)
                strncpy(status, "CHANUNAVAIL", sizeof(status) - 1);
 
        time(&start_time);
-       peer = wait_for_answer(chan, outgoing, &to, &allowredir_in, &allowredir_out, &allowdisconnect_in, &allowdisconnect_out, &sentringing, status, sizeof(status));
+       peer = wait_for_answer(chan, outgoing, &to, &allowredir_in, &allowredir_out, &allowdisconnect_in, &allowdisconnect_out, &sentringing, &noforwardhtml, status, sizeof(status));
 
        if (!peer) {
                if (to) 
index 1ddfecf8dd368c5da031788c4a4e513a7fa5b7d0..92d9e31b5a3c11b42a9087018b10233f31b10410 100755 (executable)
--- a/channel.c
+++ b/channel.c
@@ -1618,6 +1618,14 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
        case AST_FRAME_TEXT:
                if (chan->pvt->send_text)
                        res = chan->pvt->send_text(chan, (char *) fr->data);
+               else
+                       res = 0;
+               break;
+       case AST_FRAME_HTML:
+               if (chan->pvt->send_html)
+                       res = chan->pvt->send_html(chan, fr->subclass, (char *) fr->data, fr->datalen);
+               else
+                       res = 0;
                break;
        case AST_FRAME_VIDEO:
                /* XXX Handle translation of video codecs one day XXX */
@@ -2677,6 +2685,7 @@ int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, struct as
                        (f->frametype == AST_FRAME_TEXT) ||
                        (f->frametype == AST_FRAME_VIDEO) || 
                        (f->frametype == AST_FRAME_IMAGE) ||
+                       (f->frametype == AST_FRAME_HTML) ||
                        (f->frametype == AST_FRAME_DTMF)) {
                        if ((f->frametype == AST_FRAME_DTMF) && 
                                (flags & (AST_BRIDGE_DTMF_CHANNEL_0 | AST_BRIDGE_DTMF_CHANNEL_1))) {
index 96b83d25aa8818d6367062f9505b2576dd633652..a648b744dc8b71d872ea284a4ce13cc763d974f0 100755 (executable)
@@ -379,6 +379,17 @@ static struct ast_frame  *agent_read(struct ast_channel *ast)
        return f;
 }
 
+static int agent_sendhtml(struct ast_channel *ast, int subclass, char *data, int datalen)
+{
+       struct agent_pvt *p = ast->pvt->pvt;
+       int res = -1;
+       ast_mutex_lock(&p->lock);
+       if (p->chan) 
+               res = ast_channel_sendhtml(p->chan, subclass, data, datalen);
+       ast_mutex_unlock(&p->lock);
+       return res;
+}
+
 static int agent_write(struct ast_channel *ast, struct ast_frame *f)
 {
        struct agent_pvt *p = ast->pvt->pvt;
@@ -748,6 +759,7 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state)
                tmp->pvt->answer = agent_answer;
                tmp->pvt->read = agent_read;
                tmp->pvt->write = agent_write;
+               tmp->pvt->send_html = agent_sendhtml;
                tmp->pvt->exception = agent_read;
                tmp->pvt->indicate = agent_indicate;
                tmp->pvt->fixup = agent_fixup;
index 439bd3dfe885433fddf071bd9cbd57cfd43eea38..1637618cad2949dde6ffe0a98dc8ff62df18aa0d 100755 (executable)
@@ -139,7 +139,7 @@ static void check_bridge(struct local_pvt *p, int isoutbound)
 {
        if (p->alreadymasqed || p->nooptimization)
                return;
-       if (isoutbound && p->chan && p->chan->bridge && p->owner) {
+       if (isoutbound && p->chan && p->chan->bridge && p->owner && !p->owner->pvt->readq) {
                /* Masquerade bridged channel into owner */
                /* Lock everything we need, one by one, and give up if
                   we can't get everything.  Remember, we'll get another
@@ -152,7 +152,7 @@ static void check_bridge(struct local_pvt *p, int isoutbound)
                        }
                        ast_mutex_unlock(&p->chan->bridge->lock);
                }
-       } else if (!isoutbound && p->owner && p->owner->bridge && p->chan) {
+       } else if (!isoutbound && p->owner && p->owner->bridge && p->chan && !p->chan->pvt->readq) {
                /* Masquerade bridged channel into chan */
                if (!ast_mutex_trylock(&p->owner->bridge->lock)) {
                        if (!ast_mutex_trylock(&p->chan->lock)) {
@@ -233,6 +233,22 @@ static int local_digit(struct ast_channel *ast, char digit)
        return res;
 }
 
+static int local_sendhtml(struct ast_channel *ast, int subclass, char *data, int datalen)
+{
+       struct local_pvt *p = ast->pvt->pvt;
+       int res = -1;
+       struct ast_frame f = { AST_FRAME_HTML, };
+       int isoutbound;
+       ast_mutex_lock(&p->lock);
+       isoutbound = IS_OUTBOUND(ast, p);
+       f.subclass = subclass;
+       f.data = data;
+       f.datalen = datalen;
+       res = local_queue_frame(p, isoutbound, &f, ast);
+       ast_mutex_unlock(&p->lock);
+       return res;
+}
+
 static int local_call(struct ast_channel *ast, char *dest, int timeout)
 {
        struct local_pvt *p = ast->pvt->pvt;
@@ -425,6 +441,8 @@ static struct ast_channel *local_new(struct local_pvt *p, int state)
                tmp2->pvt->pvt = p;
                tmp->pvt->send_digit = local_digit;
                tmp2->pvt->send_digit = local_digit;
+               tmp->pvt->send_html = local_sendhtml;
+               tmp2->pvt->send_html = local_sendhtml;
                tmp->pvt->call = local_call;
                tmp2->pvt->call = local_call;
                tmp->pvt->hangup = local_hangup;
index 75f022d42a2c2f4ae0793aed14d734041487b406..0b3c4f4f59478096e12308d1eeab3a2a857215ae 100755 (executable)
@@ -299,7 +299,9 @@ void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, s
                "NULL   ",
                "IAX    ",
                "TEXT   ",
-               "IMAGE  " };
+               "IMAGE  ",
+               "HTML   ",
+               "CNG    " };
        char *iaxs[] = {
                "(0?)",
                "NEW    ",
@@ -371,7 +373,7 @@ void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, s
                /* Don't mess with mini-frames */
                return;
        }
-       if (fh->type > (int)sizeof(frames)/(int)sizeof(char *)) {
+       if (fh->type >= (int)sizeof(frames)/(int)sizeof(frames[0])) {
                snprintf(class2, (int)sizeof(class2), "(%d?)", fh->type);
                class = class2;
        } else {
diff --git a/frame.c b/frame.c
index 1f2b8b1628413283c03c252e4d3b0b9413bda1c2..a1bb27cb5e24b5c4d041303899f183f20aa5eba5 100755 (executable)
--- a/frame.c
+++ b/frame.c
@@ -357,7 +357,7 @@ struct ast_frame *ast_fr_fdread(int fd)
        /* Forget about being mallocd */
        f->mallocd = 0;
        /* Re-write the source */
-       f->src = __FUNCTION__;
+       f->src = (char *)__FUNCTION__;
        if (f->datalen > sizeof(buf) - sizeof(struct ast_frame)) {
                /* Really bad read */
                ast_log(LOG_WARNING, "Strange read (%d bytes)\n", f->datalen);