Hello,
I'm inserting some headers after getting value from http_async_query. If a call is relayed, I see them. But If I t_suspend and t_continue call (before time out), I do not see added headers. Here is flow:
route(START) t_newtran(); #.. prep for query http_async_query("url","HTTP");
route(HTTP) #.. collect and using data from query insert_hf("$var(key): $var(value)\r\n"); t_store();
if (registered("location") { route(RELAY); } else { t_suspend(); exit; }
route(AWAKE) t_continue();
I see that the branch index ($T_branch_idx) is 0 at start. 1 after http query, +1 if there is forking or location. +1 after t_suspend. It looks like t_continue uses a branch with index after t_suspend. I tried with t_save_lumps() to carry over changes.
Any idea how to do this?
Hello,
if you are not seeing them in the configuration later on directly, this is expected: https://www.kamailio.org/wiki/tutorials/faq/main#why_changes_made_to_headers...
Cheers,
Henning
-- Henning Westerholt – https://skalatan.de/blog/ Kamailio services – https://gilawa.comhttps://gilawa.com/
From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Fuad Trle Sent: Friday, March 25, 2022 4:08 PM To: sr-users@lists.kamailio.org Subject: [SR-Users] t_suspend / t_continue & insert_hf
Hello,
I'm inserting some headers after getting value from http_async_query. If a call is relayed, I see them. But If I t_suspend and t_continue call (before time out), I do not see added headers. Here is flow:
route(START) t_newtran(); #.. prep for query http_async_query("url","HTTP");
route(HTTP) #.. collect and using data from query insert_hf("$var(key): $var(value)\r\n"); t_store();
if (registered("location") { route(RELAY); } else { t_suspend(); exit; }
route(AWAKE) t_continue();
I see that the branch index ($T_branch_idx) is 0 at start. 1 after http query, +1 if there is forking or location. +1 after t_suspend. It looks like t_continue uses a branch with index after t_suspend. I tried with t_save_lumps() to carry over changes.
Any idea how to do this?
Hi Henning,
I have tried this, but without success. *This function can be used from REQUEST_ROUTE or core REPLY_ROUTE.* t_newtrans & http_async_query force me to enter a new routing block and call fail with "500 I'm terribly sorry, server error occurred (1/TM)". There is no explicit exit at the end of route(HTTP) but for some reason execution stopped and did not continue in request_route.
I don't think I can fulfil those requirements (call function in request route and before record_route). Suspend is the last option (after location lookup and parallel forking).
On Sun, Mar 27, 2022 at 10:51 PM Henning Westerholt hw@gilawa.com wrote:
Hello,
if you are not seeing them in the configuration later on directly, this is expected: https://www.kamailio.org/wiki/tutorials/faq/main#why_changes_made_to_headers...
Cheers,
Henning
--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com
*From:* sr-users sr-users-bounces@lists.kamailio.org *On Behalf Of *Fuad Trle *Sent:* Friday, March 25, 2022 4:08 PM *To:* sr-users@lists.kamailio.org *Subject:* [SR-Users] t_suspend / t_continue & insert_hf
Hello,
I'm inserting some headers after getting value from http_async_query. If a call is relayed, I see them. But If I t_suspend and t_continue call (before time out), I do not see added headers. Here is flow:
route(START)
t_newtran();
#.. prep for query
http_async_query("url","HTTP");
route(HTTP)
#.. collect and using data from query
insert_hf("$var(key): $var(value)\r\n");
t_store();
if (registered("location") {
route(RELAY);
} else {
t_suspend(); exit;
}
route(AWAKE)
t_continue();
I see that the branch index ($T_branch_idx) is 0 at start. 1 after http query, +1 if there is forking or location. +1 after t_suspend. It looks like t_continue uses a branch with index after t_suspend. I tried with t_save_lumps() to carry over changes.
Any idea how to do this?
Hi Fuad, without going too far in kamailio's internals, a resume route is equivalent to a failure route and, as such, it operates on a "fake" fresh message. One solution is to use msg_apply_changes() but my general advice is that all headers and sdp mangling (aka rtpengine invocations) should be done in branch routes, especially if your routing logic includes async routes/failure routes.
Federico
On Mon, Mar 28, 2022 at 1:20 PM Fuad Trle trle.fuad@gmail.com wrote:
Hi Henning,
I have tried this, but without success. *This function can be used from REQUEST_ROUTE or core REPLY_ROUTE.* t_newtrans & http_async_query force me to enter a new routing block and call fail with "500 I'm terribly sorry, server error occurred (1/TM)". There is no explicit exit at the end of route(HTTP) but for some reason execution stopped and did not continue in request_route.
I don't think I can fulfil those requirements (call function in request route and before record_route). Suspend is the last option (after location lookup and parallel forking).
On Sun, Mar 27, 2022 at 10:51 PM Henning Westerholt hw@gilawa.com wrote:
Hello,
if you are not seeing them in the configuration later on directly, this is expected: https://www.kamailio.org/wiki/tutorials/faq/main#why_changes_made_to_headers...
Cheers,
Henning
--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com
*From:* sr-users sr-users-bounces@lists.kamailio.org *On Behalf Of *Fuad Trle *Sent:* Friday, March 25, 2022 4:08 PM *To:* sr-users@lists.kamailio.org *Subject:* [SR-Users] t_suspend / t_continue & insert_hf
Hello,
I'm inserting some headers after getting value from http_async_query. If a call is relayed, I see them. But If I t_suspend and t_continue call (before time out), I do not see added headers. Here is flow:
route(START)
t_newtran();
#.. prep for query
http_async_query("url","HTTP");
route(HTTP)
#.. collect and using data from query
insert_hf("$var(key): $var(value)\r\n");
t_store();
if (registered("location") {
route(RELAY);
} else {
t_suspend(); exit;
}
route(AWAKE)
t_continue();
I see that the branch index ($T_branch_idx) is 0 at start. 1 after http query, +1 if there is forking or location. +1 after t_suspend. It looks like t_continue uses a branch with index after t_suspend. I tried with t_save_lumps() to carry over changes.
Any idea how to do this?
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: