<p>Considering such route for async queries </p>

<p><code>route[REQUESTRTJSON] {</code><br>
<code>xlogl("L_INFO", "Requesting JSON routes\n");</code><br>
<code>t_newtran();</code><br>
<code>$http_req(hdr) = "Expect:";</code><br>
<code>$http_req(timeout) = DEFAULTHTTPTIMEOUTMSEC;</code><br>
<code>http_async_query("http://127.0.0.1/webrtcwslb/forwarder.php?forwardservice=kamailiort&rU=$(rU{s.encode.hexa})&fU=$(fU{s.encode.hexa})&dd=$(dd{s.encode.hexa})&du=$(du{s.encode.hexa})&rd=$(rd{s.encode.hexa})&fn=$(fn{s.encode.hexa})&fd=$(fd{s.encode.hexa})&td=$(td{s.encode.hexa})&tn=$(tn{s.encode.hexa})&tU=$(tU{s.encode.hexa})&ci=$(ci{s.encode.hexa})&ct=$(ct{s.encode.hexa})&si=$(si{s.encode.hexa})&mb=$(mb{s.encode.hexa})&dP=$(dP{s.encode.hexa})","HTTPRTJSONREPLY");</code><br>
<code>}</code></p>

<p>And answer processed in</p>

<p><code>route[HTTPRTJSONREPLY] {</code><br>
<code>if($http_ok) {</code><br>
<code>xlogl("L_INFO", "route[HTTPRTJSONREPLY]: status $http_rs\n");</code><br>
<code>xlogl("L_INFO", "route[HTTPRTJSONREPLY]: body $http_rb\n");</code><br>
<code>json_get_field($http_rb,"routing", "$var(routing)");</code><br>
<code>if($var(routing)=="location") {</code><br>
<code>route(LOCATION);</code><br>
<code>exit;</code><br>
<code>}</code><br>
<code>xlogl("L_INFO", "route[HTTPRTJSONREPLY]: init routes\n");</code><br>
<code>rtjson_init_routes("$http_rb");</code><br>
<code>xlogl("L_INFO", "route[HTTPRTJSONREPLY]: pushing routes\n");</code><br>
<code>rtjson_push_routes();</code><br>
<code>xlogl("L_INFO", "route[HTTPRTJSONREPLY]: pushed routes\n");</code><br>
<code>t_on_branch("MANAGE_BRANCH");</code><br>
<code>t_on_failure("MANAGE_FAILURE");</code><br>
<code>route(RELAY);</code><br>
<code>exit;</code><br>
<code>} else {</code><br>
<code>xlogl("L_INFO", "route[HTTPRTJSONREPLY]: error $http_err\n");</code><br>
<code>exit;</code><br>
<code>}</code><br>
<code>}</code></p>

<p>the cfgtrace gives</p>

<blockquote>
<p>2016-11-16T09:29:36.869221+01:00 localhost (12040) ERROR: *** cfgtrace:request_route=[REQUESTRTJSON] c=[/product/CCAPI/WebRTC/Kamailio/etc/1479284325.480324_f0b20d2e1c37d2fa3dfed1126a48aacaf79c2ab6//kamailio.cfg] l=581 a=26 n=http_async_query<br>
...<br>
2016-11-16T09:29:36.912117+01:00 localhost (12035) ERROR: *** cfgtrace:failure_route=[HTTPRTJSONREPLY] c=[/product/CCAPI/WebRTC/Kamailio/etc/1479284325.480324_f0b20d2e1c37d2fa3dfed1126a48aacaf79c2ab6//kamailio.cfg] l=607 a=16 n=if</p>
</blockquote>

<p>so HTTPRTJSONREPLY route is considered as failure_route, such state is kept when calling route(RELAY) and further  raising the following code in rtpengine on INVITE for rtpengine_manage() function <br>
<code>if (msg->first_line.type == SIP_REQUEST) {</code><br>
<code>...</code><br>
<code>if(method==METHOD_INVITE && nosdp==0) {</code><br>
<code>msg->msg_flags |= FL_SDP_BODY;</code><br>
<code>if(tmb.t_gett!=NULL && tmb.t_gett()!=NULL</code><br>
<code>&& tmb.t_gett()!=T_UNDEFINED)</code><br>
<code>tmb.t_gett()->uas.request->msg_flags |= FL_SDP_BODY;</code><br>
<code>if(route_type==FAILURE_ROUTE)</code><br>
<code>return rtpengine_delete(msg, flags);</code><br>
<code>return rtpengine_offer_answer(msg, flags, OP_OFFER, 0);</code><br>
<code>}</code></p>

<p>On kamailio 4.4.1 rtpengine_offer_answer() was called, but now rtpengine_delete() is called due to (route_type==FAILURE_ROUTE)</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/855#issuecomment-260890866">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZaFJkULIJIkPQ_3MyZyYMOQJNGKbks5q-satgaJpZM4KtmBy">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36Zdj3wh3e0pMz-BUg2UFeNuOXqSKrks5q-satgaJpZM4KtmBy.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/issues/855#issuecomment-260890866"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@lglayal in #855: Considering such route for async queries \r\n\r\n` route[REQUESTRTJSON] { `\r\n`   xlogl(\"L_INFO\", \"Requesting JSON routes\\n\"); `\r\n`   t_newtran(); `\r\n`   $http_req(hdr) = \"Expect:\"; `\r\n`   $http_req(timeout) = DEFAULTHTTPTIMEOUTMSEC; `\r\n`   http_async_query(\"http://127.0.0.1/webrtcwslb/forwarder.php?forwardservice=kamailiort\u0026rU=$(rU{s.encode.hexa})\u0026fU=$(fU{s.encode.hexa})\u0026dd=$(dd{s.encode.hexa})\u0026du=$(du{s.encode.hexa})\u0026rd=$(rd{s.encode.hexa})\u0026fn=$(fn{s.encode.hexa})\u0026fd=$(fd{s.encode.hexa})\u0026td=$(td{s.encode.hexa})\u0026tn=$(tn{s.encode.hexa})\u0026tU=$(tU{s.encode.hexa})\u0026ci=$(ci{s.encode.hexa})\u0026ct=$(ct{s.encode.hexa})\u0026si=$(si{s.encode.hexa})\u0026mb=$(mb{s.encode.hexa})\u0026dP=$(dP{s.encode.hexa})\",\"HTTPRTJSONREPLY\");`\r\n`  }`\r\n\r\n\r\nAnd answer processed in\r\n\r\n`route[HTTPRTJSONREPLY] {`\r\n`  if($http_ok) {`\r\n`      xlogl(\"L_INFO\", \"route[HTTPRTJSONREPLY]: status $http_rs\\n\");`\r\n`      xlogl(\"L_INFO\", \"route[HTTPRTJSONREPLY]: body $http_rb\\n\");`\r\n`    json_get_field($http_rb,\"routing\", \"$var(routing)\");`\r\n`    if($var(routing)==\"location\") {`\r\n`      route(LOCATION);`\r\n`      exit;`\r\n`    }`\r\n`    xlogl(\"L_INFO\", \"route[HTTPRTJSONREPLY]: init routes\\n\");`\r\n`    rtjson_init_routes(\"$http_rb\");`\r\n`    xlogl(\"L_INFO\", \"route[HTTPRTJSONREPLY]: pushing routes\\n\");`\r\n`    rtjson_push_routes();`\r\n`    xlogl(\"L_INFO\", \"route[HTTPRTJSONREPLY]: pushed routes\\n\");`\r\n`    t_on_branch(\"MANAGE_BRANCH\");`\r\n`    t_on_failure(\"MANAGE_FAILURE\");`\r\n`    route(RELAY);`\r\n`    exit;`\r\n`  } else {`\r\n`    xlogl(\"L_INFO\", \"route[HTTPRTJSONREPLY]: error $http_err\\n\");`\r\n`    exit;`\r\n`  }`\r\n`}`\r\n \r\n\r\nthe cfgtrace gives\r\n\r\n\u003e 2016-11-16T09:29:36.869221+01:00 localhost (12040) ERROR: *** cfgtrace:request_route=[REQUESTRTJSON] c=[/product/CCAPI/WebRTC/Kamailio/etc/1479284325.480324_f0b20d2e1c37d2fa3dfed1126a48aacaf79c2ab6//kamailio.cfg] l=581 a=26 n=http_async_query\r\n\u003e ...\r\n\u003e 2016-11-16T09:29:36.912117+01:00 localhost (12035) ERROR: *** cfgtrace:failure_route=[HTTPRTJSONREPLY] c=[/product/CCAPI/WebRTC/Kamailio/etc/1479284325.480324_f0b20d2e1c37d2fa3dfed1126a48aacaf79c2ab6//kamailio.cfg] l=607 a=16 n=if\r\n\r\nso HTTPRTJSONREPLY route is considered as failure_route, such state is kept when calling route(RELAY) and further  raising the following code in rtpengine on INVITE for rtpengine_manage() function \r\n`if (msg-\u003efirst_line.type == SIP_REQUEST) {`\r\n`...`\r\n`\t\tif(method==METHOD_INVITE \u0026\u0026 nosdp==0) {`\r\n`\t\t\tmsg-\u003emsg_flags |= FL_SDP_BODY;`\r\n`\t\t\tif(tmb.t_gett!=NULL \u0026\u0026 tmb.t_gett()!=NULL`\r\n`\t\t\t\t\t\u0026\u0026 tmb.t_gett()!=T_UNDEFINED)`\r\n`\t\t\t\ttmb.t_gett()-\u003euas.request-\u003emsg_flags |= FL_SDP_BODY;`\r\n`\t\t\tif(route_type==FAILURE_ROUTE)`\r\n`\t\t\t\treturn rtpengine_delete(msg, flags);`\r\n`\t\t\treturn rtpengine_offer_answer(msg, flags, OP_OFFER, 0);`\r\n`\t\t}`\r\n\r\nOn kamailio 4.4.1 rtpengine_offer_answer() was called, but now rtpengine_delete() is called due to (route_type==FAILURE_ROUTE)\r\n"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/855#issuecomment-260890866"}}}</script>