[OpenSIPS-Users] Minimum length of call

Ron McCarthy ronmccar at gmail.com
Mon Jan 18 21:55:29 CET 2010


Hi List,

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.

Inside the loose_route() and is_method("BYE") I put this:

          $avp(s:nowts)=$Ts;
          $avp(s:calllength)=$avp(s:calltime) - $Ts;

          if($avp(s:calllength) < "6"){
            $avp(s:sleeptime)= "6" - $avp(s:calllength);
            xlog("L_NOTICE","Now TS: $Ts Call was $avp(s:calllength) seconds
long, sleeping for $avp(s:sleeptime)");
            #sleep("$avp(s:sleeptime)");
          } else {
            xlog("L_NOTICE","Now TS: $Ts Call was $avp(s:calllength) seconds
long, not sleeping");
          }


Inside the onreply_route I put this:

  if(t_check_status("200") && is_method("INVITE")){
    $avp(s:calltime)=$Ts;
    xlog("L_NOTICE","Call connected at $avp(s:calltime)");
  }

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.

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.

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20100118/fecc04aa/attachment.htm 


More information about the Users mailing list