Accept invites from an unregistered endpoint

Hi, im having problems trying to accept invites from a non registered extension.

Im trying to deploy a kamailio in front of two asterisk using dispatcher module in order to have a HA support for our applications

All of our extensions and SIP phone Numbers register against kamailio and then kamailio resend all Register to both asterisk and Invites only to main asterisk.
I had no problem with calls between registered extensions, but now im trying to receive an incoming call from a SIP phone number that is registered on kamailio and resend invite to asterisk.

Asterisk always responds with
[Jun 12 13:19:32] NOTICE[17812]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request ‘INVITE’ from ‘sip:Phone_number@Provider;user=phone’ failed for ‘IP’ (callid: 10.25.37.28_2833585_4132225722583551516_b2b-1) - No matching endpoint found

The configuration for this extension is the following
[Phone_Number]
type=endpoint
context=from_extension
;subscribe_context=subscribe
disallow=all
allow=ulaw,g722
dtmf_mode=rfc4733
direct_media=no
force_rport=yes
rtp_symmetric=yes
transport=transporte
aors=Phone_number
outbound_proxy=sip:IP_Kamailio

[Phone_number]
type=aor
max_contacts=5
remove_existing=yes
qualify_frequency=30
outbound_proxy=sip:Phone_number@IP_kamailio

I’ve seen that i can fix this if i configure that endpoint like a trunk, but if it’s configured like that my extensions can’t be registered on asterisk, and it sends the following message
[Jun 12 12:47:38] WARNING[17428]: res_pjsip_registrar.c:1080 find_registrar_aor: AOR ‘’ not found for endpoint ‘Phone_number’

Does someone face this problem before?
Any help will be very much appreciated

Thank you in advance

What does this mean, given that there is no such thing as a trunk or an extension in the SIP specification.

I don’t understand why the endpoint is not being matched based on the From: user field.

Good evening thank you for your response.
I’m sorry english is not my main language and i’m not use to the technical language.

By extensions i reffer to the endpoint created in asterisk to allow a SIP phone/WebRTC client to register into asterisk
By trunk i reffer to the endpoint created to allow invites from a geographic number (like the ones provided by LCR, or europesip). This type of endpoint sends options in order to make sure that the communicaction is working propperly

I’m not sure if this is what you were asking or if i’m completly wrong.
If this is not what you needed, can you explain to me what do you need me to send or explain?

Thank you for your time
I’m sorry about the language barrier. I’ll try to do my best to explain myself

What specific options are you sending that make your case work?

Hi again,

Thank you for your response.
I don’t know what speciffic options it sends.The configuration when it accepts invites from the geographic number

[Phone_Number]
type=endpoint
transport=transporte
context=from_kamailio
disallow=all
allow=ulaw
allow=alaw
outbound_auth=IP_kamailio
aors=mytrunk
force_rport=yes
direct_media=no

[Phone_Number]
type=aor
contact=sip:IP_Kamailio:5060

[Phone_Number]
type=identify
endpoint=Phone_Number
match=IP_Kamailio

When this works, if i use the command pjsip show endpoints i can see this information

Endpoint: Phone_Number Not in use 0 of inf
Aor: Phone_Number 0
Contact: Phone_Number/sip:IP_Kamaialio:5060 4134cd55a7 NonQual nan
Transport: transporte udp 0 0 0.0.0.0:5080
Identify: Phone_Number/Phone_Number
Match: IP_Kamailio/32

But i cannot register the endpoint related to the softphone, whenever i try it register propperly on kamailio but i receive this message on the asterisk console
[Jun 12 15:33:20] WARNING[17812]: res_pjsip_registrar.c:1080 find_registrar_aor: AOR ‘’ not found for endpoint ‘Phone_Number’

My dialplan is set to dial to a softphone when asterisk recives a call from the geographic number.
but i recieve this message from asterisk
[Jun 12 15:20:57] ERROR[18203]: res_pjsip.c:3589 ast_sip_create_dialog_uac: Endpoint ‘1000’: Could not create dialog to invalid URI ‘1000’. Is endpoint registered and reachable?
[Jun 12 15:20:57] ERROR[18203]: chan_pjsip.c:2710 request: Failed to create outgoing session to endpoint ‘1000’

I guess it’s because my extension can’t be register because of the error

I don’t know what changes should i make to in order to make it work.

Let me know if i had to explain something again or if there is something that isn’t explained propperly

Again, thank you for your time and patience

The To header in the REGISTER is missing the user name field.

Sorry for the late response.

I had to install sngrep in order to check this. I don’t think that’s the case because all the fields looks correct in the SIP message

│REGISTER sip:IP_Asterisk:5080 SIP/2.0
│Via: SIP/2.0/UDP IP_KAMAILIO;branch=z9hG4bK617f.97cd7a5e756514f6b107fa93bc36be19.0
│Via: SIP/2.0/UDP Softphone_IP:60661;received=80.33.30.219;rport=60661;branch=z9hG4bKPjad79367f34134f1da3b2129048a288b2
│Max-Forwards: 69
│From: sip:1000@IP_KAMAILIO;tag=359c8c8cba8e4b0ea15db8d03726b991
│To: sip:1000@IP_KAMAILIO
│Call-ID: e2d8be9950e14739bd458790c34d0db9
│CSeq: 20966 REGISTER
│User-Agent: MicroSIP/3.21.3
│Contact: sip:1000@Softphone_IP:60661;ob;+sip.ice
│Expires: 300
│Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
│Authorization: Digest username=“1000”, realm=“IP_KAMAILIO”, nonce=“ZImEiWSJg12DsjygoIXP1ZbgkGGACNNh”, uri=“sip:IP_KAMAILIO”, response=“471e37f20cb71347d113a70b8a7ad076”
│Content-Length: 0

Thank you for your time and response

Not at all. The endpoint config has ´aors=mytrunk´ that aor section doesnt exist.

But it is still not finding ‘’ rather than not finding a named section. That could be a bug with the message. Obviously both having a null user and and having no AORs at all will both cause a failure.

Good morning,

I’m sorry for the late response. I’ve been troubleshooting and i solved it by changing the to and from fields in the invites send by my kamailio. Asterisk didn’t accept the phone number in “from” field, so we changed it to proxy to force asterisk to accept the message and we send the phone number in the display part of “from” field

Thank you all for your time and response. Especially to david551, you were right, the problem was related to the “to” header

Have a good day

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