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's past 12 seconds then hang the call up.<br>
<br>
Inside the loose_route() and is_method("BYE") I put this:<br><br>
$avp(s:nowts)=$Ts;<br>
$avp(s:calllength)=$avp(s:calltime) - $Ts;<br>
<br>
if($avp(s:calllength) < "6"){<br>
$avp(s:sleeptime)= "6" - $avp(s:calllength); <br>
xlog("L_NOTICE","Now TS: $Ts Call was $avp(s:calllength) seconds long, sleeping for $avp(s:sleeptime)");<br>
#sleep("$avp(s:sleeptime)");<br>
} else {<br>
xlog("L_NOTICE","Now TS: $Ts Call was $avp(s:calllength) seconds long, not sleeping");<br>
}<br>
<br>
<br>
Inside the onreply_route I put this:<br><br>
if(t_check_status("200") && is_method("INVITE")){<br>
$avp(s:calltime)=$Ts;<br>
xlog("L_NOTICE","Call connected at $avp(s:calltime)");<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>