<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.30.3">
</HEAD>
<BODY>
Yes, a decide to do a lua script for this task.<BR>
<BR>
What I'm doing is a group call that loops all the members until a global timeout is reached.<BR>
<BR>
Is the code:<BR>
<BR>
call_timeout = session:getVariable(&quot;call_timeout&quot;) or 60<BR>
timestamp_a = os.time()<BR>
-- while the call is not answered<BR>
while session:answered()==false do<BR>
-- dial the group<BR>
session:setVariable(&quot;call_timeout&quot;, call_timeout)<BR>
session:execute(&quot;bridge&quot;,&quot;\${group_call(<A HREF="mailto:two@commsmundi.com">two@default</A>+F)}&quot;)<BR>
<BR>
-- bridge state<BR>
if (session:ready() == false) then break end<BR>
if (session:hangupState()) then break end<BR>
<BR>
-- check global time, and remove the used amount of time already used in the call<BR>
timestamp_b = os.time()<BR>
sec = timestamp_b - timestamp_a<BR>
timestamp_a = timestamp_b<BR>
call_timeout = call_timeout - sec<BR>
if (call_timeout &lt;= 0) then<BR>
session:setVariable(&quot;originate_disposition&quot;, &quot;ALLOTTED_TIMEOUT&quot;)<BR>
debug.info(&quot;GROUP: CALL TIMEOUT!&quot;)<BR>
break<BR>
end<BR>
end<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
On Mon, 2011-10-17 at 13:12 -0700, Michael Collins wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
    Did you figure this out yet? Not sure exactly what you're trying to do here, but you could use the sched_hangup API and schedule a hangup or sched_transfer to schedule a transfer to a specific dialplan extension that does your cleanup work.<BR>
    <BR>
    <BR>
    <FONT SIZE="1">&lt;action application=&quot;set&quot; data=&quot;api_res=${sched_transfer +60 ${uuid} handle_timeout XML handlers}&quot;/&gt;</FONT><BR>
    <BR>
    <BR>
    Then something like this for the dp<BR>
    <BR>
    <BR>
    <FONT SIZE="1">&lt;context name=&quot;handlers&quot;&gt;</FONT><BR>
    <FONT SIZE="1">&nbsp; &lt;extension name=&quot;handle loop timeouts&quot;&gt;</FONT><BR>
    <BR>
    <FONT SIZE="1">&nbsp; &nbsp; &lt;condition field=&quot;destination_number&quot; expression=&quot;^handle_timeout$&quot;&gt;</FONT><BR>
    <FONT SIZE="1">&nbsp; &nbsp; &nbsp; &lt;action application=&quot;log&quot; data=&quot;INFO OB call timed out...&quot;/&gt;</FONT><BR>
    <FONT SIZE="1">&nbsp; &nbsp; &nbsp; &lt;action application=&quot;foo&quot; data=&quot;bar&quot;/&gt; &lt;!-- do something useful --&gt;</FONT><BR>
    <FONT SIZE="1">&nbsp; &nbsp; &nbsp; &lt;action application=&quot;hangup&quot; data=&quot;pick_a_hangup_cause_if_you_wish&quot;/&gt;</FONT><BR>
    <FONT SIZE="1">&nbsp; &nbsp; &lt;/condition&gt;</FONT><BR>
    <FONT SIZE="1">&nbsp; &lt;/extensions&gt;</FONT><BR>
    <FONT SIZE="1">&lt;/context&gt;</FONT><BR>
    <BR>
    <BR>
    -MC<BR>
    <BR>
    On Thu, Oct 13, 2011 at 10:09 AM, Antonio &lt;<A HREF="mailto:asilva@wirelessmundi.com">asilva@wirelessmundi.com</A>&gt; wrote:<BR>
    <BLOCKQUOTE>
        <BR>
        Hi,<BR>
        <BR>
        Is it possible to loop a bridge until a global call timeout (or other variable) is reached?<BR>
        <BR>
        In the wiki is this example is a fixed number of loops...<BR>
        <BR>
        &lt;extension name=&quot;3-way gateway distro&quot;&gt; 
<PRE>
&lt;condition field=&quot;destination_number&quot; expression=&quot;^(.*)$&quot;&gt;
      &lt;action application=&quot;set&quot; data=&quot;continue_on_fail=true&quot;/&gt;
      &lt;action application=&quot;set&quot; data=&quot;hangup_after_bridge=true&quot;/&gt;
      &lt;action application=&quot;bridge&quot; data=&quot;sofia/gateway/${distributor(3gw)}/$1&quot; loop=&quot;3&quot;/&gt;
    &lt;/condition&gt;
&nbsp; &lt;/extension&gt;

My idea is to call a group sequential, but once it reaches the last member it starts over again.
so when calling a group, once the timeout for each user in the group is reach it hangups the call (the normal behavior),
it jumps again to the begin of the group until a global timeout is reached.

For example:

&lt;extension name=&quot;group&quot;&gt; 
&lt;condition field=&quot;destination_number&quot; expression=&quot;^(.*)$&quot;&gt;
      &lt;action application=&quot;set&quot; data=&quot;continue_on_fail=true&quot;/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;hangup_after_bridge=true&quot;/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;call_timeout=60&quot;/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;set&quot; data=&quot;leg_timeout=10&quot;/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application=&quot;bridge&quot; data=&quot;&quot;${group_call(group1@default+F)}&quot; loop=&quot;3&quot;/&gt;
    &lt;/condition&gt;
&nbsp; &lt;/extension&gt;

In my group i have two members only.



</PRE>
        <BR>
        <TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
-- 

Un cordial saludo / Best regards, 

&nbsp;_________________________

Ant&#243;nio Silva

E-mail:<A HREF="mailto:asilva@wirelessmundi.com">asilva@wirelessmundi.com</A>
</PRE>
</TD>
</TR>
</TABLE>
        <BR>
        <BR>
        FreeSWITCH-users mailing list<BR>
        <A HREF="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</A><BR>
        <A HREF="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</A><BR>
        UNSUBSCRIBE:<A HREF="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</A><BR>
        <A HREF="http://www.freeswitch.org">http://www.freeswitch.org</A><BR>
        <BR>
    </BLOCKQUOTE>
    <BR>
    <BR>
<PRE>
FreeSWITCH-users mailing list
<A HREF="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</A>
<A HREF="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</A>
UNSUBSCRIBE:<A HREF="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</A>
<A HREF="http://www.freeswitch.org">http://www.freeswitch.org</A>
</PRE>
</BLOCKQUOTE>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
-- 

Un cordial saludo / Best regards, 

&nbsp;_________________________

Ant&#243;nio Silva

E-mail:<A HREF="mailto:asilva@wirelessmundi.com">asilva@wirelessmundi.com</A>
</PRE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>