Browse code

dsm: add more clear debugging on transitions

Stefan Sayer authored on 17/12/2013 14:00:46
Showing 2 changed files
... ...
@@ -526,17 +526,20 @@ void DSMStateEngine::runEvent(AmSession* sess, DSMSession* sc_sess,
526 526
   map<string,string> exception_params;
527 527
   bool is_exception = run_exception;
528 528
 
529
+  DBG("o v DSM processing event, current state '%s' v\n", current->name.c_str());
529 530
   bool is_consumed = true;
530 531
   do {
531 532
     try {
532 533
       is_consumed = true;
533 534
 
535
+
536
+      DBG(" > state '%s'\n", current->name.c_str());
534 537
       for (vector<DSMTransition>::iterator tr = current->transitions.begin();
535 538
 	   tr != current->transitions.end();tr++) {
536 539
 	if (tr->is_exception != is_exception)
537 540
 	  continue;
538 541
 	
539
-	DBG("checking transition '%s'\n", tr->name.c_str());
542
+	DBG(" ...checking transition '%s'\n", tr->name.c_str());
540 543
 	
541 544
 	vector<DSMCondition*>::iterator con=tr->precond.begin();
542 545
 	while (con!=tr->precond.end()) {
... ...
@@ -545,7 +548,7 @@ void DSMStateEngine::runEvent(AmSession* sess, DSMSession* sc_sess,
545 548
 	  con++;
546 549
 	}
547 550
 	if (con == tr->precond.end()) {
548
-	  DBG("transition '%s' matched.\n", tr->name.c_str());
551
+	  DBG(" .>>transition '%s' matched.\n", tr->name.c_str());
549 552
 	  
550 553
 	  //  matched all preconditions
551 554
 	  // find target state
... ...
@@ -560,7 +563,7 @@ void DSMStateEngine::runEvent(AmSession* sess, DSMSession* sc_sess,
560 563
 	  
561 564
 	  // run post-actions
562 565
 	  if (current->post_actions.size()) {
563
-	    DBG("running %zd post_actions of state '%s'\n",
566
+	    DBG(" >>>running %zd post_actions of state '%s'\n",
564 567
 		current->post_actions.size(), current->name.c_str());
565 568
 	    if (runactions(current->post_actions.begin(), 
566 569
 			   current->post_actions.end(), 
... ...
@@ -571,7 +574,7 @@ void DSMStateEngine::runEvent(AmSession* sess, DSMSession* sc_sess,
571 574
 	  
572 575
 	  // run transition actions
573 576
 	  if (tr->actions.size()) {
574
-	    DBG("running %zd actions of transition '%s'\n",
577
+	    DBG("  >>>running %zd actions of transition '%s'\n",
575 578
 		tr->actions.size(), tr->name.c_str());
576 579
 	    if (runactions(tr->actions.begin(), 
577 580
 			   tr->actions.end(), 
... ...
@@ -584,7 +587,7 @@ void DSMStateEngine::runEvent(AmSession* sess, DSMSession* sc_sess,
584 587
 	  if (!target_st) {
585 588
 	    break;
586 589
 	  }
587
-	  DBG("changing to new state '%s'\n", target_st->name.c_str());
590
+	  DBG("  >>>changing to new state '%s'\n", target_st->name.c_str());
588 591
 	  
589 592
 #ifdef USE_MONITORING
590 593
 	  MONITORING_LOG(sess->getLocalTag().c_str(), "dsm_state", target_st->name.c_str());
... ...
@@ -606,7 +609,7 @@ void DSMStateEngine::runEvent(AmSession* sess, DSMSession* sc_sess,
606 609
 	  
607 610
 	  // execute pre-actions
608 611
 	  if (current->pre_actions.size()) {
609
-	    DBG("running %zd pre_actions of state '%s'\n",
612
+	    DBG(" >>>running %zd pre_actions of state '%s'\n",
610 613
 		current->pre_actions.size(), current->name.c_str());
611 614
 	    if (runactions(current->pre_actions.begin(), 
612 615
 			   current->pre_actions.end(), 
... ...
@@ -614,6 +617,7 @@ void DSMStateEngine::runEvent(AmSession* sess, DSMSession* sc_sess,
614 617
 	      break;
615 618
 	    }
616 619
 	  }
620
+	  DBG(" >>o arrived in state '%s'\n", current->name.c_str());
617 621
 	  
618 622
 	  break;
619 623
 	}
... ...
@@ -629,6 +633,8 @@ void DSMStateEngine::runEvent(AmSession* sess, DSMSession* sc_sess,
629 633
     }
630 634
 
631 635
   } while (!is_consumed);
636
+
637
+  DBG("o ^ DSM event processed/consumed; current state '%s' ^\n", current->name.c_str());
632 638
 }
633 639
 
634 640
 bool DSMStateEngine::callDiag(const string& diag_name, AmSession* sess, DSMSession* sc_sess,
... ...
@@ -98,6 +98,8 @@ legStateChange
98 98
 BLegRefused
99 99
     Reply parameters (#sip_reason, #sip_code, ...)
100 100
 
101
+B2B.otherRequest, B2B.otherReply - see dsm_syntax.txt
102
+
101 103
 -- ----- hold related -------- 
102 104
 PutOnHold
103 105