Search the Asterisk Blog

PJSIP: DNS Manager (dnsmgr) and Full Dynamic Hostname Support, Coming Soon!

By Ben Ford

Recently there’s been discussion on chan_sip going away in the future which led to many comparisons between it and chan_pjsip. What does chan_pjsip do better? What is chan_pjsip missing? What does chan_sip do better? What does chan_pjsip have that chan_sip doesn’t?

Enter dnsmgr for PJSIP

One thing chan_sip has that chan_pjsip was lacking is the ability to handle dynamic IP addresses. This functionality is present in chan_sip via the externhost and externrefresh configuration options in sip.conf. From the sample configuration file:

If your Asterisk system is behind a dynamic IP address, chan_sip could be configured appropriately to handle any change to the IP address. The IP address could be changed by something external which Asterisk then uses to update its public IP address every refresh interval. A dynamic hostname can be specified, which is used to keep everything up to date.

For awhile, chan_pjsip did not have this functionality implemented. However, support has been added for dnsmgr (DNS manager) that allowed it to tackle this problem. Here’s what the dnsmgr.conf file looks like:

In order to have your external address information automatically update you will need to enable dnsmgr and choose a refresh interval. The interval is how often dnsmgr will update the address information. While the default is 300 you can lower it if you want at the cost of more frequent DNS queries.

In pjsip.conf, you’ll need to set up a transport with the correct information. Here’s an example of a very basic configuration:

While full support for dnsmgr has not yet made it into a release it will be in the next set. As of this blog post that will be 13.19.0 and 15.2.0 so if you were holding off on building a PJSIP system due to a lack of support for dynamic IPs, check out those releases when they arrive and be prepared to give it a try!

For those that enjoy looking at the code more, here’s a link to the code review.

There Are 8 Comments

Add to the Discussion

Your email address will not be published. Required fields are marked *

About the Author

Ben Ford

See All of Ben's Articles