Correct Endpoint Format for using ARI Channel Redirect API

I am working on implementing REFER logic into an ARI application I develop using the documentation here: Channels - Asterisk Documentation

I currently want to redirect between two asterisk machines. These currently are stored in our database as the endpoints asterisk0 and asterisk1.

I have tried various syntaxs for endpoint functionality. The only one I have gotten to work is “PJSIP/asterisk0” and “PJSIP/asterisk1”.

However this issues a Refer-To header that the proxy in question does not handle correctly and seems to not follow the formats defined in RFC 3515 - The Session Initiation Protocol (SIP) Refer Method.

It issues like this:

I have tried different formats like “PJSIP/+12223334444@asterisk0” and “endpoint:pjsip/+12223334444@asterisk0” however when I use these formats the API just fails silently. I receive a 200/no exceptions from the ARI client and no redirect is issued.

What is the correct format for using the channels.redirect() API to get a properly formatted Refer-To header?

I haven’t used Transfer() with chan_pjsip and it is a very long time since I used it with chan_sip, but the above matches the production:

Refer-To = ("Refer-To" / "r") HCOLON ( name-addr / addr-spec ) *
      (SEMI generic-param)

given in the RFC you quote. The examples are not exhaustive. In particular they don’t include domain only URIs, but such are perfectly valid.

What I do remember, when I used it, is that you had to specify what you wanted in the header, without any endpoint/peer name. It looks as though it might now be coping with some endpoint/AOR cases, but you may well have to use a literal URI (with full domain name) in more complex cases. I can’t remember if the scheme had to be present, in the URI.

Thanks for the reply.

I do see that the RFC does support the existing format actually. My issue is that when the proxy tries to Refer to the second asterisk the To is populated with the contents of the refer-header, and the other asterisk does not like that there is no user param in the To.

My issue is that I am limited to passing some endpoint via ARI as opposed to using a redirect in AMI/AGI where I saw examples of describing the context, from,to etc.

I never found a solution to this. I used our SIP Proxy to edit the header instead so that the the number was in the Refer-To: Header. I think this is only a limitation of using the ARI redirect functionality as I see other interfaces provided more arguments.