Hello,

iirc, the $dlg_var(...) can have only string value. Can you try the assignments with values "700" and "701"?

Otherwise, I tested and if a dlg_var si set for BYE, it appears in acc cdr.

Cheers,
Daniel

On 29/01/15 12:20, Mickael Marrache wrote:

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



_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - http://www.kamailioworld.com