For a specialized Asterisk application, I need to use Realtime lookups of SIP phones attempting to register. I successfully inserted the CURL HTTP lookup call in extconfig.conf and whenever my test device attempts to register, Asterisk calls my web server script, which gets:
POST /sippeers/single HTTP/1.1 User-Agent: asterisk-libcurl-agent/1.0 Host: 127.0.0.1:8080 Accept: */* Content-Length: 11 Content-Type: application/x-www-form-urlencoded name=300002
so I know that Asterisk does everything right.
I cannot craft a reply that satisfies Asterisk, though. No matter what I return, the end result is that the phone gets denied.
Do I understand it correctly that I should essentially return, on one line and delimited by & characters, exactly what the sip.conf file would contain for this SIP phone user? Preceded with the usual HTTP 1.1 headers?
I cut down my sip.conf file to the bare minimum and my phone correctly registers with just this:
However when I return the following from my web server, Asterisk does not even show a registration attempt on the console (in verbose=5) while it polls the web server:
HTTP/1.1 200 OK Content-Type: text/html Connection: close type=friend
I tried many permutations and headers and detail changes, and nothing ever succeeded yet. I must miss something obvious. A hint that I get is that Asterisk (and thus my phone) get stuck in the authentication process if I don’t forcefully close the HTTP connection from my server. This is after I have sent, and flushed, the reply. It may be that I send a completely unexpected kind of response.
Is there anybody who could drop me a working verbatim HTTP 1.1 reply to the kind of query shown above?