PJSIP: multiple aors to match different endpoints from same IP?

Hi all,

I am running Asterisk 13.17.1. My router (AVM Fritzbox) is to be used to provide a trunk for outbound (and inbound) phone calls as well as it is a DECT base station. This means that the router also registers at the Asterisk server to use it for DECT endpoints.

I think I figured out how to configure both types, as when used separately, both (trunk and DECT phone) work fine.
The problem is that when activating both, registration for the DECT handset doesn’t work

Here is the relevant part of my pjsip_wizard.conf:

[fritzbox-template](!)
type = wizard
transport = transport-udp

sends_auth = yes
sends_registrations = yes
remote_hosts = 192.168.178.1

endpoint/allow=!all,g722,alaw,ulaw,g729,gsm
endpoint/context=ankommend
endpoint/from_domain=fritz.box
endpoint/dtmf_mode=rfc4733
endpoint/direct_media=no

aor/qualify_frequency = 60
aor/default_expiration=585

registration/retry_interval = 60
registration/server_uri=sip:astuser@192.168.178.1
registration/forbidden_retry_interval=120

[fb12345](fritzbox-template)
aor/contact=sip:astuser@192.168.178.1
outbound_auth/username = astuser
outbound_auth/password = pass
registration/contact_user=fb12345
endpoint/from_user = astuser

[nst-template](!)
language = de
type=wizard

accepts_registrations = yes
sends_registrations = no
accepts_auth = yes 
sends_auth = no

aor/max_contacts = 3
aor/default_expiration = 600

endpoint/allow=!all,g722,alaw,ulaw,g729,gsm
endpoint/context=abgehend
endpoint/send_rpid=yes
endpoint/dtmf_mode=auto

allow_subscribe=yes
rpid_update=yes


[decta](nst-template)
aor/contact=sip:decta@192.168.178.1
inbound_auth/username=decta
inbound_auth/password=pass

When I try to set a call from the DECT handset, the following error occurs twice:

WARNING[13448] res_pjsip_registrar.c: AOR ‘decta’ not found for endpoint ‘fb12345’

It looks like registrations from the router for the DECT handset are mismatched to the trunk endpoint. I did have a look at the generated PJSIP configuration (with pjsip export config_wizard primitives ) but didn’t see any mess so far. In fact, nearly every time the IP address of the router (192.168.178.1) is set, it is used with the full sip uri. The only exception is the following identify-block:

[fb12345-identify]
type = identify
match = 192.168.178.1/255.255.255.255
srv_lookups = true
@pjsip_wizard = fb12345
endpoint = fb12345

Any hints?

So, I did some further reading.
A SIP INVITE from both decta as well as fb12345 has a correctly und fully set Contact header element. So there should be enough information to distinguish between them.

Is it possible that the identify section, i.e. the pure IP address match, is preferred as soon as it exists?

The order for endpoint identifiers is configured in pjsip.conf:

;endpoint_identifier_order=ip,username,anonymous
            ; The order by which endpoint identifiers are given priority.
            ; Currently, "ip", "username", "auth_username" and "anonymous" are valid
            ; identifiers as registered by the res_pjsip_endpoint_identifier_* modules.
            ; Some modules like res_pjsip_endpoint_identifier_user register more than
            ; one identifier. Use the CLI command "pjsip show identifiers" to see the
            ; identifiers currently available.
            ; (default: ip,username,anonymous)

With a default of ip,username,anonymous as it states. The identify section is strictly based on the source IP address, the SIP message itself is not used. As well no endpoint identifier uses the Contact header to match.

3 Likes

Thanks for the hint, it works now!