Module: sems
Branch: master
Commit: 7fec57b68e8ceae7994934c7b8f74f4fc81ec69f
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=7fec57b68e8ceae7994934c7b8f74f4fc81ec69f

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Mon May 30 18:52:04 2011 +0200

db_reg_agent: b/f: auth detect, retry on send msg err

---

 apps/db_reg_agent/DBRegAgent.cpp |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/apps/db_reg_agent/DBRegAgent.cpp b/apps/db_reg_agent/DBRegAgent.cpp
index e9483e9..2993711 100644
--- a/apps/db_reg_agent/DBRegAgent.cpp
+++ b/apps/db_reg_agent/DBRegAgent.cpp
@@ -542,6 +542,11 @@ void 
DBRegAgent::onRegistrationActionEvent(RegistrationActionEvent* reg_action_e
                               reg_action_ev->subscriber_id,
                               480, "unable to send request",
                               true, REG_STATUS_FAILED);
+         if (error_retry_interval) {
+           // schedule register-refresh after error_retry_interval
+           setRegistrationTimer(reg_action_ev->subscriber_id, 
error_retry_interval,
+                                RegistrationActionEvent::Register);
+         }
        }
       }
       registrations_mut.unlock();
@@ -561,6 +566,11 @@ void 
DBRegAgent::onRegistrationActionEvent(RegistrationActionEvent* reg_action_e
                               reg_action_ev->subscriber_id,
                               480, "unable to send request",
                               true, REG_STATUS_FAILED);
+         if (error_retry_interval) {
+           // schedule register-refresh after error_retry_interval
+           setRegistrationTimer(reg_action_ev->subscriber_id, 
error_retry_interval,
+                                RegistrationActionEvent::Deregister);
+         }
        }
       }
       registrations_mut.unlock();
@@ -698,14 +708,13 @@ void DBRegAgent::onSipReplyEvent(AmSipReplyEvent* ev) {
        ERROR("Internal error: registration object missing\n");
        return;
       }
+      unsigned int cseq_before = registration->getDlg()->cseq;
 
-      // AmSIPRegistration::RegistrationState state_before = 
r_it->second->getState();
 #ifdef HAS_OFFER_ANSWER
       registration->getDlg()->onRxReply(ev->reply);
 #else
       registration->getDlg()->updateStatus(ev->reply);
 #endif
-      AmSIPRegistration::RegistrationState current_state = 
registration->getState();
 
       //update registrations set 
       bool update_status = false;
@@ -716,7 +725,10 @@ void DBRegAgent::onSipReplyEvent(AmSipReplyEvent* ev) {
       bool auth_pending = false;
 
       if (ev->reply.code >= 300) {
-       if (current_state == AmSIPRegistration::RegisterPending) {
+       // auth response codes
+       if ((ev->reply.code == 401 || ev->reply.code == 407) &&
+           // processing reply triggered sending request: resent by auth
+           (cseq_before != registration->getDlg()->cseq)) {
          DBG("received negative reply, but still in pending state (auth).\n");
          auth_pending = true;
        } else {

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to