Hi List,<br>
<br>
When a user hangs up a call (call comes into proxy, connects to PSTN) and if the user that made the call hangups before a certain amount of time I want to delay sending the BYE to the upstream carrier, but ACK the BYE to the person they called and then have acc show the correct call timestamps of when the user really hanged up. Basically if a call is less then say 12 seconds id like to sleep() a few seconds until it&#39;s past 12 seconds then hang the call up.<br>

<br>
Inside the loose_route() and is_method(&quot;BYE&quot;) I put this:<br><br>
          $avp(s:nowts)=$Ts;<br>
          $avp(s:calllength)=$avp(s:calltime) - $Ts;<br>
<br>
          if($avp(s:calllength) &lt; &quot;6&quot;){<br>
            $avp(s:sleeptime)= &quot;6&quot; - $avp(s:calllength); <br>
            xlog(&quot;L_NOTICE&quot;,&quot;Now TS: $Ts Call was $avp(s:calllength) seconds long, sleeping for $avp(s:sleeptime)&quot;);<br>
            #sleep(&quot;$avp(s:sleeptime)&quot;);<br>
          } else {<br>
            xlog(&quot;L_NOTICE&quot;,&quot;Now TS: $Ts Call was $avp(s:calllength) seconds long, not sleeping&quot;);<br>
          }<br>
<br>
<br>
Inside the onreply_route I put this:<br><br>
  if(t_check_status(&quot;200&quot;) &amp;&amp; is_method(&quot;INVITE&quot;)){<br>
    $avp(s:calltime)=$Ts;<br>
    xlog(&quot;L_NOTICE&quot;,&quot;Call connected at $avp(s:calltime)&quot;);<br>
  }<br>
<br>
To me I would think I would then have the timestamp at when the call started (that parts works), then in the loose_route() I could take the current timestamp and subtract the two, then if less the X seconds, sleep before it sends the BYE.<br>

<br>
I know their is more to it then that, but as a starting point the $avp(s:calltime) var is NULL when the call hits loose_route() is, I have verified this by the log.<br>
<br>
Any help / insight on this would be great, I would think the variables would be accessible anyway I try to check for values, but it appears that is not the case.<br>