Hi,

 

Is there a way to set a dialog variable when a BYE is received so that it can be written in a CDR?

 

I tried as follows but it didn't work:

 

if (loose_route()) {

          ……

          if(is_method("BYE")) {

                    if(is_direction("downstream")) {

                             #Call disconnected by caller

                             $dlg_var(dr) = 700;

                    } else {

                                #Call disconnected by callee

                                $dlg_var(dr) = 701;

                    }

                    xlog("Setting disconnect reason to $dlg_var(dr)\n");

          }

          ……

          exit;

}

 

The xlog statement prints:

 

ERROR: <script>: Setting disconnect reason to <null>

 

The doc states:

 

This pseudo-variable will be available only for subsequential requests after doing loose_route().

 

Thanks,

Mickael