Common SIP URI Issues

When transitioning from the chan_sip channel driver to chan_pjsip one of the items that can catch people off guard is the use of SIP URIs within PJSIP. This is because in chan_sip these are generated on your behalf based on different configuration options while in chan_pjsip we leave this up to the user. Let’s take a look at the two common problems people run into!

Could not create dialog to invalid URI

A URI is constructed out of a scheme and a hostname at a minimum. If you specify merely a hostname, such as “asterisk.org”, this will be considered invalid as PJSIP requires a scheme to be specified and does not automatically assume that it is sip. You would need to add “sip:” to the front resulting in “sip:asterisk.org” to turn it into a SIP URI. Note that there may be other log messages which convey this issue, so be sure to check both your console log at startup and at runtime to see if this is potentially a problem.

Request URI Does Not Contain User Portion

This is seen when people configure an “outbound_proxy” on either an endpoint, AOR, or outbound registration and do not have loose routing enabled. Loose routing is a parameter on the URI which instructs PJSIP to not change the request URI to that of the outbound proxy. This can be because of two issues:

Lack of Loose Routing In General

By default PJSIP does not enable loose routing on a SIP URI. It has to be explicitly done in the configuration by adding “;lr” to the SIP URI. Note though that if using a .conf file you may need slightly more due to the following issue.

Configuration File Comment

In configuration files prefixing a string with “;” indicates to the configuration parser that it is a comment and should be ignored. This is problematic for the loose routing URI parameter so you must escape it by placing “\” in front of it resulting “\;lr”.

Putting these together into a full example yields “sip:asterisk.org\;lr”

This would configure the outbound proxy to be “asterisk.org” and enable loose routing.

I hope these things I’ve seen people run into help if you’re experiencing the issue yourself!

3 Responses

  1. In some databases I have a problem using the loose routing, to solve this you need to use “^3Blr” example: “sip:asterisk.org^3Blr”

  2. Hi Team,

    I am using asterisk 16.8cert patch version with chan_sip to support Tel uri but now when call coming from landline phone then then it is reject with 416 unsupported uri as shown in below attached screen shot.So can we modify asterisk source code to support both noth uri?

  3. Hi Team,

    Can you please tell me asterisk 16.8 cert version support both sip and tell uri ?

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.

About the Author

What can we help you find?