<p>Hello,</p>

<p>This can be achieved now by using the dialog exported events ( see <a href="http://www.opensips.org/html/docs/modules/2.1.x/dialog.html#id297207">http://www.opensips.org/html/docs/modules/2.1.x/dialog.html#id297207</a> )<br>
By using the event_route module (  <a href="http://www.opensips.org/html/docs/modules/2.1.x/event_route#id293506">http://www.opensips.org/html/docs/modules/2.1.x/event_route#id293506</a> ) and declaring a script route as route[E_DLG_STATE_CHANGED] , you will be able to detect when the dialog switches from the 4 state ( established ) to state 5 ( ended ) - the route will get called before the accounting is done, thus allowing you to populate your variables.</p>

<p>Best Regards,<br>
Vlad</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/issues/526#issuecomment-107924542">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOciaYxRwHuEchcHsdGJ3PGIIlaU5nOks5oPY2CgaJpZM4Et4VL.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
    <link itemprop="url" href="https://github.com/OpenSIPS/opensips/issues/526#issuecomment-107924542"></link>
    <meta itemprop="name" content="View Issue"></meta>
  </div>
  <meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>