"pjsip show contacts" and PJSIP_DIAL_CONTACTS() don't see my contact objects / Cannot receive calls in Asterisk 13.9.1

Hi everyone,

I’m afraid that I need some help with my asterisk server.

The problem is that my asterisk server (v13.9.1) fails to register SIP clients properly. Although each SIP REGISTER request is met with a 200 OK response, no contact object is ever created.

As a result of this, I cannot receive any calls although I’m able to dial out just fine.

After some digging, I found this ticket on the tracker which describes a similar issue where contact objects where actually created but deleted early, causing some calls to fail while others succeeded.


However, that issue is supposed to be fixed in the version that I’m using.

Does anybody have an idea what’s happening here?

What is the console output? Where are you storing things?

Unfortunately, I’m not getting any real output on the console.

Even if I set all loglevels to ON, there is still nothing.

The only output I can get is the SIP messages themselves (with pjsip set logger on) but I doubt that this would be useful in this case.

Concerning storage, I found out that my contact objects are stored in astdb under record family “registry/contact”.

“database show” is telling me that my contact objects are actually stored in there. ATM, there are 2 of them.

However, I cannot retrieve these objects with “pjsip show contacts” (nor does PJSIP_DIAL_CONTACTS() work).


If I change the AOR identifier to something that doesn’t start with a +, it suddenly works.

But why does PJSIP dislike + characters?

It should be fine with it, unless the AstDB stuff doesn’t like it. I’d suggest filing an issue[1].

[1] https://issues.asterisk.org/jira

Gotcha #2.

I found something that might be causing this issue.

In source file asterisk/location.c, function struct ao2_container *ast_sip_location_retrieve_aor_contacts_nolock(const struct ast_sip_aor *aor), line 189, asterisk is using regular expressions to identify AORs.

snprintf(regex, sizeof(regex), “^%s;@”, ast_sorcery_object_get_id(aor));

Since + is a metacharacter in regex that matches the preceding subexpression one or more times, it doesn’t surprise me that a + is causing trouble.

However, that still doesn’t explain why show contacts doesn’t give any results.

Edit: File is asterisk/res/res_pjsip/location.c

Gotcha, that’s it.

In order to make a contact show up, I need a contact object AND a matching AOR object.

Due to the regex bug, my contact objects fail to match the AOR and therefore, I can’t see them.

However, if I create an additioal AOR called \+0000, then my missing contact object (which actually belongs to AOR +0000) will show up under AOR \+0000.

I’ll file a bug in a few minutes. Greetings to bobby tables.

Edit: Done. https://issues.asterisk.org/jira/browse/ASTERISK-26151