I’ve got the following pjsip.conf:
[transport-udp] type=transport bind=0.0.0.0:5060 protocol=udp allow_reload=yes [registrar] type=identify endpoint=registrar match=172.31.9.202 match=172.31.10.12 [registrar] type=aor contact=sip:registrar-intmd.example.com [registrar] type=endpoint transport=transport-udp context=dial disallow=all allow=ulaw,alaw aors=registrar force_rport=yes direct_media=no rtp_symmetric=yes rtp_timeout=120 [remote_atx] type=identify endpoint=remote_atx match_header=X-Remote-Atx: true [remote_atx] type=endpoint transport=transport-udp context=remote_atx disallow=all allow=ulaw,alaw aors=registrar force_rport=yes direct_media=no rtp_symmetric=yes refer_blind_progress=no rtp_timeout=120 identify_by=header
What I’m trying to achieve is that normal invites from the IP addresses listed in the registrar identify must go to the registrar-context, and invites that contains a X-Remote-Atx: true header must go to the remote_atx.
The servers that sends these invites are Kamailio servers, and the purpose of it all is to handle Remote Attended Transfers, so whenever Kamailio sees an INVITE from an Asterisk server with a Replaces header, it’ll find out which server has the Call-ID referenced in this header, and forward that INVITE to the appropriate Asterisk server.
This works excellently, Asterisk magically performs a switch when it sees this invite with a Replaces-header:
-- Channel PJSIP/registrar-00000000 left 'simple_bridge' basic-bridge <09141555-cb02-4efc-8a7f-50c995c49cc0> -- Channel PJSIP/registrar-00000002 swapped with PJSIP/registrar-00000000 into 'simple_bridge' basic-bridge <09141555-cb02-4efc-8a7f-50c995c49cc0>
However, I use AMI events from these servers for a ton of stuff, and I’d like the INVITE with the Replaces-header to be placed in the remote_atx context, instead of the registrar one.
This is what I’m trying to do with the [remote_atx] identify and endpoint, however it seems that PJSIP just sees that this is from one of the IP addresses in the [registrar] identify section, and just shoves this invite into the “dial” context.
Is there some method I can use that’ll make the match by match_header take precedence over identify by IP?