Refeer from SIPTrunk

Hi, I want to execute the following scenario:
I call a phone number, someone answers, and I want to perform a REFER to an extension.

I use ARI to establish the connection:

I also use ARI to perform the REFER:

In sngrep, I see a 500 Internal Server Error:

In the Asterisk logs:

What could be the reason for this?
Or am I misunderstanding the flow and should approach this differently?

You haven’t shown us the REFER! It is best to use the asterisk channel driver logs.

Also chan_sip is no longer supported.

Does the provider even support REFER?

Yes, my provider support REFER.

REFER loks like:

They probably don’t support REFER. I don’t think it is that common for providers to do so.

If they claim to do so, you will have to ask them what is wrong.

If it turns out that the provider does not allow it, what other way can I handle such a scenario?

Bridge it in Asterisk.