<pre>Thank Klaus, </pre><pre>I&#39;ve try with t_suspend() and t_continue() as your guide, </pre><pre><i>#Failure route to react with negative messages
failure_route[1] {
if (t_check_status(&quot;5[0-9][2-9]&quot;))
{       if(t_suspend())
           {
           xlog(&quot;proceesing suspended in trasaction [$T(id_index):$T(id_label)]\n&quot;);
               xlog(&quot;before sleep \n&quot;);
           }

        if(async_sleep(&quot;20&quot;))
        xlog(&quot;After sleep 20s \n&quot;);
        
        if(t_continue(&#39;1&#39;,&#39;1&#39;,&#39;MYROUTE&#39;))
        xlog(&quot;Continuation successfully \n&quot;);
exit;
};</i></pre><pre><br></pre><pre>And i found that t_suspend() and async_sleep() runnung ok but t_continue() seems not running. </pre><pre>I read about TMX module and TMX module Pseudo-Variables but still can not figure out it :(</pre>
<pre><br></pre><pre>Secondly, in case of t_continue() runs successfully , please tell me how to let Kamailio resend the INVITE message </pre><pre>to client B (before the t_continue(), i think so ) - while client B is waking up ?  </pre>
<pre>Which functions and modules that i need to do this?</pre><pre>Thanks.</pre><pre>-----------------------------------------------------------------</pre><pre>Hi!

You have to use a failure route 
(<a href="http://kamailio.org/docs/modules/3.3.x/modules/tm.html#t_on_failure">http://kamailio.org/docs/modules/3.3.x/modules/tm.html#t_on_failure</a>).

In the failure route check if the reply code is 404 and if yes, trigger 
the APNS logic and then put the call e.g. on a stack and resume e.g. 
every second and ofrward to the &quot;SIP server&quot; again to see if the client 
is registered meanwhile.

For the asynchronous processing take a look at these functions:
t_suspend(),t_resume()[1]. For example you can call t_resume in a timer 
route every second. For the timer route, to know which transactions are 
currently suspended and are waiting for further processing, you could 
put the transaction identifiers in a message-queue [2] and read the 
queue from the timer route.

regards
Klaus

[1] <a href="http://kamailio.org/docs/modules/3.3.x/modules_k/tmx.html#id2535968">http://kamailio.org/docs/modules/3.3.x/modules_k/tmx.html#id2535968</a>
[2] <a href="http://kamailio.org/docs/modules/3.3.x/modules/mqueue.html">http://kamailio.org/docs/modules/3.3.x/modules/mqueue.html</a>



On 24.07.2012 06:02, Duong Manh Truong wrote:
&gt;<i> Hi list,
</i>&gt;<i>
</i>&gt;<i> My team are developing a SIP client for mobile running iOS ,
</i>&gt;<i>
</i>&gt;<i> then having to deal with the &quot;back ground mode&quot; problem while this soft
</i>&gt;<i> is installed on mobiles
</i>&gt;<i>
</i>&gt;<i> One of the solutions is using APNS. (Apple Push Notification Service)
</i>&gt;<i>
</i>&gt;<i> I wanna to use Kamailio as SIP Redirect / Proxy for my current SIP server
</i>&gt;<i>
</i>&gt;<i> The model is like that:
</i>&gt;<i>
</i>&gt;<i> User A &lt;---------&gt; Kamailio  &lt;---------&gt; SIP server &lt;--------&gt; User B
</i>&gt;<i>
</i>&gt;<i> IF UserA call UserB, UserB is not available now (not registered yet),
</i>&gt;<i> normally, SIP server will reply Kamailio with &quot;404 Not found&quot;
</i>&gt;<i>
</i>&gt;<i> In that case, i want to set up Kamailio do the communication with APNS
</i>&gt;<i> and waiting  for UserB &quot;Wake up&quot; then RESEND the Invite message ......
</i>&gt;<i> (instead of forwarding this 404 message to UserA)
</i>&gt;<i>
</i>&gt;<i> I am getting stuck at how Kamailio can control &quot;404 Not found&quot; message
</i>&gt;<i> which it receives from SIP server .
</i>&gt;<i>
</i>&gt;<i> I do searching around several days but still can not get any clearer
</i>&gt;<i> points.
</i>&gt;<i>
</i>&gt;<i> Please help me with some instruction/ configuration of Kamailio for this
</i>&gt;<i> case !
</i>&gt;<i>
</i>&gt;<i> Thank you very much.
</i>&gt;<i>
</i>&gt;<i>
</i>&gt;<i> _______________________________________________
</i>&gt;<i> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
</i>&gt;<i> <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">sr-users at lists.sip-router.org</a>
</i>&gt;<i> <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</i>&gt;<i>
</i>
</pre><br class="Apple-interchange-newline">