PJSIP endpoint for Kamailio dispatcher

Hi all,

I am using Kamailio’s dispatcher module to provide simple failover between two Asterisk servers:
http://www.kamailio.org/docs/modules/5.0.x/modules/dispatcher.html

When Kamailio is testing to see if the Asterisk servers are up it sends an OPTIONS to Asterisk. At the moment I am seeing

Apr 19 10:23:53 voip01.syd asterisk[28944]: [Apr 19 10:23:53] NOTICE[28972]: res_pjsip/pjsip_distributor.c:525 log_failed_request: Request ‘OPTIONS’ from ‘sip:dispatcher@localhost’ failed for ‘192.168.10.210:5060’ (callid: 000985c250642e63-28038@192.168.10.210) - No matching endpoint found

I am wondering how I can create an endpoint so Asterisk will reply to the OPTIONS from Kamailio?

My pjsip.conf

[root@voip01 ~]# cat /etc/asterisk/pjsip.conf
; TRANSPORT
 
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5061

; PROXY
[kamailio]
type=endpoint
transport=transport-udp
aors=kamailio
rewrite_contact=no

[kamailio]
type=aor
contact=sip:192.168.10.210:5060

I am using Asterisk 14 and Kamailio 5

edit: If I create an identify to match the IP my test peers stop working, although the dispatcher testing works

Adding an anonymous endpoint seems to work ok:

[anonymous] 
type=endpoint 
transport=transport-udp 
context=anonymous 
allow=all

Is this is a good idea?

defining an endpoint named “anonymous”. will accept anoymous calls, which is not allowed by default and not recommended, at least make sure the anonymous context do not have access to internal or outbound dialing extensions

1 Like

Does it matter that the endpoint can’t be found. When Asterisk is using OPTIONSs to test a “connection”, and 404 response is just as valid as a 200 one.

I suppose not, although replying with a 200 seems neater (and results in less logs). It might be more trouble than it’s worth with the anonymous call restrictions though.

bump. Still not sure what to do about this. My console is full of this :frowning:

[Aug 23 15:23:16] NOTICE[19720]: res_pjsip/pjsip_distributor.c:659 log_failed_request: Request 'OPTIONS' from '<sip:dispatcher@voip01.syd>' failed for 'x.x.x.x:5060' (callid: 6650e5586ed28055-20740@x.x.x.x) - No matching endpoint found

please help

After some more digging it looks like the anonymous endpoint is the way to go:

With a dialplan for the anonymous context that looks like this

[anonymous]
exten => _.,1,HangUp(21)

This replies with a 403 for all calls in my testing. Should it be 401? Is there any a better option than having this anonymous context?