it would have been better if you have showed how you are calling it in your script, especially in which route block, but anyways,

1. In transaction-less scenario, after calling this function the script execution will continue, so you have to send some provisional reply, such as "100 Trying" and then exit. Upon receiving http response, named-route will be executed in failure route context and you can send the actual / final sip response e.g. 302.

2. If you have created transaction, then you send provisional reply "100 Trying" BEFORE calling this function, since script execution will be paused upon function call. When a http response is received you will be in named-route but still be in old context (main or branch but with async related limitations) and can send final sip response e.g. 302.

Also note that things will dramatically change if you fork the sip call before calling this function, in which case it is best to call this function in branch route instead of main or failure route.

Hope this helps.

--
Muhammad Shahzad Shafi
Tel: +49 176 99 83 10 85


-------- Original message --------
From: Brooks Bridges <bbridges@call48.com>
Date: Fri, 15 Oct 2021, 17:03
To: sr-users@lists.kamailio.org
Subject: [SR-Users] http_async_client "route_name" is considered a failure route?
So I've been working on this for a while, and I cannot seem to find a way around this.  When using the http_async_client to request data from an external API, the returned data in the "route_name" target is being treated as a failure route, so most of the subsequent processing and messaging that I want to do is not working, either because the function can't be used in a failure route, or because I have to create a transaction prior to doing the request, which then throws an error by immediately triggering a 500 after I return the response I want (via 302 to the requesting client).

Am I using http_async_client incorrectly somehow that's causing this behavior or is it expected that the response route is treated as a failure route?

Confidentiality Notice: This e-mail, and any attachment to it, contains privileged and confidential information intended only for the use of the individual(s) or entity named on the e-mail. If the reader of this e-mail is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that reading this e-mail is strictly prohibited. If you have received this e-mail in error, please immediately return it to the sender and delete it from your system.

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users