Author: rizzo
Date: Sat Jul 21 04:39:24 2007
New Revision: 76280

URL: http://svn.digium.com/view/asterisk?view=rev&rev=76280
Log:
sync with trunk for flags removal

Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: 
http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=76280&r1=76279&r2=76280
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Sat Jul 21 04:39:24 2007
@@ -757,8 +757,8 @@
        P: Peer/user only, not dialog
        G: Global flag only
 */
-#define SIP_ALREADYGONE                (1 << 0)        /*!< D: Whether or not 
we've already been destroyed by our peer */
-#define SIP_NEEDDESTROY                (1 << 1)        /*!< D: if we need to 
be destroyed by the monitor thread */
+#define __SIP_ALREADYGONE              (1 << 0)        /*!< D: Whether or not 
we've already been destroyed by our peer */
+#define __SIP_NEEDDESTROY              (1 << 1)        /*!< D: if we need to 
be destroyed by the monitor thread */
 #define SIP_NOVIDEO            (1 << 2)        /*!< D: Didn't get video in 
invite, don't offer */
 #define SIP_RINGING            (1 << 3)        /*!< D: Have sent 180 ringing */
 #define SIP_PROGRESS_SENT      (1 << 4)        /*!< D: Have sent 183 message 
progress */
@@ -1012,6 +1012,8 @@
 
        /* boolean or small integers that don't belong in flags */
        char do_history;                        /*!< Set if we want to record 
history */
+       char alreadygone;                       /*!< already destroyed by our 
peer */
+       char needdestroy;                       /*!< need to be destroyed by 
the monitor thread */
 
        int timer_t1;                           /*!< SIP timer T1, ms rtt */
        unsigned int sipoptions;                /*!< Supported SIP options on 
the other end */
@@ -1125,24 +1127,6 @@
        return NULL;
 }
 
-/*! \brief set the SIP_NEEDDESTROY flag on a dialog */
-static inline void set_destroy(struct sip_pvt *pvt)
-{
-       ast_set_flag(&pvt->flags[0], SIP_NEEDDESTROY);  
-}
-
-/*! \brief clear the SIP_NEEDDESTROY flag on a dialog */
-static inline void clear_destroy(struct sip_pvt *pvt)
-{
-       ast_set_flag(&pvt->flags[0], SIP_NEEDDESTROY);  
-}
-
-/*! \brief test the SIP_NEEDDESTROY flag on a dialog */
-static inline int test_destroy(const struct sip_pvt *pvt)
-{
-       return ast_test_flag(&pvt->flags[0], SIP_NEEDDESTROY) ? 1 : 0;
-}
-
 #define FLAG_RESPONSE (1 << 0) /* basically, any non-zero value */
 #define FLAG_FATAL (1 << 1)
 
@@ -2011,7 +1995,7 @@
 static void sip_alreadygone(struct sip_pvt *dialog)
 {
        ast_debug(3, "Setting SIP_ALREADYGONE on dialog %s\n", dialog->callid);
-       ast_set_flag(&dialog->flags[0], SIP_ALREADYGONE);
+       dialog->alreadygone = 1;
 }
 
 /*! Resolve DNS srv name or host name in a sip_proxy structure */
@@ -2392,7 +2376,7 @@
                        /* If no channel owner, destroy now */
                        /* Let the peerpoke system expire packets when the 
timer expires for poke_noanswer */
                        if (pkt->method != SIP_OPTIONS && pkt->method != 
SIP_REGISTER)
-                               set_destroy(pvt);
+                               pvt->needdestroy = 1;
                }
        }
 
@@ -3945,7 +3929,7 @@
                ast_debug(4, "SIP Transfer: Not hanging up right now... 
Rescheduling hangup for %s.\n", p->callid);
                sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);     /* also cancels 
previous one if there */
                ast_clear_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER);        
/* Really hang up next time */
-               clear_destroy(p);
+               p->needdestroy = 0;
                /* XXX assert(p->owner == ast); */
                if (p->owner->tech_pvt) /* i believe that's always */
                        p->owner->tech_pvt = pvt_unref(p->owner->tech_pvt);
@@ -3995,13 +3979,13 @@
           (Sorry, mother-in-law, you can't deny a hangup by sending
           603 declined to BYE...)
        */
-       if (ast_test_flag(&p->flags[0], SIP_ALREADYGONE))
+       if (p->alreadygone)
                needdestroy = 1;        /* Set destroy flag at end of this 
function */
        else if (p->invitestate != INV_CALLING)
                sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 
        /* Start the process if it's not already started */
-       if (!ast_test_flag(&p->flags[0], SIP_ALREADYGONE) && 
!ast_strlen_zero(p->initreq.data)) {
+       if (!p->alreadygone && !ast_strlen_zero(p->initreq.data)) {
                if (needcancel) {       /* Outgoing call, not up */
                        if (ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
                                /* stop retransmitting an INVITE that has not 
received a response */
@@ -4071,7 +4055,7 @@
                }
        }
        if (needdestroy)
-               set_destroy(p);
+               p->needdestroy = 1;
        sip_pvt_unlock(p);
        return 0;
 }
@@ -8107,7 +8091,7 @@
                   in the single SIP manager thread. */
                /* XXX p->registry == r so and r has 2 refs, so the unref won't 
take the object away */
                p = r->register_pvt;
-               set_destroy(p); /* XXX why do that if we are going to kill it 
in a moment ? */
+               p->needdestroy = 1;     /* XXX why do that if we are going to 
kill it in a moment ? */
                /* Pretend to ACK anything just in case */
                __sip_pretend_ack(p); /* XXX we need p locked, not sure we have 
*/
 
@@ -11654,7 +11638,7 @@
                        cur->ocseq, cur->icseq,         /* XXX note, these are 
uint32, do not fit well in 5 digits */
                        ast_getformatname(cur->owner ? 
cur->owner->nativeformats : 0), 
                        ast_test_flag(&cur->flags[1], SIP_PAGE2_CALL_ONHOLD) ? 
"Yes" : "No",
-                       test_destroy(cur) ? "(d)" : "",
+                       cur->needdestroy ? "(d)" : "",
                        cur->lastmsg ,
                        referstatus
                );
@@ -11916,7 +11900,7 @@
                ast_cli(fd, "  Original uri:           %s\n", cur->uri);
        if (!ast_strlen_zero(cur->cid_num))
                ast_cli(fd, "  Caller-ID:              %s\n", cur->cid_num);
-       ast_cli(fd, "  Need Destroy:           %d\n", test_destroy(cur));
+       ast_cli(fd, "  Need Destroy:           %s\n", cur->needdestroy ? "Yes" 
: "No");
        ast_cli(fd, "  Last Message:           %s\n", cur->lastmsg);
        ast_cli(fd, "  Promiscuous Redir:      %s\n", 
ast_test_flag(&cur->flags[0], SIP_PROMISCREDIR) ? "Yes" : "No");
        ast_cli(fd, "  Route:                  %s\n", cur->route ? 
cur->route->hop : "N/A");
@@ -12950,7 +12934,7 @@
        else
                ast_debug(4, "SIP response %d to standard invite\n", resp);
 
-       if (ast_test_flag(&p->flags[0], SIP_ALREADYGONE)) { /* This call is 
already gone */
+       if (p->alreadygone) { /* This call is already gone */
                ast_debug(1, "Got response on call that is already terminated: 
%s (ignoring)\n", p->callid);
                return;
        }
@@ -13137,7 +13121,7 @@
                        p->invitestate = INV_CALLING;   /* XXX reset state */
                        if (p->authtries == MAX_AUTHTRIES || do_proxy_auth(p, 
req, resp, SIP_INVITE, 1)) {
                                ast_log(LOG_NOTICE, "Failed to authenticate on 
INVITE to '%s'\n", get_header(&p->initreq, "From"));
-                               set_destroy(p); 
+                               p->needdestroy = 1;
                                sip_alreadygone(p);
                                if (p->owner)
                                        ast_queue_control(p->owner, 
AST_CONTROL_CONGESTION);
@@ -13151,7 +13135,7 @@
                ast_log(LOG_WARNING, "Received response: \"Forbidden\" from 
'%s'\n", get_header(&p->initreq, "From"));
                if (!req_ignore(req) && p->owner)
                        ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
-               set_destroy(p); 
+               p->needdestroy = 1;
                sip_alreadygone(p);
                break;
 
@@ -13199,12 +13183,12 @@
                         /* While figuring that out, hangup the call */
                         if (p->owner && !ast_test_flag(req, SIP_PKT_IGNORE))
                                 ast_queue_control(p->owner, 
AST_CONTROL_CONGESTION);
-                        ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
+                        p->needdestroy = 1;
                 } else {
                         /* We can't set up this call, so give up */
                         if (p->owner && !ast_test_flag(req, SIP_PKT_IGNORE))
                                 ast_queue_control(p->owner, 
AST_CONTROL_CONGESTION);
-                        ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
+                        p->needdestroy = 1;
                 }
                 break;
 
@@ -13215,7 +13199,7 @@
                transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
                if (p->owner && !req_ignore(req))
                        ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
-               set_destroy(p);
+               p->needdestroy = 1;
                break;
 
        case 501: /* Not implemented */
@@ -13250,12 +13234,12 @@
                if (ast_strlen_zero(p->authname)) {
                        ast_log(LOG_WARNING, "Asked to authenticate REFER to 
%s:%d but we have no matching peer or realm auth!\n",
                                ast_inet_ntoa(p->recv.sin_addr), 
ntohs(p->recv.sin_port));
-                       set_destroy(p);
+                       p->needdestroy = 1;
                }
                if (p->authtries > 1 || do_proxy_auth(p, req, resp, SIP_REFER, 
0)) {
                        ast_log(LOG_NOTICE, "Failed to authenticate on REFER to 
'%s'\n", get_header(&p->initreq, "From"));
                        p->refer->status = REFER_NOAUTH;
-                       set_destroy(p);
+                       p->needdestroy = 1;
                }
                break;
        case 481: /* Call leg does not exist */
@@ -13266,7 +13250,7 @@
                ast_log(LOG_WARNING, "Remote host can't match REFER request to 
call '%s'. Giving up.\n", p->callid);
                if (p->owner)
                        ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
-               set_destroy(p);
+               p->needdestroy = 1;
                break;
  
        case 500:   /* Server error */
@@ -13274,18 +13258,18 @@
                /* Return to the current call onhold */
                /* Status flag needed to be reset */
                ast_log(LOG_NOTICE, "SIP transfer to %s failed, call miserably 
fails. \n", p->refer->refer_to);
-               set_destroy(p);
+               p->needdestroy = 1;
                p->refer->status = REFER_FAILED;
                break;
        case 603:   /* Transfer declined */
                ast_log(LOG_NOTICE, "SIP transfer to %s declined, call 
miserably fails. \n", p->refer->refer_to);
                p->refer->status = REFER_FAILED;
-               set_destroy(p);
+               p->needdestroy = 1;
                break;
        }
 }
 
-/*! \brief decouple the sip_pvt and the sip_registry, and mark the pvt with 
set_destroy.
+/*! \brief decouple the sip_pvt and the sip_registry, and mark the pvt with 
needdestroy = 1.
  * The objects are still in their containers so they don't go away,
  * or we should be careful with the release order (by keeping a
  * reference and releasing afterwards).
@@ -13296,7 +13280,7 @@
 
        r->register_pvt = pvt_unref(r->register_pvt);
        p->registry = registry_unref(r);
-       set_destroy(p);
+       p->needdestroy = 1;
 }
 
 /*! \brief Handle responses on REGISTER to services.
@@ -13314,7 +13298,7 @@
                        ast_log(LOG_WARNING, "Got %d on REGISTER but we have no 
sip_registry entry", resp);
                else
                        ast_log(LOG_WARNING, "Got %d on REGISTER, but 
mismatched link p %p reg->p %p", resp, p, r->register_pvt);
-               set_destroy(p);
+               p->needdestroy = 1;
                return 1;
        }
 
@@ -13511,7 +13495,7 @@
        if (peer->pokeexpire > -1)
                ast_sched_del(sched, peer->pokeexpire);
        peer->pokeexpire = -1;
-       set_destroy(p);
+       p->needdestroy = 1;
 
        /* Try again eventually */
        peer->pokeexpire = ast_sched_add(sched,
@@ -13623,12 +13607,12 @@
                                                ast_debug(4, "Got OK on REFER 
Notify message\n");
                                } else {
                                        if (p->subscribed == NONE) 
-                                               set_destroy(p);
+                                               p->needdestroy = 1;
                                }
                        } else if (sipmethod == SIP_REGISTER) 
                                res = handle_response_register(p, resp, rest, 
req, seqno);
                        else if (sipmethod == SIP_BYE)          /* Ok, we're 
ready to go */
-                               set_destroy(p);
+                               p->needdestroy = 1;
                        break;
                case 202:   /* Transfer accepted */
                        if (sipmethod == SIP_REFER) 
@@ -13643,7 +13627,7 @@
                                res = handle_response_register(p, resp, rest, 
req, seqno);
                        else {
                                ast_log(LOG_WARNING, "Got authentication 
request (401) on unknown %s to '%s'\n", sip_methods[sipmethod].text, 
get_header(req, "To"));
-                               set_destroy(p);
+                               p->needdestroy = 1;
                        }
                        break;
                case 403: /* Forbidden - we failed authentication */
@@ -13653,7 +13637,7 @@
                                res = handle_response_register(p, resp, rest, 
req, seqno);
                        else {
                                ast_log(LOG_WARNING, "Forbidden - maybe wrong 
password on authentication for %s\n", msg);
-                               set_destroy(p);
+                               p->needdestroy = 1;
                        }
                        break;
                case 404: /* Not found */
@@ -13676,14 +13660,14 @@
                                        ast_log(LOG_WARNING, "Asked to 
authenticate %s, to %s:%d but we have no matching peer!\n",
                                                        msg, 
ast_inet_ntoa(p->recv.sin_addr), ntohs(p->recv.sin_port));
                                        /* XXX is this in or out of the block ? 
*/
-                                       set_destroy(p);
+                                       p->needdestroy = 1;
                                }
                                if (p->authtries == MAX_AUTHTRIES || 
do_proxy_auth(p, req, 407, sipmethod, 0)) {
                                        ast_log(LOG_NOTICE, "Failed to 
authenticate on %s to '%s'\n", msg, get_header(&p->initreq, "From"));
-                                       set_destroy(p);
+                                       p->needdestroy = 1;
                                }
                        } else  /* We can't handle this, giving up in a bad way 
*/
-                               set_destroy(p);
+                               p->needdestroy = 1;
 
                        break;
                case 423: /* Interval too brief */
@@ -13723,7 +13707,7 @@
                                handle_response_invite(p, resp, rest, req, 
seqno);
                        else {
                                ast_debug(1, "Got 491 on %s, unspported. Call 
ID %s\n", sip_methods[sipmethod].text, p->callid);
-                               set_destroy(p);
+                               p->needdestroy = 1;
                        }
                        break;
                case 501: /* Not Implemented */
@@ -13800,7 +13784,7 @@
                                if (sipmethod != SIP_MESSAGE && sipmethod != 
SIP_INFO)
                                        sip_alreadygone(p);
                                if (!p->owner)
-                                       set_destroy(p);
+                                       p->needdestroy = 1;
                        } else if ((resp >= 100) && (resp < 200)) {
                                if (sipmethod == SIP_INVITE) {
                                        if (!req_ignore(req))
@@ -13848,17 +13832,17 @@
                                        /* ast_queue_hangup(p->owner); Disabled 
*/
                                } else {
                                        if (!p->subscribed && !p->refer)
-                                               set_destroy(p);
+                                               p->needdestroy = 1;
                                }
                        } else if (sipmethod == SIP_BYE)
-                               set_destroy(p);
+                               p->needdestroy = 1;
                        else if (sipmethod == SIP_MESSAGE || sipmethod == 
SIP_INFO)
                                /* We successfully transmitted a message or
                                        a video update request in INFO */
                                ;
                        else if (sipmethod == SIP_BYE) 
                                /* Ok, we're ready to go */
-                               set_destroy(p);
+                               p->needdestroy = 1;
                        break;
                case 202:   /* Transfer accepted */
                        if (sipmethod == SIP_REFER) 
@@ -13873,7 +13857,7 @@
                        else if (sipmethod == SIP_BYE) {
                                if (p->authtries == MAX_AUTHTRIES || 
do_proxy_auth(p, req, resp, sipmethod, 0)) {
                                        ast_log(LOG_NOTICE, "Failed to 
authenticate on %s to '%s'\n", msg, get_header(&p->initreq, "From"));
-                                       set_destroy(p);
+                                       p->needdestroy = 1;
                                }
                        }
                        break;
@@ -13882,7 +13866,7 @@
                                /* Re-invite failed */
                                handle_response_invite(p, resp, rest, req, 
seqno);
                        } else if (sipmethod == SIP_BYE) {
-                               set_destroy(p);
+                               p->needdestroy = 1;
                        } else if (sipdebug) {
                                ast_debug(1, "Remote host can't match request 
%s to call '%s'. Giving up\n", sip_methods[sipmethod].text, p->callid);
                        }
@@ -15204,7 +15188,7 @@
                if (!req_ignore(req)) {
                        append_history(p, "Xfer", "Refer failed. Outside of 
dialog.");
                        sip_alreadygone(p);
-                       set_destroy(p);
+                       p->needdestroy = 1;
                }
                return 0;
        }       
@@ -15673,7 +15657,7 @@
        */
        if (!global_allowsubscribe) {
                transmit_response(p, "403 Forbidden (policy)", req);
-               set_destroy(p);
+               p->needdestroy = 1;
                return 0;
        }
 
@@ -15693,7 +15677,7 @@
        if (ast_strlen_zero(eventheader)) {
                ast_debug(2, "Received SIP subscribe for unknown event package: 
<none>\n");
                transmit_response(p, "489 Bad Event", req);
-               set_destroy(p);
+               p->needdestroy = 1;
                return 0;
        }
 
@@ -15710,7 +15694,7 @@
                        ast_log(LOG_NOTICE, "Failed to authenticate user %s for 
SUBSCRIBE\n", get_header(req, "From"));
                        transmit_response_reliable(p, "403 Forbidden", req);
                }
-               set_destroy(p);
+               p->needdestroy = 1;
                return 0;
        }
 
@@ -15721,7 +15705,7 @@
        /* Check if this user/peer is allowed to subscribe at all */
        if (!ast_test_flag(&p->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)) {
                transmit_response(p, "403 Forbidden (policy)", req);
-               set_destroy(p);
+               p->needdestroy = 1;
                unref_peer(authpeer);
                return 0;
        }
@@ -15745,7 +15729,7 @@
        build_contact(p);
        if (gotdest) {
                transmit_response(p, "404 Not Found", req);
-               set_destroy(p);
+               p->needdestroy = 1;
                unref_peer(authpeer);
                return 0;
        }
@@ -15782,7 +15766,7 @@
 
                                ast_log(LOG_WARNING,"SUBSCRIBE failure: no 
Accept header: pvt: stateid: %d, laststate: %d, dialogver: %d, subscribecont: 
'%s', subscribeuri: '%s'\n",
                                        p->stateid, p->laststate, p->dialogver, 
p->subscribecontext, p->subscribeuri);
-                               ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);    
+                               p->needdestroy = 1;
                                return 0;
                        }
                        /* if p->subscribed is non-zero, then accept is not 
obligatory; according to rfc 3265 section 3.1.3, at least.
@@ -15795,7 +15779,7 @@
                        transmit_response(p, mybuf, req);
                        ast_log(LOG_WARNING,"SUBSCRIBE failure: unrecognized 
format: '%s' pvt: subscribed: %d, stateid: %d, laststate: %d, dialogver: %d, 
subscribecont: '%s', subscribeuri: '%s'\n",
                                accept, (int)p->subscribed, p->stateid, 
p->laststate, p->dialogver, p->subscribecontext, p->subscribeuri);
-                       set_destroy(p);
+                       p->needdestroy = 1;
                        return 0;
                }
        } else if (!strcmp(event, "message-summary")) { 
@@ -15803,7 +15787,7 @@
                        /* Format requested that we do not support */
                        ast_debug(2, "Received SIP mailbox subscription for 
unknown format: %s\n", accept);
                        transmit_response(p, "406 Not Acceptable", req);
-                       set_destroy(p);
+                       p->needdestroy = 1;
                        unref_peer(authpeer);
                        return 0;
                }
@@ -15815,7 +15799,7 @@
                if (ast_strlen_zero(authpeer->mailbox)) {
                        ast_log(LOG_NOTICE, "Received SIP subscribe for peer 
without mailbox: %s\n", authpeer->name);
                        transmit_response(p, "404 Not found (no mailbox)", req);
-                       set_destroy(p);
+                       p->needdestroy = 1;
                        unref_peer(authpeer);
                        return 0;
                }
@@ -15839,7 +15823,7 @@
        } else { /* At this point, Asterisk does not understand the specified 
event */
                ast_debug(2, "Received SIP subscribe for unknown event package: 
%s\n", event);
                transmit_response(p, "489 Bad Event", req);
-               set_destroy(p);
+               p->needdestroy = 1;
                unref_peer(authpeer);
                return 0;
        }
@@ -15850,7 +15834,7 @@
 
        if (!req_ignore(req) && p)
                p->lastinvite = seqno;
-       if (p && !test_destroy(p)) {
+       if (p && !p->needdestroy) {
                p->expiry = atoi(get_header(req, "Expires"));
 
                /* check if the requested expiry-time is within the approved 
limits from sip.conf */
@@ -15882,7 +15866,7 @@
 
                                ast_log(LOG_NOTICE, "Got SUBSCRIBE for 
extension [EMAIL PROTECTED] from %s, but there is no hint for that 
extension\n", p->exten, p->context, ast_inet_ntoa(p->sa.sin_addr));
                                transmit_response(p, "404 Not found", req);
-                               set_destroy(p);
+                               p->needdestroy = 1;
                                return 0;
                        }
 
@@ -15913,7 +15897,7 @@
                                if (!strcmp(p_old->username, p->username)) {
                                        if (!strcmp(p_old->exten, p->exten) &&
                                            !strcmp(p_old->context, 
p->context)) {
-                                               set_destroy(p_old);
+                                               p_old->needdestroy = 1;
                                                sip_pvt_unlock(p_old);
                                                ao2_ref(p_old, -1);
                                                break;
@@ -15934,7 +15918,7 @@
                                if (!strcmp(p_old->username, p->username)) {
                                        if (!strcmp(p_old->exten, p->exten) &&
                                            !strcmp(p_old->context, 
p->context)) {
-                                               set_destroy(p_old);
+                                               p_old->needdestroy = 1;
                                                sip_pvt_unlock(p_old);
                                                break;
                                        }
@@ -15946,7 +15930,7 @@
                        }
                }
                if (!p->expiry)
-                       set_destroy(p);
+                       p->needdestroy = 1;
        }
        return 1;       /* XXX is this an invalid return ? should it be -1 ? */
 }
@@ -16024,7 +16008,7 @@
        }
        if (res) {
                if (!p->initreq.headers)        /* New call */
-                       set_destroy(p); /* Make sure we destroy this dialog */
+                       p->needdestroy = 1;
                return -1;
        }
 
@@ -16084,7 +16068,7 @@
                        transmit_response(p, "503 Server error", req);  /* We 
must respond according to RFC 3261 sec 12.2 */
                return -1;
        } else if (p->icseq == seqno && req->method != SIP_ACK &&
-                  (p->method != SIP_CANCEL || ast_test_flag(&p->flags[0], 
SIP_ALREADYGONE))) {
+                  (p->method != SIP_CANCEL || p->alreadygone)) {
                /* Duplicate of the last sequence. Set the SIP_PKT_IGNORE flag, 
meaning
                 * "don't do anything with it" (because we have already 
performed the
                 * required action), but still have to respond appropriately, 
as the other
@@ -16185,7 +16169,7 @@
                }
                /* Got an ACK that we did not match. Ignore silently */
                if (!p->lastinvite && ast_strlen_zero(p->randdata))
-                       set_destroy(p);
+                       p->needdestroy = 1;
                break;
        default:
                transmit_response_with_allow(p, "501 Method Not Implemented", 
req, 0);
@@ -16193,7 +16177,7 @@
                        req->rlPart1, ast_inet_ntoa(p->sa.sin_addr));
                /* If this is some new method, and we don't have a call, 
destroy it now */
                if (!p->initreq.headers)
-                       set_destroy(p);
+                       p->needdestroy = 1;
                break;
        }
        return res;
@@ -16523,7 +16507,7 @@
                        while ((cur = ao2_iterator_next(&i))) {
                                sip_pvt_lock(cur);
                                check_rtp_timeout(cur, t);
-                               if (test_destroy(cur) && !cur->packets && 
!cur->owner) {
+                               if (cur->needdestroy && !cur->packets && 
!cur->owner) {
                                        ao2_unlink(dialogs, cur);
                                }
                                sip_pvt_unlock(cur);
@@ -16541,7 +16525,7 @@
                                /* Check RTP timeouts and kill calls if we have 
a timeout set and do not get RTP */
                                check_rtp_timeout(tmp, t);
                                /* If we have sessions that needs to be 
destroyed, do it now */
-                               if (test_destroy(tmp) && !tmp->packets && 
!tmp->owner) {
+                               if (tmp->needdestroy && !tmp->packets && 
!tmp->owner) {
                                        /* XXX optimized version of 
sip_destroy() */
                                        /* unlink and free. */
                                        sip_pvt_unlock(tmp);
@@ -18318,7 +18302,7 @@
        if (chan->_state != AST_STATE_UP && !global_directrtpsetup)     /* We 
are in early state */
                return 0;
        sip_pvt_lock(p);
-       if (ast_test_flag(&p->flags[0], SIP_ALREADYGONE)) {
+       if (p->alreadygone) {
                /* If we're destroyed, don't bother */
                sip_pvt_unlock(p);
                return 0;


_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits

Reply via email to