Browse code

sbc transparent dialog ID q/f: reuse to-tag

was part of commit 9484f0b17153fc6d5d25cc0961617851f58a8957, lost by me
during merge loong time ago

Václav Kubart authored on 08/08/2013 05:49:50
Showing 4 changed files
... ...
@@ -346,6 +346,13 @@ void CallLeg::b2bInitial2xx(AmSipReply& reply, bool forward)
346 346
   updateCallStatus(Connected, &reply);
347 347
 }
348 348
 
349
+void CallLeg::onInitialReply(B2BSipReplyEvent *e)
350
+{
351
+    if (e->reply.code < 200) b2bInitial1xx(e->reply, e->forward);
352
+    else if (e->reply.code < 300) b2bInitial2xx(e->reply, e->forward);
353
+    else b2bInitialErr(e->reply, e->forward);
354
+}
355
+
349 356
 void CallLeg::b2bInitialErr(AmSipReply& reply, bool forward)
350 357
 {
351 358
   if (getCallStatus() == Ringing && getOtherId() != reply.from_tag) {
... ...
@@ -404,9 +411,7 @@ void CallLeg::onB2BReply(B2BSipReplyEvent *ev)
404 411
 
405 412
     TRACE("established CSeq: %d, forward: %s\n", est_invite_cseq, ev->forward ? "yes": "no");
406 413
 
407
-    if (reply.code < 200) b2bInitial1xx(reply, ev->forward);
408
-    else if (reply.code < 300) b2bInitial2xx(reply, ev->forward);
409
-    else b2bInitialErr(reply, ev->forward);
414
+    onInitialReply(ev);
410 415
   }
411 416
   else {
412 417
     // handle non-initial replies
... ...
@@ -344,6 +344,8 @@ class CallLeg: public AmB2BSession
344 344
     virtual void onSipRequest(const AmSipRequest& req);
345 345
     virtual void onSipReply(const AmSipRequest& req, const AmSipReply& reply, AmSipDialog::Status old_dlg_status);
346 346
 
347
+    virtual void onInitialReply(B2BSipReplyEvent *e);
348
+
347 349
     /* callback method called when hold/resume request is replied */
348 350
     virtual void handleHoldReply(bool succeeded);
349 351
 
... ...
@@ -535,6 +535,14 @@ void SBCCallLeg::setOtherId(const AmSipReply& reply)
535 535
   }
536 536
 }
537 537
 
538
+void SBCCallLeg::onInitialReply(B2BSipReplyEvent *e)
539
+{
540
+  if (call_profile.transparent_dlg_id && !e->reply.to_tag.empty()) {
541
+    dlg->setExtLocalTag(e->reply.to_tag);
542
+  }
543
+  CallLeg::onInitialReply(e);
544
+}
545
+
538 546
 void SBCCallLeg::onSipReply(const AmSipRequest& req, const AmSipReply& reply,
539 547
 			   AmBasicSipDialog::Status old_dlg_status)
540 548
 {
... ...
@@ -190,6 +190,8 @@ class SBCCallLeg : public CallLeg, public CredentialHolder
190 190
   void onSipReply(const AmSipRequest& req, const AmSipReply& reply, AmSipDialog::Status old_dlg_status);
191 191
   void onSendRequest(AmSipRequest& req, int &flags);
192 192
 
193
+  virtual void onInitialReply(B2BSipReplyEvent *e);
194
+
193 195
   void onRemoteDisappeared(const AmSipReply& reply);
194 196
   void onBye(const AmSipRequest& req);
195 197
   void onOtherBye(const AmSipRequest& req);