aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-11 04:31:33 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-11 04:31:33 +0000
commit3e7d0619de6a4bbf8c192419c82982a0cbd18128 (patch)
tree73b1a7dd8a9448c2c8eb9dd85c4c94bd2236ccc0
parent4601c0b2e1ccd2006575680bafd4dc389a96e0f1 (diff)
When swapping subs, queue a null frame, extend delay for hangup-on-flash
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@823 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xchannel.c2
-rwxr-xr-xchannels/chan_sip.c2
-rwxr-xr-xchannels/chan_zap.c14
3 files changed, 14 insertions, 4 deletions
diff --git a/channel.c b/channel.c
index 032b693bc..49982d849 100755
--- a/channel.c
+++ b/channel.c
@@ -378,6 +378,8 @@ int ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, int lock)
if (write(chan->pvt->alertpipe[1], &blah, sizeof(blah)) != sizeof(blah))
ast_log(LOG_WARNING, "Unable to write to alert pipe on %s, frametype/subclass %d/%d (qlen = %d): %s!\n",
chan->name, f->frametype, f->subclass, qlen, strerror(errno));
+ } else if (chan->blocking) {
+ pthread_kill(chan->blocker, SIGURG);
}
if (lock)
ast_pthread_mutex_unlock(&chan->lock);
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 587fa9a5b..f2ee9853c 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2304,8 +2304,8 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, char *cmd, c
add_header(req, "From", from);
strncpy(p->exten, l, sizeof(p->exten) - 1);
build_contact(p);
- add_header(req, "Contact", p->our_contact);
add_header(req, "To", to);
+ add_header(req, "Contact", p->our_contact);
add_header(req, "Call-ID", p->callid);
add_header(req, "CSeq", tmp);
add_header(req, "User-Agent", "Asterisk PBX");
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 1ac3cf8a0..e67621cd8 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -242,7 +242,7 @@ static inline int zt_wait_event(int fd)
#define CALLWAITING_SILENT_SAMPLES ( (300 * 8) / READ_SIZE) /* 300 ms */
#define CALLWAITING_REPEAT_SAMPLES ( (10000 * 8) / READ_SIZE) /* 300 ms */
#define CIDCW_EXPIRE_SAMPLES ( (500 * 8) / READ_SIZE) /* 500 ms */
-#define MIN_MS_SINCE_FLASH ( (1000) ) /* 1000 ms */
+#define MIN_MS_SINCE_FLASH ( (2000) ) /* 2000 ms */
#define RINGT ( (8000 * 8) / READ_SIZE)
struct zt_pvt;
@@ -497,6 +497,7 @@ static void swap_subs(struct zt_pvt *p, int a, int b)
int tchan;
int tinthreeway;
struct ast_channel *towner;
+ struct ast_frame null = { AST_FRAME_NULL, };
ast_log(LOG_DEBUG, "Swapping %d and %d\n", a, b);
@@ -512,10 +513,14 @@ static void swap_subs(struct zt_pvt *p, int a, int b)
p->subs[b].owner = towner;
p->subs[b].inthreeway = tinthreeway;
- if (p->subs[a].owner)
+ if (p->subs[a].owner) {
p->subs[a].owner->fds[0] = p->subs[a].zfd;
- if (p->subs[b].owner)
+ ast_queue_frame(p->subs[a].owner, &null, 0);
+ }
+ if (p->subs[b].owner) {
p->subs[b].owner->fds[0] = p->subs[b].zfd;
+ ast_queue_frame(p->subs[b].owner, &null, 0);
+ }
}
@@ -2513,9 +2518,12 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
unsigned int mssinceflash;
gettimeofday(&tv, NULL);
mssinceflash = (tv.tv_sec - p->flashtime.tv_sec) * 1000 + (tv.tv_usec - p->flashtime.tv_usec) / 1000;
+ ast_log(LOG_DEBUG, "Last flash was %d ms ago\n", mssinceflash);
if (mssinceflash < MIN_MS_SINCE_FLASH) {
/* It hasn't been long enough since the last flashook. This is probably a bounce on
hanging up. Hangup both channels now */
+ if (p->subs[SUB_THREEWAY].owner)
+ ast_queue_hangup(p->subs[SUB_THREEWAY].owner, 0);
p->subs[SUB_THREEWAY].owner->_softhangup |= AST_SOFTHANGUP_DEV;
ast_log(LOG_DEBUG, "Looks like a bounced flash, hanging up both calls on %d\n", p->channel);
} else if ((ast->pbx) ||