AMI: manager.conf setvar= option drops all URL variable= options set during originate

Asterisk 18, PJSIP.

I’m using AMI to originate calls via Asterisk’s built-in HTTP server.

The request looks something like this:
./mxml?action=originate&channel= ... &variable=requestid=123456

So I’m setting some channel variable requestid in the request URL to process it in the dialplan. And everything works fine.

But while processing dialplan I also need to know the AMI account name, so I’m trying to use the manager.conf setvar= option like this:

[someamiuser]
secret=123456
deny=0.0.0.0/0.0.0.0
permit=10.10.0.199/255.255.255.255
write = originate
setvar=AMIACCOUNT=someamiuser

The problem is: as soon as I add a setvar expression in manager.conf, the variable AMIACCOUNT becomes available in the dialplan, but the variable set previously via URL (requestid) becomes missing (I expected they should both be accessible simultaneously).

So is this a bug and maybe there is a workaround, or maybe I’m doing something wrong? Thanks.

The HTTP API is rarely used and not well maintained. The advice here would be to use the standard interface.

Could you please tell what do you mean under standard interface to use, having in one hand just bare asterisk and in another some remote applications that are able to make http-requests only? ARI? I mean, AGI, AMI and ARI are all in a way “standard” for quite a while…

The standard interface is port 5038, with lines of the form:

<keyword>: <value>

Action as the keyword for the verb, and a blank line at the end of a request. This is what underlies all the standard AMI class libraries.

Unfortunately, this needs a third party http-server to proxy http-requests into a tcp-session. Buy I would give it a try just to check whever this was an AJAM bug or a general AMI problem, thanks.