Thanks Henning!
In this instance the uac_replace_from method is not working either. I attempted to use KSR.uac.uac_replace_from("batman", "") inside the redirect_transaction() method and it was not successful. However, If I perform this BEFORE calling
KSR.tm.t_newtran() then the From header uses the “batman” value for the response. The problem is that I still cannot use the asynchronous lookup response to modify the From header once the transaction has been created.
-Michael
From: sr-users <sr-users-bounces@lists.kamailio.org>
On Behalf Of Henning Westerholt
Sent: Friday, November 19, 2021 12:07 PM
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Cc: Mike Tihonchik <mtihonchik@firstorion.com>; Julie Fowler <jfowler@firstorion.com>
Subject: Re: [SR-Users] Help with Async transaction responses
Hello,
Not sure if it works in this scenarios, but did you already tried to use:
https://kamailio.org/docs/modules/stable/modules/uac.html#uac.f.uac_replace_from
Cheers,
Henning
From: sr-users <sr-users-bounces@lists.kamailio.org>
On Behalf Of Michael Friesen
Sent: Friday, November 19, 2021 6:57 PM
To: sr-users@lists.kamailio.org
Cc: Julie Fowler <jfowler@firstorion.com>; Mike Tihonchik <mtihonchik@firstorion.com>
Subject: [SR-Users] Help with Async transaction responses
Hello,
I am attempting to perform some asynchronous lookup upon receiving an INVITE and then reply with a 3xx response with a modified From header. My workflow now is to create a transaction when receiving the INVITE,
suspend the transaction, perform the asynchronous lookup, continue the transaction upon response, and then modify the From header and reply. The ONLY problem I am having is modifying the From header! How can I modify the From header in this scenario?
function ksr_request_route()
if KSR.is_INVITE() then
if KSR.tm.t_newtran() then
cache_transaction_info()
KSR.tmx.t_suspend()
--perform async loookup
end
end
return 1
end
--This function called on response from async lookup. Equivalent of ONREPLY_ROUTE
function ksr_reply_route()
--Finds the transaction_index and transaction_label from a cache
KSR.tmx.t_continue(transaction_index, transaction_label, "redirect_transaction");
KSR.x.drop()
return 1
end
function redirect_transaction()
KSR.pv.sets("$fU", "Jenny") --Doesn't actually modify the from username for 302 response!
KSR.tm.t_reply(302, "Redirecting")
return 1
end
Thank you much!
-Michael