Questions about PJSIP OPTIONS hostname and where Asterisk retrieves it from

When a device REGISTERs to Asterisk successfully and the Qualify settings are enabled, Asterisk sends an OPTIONS message. Where does it retrieve the hostname value for the From message?

Initially thought it would be from the successful registration, but that doesn’t appear to be the case.

Reason I am asking, one of my coworkers configured a customer’s Ubuntu box with the hostname set to start with a 1 (example, 1abcdefghijklmnopq) and did not use a fdqn. We modified the hostname to be the fdqn, but it was still not using the fdqn. We ended up changing /etc/hosts and suddenly the fdqn was being sent.

Device was not responding to the OPTIONS message because it treats anything starting with a 1 (possibly any number) as either the IP4/IP6 or a full domain name. In this case, it was not seeing that so it generated an error and never responded. (Probably not the right behavior for it to not respond, but that’s for a different person to work with them).


Normally it’s not a hostname, it’s an IP address. If from_domain is set we’d use that. The actual logic is here[1]. It tries to determine the transport it’s going out on to get the IP address to use, if NAT is configured then it would be updated elsewhere to the public IP address as appropriate.


Thank you Joshua.

In this case, it is a WebRTC connection so the SSL license is tied to a domain name.
We have dozens of other sites who did not run into any problems. This was the first site to start their domain name with a number and as best as we can tell the javascript used by the browser/webpage doesn’t support starting with a number.

For what it’s worth, the instructions that we original wrote for our own staff was to always use the FDQN. Unfortunately with transitions in staff that everyone has to deal with, someone at some time decided to stop putting the FDQN on boxes we configure for Asterisk and WebRTC.


This would seem to violate RFC 1035: RFC 1035 - Domain names - implementation and specification (host names must start with a letter).

Everyone involved in tracking down the issue was wondering why someone used the name they did for the box. Guessing we have all had to deal with significant staff changes over the last few years. What one person decides to do can turn into a painful process.

Wouldn’t RFC 1135 replace 1035?

[RFC 1123 - Requirements for Internet Hosts - Application and Support](https://RFC1123 section 2.1)

The syntax of a legal Internet host name was specified in RFC-952 [DNS:4]. One aspect of host name syntax is hereby changed: the restriction on the first character is relaxed to allow either a letter or a digit. Host software MUST support this more liberal syntax.

FWIW, I believe there is a SIP RFC (think it is 3261) indicates leading 1 is illegal (at least for SIP).

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.