Trying to achieve dynamic binding of user directory. In short: It’s not doing the authorization properly. I can use curl in the command line and it works perfectly, specifying BASIC auth.. however with the freeswitch module it returns HTTP 401.

 

So I’ve taken a close look at the network packets being sent and there are some issues.

 

This is between the <bindings></bindings> tags in my xml_curl.conf.xml  (1.2.3.4 represents my webserver’s IP)

 

        <binding name="users">

                <param name="gateway-url" value="http://1.2.3.4:2000/users.aspx" bindings="directory"/>

                <param name="gateway-credentials" value="username:password"/>

        </binding>

 

When I run “curl –basic –u username http://1.2.3.4:2000/users.aspx” it asks me for a password and returns the correct thing. I use tshark to monitor, and it sends a GET request, with the correct authorization credentials in the header. I receive an HTTP 200 OK packet and the xml follows.

 

When I startup freeswitch, I guess the xml curl module gets to run, and it makes the request. However this time it’s a POST, and oddly DOES NOT include the Authorization: Basic <encodedstring> line in the packet. I get back two HTTP 401 Unauthorized responses, and then freeswitch sends out another POST, this time includes the authorization line, and I get back an OK with the xml.

My user directory is updated and we’re all good.

 

The inconsistent POST request sent by the module causes freeswitch to hang for 1-2 minutes during start-up.

 

Has anyone else had this issue? Is this a bug or intended functionality (ping the server before making a real request?). I’d love to sort this out, otherwise getting an updated directory isn’t real-time, thus defeating the purpose.

Thanks,

 

Christian