Browse code

align to new AmBasicSipEventHandler interface

Raphael Coeffic authored on 18/12/2012 17:00:07
Showing 24 changed files
... ...
@@ -190,10 +190,12 @@ void AnnounceTransferDialog::onSipRequest(const AmSipRequest& req)
190 190
   }
191 191
 }
192 192
 
193
-void AnnounceTransferDialog::onSipReply(const AmSipReply& rep, AmSipDialog::Status old_dlg_status) {
194
-  AmSipRequest* req = dlg.getUACTrans(rep.cseq);
193
+void AnnounceTransferDialog::onSipReply(const AmSipRequest& req, 
194
+					const AmSipReply& rep, 
195
+					AmBasicSipDialog::Status old_dlg_status)
196
+{
195 197
   if ((status==Transfering ||status==Hangup)  && 
196
-      req && req->method == "REFER") {
198
+      req.method == SIP_METH_REFER) {
197 199
     if (rep.code >= 300) {
198 200
       DBG("refer not accepted, stop session.\n");
199 201
       dlg.bye();
... ...
@@ -201,7 +203,7 @@ void AnnounceTransferDialog::onSipReply(const AmSipReply& rep, AmSipDialog::Stat
201 203
     }
202 204
   }
203 205
 
204
-  AmSession::onSipReply(rep, old_dlg_status);
206
+  AmSession::onSipReply(req, rep, old_dlg_status);
205 207
 }
206 208
 
207 209
 void AnnounceTransferDialog::onBye(const AmSipRequest& req)
... ...
@@ -72,7 +72,8 @@ public:
72 72
   void startSession();
73 73
   void onBye(const AmSipRequest& req);
74 74
   void onSipRequest(const AmSipRequest& req);
75
-  void onSipReply(const AmSipReply& rep, AmSipDialog::Status old_dlg_status);
75
+  void onSipReply(const AmSipRequest& req, const AmSipReply& rep, 
76
+		  AmBasicSipDialog::Status old_dlg_status);
76 77
   void onDtmf(int event, int duration_msec) {}
77 78
 
78 79
   void process(AmEvent* event);
... ...
@@ -912,9 +912,11 @@ void ConferenceDialog::onSipRequest(const AmSipRequest& req)
912 912
   return;
913 913
 }
914 914
 
915
-void ConferenceDialog::onSipReply(const AmSipReply& reply, AmSipDialog::Status old_dlg_status)
915
+void ConferenceDialog::onSipReply(const AmSipRequest& req,
916
+				  const AmSipReply& reply, 
917
+				  AmBasicSipDialog::Status old_dlg_status)
916 918
 {
917
-  AmSession::onSipReply(reply, old_dlg_status);
919
+  AmSession::onSipReply(req, reply, old_dlg_status);
918 920
 
919 921
   DBG("ConferenceDialog::onSipReply: code = %i, reason = %s\n, status = %i\n",
920 922
       reply.code,reply.reason.c_str(),dlg.getStatus());
... ...
@@ -160,7 +160,9 @@ public:
160 160
   void onBye(const AmSipRequest& req);
161 161
 
162 162
   void onSipRequest(const AmSipRequest& req);
163
-  void onSipReply(const AmSipReply& reply, AmSipDialog::Status old_dlg_status);
163
+  void onSipReply(const AmSipRequest& req,
164
+		  const AmSipReply& reply, 
165
+		  AmBasicSipDialog::Status old_dlg_status);
164 166
 
165 167
 #ifdef WITH_SAS_TTS
166 168
   void onZRTPEvent(zrtp_event_t event, zrtp_stream_ctx_t *stream_ctx);
... ...
@@ -319,7 +319,10 @@ void DSMCall::onSipRequest(const AmSipRequest& req) {
319 319
   AmB2BCallerSession::onSipRequest(req);  
320 320
 }
321 321
 
322
-void DSMCall::onSipReply(const AmSipRequest& req, const AmSipReply& reply, AmSipDialog::Status old_dlg_status) {
322
+void DSMCall::onSipReply(const AmSipRequest& req,
323
+			 const AmSipReply& reply, 
324
+			 AmBasicSipDialog::Status old_dlg_status) 
325
+{
323 326
 
324 327
   if (checkVar(DSM_ENABLE_REPLY_EVENTS, DSM_TRUE)) {
325 328
     map<string, string> params;
... ...
@@ -88,7 +88,9 @@ public:
88 88
   void onRemoteDisappeared(const AmSipReply& reply);
89 89
 
90 90
   void onSipRequest(const AmSipRequest& req);
91
-  void onSipReply(const AmSipRequest& req, const AmSipReply& reply, AmSipDialog::Status old_dlg_status);
91
+  void onSipReply(const AmSipRequest& req,
92
+		  const AmSipReply& reply, 
93
+		  AmBasicSipDialog::Status old_dlg_status);
92 94
 
93 95
   bool getSdpOffer(AmSdp& offer);
94 96
   bool getSdpAnswer(const AmSdp& offer, AmSdp& answer);
... ...
@@ -738,11 +738,14 @@ void safe_Py_DECREF(PyObject* pyo) {
738 738
   Py_DECREF(pyo);
739 739
 }
740 740
 
741
-void IvrDialog::onSipReply(const AmSipReply& r, AmSipDialog::Status old_dlg_status) {
742
-  PyObject* pyo = getPySipReply(r);
741
+void IvrDialog::onSipReply(const AmSipRequest& req,
742
+			   const AmSipReply& reply, 
743
+			   AmBasicSipDialog::Status old_dlg_status) 
744
+{
745
+  PyObject* pyo = getPySipReply(reply);
743 746
   callPyEventHandler("onSipReply","(O)", pyo);
744 747
   safe_Py_DECREF(pyo);
745
-  AmB2BSession::onSipReply(r,old_dlg_status);
748
+  AmB2BSession::onSipReply(req,reply,old_dlg_status);
746 749
 }
747 750
 
748 751
 void IvrDialog::onSipRequest(const AmSipRequest& r){
... ...
@@ -153,7 +153,9 @@ class IvrDialog : public AmB2BCallerSession
153 153
   void onOtherBye(const AmSipRequest& req);
154 154
   bool onOtherReply(const AmSipReply& r);
155 155
 
156
-  void onSipReply(const AmSipReply& r,AmSipDialog::Status old_dlg_status);
156
+  void onSipReply(const AmSipRequest& req,
157
+		  const AmSipReply& reply, 
158
+		  AmBasicSipDialog::Status old_dlg_status);
157 159
   void onSipRequest(const AmSipRequest& r);
158 160
 
159 161
   void onRtpTimeout();
... ...
@@ -109,10 +109,11 @@ void RtmpSession::onBye(const AmSipRequest& req)
109 109
   AmSession::onBye(req);
110 110
 }
111 111
 
112
-void RtmpSession::onSipReply(const AmSipReply& reply,
113
-			     AmSipDialog::Status old_dlg_status)
112
+void RtmpSession::onSipReply(const AmSipRequest& req,
113
+			     const AmSipReply& reply, 
114
+			     AmBasicSipDialog::Status old_dlg_status)
114 115
 {
115
-  AmSession::onSipReply(reply,old_dlg_status);
116
+  AmSession::onSipReply(req,reply,old_dlg_status);
116 117
 
117 118
   sendCallState();
118 119
 
... ...
@@ -71,8 +71,9 @@ public:
71 71
   void onSessionStart();
72 72
   void onBye(const AmSipRequest& req);
73 73
   void onBeforeDestroy();
74
-  void onSipReply(const AmSipReply& reply,
75
-		  AmSipDialog::Status old_dlg_status);
74
+  void onSipReply(const AmSipRequest& req,
75
+		  const AmSipReply& reply, 
76
+		  AmBasicSipDialog::Status old_dlg_status);
76 77
 
77 78
   void onInvite(const AmSipRequest& req);
78 79
 
... ...
@@ -911,7 +911,7 @@ void CallLeg::addNewCallee(CallLeg *callee, ConnectLegEvent *e, AmB2BSession::RT
911 911
   b.id = callee->getLocalTag();
912 912
 
913 913
   callee->setRtpRelayMode(mode);
914
-  if ((mode == RTP_Relay)) {
914
+  if (mode == RTP_Relay) {
915 915
     // do not initialise the media session with A leg to avoid unnecessary A leg
916 916
     // RTP stream creation in every B leg's media session
917 917
     if (a_leg) b.media_session = new AmB2BMedia(NULL, callee);
... ...
@@ -978,7 +978,7 @@ void CallLeg::addExistingCallee(const string &session_tag, ReconnectLegEvent *ev
978 978
 
979 979
   OtherLegInfo b;
980 980
   b.id = session_tag;
981
-  if ((rtp_relay_mode == RTP_Relay)) {
981
+  if (rtp_relay_mode == RTP_Relay) {
982 982
     // do not initialise the media session with A leg to avoid unnecessary A leg
983 983
     // RTP stream creation in every B leg's media session
984 984
     b.media_session = new AmB2BMedia(NULL, NULL);
... ...
@@ -1012,7 +1012,7 @@ void CallLeg::replaceExistingLeg(const string &session_tag, const AmSipRequest &
1012 1012
 
1013 1013
   OtherLegInfo b;
1014 1014
   b.id.clear(); // this is an invalid local tag (temporarily)
1015
-  if ((rtp_relay_mode == RTP_Relay)) {
1015
+  if (rtp_relay_mode == RTP_Relay) {
1016 1016
     // let the other leg to set its part, we will set our once connected
1017 1017
     b.media_session = new AmB2BMedia(NULL, NULL);
1018 1018
     b.media_session->addReference(); // new reference for me
... ...
@@ -1038,7 +1038,7 @@ void CallLeg::replaceExistingLeg(const string &session_tag, const string &hdrs)
1038 1038
 
1039 1039
   OtherLegInfo b;
1040 1040
   b.id.clear(); // this is an invalid local tag (temporarily)
1041
-  if ((rtp_relay_mode == RTP_Relay)) {
1041
+  if (rtp_relay_mode == RTP_Relay) {
1042 1042
     // let the other leg to set its part, we will set our once connected
1043 1043
     b.media_session = new AmB2BMedia(NULL, NULL);
1044 1044
     b.media_session->addReference(); // new reference for me
... ...
@@ -5,7 +5,7 @@
5 5
 #include "sbc_events.h"
6 6
 
7 7
 class SBCCallLeg;
8
-class SBCCallProfile;
8
+struct SBCCallProfile;
9 9
 
10 10
 struct InitialInviteHandlerParams
11 11
 {
... ...
@@ -453,13 +453,13 @@ void SBCCallLeg::onSipReply(const AmSipRequest& req, const AmSipReply& reply,
453 453
   DBG("onSipReply: %i %s (fwd=%i)\n",reply.code,reply.reason.c_str(),fwd);
454 454
   DBG("onSipReply: content-type = %s\n",reply.body.getCTStr().c_str());
455 455
   if (fwd) {
456
-      CALL_EVENT_H(onSipReply,reply, old_dlg_status);
456
+    CALL_EVENT_H(onSipReply, req, reply, old_dlg_status);
457 457
   }
458 458
 
459 459
   if (NULL != auth) {
460 460
     // only for SIP authenticated
461 461
     unsigned int cseq_before = dlg.cseq;
462
-    if (auth->onSipReply(reply, old_dlg_status)) {
462
+    if (auth->onSipReply(req, reply, old_dlg_status)) {
463 463
       if (cseq_before != dlg.cseq) {
464 464
         DBG("uac_auth consumed reply with cseq %d and resent with cseq %d; "
465 465
             "updating relayed_req map\n", reply.cseq, cseq_before);
... ...
@@ -1357,11 +1357,12 @@ void SBCCallLeg::changeRtpMode(RTPRelayMode new_mode)
1357 1357
   // be lossy because already existing media object would be destroyed.
1358 1358
   // FIXME: use AmB2BMedia in all RTP relay modes to avoid these problems?
1359 1359
   switch (rtp_relay_mode) {
1360
-    case RTP_Relay:
1360
+  case RTP_Relay:
1361
+  case RTP_Transcoding:
1361 1362
       clearRtpReceiverRelay();
1362 1363
       break;
1363 1364
 
1364
-    case RTP_Direct:
1365
+  case RTP_Direct:
1365 1366
       // create new blablabla
1366 1367
       setMediaSession(new AmB2BMedia(a_leg ? this: NULL, a_leg ? NULL : this));
1367 1368
       break;
... ...
@@ -1412,11 +1413,12 @@ void SBCCallLeg::onB2BEvent(B2BEvent* ev)
1412 1413
       if (e->new_mode == rtp_relay_mode) return; // requested mode is set already
1413 1414
 
1414 1415
       switch (rtp_relay_mode) {
1415
-        case RTP_Relay:
1416
+      case RTP_Relay:
1417
+      case RTP_Transcoding:
1416 1418
           clearRtpReceiverRelay();
1417 1419
           break;
1418 1420
 
1419
-        case RTP_Direct:
1421
+      case RTP_Direct:
1420 1422
           // create new blablabla
1421 1423
           setMediaSession(e->media);
1422 1424
           media_session->changeSession(a_leg, this);
... ...
@@ -210,10 +210,11 @@ void WebConferenceDialog::onEarlySessionStart() {
210 210
   AmSession::onEarlySessionStart();
211 211
 }
212 212
 
213
-void WebConferenceDialog::onSipReply(const AmSipReply& reply,
214
-				     AmSipDialog::Status old_dlg_status)
213
+void WebConferenceDialog::onSipReply(const AmSipRequest& req,
214
+				     const AmSipReply& reply, 
215
+				     AmBasicSipDialog::Status old_dlg_status)
215 216
 {
216
-  AmSession::onSipReply(reply,old_dlg_status);
217
+  AmSession::onSipReply(req,reply,old_dlg_status);
217 218
 
218 219
   DBG("reply: %u %s, old_dlg_status = %s, status = %s\n",
219 220
       reply.code, reply.reason.c_str(),
... ...
@@ -99,7 +99,9 @@ public:
99 99
   ~WebConferenceDialog();
100 100
 
101 101
   void process(AmEvent* ev);
102
-  void onSipReply(const AmSipReply& reply, AmSipDialog::Status old_dlg_status);
102
+  void onSipReply(const AmSipRequest& req,
103
+		  const AmSipReply& reply, 
104
+		  AmBasicSipDialog::Status old_dlg_status);
103 105
 
104 106
   void onInvite(const AmSipRequest& req);
105 107
 
... ...
@@ -816,7 +816,7 @@ void AmSession::onSipRequest(const AmSipRequest& req)
816 816
 void AmSession::onSipReply(const AmSipRequest& req, const AmSipReply& reply,
817 817
 			   AmBasicSipDialog::Status old_dlg_status)
818 818
 {
819
-  CALL_EVENT_H(onSipReply, reply, old_dlg_status);
819
+  CALL_EVENT_H(onSipReply, req, reply, old_dlg_status);
820 820
 
821 821
   updateRefreshMethod(reply.hdrs);
822 822
 
... ...
@@ -903,7 +903,7 @@ void AmSession::onSendRequest(AmSipRequest& req, int& flags)
903 903
 
904 904
 void AmSession::onSendReply(const AmSipRequest& req, AmSipReply& reply, int& flags)
905 905
 {
906
-  CALL_EVENT_H(onSendReply,reply,flags);
906
+  CALL_EVENT_H(onSendReply,req,reply,flags);
907 907
 }
908 908
 
909 909
 /** Hook called when an SDP offer is required */
... ...
@@ -26,45 +26,3 @@
26 26
  */
27 27
 
28 28
 #include "AmSessionEventHandler.h"
29
-
30
-// AmSessionEventHandler methods
31
-int AmSessionEventHandler::configure(AmConfigReader& conf)
32
-{
33
-  return 0;
34
-}
35
-
36
-bool AmSessionEventHandler::process(AmEvent*)
37
-{
38
-  return false;
39
-}
40
-
41
-bool AmSessionEventHandler::onSipRequest(const AmSipRequest&)
42
-{
43
-  return false;
44
-}
45
-
46
-bool AmSessionEventHandler::onSipReply(const AmSipReply& reply, AmSipDialog::Status old_dlg_status)
47
-{
48
-  return false;
49
-}
50
-
51
-bool AmSessionEventHandler::onSipReqTimeout(const AmSipRequest &)
52
-{
53
-  return false;
54
-}
55
-
56
-bool AmSessionEventHandler::onSipRplTimeout(const AmSipRequest &, 
57
-    const AmSipReply &)
58
-{
59
-  return false;
60
-}
61
-
62
-bool AmSessionEventHandler::onSendRequest(AmSipRequest& req, int flags)
63
-{
64
-  return false;
65
-}
66
-
67
-bool AmSessionEventHandler::onSendReply(AmSipReply& reply, int flags)
68
-{
69
-  return false;
70
-}
... ...
@@ -58,21 +58,29 @@ public:
58 58
   virtual ~AmSessionEventHandler() {}
59 59
 
60 60
   /** Returns -1 on error, 0 else. */
61
-  virtual int configure(AmConfigReader& conf);
61
+  virtual int configure(AmConfigReader& conf)
62
+  { return 0; }
62 63
 
63 64
   /* 
64 65
    * All the methods return true if the event processing 
65 66
    * shall be stopped after them.
66 67
    */
67
-  virtual bool process(AmEvent*);
68
+  virtual bool process(AmEvent*)
69
+  { return false; }
68 70
 
69
-  virtual bool onSipRequest(const AmSipRequest&);
70
-  virtual bool onSipReply(const AmSipReply&, AmSipDialog::Status old_dlg_status);
71
-  virtual bool onSipReqTimeout(const AmSipRequest &);
72
-  virtual bool onSipRplTimeout(const AmSipRequest &, const AmSipReply &);
71
+  virtual bool onSipRequest(const AmSipRequest& req)
72
+  { return false; }
73 73
 
74
-  virtual bool onSendRequest(AmSipRequest& req, int flags);
75
-  virtual bool onSendReply(AmSipReply& reply, int flags);
74
+  virtual bool onSipReply(const AmSipRequest& req, 
75
+  			  const AmSipReply& reply, 
76
+  			  AmBasicSipDialog::Status old_dlg_status)
77
+  { return false; }
78
+
79
+  virtual bool onSendRequest(AmSipRequest& req, int& flags)
80
+  { return false; }
81
+
82
+  virtual bool onSendReply(const AmSipRequest& req, AmSipReply& reply, int& flags)
83
+  { return false; }
76 84
 };
77 85
 
78 86
 
... ...
@@ -175,16 +175,16 @@ bool AmSIPRegistration::doUnregister()
175 175
   return res;
176 176
 }
177 177
 
178
-void AmSIPRegistration::onSendRequest(AmSipRequest& req, int flags)
178
+void AmSIPRegistration::onSendRequest(AmSipRequest& req, int& flags)
179 179
 {
180 180
   if (seh)
181 181
     seh->onSendRequest(req,flags);
182 182
 }
183 183
 	
184
-void AmSIPRegistration::onSendReply(AmSipReply& reply,
185
-				    int flags) {
184
+void AmSIPRegistration::onSendReply(const AmSipRequest& req, AmSipReply& reply,
185
+				    int& flags) {
186 186
   if (seh)
187
-    seh->onSendReply(reply,flags);
187
+    seh->onSendReply(req,reply,flags);
188 188
 }
189 189
 
190 190
 AmSIPRegistration::RegistrationState AmSIPRegistration::getState() {
... ...
@@ -250,10 +250,11 @@ bool AmSIPRegistration::registerExpired(time_t now_sec) {
250 250
   return ((reg_begin+reg_expires) < (unsigned int)now_sec);	
251 251
 }
252 252
 
253
-void AmSIPRegistration::onSipReply(const AmSipReply& reply, 
254
-				   AmSipDialog::Status old_dlg_status)
253
+void AmSIPRegistration::onSipReply(const AmSipRequest& req,
254
+				   const AmSipReply& reply, 
255
+				   AmBasicSipDialog::Status old_dlg_status)
255 256
 {
256
-  if ((seh!=NULL) && seh->onSipReply(reply, old_dlg_status))
257
+  if ((seh!=NULL) && seh->onSipReply(req,reply, old_dlg_status))
257 258
     return;
258 259
 
259 260
   if (reply.code>=200)
... ...
@@ -109,15 +109,17 @@ class AmSIPRegistration
109 109
 
110 110
   bool registerSendTimeout(time_t now_sec);
111 111
 
112
-  void onSendRequest(AmSipRequest& req, int flags);
113
-  void onSendReply(AmSipReply& req, int flags);
112
+  void onSendRequest(AmSipRequest& req, int& flags);
113
+  void onSendReply(const AmSipRequest& req, AmSipReply& reply, int& flags);
114 114
 
115 115
   // DialogControl if
116 116
   AmBasicSipDialog* getDlg() { return &dlg; }
117 117
   // CredentialHolder	
118 118
   UACAuthCred* getCredentials() { return &cred; }
119 119
 
120
-  void onSipReply(const AmSipReply& reply, AmSipDialog::Status old_dlg_status);
120
+  void onSipReply(const AmSipRequest& req,
121
+		  const AmSipReply& reply, 
122
+		  AmBasicSipDialog::Status old_dlg_status);
121 123
 
122 124
   /** is this registration registered? */
123 125
   bool active; 
... ...
@@ -80,61 +80,57 @@ bool SessionTimer::onSipRequest(const AmSipRequest& req)
80 80
   return false;
81 81
 }
82 82
 
83
-bool SessionTimer::onSipReply(const AmSipReply& reply, AmSipDialog::Status old_dlg_status)
83
+bool SessionTimer::onSipReply(const AmSipRequest& req, const AmSipReply& reply, 
84
+			      AmBasicSipDialog::Status old_dlg_status)
84 85
 {
85 86
   if (session_timer_conf.getEnableSessionTimer() &&
86 87
       (reply.code == 422) &&
87 88
       ((reply.cseq_method == SIP_METH_INVITE) || 
88 89
        (reply.cseq_method == SIP_METH_UPDATE))) {
89
-    std::map<unsigned int, SIPRequestInfo >::iterator ri =
90
-      sent_requests.find(reply.cseq);
91
-    if (ri != sent_requests.end()) {
92
-      SIPRequestInfo& orig_req = ri->second;
93
-
94
-      // get Min-SE
95
-      unsigned int i_minse;
96
-      string min_se_hdr = getHeader(reply.hdrs, SIP_HDR_MIN_SE, true);
97
-      if (!min_se_hdr.empty()) {
98
-	if (str2i(strip_header_params(min_se_hdr), i_minse)) {
99
-	  WARN("error while parsing " SIP_HDR_MIN_SE " header value '%s'\n",
100
-	       strip_header_params(min_se_hdr).c_str());
101
-	} else {
102 90
 
103
-	  if (i_minse <= session_timer_conf.getMaximumTimer()) {
104
-	    session_interval = i_minse;
105
-	    unsigned int new_cseq = s->dlg.cseq;
106
-	    // resend request with interval i_minse
107
-	    if (s->dlg.sendRequest(orig_req.method, &orig_req.body,
108
-				   orig_req.hdrs) == 0) {
109
-              DBG("request with new Session Interval %u successfully sent.\n", i_minse);
110
-	      // undo SIP dialog status change
111
-	      if (s->dlg.getStatus() != old_dlg_status)
112
-	        s->dlg.setStatus(old_dlg_status);
113
-
114
-	      s->updateUACTransCSeq(reply.cseq, new_cseq);
115
-	      // processed
116
-	      return true;
117
-            } else {
118
-              ERROR("failed to send request with new Session Interval.\n");
119
-            }
91
+    // get Min-SE
92
+    unsigned int i_minse;
93
+    string min_se_hdr = getHeader(reply.hdrs, SIP_HDR_MIN_SE, true);
94
+    if (!min_se_hdr.empty()) {
95
+      if (str2i(strip_header_params(min_se_hdr), i_minse)) {
96
+	WARN("error while parsing " SIP_HDR_MIN_SE " header value '%s'\n",
97
+	     strip_header_params(min_se_hdr).c_str());
98
+      } else {
99
+	
100
+	if (i_minse <= session_timer_conf.getMaximumTimer()) {
101
+	  session_interval = i_minse;
102
+	  unsigned int new_cseq = s->dlg.cseq;
103
+	  // resend request with interval i_minse
104
+	  if (s->dlg.sendRequest(req.method, &req.body,req.hdrs) == 0) {
105
+	    DBG("request with new Session Interval %u successfully sent.\n", i_minse);
106
+	    // undo SIP dialog status change
107
+	    if (s->dlg.getStatus() != old_dlg_status)
108
+	      s->dlg.setStatus(old_dlg_status);
109
+
110
+	    s->updateUACTransCSeq(reply.cseq, new_cseq);
111
+	    // processed
112
+	    return true;
120 113
 	  } else {
121
-	    DBG("other side requests too high Min-SE: %u (our limit %u)\n",
122
-		i_minse, session_timer_conf.getMaximumTimer());
114
+	    ERROR("failed to send request with new Session Interval.\n");
123 115
 	  }
116
+	} else {
117
+	  DBG("other side requests too high Min-SE: %u (our limit %u)\n",
118
+	      i_minse, session_timer_conf.getMaximumTimer());
124 119
 	}
125 120
       }
126
-    } else {
127
-      WARN("request CSeq %u not found in sent requests; unable to retry after 422\n",
128
-	   reply.cseq);
129 121
     }
122
+  } 
123
+
124
+  if ((reply.cseq_method == SIP_METH_INVITE) || 
125
+      (reply.cseq_method == SIP_METH_UPDATE)) {
126
+
127
+    updateTimer(s,reply);
130 128
   }
131
-  if ((reply.cseq_method == SIP_METH_INVITE) || (reply.cseq_method == SIP_METH_UPDATE)) {
132
-      updateTimer(s,reply);
133
-  }
129
+
134 130
   return false;
135 131
 }
136 132
 
137
-bool SessionTimer::onSendRequest(AmSipRequest& req, int flags)
133
+bool SessionTimer::onSendRequest(AmSipRequest& req, int& flags)
138 134
 {
139 135
   if (req.method == "BYE") {
140 136
     removeTimers(s);
... ...
@@ -163,7 +159,8 @@ bool SessionTimer::onSendRequest(AmSipRequest& req, int flags)
163 159
 }
164 160
 
165 161
 
166
-bool SessionTimer::onSendReply(AmSipReply& reply, int flags)
162
+bool SessionTimer::onSendReply(const AmSipRequest& req,
163
+			       AmSipReply& reply, int& flags)
167 164
 {
168 165
   // only in 2xx responses to INV/UPD
169 166
   if  (((reply.cseq_method != SIP_METH_INVITE) && 
... ...
@@ -155,10 +155,11 @@ class SessionTimer: public AmSessionEventHandler
155 155
   virtual bool process(AmEvent*);
156 156
 
157 157
   virtual bool onSipRequest(const AmSipRequest&);
158
-  virtual bool onSipReply(const AmSipReply&, AmSipDialog::Status old_dlg_status);
158
+  virtual bool onSipReply(const AmSipRequest&, const AmSipReply&, 
159
+			  AmBasicSipDialog::Status old_dlg_status);
159 160
 
160
-  virtual bool onSendRequest(AmSipRequest& req, int flags);
161
-  virtual bool onSendReply(AmSipReply& reply, int flags);
161
+  virtual bool onSendRequest(AmSipRequest& req, int& flags);
162
+  virtual bool onSendReply(const AmSipRequest& req, AmSipReply& reply, int& flags);
162 163
 };
163 164
 
164 165
 
... ...
@@ -127,7 +127,8 @@ bool UACAuth::onSipRequest(const AmSipRequest& req)
127 127
   return false;
128 128
 }
129 129
 
130
-bool UACAuth::onSipReply(const AmSipReply& reply, AmSipDialog::Status old_dlg_status)
130
+bool UACAuth::onSipReply(const AmSipRequest& req, const AmSipReply& reply, 
131
+			 AmBasicSipDialog::Status old_dlg_status)
131 132
 {
132 133
   bool processed = false;
133 134
   if (reply.code==407 || reply.code==401) {
... ...
@@ -221,7 +222,7 @@ bool UACAuth::onSipReply(const AmSipReply& reply, AmSipDialog::Status old_dlg_st
221 222
   return processed;
222 223
 }
223 224
 
224
-bool UACAuth::onSendRequest(AmSipRequest& req, int flags)
225
+bool UACAuth::onSendRequest(AmSipRequest& req, int& flags)
225 226
 {
226 227
   // add authentication header if nonce is already there
227 228
   string result;
... ...
@@ -250,7 +251,7 @@ bool UACAuth::onSendRequest(AmSipRequest& req, int flags)
250 251
 }
251 252
 
252 253
 
253
-bool UACAuth::onSendReply(AmSipReply& reply, int flags)
254
+bool UACAuth::onSendReply(const AmSipRequest& req, AmSipReply& reply, int& flags)
254 255
 {
255 256
   return false;
256 257
 }
... ...
@@ -157,9 +157,10 @@ class UACAuth : public AmSessionEventHandler
157 157
   virtual bool process(AmEvent*);
158 158
   virtual bool onSipEvent(AmSipEvent*);
159 159
   virtual bool onSipRequest(const AmSipRequest&);
160
-  virtual bool onSipReply(const AmSipReply&, AmBasicSipDialog::Status old_status);
161
-  virtual bool onSendRequest(AmSipRequest& req, int flags);
162
-  virtual bool onSendReply(AmSipReply& reply, int flags);
160
+  virtual bool onSipReply(const AmSipRequest&, const AmSipReply&, 
161
+			  AmBasicSipDialog::Status old_status);
162
+  virtual bool onSendRequest(AmSipRequest& req, int& flags);
163
+  virtual bool onSendReply(const AmSipRequest& req, AmSipReply& reply, int& flags);
163 164
 };
164 165
 
165 166