Incoming call that routes to a Cisco CME via SIP trunk looping, CME uses extension not DID

freepbx
pjsip
siptrunk
Tags: #<Tag:0x00007f70288edd80> #<Tag:0x00007f70288edba0> #<Tag:0x00007f70288ed8d0>

(jack black) #1

After upgrading from an old FreePBX distro using chan_sip, our SIP trunk to a Cisco CME router started looping incoming calls from PSTN and not connecting them to the CME extensions.

Our PSTN trunks come into FreePBX and certain DID’s are routed to the CME Trunk:
[2021-02-19 21:23:03] VERBOSE[21095][C-00000afc] app_dial.c: Called PJSIP/NNNXXXXXXX@TRUNK-CME
Right after the above call goes out the trunk I see this INVITE come in from CME:
[2021-02-19 21:23:03] VERBOSE[22703] pbx_variables.c: Setting global variable ‘SIPDOMAIN’ to ‘10.1.10.16’ (CME Router IP)
[2021-02-19 21:23:03] VERBOSE[21117][C-00000afd] pbx.c: Executing [2069@from-internal:1] Macro(“PJSIP/TRUNK-CME-00000a36”, “user-callerid,LIMIT”) in new stack
2069 is the 4 digit extension behind CME that the DID translates to on CME (voice-translation profile on incoming match)

For internal 4 digit dialing, there is an outbound route on FreePBX with dialplan matching the 4 digit extensions at the CME site so FreePBX routes the 2069 call back to the TRUNK-CME and CME send an INVITE from 2069 until we get a system monitoring notice (SNMP/LibreNMS) that shows a spike in loopback interface traffic and we restart asterisk.

TRUNK-CME is in the from-internal context, no authentication or non-default options. Same settings seemed to function properly on the old FreePBX w/ chan_sip. I’m looking for suggestions on a better design for my setup if possible.

tcpdump pcap of a looping call with anonymized info is here: https :// pastecry.pt/o12JhC#Uc%3ADea%3AEh6Vys-Ed4Mum5Em5Myp (new users can’t put links in so remove spaces)
Thanks!