[svn-commits] oej: branch oej/notify-race-10052 r115016 - /team/oej/notify-race-10052/chann...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu May 1 13:58:07 CDT 2008
Author: oej
Date: Thu May 1 13:58:06 2008
New Revision: 115016
URL: http://svn.digium.com/view/asterisk?view=rev&rev=115016
Log:
Applying patch from bug report
Modified:
team/oej/notify-race-10052/channels/chan_sip.c
Modified: team/oej/notify-race-10052/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/notify-race-10052/channels/chan_sip.c?view=diff&rev=115016&r1=115015&r2=115016
==============================================================================
--- team/oej/notify-race-10052/channels/chan_sip.c (original)
+++ team/oej/notify-race-10052/channels/chan_sip.c Thu May 1 13:58:06 2008
@@ -900,6 +900,10 @@
int attendedtransfer; /*!< Attended or blind transfer? */
int localtransfer; /*!< Transfer to local domain? */
enum referstatus status; /*!< REFER status */
+ int notify_cseq; /*!< Cseq of unanswered NOTIFY */
+ char *next_notify; /*!< Next notify to send */
+ int next_cseq; /*!< Cseq to use */
+ int next_terminate; /*!< Terminate flag of next message */
};
/*! \brief sip_pvt: PVT structures are used for each SIP dialog, ie. a call, a registration, a subscribe */
@@ -3132,6 +3136,10 @@
}
if (p->udptl)
ast_udptl_destroy(p->udptl);
+
+ if (p->refer && p->refer->next_notify)
+ free(p->refer->next_notify);
+
if (p->refer)
free(p->refer);
if (p->route) {
@@ -7416,6 +7424,18 @@
struct sip_request req;
char tmp[SIPBUFSIZE/2];
+ /* Check if we already have an open NOTIFY transaction. If so, then cache this.
+ Overwrite previous message if we have multiple messages on queue. */
+ if (p->refer && p->refer->notify_cseq) {
+ if (p->refer->next_notify)
+ free(p->refer->next_notify);
+ p->refer->next_notify = ast_strdup(message);
+ p->refer->next_cseq = cseq;
+ p->refer->next_terminate = terminate;
+ if (option_debug > 2)
+ ast_log(LOG_DEBUG, "Queueing Refer NOTIFY message due to open transaction.\n");
+ }
+
reqprep(&req, p, SIP_NOTIFY, 0, 1);
snprintf(tmp, sizeof(tmp), "refer;id=%d", cseq);
add_header(&req, "Event", tmp);
@@ -7432,6 +7452,8 @@
initialize_initreq(p, &req);
p->lastnoninvite = p->ocseq;
+ if (p->refer)
+ p->refer->notify_cseq = p->ocseq;
return send_request(p, &req, XMIT_RELIABLE, p->ocseq);
}
@@ -12765,8 +12787,16 @@
if (!p->refer) {
ast_log(LOG_WARNING, "Notify answer on an owned channel? - %s\n", p->owner->name);
ast_queue_hangup(p->owner);
- } else if (option_debug > 3)
- ast_log(LOG_DEBUG, "Got OK on REFER Notify message\n");
+ } else {
+ if (option_debug > 3)
+ ast_log(LOG_DEBUG, "Got OK on REFER Notify message\n");
+ p->refer->notify_cseq = 0; /* No pending NOTIFY's */
+ if (p->refer->next_notify) { /* If we have a queued notify, send it now */
+ transmit_notify_with_sipfrag(p, p->refer->next_cseq, p->refer->next_notify, p->refer->next_terminate);
+ free(p->refer->next_notify);
+ p->refer->next_notify = NULL;
+ }
+ }
} else {
if (p->subscribed == NONE)
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
More information about the svn-commits
mailing list