Browse code

sip: fixed issues related to forking behind the SBC.

Raphael Coeffic authored on 08/04/2013 13:40:43
Showing 2 changed files
... ...
@@ -423,7 +423,7 @@ void AmBasicSipDialog::updateDialogTarget(const AmSipReply& reply)
423 423
 
424 424
 void AmBasicSipDialog::setRemoteTag(const string& new_rt)
425 425
 {
426
-  if(!new_rt.empty() && remote_tag.empty()){
426
+  if(new_rt != remote_tag){
427 427
     remote_tag = new_rt;
428 428
   }
429 429
 }
... ...
@@ -343,7 +343,7 @@ bool AmSipDialog::onRxReplyStatus(const AmSipReply& reply,
343 343
     case Trying:
344 344
     case Proceeding:
345 345
       if(reply.code < 200){
346
-	if(reply.to_tag.empty())
346
+	if(reply.code == 100 || reply.to_tag.empty())
347 347
 	  setStatus(Proceeding);
348 348
 	else {
349 349
 	  setStatus(Early);
... ...
@@ -367,6 +367,7 @@ bool AmSipDialog::onRxReplyStatus(const AmSipReply& reply,
367 367
 
368 368
       if(reply.code >= 300) {// error reply
369 369
 	setStatus(Disconnected);
370
+	setRemoteTag(reply.to_tag);
370 371
       }
371 372
       else if(cancel_pending){
372 373
 	cancel_pending = false;
... ...
@@ -392,6 +393,7 @@ bool AmSipDialog::onRxReplyStatus(const AmSipReply& reply,
392 393
       }
393 394
       else { // error reply
394 395
 	setStatus(Disconnected);
396
+	setRemoteTag(reply.to_tag);
395 397
       }
396 398
       break;
397 399
 
... ...
@@ -404,6 +406,7 @@ bool AmSipDialog::onRxReplyStatus(const AmSipReply& reply,
404 406
       else if(reply.code < 300){
405 407
 	// CANCEL rejected
406 408
 	DBG("CANCEL rejected/too late - bye()\n");
409
+	setRemoteTag(reply.to_tag);
407 410
 	bye();
408 411
 	// if BYE could not be sent,
409 412
 	// there is nothing we can do anymore...