[SR-Users] Help with Async transaction responses

Michael Friesen mfriesen at firstorion.com
Fri Nov 19 19:56:43 CET 2021


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 at lists.kamailio.org> On Behalf Of Henning Westerholt
Sent: Friday, November 19, 2021 12:07 PM
To: Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
Cc: Mike Tihonchik <mtihonchik at firstorion.com>; Julie Fowler <jfowler at 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<https://us-west-2.protection.sophos.com?d=kamailio.org&u=aHR0cHM6Ly9rYW1haWxpby5vcmcvZG9jcy9tb2R1bGVzL3N0YWJsZS9tb2R1bGVzL3VhYy5odG1sI3VhYy5mLnVhY19yZXBsYWNlX2Zyb20=&i=NWQ3MTY5NGVhZjFkZjgxN2NhMWRiNmIx&t=QUFrZ3RTWUx1WVdDWDFWbzBNUlBUaTd3MTdqeHZkY0Qrc3NPVWRwQWl4QT0=&h=932613dd668d4e0ea6f768041a0bd41e>

Cheers,

Henning

--
Henning Westerholt - https://skalatan.de/blog/<https://us-west-2.protection.sophos.com?d=skalatan.de&u=aHR0cHM6Ly9za2FsYXRhbi5kZS9ibG9nLw==&i=NWQ3MTY5NGVhZjFkZjgxN2NhMWRiNmIx&t=WStDbk50SzBLNjVwR01sTHRvYlVwbzA0dzdhQlBnNUF2WnErNFp6SEhYaz0=&h=932613dd668d4e0ea6f768041a0bd41e>
Kamailio services - https://gilawa.com<https://us-west-2.protection.sophos.com?d=gilawa.com&u=aHR0cHM6Ly9naWxhd2EuY29tLw==&i=NWQ3MTY5NGVhZjFkZjgxN2NhMWRiNmIx&t=TFQrN1EwNWwwV2thVlBjeGpoNS9jMlRBNk5JREczWmVORHV2QlNpR21YTT0=&h=932613dd668d4e0ea6f768041a0bd41e>

From: sr-users <sr-users-bounces at lists.kamailio.org<mailto:sr-users-bounces at lists.kamailio.org>> On Behalf Of Michael Friesen
Sent: Friday, November 19, 2021 6:57 PM
To: sr-users at lists.kamailio.org<mailto:sr-users at lists.kamailio.org>
Cc: Julie Fowler <jfowler at firstorion.com<mailto:jfowler at firstorion.com>>; Mike Tihonchik <mtihonchik at firstorion.com<mailto:mtihonchik at 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20211119/b21b337e/attachment.htm>


More information about the sr-users mailing list