<div dir="ltr">Hi, <div>I'm not sure if I understood correctly, however, it seems like if UserB is dialed then send call to FreeSWITCH in parallel to doing an http_async_query ; once the http query returns a response then send call to that response.</div><div><br>If I'm correct then you need to make use of branch_route. <br><br><font face="monospace, monospace">route{<br>...<br><br>    append_branch("<span style="color:rgb(0,0,0);font-size:14px">sip:prompt-</span><wbr style="color:rgb(0,0,0);font-size:14px"><span style="color:rgb(0,0,0);font-size:14px">tone@freeswitch</span>");<br>    t_on_branch("api_query");<br>    route(RELAY);<br>}</font><br><br>Then create the branch route "api_query" and in there execute your HTTP async query. </div><div><font face="monospace, monospace">branch_route[api_query]{         </font></div><div><font face="monospace, monospace">         if($rU != "freeswitch") </font></div><div><font face="monospace, monospace">             route(http_aysnc_things);<br>}<br><br>route[http_async_things]{<br>   Code example from here: <a href="https://www.kamailio.org/docs/modules/5.1.x/modules/http_async_client.html#http_async_client.f.http_async_query">https://www.kamailio.org/docs/modules/5.1.x/modules/http_async_client.html#http_async_client.f.http_async_query</a><br>}</font></div><div><font face="monospace, monospace"><br></font><div><font face="monospace, monospace">route[HTTP_REPLY] {</font></div><div><font face="monospace, monospace">    if ($http_ok) {</font></div><div><font face="monospace, monospace">        xlog("L_INFO", "route[HTTP_REPLY]: status $http_rs body: $http_rb\n");</font></div><div><font face="monospace, monospace">        # Assuming the HTTP server replies with a SIP URI<br>        $ru = $http_rb;<br>        route(RELAY);</font></div><div><font face="monospace, monospace">    } else {</font></div><div><font face="monospace, monospace">        xlog("L_INFO", "route[HTTP_REPLY]: error  $http_err)\n");</font></div><div><font face="monospace, monospace">    }</font></div><div><font face="monospace, monospace">}</font></div></div><div><br></div><div>Thats just my idea , the code might have syntax issues so correct accordingly. If above works then it should do both ringing and the API query in parallel. As I see it you're trying to append_branch and then doing a t_newtran->HTTP ASYNC query, causing the whole blockage and that explains if you remove the last 4 line it works.</div><div><br></div><div>Regards,<br></div><div>Sammy</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 1, 2017 at 3:14 AM, 赵国杰 <span dir="ltr"><<a href="mailto:zhaoguojie2010@163.com" target="_blank">zhaoguojie2010@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div style="zoom:1">Hello,<div style="clear:both"></div></div><div style="zoom:1">      I forgot to add route(RELAY) after the append_branch(). This brings another problem. Say the original INVITE is from A to B, what I want is:</div><div style="zoom:1">          1. fork 1 more INVITE to freeswitch </div><div style="zoom:1">          2. discard the original A to B INVITE and wait for the http_async_query returns. When returns, the final destiation is determined, say C. Then send the INVITE to C. </div><div style="zoom:1"><br></div><div style="zoom:1">     However, after append_branch(), then original INVITE is sent to B anyway. How do I block the A to B INVITE?</div><div style="zoom:1"><br></div><div style="zoom:1">Thanks</div><div><div class="h5"><div id="m_2979884615763291662divNeteaseMailCard"></div><br>At 2017-12-01 15:13:10, "赵国杰" <<a href="mailto:zhaoguojie2010@163.com" target="_blank">zhaoguojie2010@163.com</a>> wrote:<br> <blockquote id="m_2979884615763291662isReplyContent" style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hello Sammy,</div><div>     Yes, I want the kamailio to play ring-back music immediately after it receive the INVITE.  My plan is to append a branch to freeswitch and let freeswitch to play the music. The problem is append_branch() does not work in the following context:</div><div><br></div><div><div>if(is_method("INVITE")) {</div><div>                append_branch("sip:prompt-<wbr>tone@freeswitch");</div><div>                xlog("append branch");</div><div>                t_newtran();</div><div>                $http_req(hdr) = "Content-Type: application/json";</div><div>                $http_req(body) = $_s({"cmuid": "$var(cmuid)"});</div><div>                http_async_query("<a href="http://127.0.0.1:8080" target="_blank">http://127.<wbr>0.0.1:8080</a>", "HTTP_REPLY");</div><div>}</div></div><div><br></div><div>if I remove the last 4 lines everything works fine. Otherwise, no forked INVITE will be sent to freeswitch. Unfortunately, I need the http_async_query to find the proper callee. Any suggestions?</div><div><br></div><div>Thanks</div><br>At 2017-11-30 23:49:59, "SamyGo" <<a href="mailto:govoiper@gmail.com" target="_blank">govoiper@gmail.com</a>> wrote:<br> <blockquote id="m_2979884615763291662isReplyContent" style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid"><div dir="ltr">Hi,<div>While Brandon is right, you can do absolutely do that but w/o any SDP or progress media in there. I'd ask why you want to do that! If you want to feed some ring-back music I'd advise you to append a branch to a media-server like asterisk and then let that do it for you.</div><div><br></div><div>So here's one way of doing that.<br><br><font face="monospace, monospace">if(is_method("INVITE")){<br>         append_branch("<a href="http://sip:183@192.168.1.5:5060" target="_blank">sip:183@192.<wbr>168.1.5:5060</a>");<br>...</font></div><div><font face="monospace, monospace">}</font></div><div><br></div><div>where IP is of asterisk and dialplan is configured to provider Progress() with media. </div><div><br></div><div>Again, it depends on why you want it?</div><div><br></div><div>Regards,</div><div>Sammy</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 29, 2017 at 11:13 PM, Brandon Armstead <span dir="ltr"><<a href="mailto:brandon@cryy.com" target="_blank">brandon@cryy.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div dir="auto">if(is_method(“INVITE”)){ .....</div><div dir="auto"><br></div><div dir="auto">sl_send_reply(“183”, “Ringing”); ....</div><div dir="auto"><br></div><div dir="auto">}</div><br><div class="gmail_quote"><div><div class="m_2979884615763291662h5"><div>On Wed, Nov 29, 2017 at 6:44 PM 赵国杰 <<a href="mailto:zhaoguojie2010@163.com" target="_blank">zhaoguojie2010@163.com</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_2979884615763291662h5"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hello guys, </div><div>     Is it possible for kamailio to initiate a 183 to caller?</div><div><br></div><div>Thanks </div></div><br><br><span title="neteasefooter"><p> </p></span></div></div>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><span class="m_2979884615763291662HOEnZb"><font color="#888888"><br>
</font></span></blockquote></div></div><span class="m_2979884615763291662HOEnZb"><font color="#888888"><div dir="ltr">-- <br></div><div class="m_2979884615763291662m_8145819928345150507gmail_signature" data-smartmail="gmail_signature">Sent from Gmail Mobile</div>
</font></span><br>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br><span title="neteasefooter"><p> </p></span></blockquote></div></div></div><br><br><span title="neteasefooter"><p> </p></span><br>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a><br>
<br></blockquote></div><br></div>