[Asterisk-cvs] asterisk/channels chan_sip.c,1.444,1.445
markster at lists.digium.com
markster at lists.digium.com
Fri Jul 9 18:57:29 CDT 2004
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv14384/channels
Modified Files:
chan_sip.c
Log Message:
Just to be especially nice, only send 100 Trying at the start of parking and don't send the 202 Accepted until the end -- still doesn't help the SNOM. They seem to give dialtone as soon as they send REFER...
Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.444
retrieving revision 1.445
diff -u -d -r1.444 -r1.445
--- chan_sip.c 9 Jul 2004 11:03:33 -0000 1.444
+++ chan_sip.c 9 Jul 2004 22:43:15 -0000 1.445
@@ -6631,28 +6631,36 @@
struct sip_dual {
struct ast_channel *chan1;
struct ast_channel *chan2;
+ struct sip_request req;
};
static void *sip_park_thread(void *stuff)
{
struct ast_channel *chan1, *chan2;
struct sip_dual *d;
+ struct sip_pvt *p;
+ struct sip_request req;
int ext;
int res;
d = stuff;
chan1 = d->chan1;
chan2 = d->chan2;
+ copy_request(&req, &d->req);
free(d);
ast_mutex_lock(&chan1->lock);
ast_do_masquerade(chan1);
ast_mutex_unlock(&chan1->lock);
res = ast_park_call(chan1, chan2, 0, &ext);
+ /* Finally send the accepted */
+ p = chan2->pvt->pvt;
+ transmit_response(p, "202 Accepted", &req);
+ /* Then hangup */
ast_hangup(chan2);
ast_log(LOG_DEBUG, "Parked on extension '%d'\n", ext);
return NULL;
}
-static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2)
+static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct sip_request *req)
{
struct sip_dual *d;
struct ast_channel *chan1m, *chan2m;
@@ -6699,6 +6707,8 @@
d = malloc(sizeof(struct sip_dual));
if (d) {
memset(d, 0, sizeof(*d));
+ /* Save original request for followup */
+ copy_request(&d->req, req);
d->chan1 = chan1m;
d->chan2 = chan2m;
if (!pthread_create(&th, NULL, sip_park_thread, d))
@@ -7033,7 +7043,6 @@
transmit_response_with_allow(p, "484 Address Incomplete", req, 1);
else {
int nobye = 0;
- transmit_response(p, "202 Accepted", req);
if (!ignore) {
if (p->refer_call) {
ast_log(LOG_DEBUG,"202 Accepted (supervised)\n");
@@ -7051,11 +7060,13 @@
if (transfer_to) {
ast_moh_stop(transfer_to);
if (!strcmp(p->refer_to, ast_parking_ext())) {
+ /* We send a 100 Trying */
+ transmit_response(p, "100 Trying", req);
/* Must release c's lock now, because it will not longer
be accessible after the transfer! */
*nounlock = 1;
ast_mutex_unlock(&c->lock);
- sip_park(transfer_to, c);
+ sip_park(transfer_to, c, req);
nobye = 1;
} else {
/* Must release c's lock now, because it will not longer
@@ -7072,6 +7083,7 @@
}
/* Always increment on a BYE */
if (!nobye) {
+ transmit_response(p, "202 Accepted", req);
transmit_request_with_auth(p, "BYE", 0, 1, 1);
p->alreadygone = 1;
}
More information about the svn-commits
mailing list