Internal call answered externaly

Hello Community,

can someone help me what to set, so FreePBX does not try to answer an internal SIP call to an external adress?
In Asterisk Console the following is logged if i try to call internally:

**<— Received SIP request (364 bytes) from UDP:192.168.189.1:5060 —>
ACK sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 87.24.76.134:5060;rport;branch=z9hG4bK2230040591F0E6B9
From: sip:[email protected];tag=3472A8F40AB65AAC
To: sip:[email protected];tag=z9hG4bK2230040591F0E6B9
Call-ID: [email protected]
CSeq: 66 ACK
User-Agent: AVM FRITZ!Box 7490 113.07.12 (Jul 3 2019)
Content-Length: 0
**

At the end of the call Asterisk tries to send packets to the ip in the third row (via) althouth the call comes from internal network.

Could someone please help me how to disable the external thing, I just want to use FreePBX fpr my internal network.

Thanks in advance, best regards
Marco

Check your NAT settings

Hello arielgrin,

thanks for your reply.
I allready tried almost every NAT-Setting I found in FreePBX WebUI, could you or someone else who knows, guide me to the correct point of config?

thanks in advance
best regards
marco

You would first need to explain your setup in order for us to help.
Please describe your setup, like hosted or on-premise, devices directly connected to FreePBX or behind a NAT device, etc etc.

Thanks again for your reply,

I have a blank RasPBX installation on a Raspberry 3B+.
I use an AVM Fritz.Box to do SIP-URI calls from an DECT-handset internally to that RasPBX.

I want RasPBX to only play an announcment and hang up after that.
Probeably FreePBX is much to big for that, but I didn’t find anything smaller :wink:

Thats all, just “internal answermachine with a hangup-function” :wink:
No NAT no external SIP-provider or incoming calls from the WAN-side of the fritzbox.

I didn’t change anything to the default RasPBX config, except for the extension that should answer and the allowing for anonymous incoming calls.

I can see Asterisk is routing the call to the right extension, plays the announcment ant hangs up that call, but the handset doesnt hear the announcement and also does not recieve the hangup command from asterisk.

in tshark on raspberry and asterisk log I saw somehow asterisk tries to contact the WAN-IP of the router.

Hope you can help me
thanks i advance
best regards
Marco

Please post internal ip of asterisk and fritz box

Fritzbox: 192.168.189.1
FreePBX: 192.168.189.39

The IP in the “Via:” line is my WAN-IP (changed ;-)) but i don’t know from where FreePBX gets it.

FreePBX isn’t getting it, that is provided by the remote side.

Are you sure?
I’m asking because 192.168.189.1 is a Fritzbox without a WAN interface, its just a DECT-base in the internal network, altought it has access to the internet, I can’t believe he would tell my WAN-IP to the FreePBX.

Best regards
Marco

The message you see is received from the device, and what is output is what is received. There are various mechanisms (such as STUN) that allow a device to determine its public IP address and then use it. Providing an actual full trace would provide further insight into what is happening.

Thanks jcolp, for the information.
It seems you are right and the information is really sent by the fritzbox.

Do you think there is a way to tell FreePBX to send the answer to the source-ip instead sending it to the “Via” header?

Because i don’t think I can get the fritzbox to change its behavior :wink:

Thanks in advance
Best regards
Marco

There are options in Asterisk to allow such a thing. I do not work on FreePBX so I do not know where/how they are exposed, but they do exist.

OK, thank you very much.
In FreePBX there is an option Custom Extension, maybe one can do it from there?

Best regards
Marco

; The RFC 3581-defined 'rport' parameter allows a client to request that Asterisk send
; SIP responses to it via the source IP and port from which the request originated
; instead of the address/port listed in the top-most Via header. 

the force rport param is accessible via the Advanced tab, NAT settings for a chan_sip extension.

This might be an issue since this is to a Fritz!Box which means this could be a trunk not an extension. As long as this is a Chan_SIP trunk then changing the nat=comedia,force_rport is what needs to be added to the trunk. However, if this is a Chan_PJSIP trunk that is different as you just can’t add any setting you want you have to use the options presented and force_rport is not a setting for PJSIP trunks. Probably because the logic behind that was “It’s a trunk, to providers. They aren’t behind NAT”.

I see it as an option, core ver. 14.0.28.14 on pjsip trunk advanced tab:

Thanks to all for your help!

@lgaetz: that sounds exactly what should be the problem
but no matter what I set in chan_sip or even pjsip extensions rport/nat setting, asterisk always sends the packets back to the top most Via header ;-(

maybe I have do do some asterisk/freepbx reloads of configuration after setting such things?
for me it seems the settings just aren’t used

thanks for your help
best regards
marco

Hello again,

regarding to my problem I logged what asterisk does when a call from the FritzBox arrives,
seems that eyerything is working as expected until it comes to ending the call, maybe one of you can see what is the problem (WAN-IP changed ;-)) the last BYE request is repeatet 5 times:

thanks in advance
best regards
marco

<--- Received SIP request (1084 bytes) from UDP:192.168.189.1:5060 --->
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 78.83.22.287:61877;rport;branch=z9hG4bKD070C3BB80E2C5FA
From: <sip:[email protected]>;tag=BE86F76F88149A82
To: <sip:[email protected]>
Call-ID: [email protected]
CSeq: 190 INVITE
Contact: <sip:[email protected]:61877;uniq=D61805C4A256BE2CFFF00B2AF766D>
Max-Forwards: 70
Expires: 120
User-Agent: AVM FRITZ!Box 7490 113.07.12 (Jul  3 2019)
Supported: 100rel,replaces
Allow-Events: telephone-event,refer
Allow: INVITE,ACK,OPTIONS,CANCEL,BYE,UPDATE,PRACK,INFO,SUBSCRIBE,NOTIFY,REFER,ME                                                                                        SSAGE,PUBLISH
Content-Type: application/sdp
Accept: application/sdp, multipart/mixed
Accept-Encoding: identity
Content-Length:   359

v=0
o=user 766034 766034 IN IP4 78.83.22.287
s=call
c=IN IP4 78.83.22.287
t=0 0
m=audio 61878 RTP/AVP 8 0 2 102 100 99 97 101
a=sendrecv
a=rtpmap:2 G726-32/8000
a=rtpmap:102 G726-32/8000
a=rtpmap:100 G726-40/8000
a=rtpmap:99 G726-24/8000
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=rtcp:61879

  == Setting global variable 'SIPDOMAIN' to 'raspbx.fritz.box'
<--- Transmitting SIP response (327 bytes) to UDP:192.168.189.1:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 78.83.22.287:61877;rport=5060;received=192.168.189.1;branch=z9                                                                                        hG4bKD070C3BB80E2C5FA
Call-ID: [email protected]
From: <sip:[email protected]>;tag=BE86F76F88149A82
To: <sip:[email protected]>
CSeq: 190 INVITE
Server: FPBX-14.0.5.9(13.27.0)
Content-Length:  0


    -- Executing [test@from-sip-external:1] NoOp("PJSIP/anonymous-0000002b",                                                                                         "Received incoming SIP connection from unknown peer to test") in new stack
    -- Executing [test@from-sip-external:2] Set("PJSIP/anonymous-0000002b",                                                                                         "DID=test") in new stack
    -- Executing [test@from-sip-external:3] Goto("PJSIP/anonymous-0000002b",                                                                                         "s,1") in new stack
    -- Goto (from-sip-external,s,1)
    -- Executing [s@from-sip-external:1] GotoIf("PJSIP/anonymous-0000002b", "1?s                                                                                        etlanguage:checkanon") in new stack
    -- Goto (from-sip-external,s,2)
    -- Executing [s@from-sip-external:2] Set("PJSIP/anonymous-0000002b", "CHANNE                                                                                        L(language)=en") in new stack
    -- Executing [s@from-sip-external:3] GotoIf("PJSIP/anonymous-0000002b", "0?n                                                                                        oanonymous") in new stack
    -- Executing [s@from-sip-external:4] Goto("PJSIP/anonymous-0000002b", "from-                                                                                        trunk,test,1") in new stack
    -- Goto (from-trunk,test,1)
    -- Executing [test@from-trunk:1] Goto("PJSIP/anonymous-0000002b", "from-                                                                                        internal,754,1") in new stack
    -- Goto (from-internal,754,1)
    -- Executing [754@from-internal:1] GotoIf("PJSIP/anonymous-0000002b", "0?ext                                                                                        -local,754,1:followme-check,754,1") in new stack
    -- Goto (followme-check,754,1)
    -- Executing [754@followme-check:1] Gosub("PJSIP/anonymous-0000002b", "follo                                                                                        wme-sub,754,1()") in new stack
    -- Executing [754@followme-sub:1] Macro("PJSIP/anonymous-0000002b", "user-ca                                                                                        llerid,") in new stack
    -- Executing [s@macro-user-callerid:1] Set("PJSIP/anonymous-0000002b", "TOUC                                                                                        H_MONITOR=1567074031.43") in new stack
    -- Executing [s@macro-user-callerid:2] Set("PJSIP/anonymous-0000002b", "AMPU                                                                                        SER=anonymous") in new stack
    -- Executing [s@macro-user-callerid:3] GotoIf("PJSIP/anonymous-0000002b", "0                                                                                        ?report") in new stack
    -- Executing [s@macro-user-callerid:4] ExecIf("PJSIP/anonymous-0000002b", "1                                                                                        ?Set(REALCALLERIDNUM=anonymous)") in new stack
    -- Executing [s@macro-user-callerid:5] Set("PJSIP/anonymous-0000002b", "AMPU                                                                                        SER=") in new stack
    -- Executing [s@macro-user-callerid:6] GotoIf("PJSIP/anonymous-0000002b", "0                                                                                        ?limit") in new stack
    -- Executing [s@macro-user-callerid:7] Set("PJSIP/anonymous-0000002b", "AMPU                                                                                        SERCIDNAME=") in new stack
    -- Executing [s@macro-user-callerid:8] ExecIf("PJSIP/anonymous-0000002b", "0                                                                                        ?Set(__CIDMASQUERADING=TRUE)") in new stack
    -- Executing [s@macro-user-callerid:9] GotoIf("PJSIP/anonymous-0000002b", "1                                                                                        ?report") in new stack
    -- Goto (macro-user-callerid,s,15)
    -- Executing [s@macro-user-callerid:15] NoOp("PJSIP/anonymous-0000002b", "Ma                                                                                        cro Depth is 1") in new stack
    -- Executing [s@macro-user-callerid:16] GotoIf("PJSIP/anonymous-0000002b", "                                                                                        1?report2:macroerror") in new stack
    -- Goto (macro-user-callerid,s,17)
    -- Executing [s@macro-user-callerid:17] GotoIf("PJSIP/anonymous-0000002b", "                                                                                        0?continue") in new stack
    -- Executing [s@macro-user-callerid:18] Set("PJSIP/anonymous-0000002b", "__T                                                                                        TL=64") in new stack
    -- Executing [s@macro-user-callerid:19] GotoIf("PJSIP/anonymous-0000002b", "                                                                                        1?continue") in new stack
    -- Goto (macro-user-callerid,s,35)
    -- Executing [s@macro-user-callerid:35] Set("PJSIP/anonymous-0000002b", "CAL                                                                                        LERID(number)=anonymous") in new stack
    -- Executing [s@macro-user-callerid:36] Set("PJSIP/anonymous-0000002b", "CAL                                                                                        LERID(name)=") in new stack
    -- Executing [s@macro-user-callerid:37] GotoIf("PJSIP/anonymous-0000002b", "                                                                                        1?cnum") in new stack
    -- Goto (macro-user-callerid,s,39)
    -- Executing [s@macro-user-callerid:39] Set("PJSIP/anonymous-0000002b", "CDR                                                                                        (cnum)=anonymous") in new stack
    -- Executing [s@macro-user-callerid:40] Set("PJSIP/anonymous-0000002b", "CHA                                                                                        NNEL(language)=en") in new stack
    -- Executing [754@followme-sub:2] Set("PJSIP/anonymous-0000002b", "DIAL_OPTI                                                                                        ONS=TtrI") in new stack
    -- Executing [754@followme-sub:3] Set("PJSIP/anonymous-0000002b", "CONNECTED                                                                                        LINE(num,i)=754") in new stack
    -- Executing [754@followme-sub:4] Gosub("PJSIP/anonymous-0000002b", "sub-pre                                                                                        sencestate-display,s,1(754)") in new stack
    -- Executing [s@sub-presencestate-display:1] Goto("PJSIP/anonymous-0000002b"                                                                                        , "state-not_set,1") in new stack
    -- Goto (sub-presencestate-display,state-not_set,1)
    -- Executing [state-not_set@sub-presencestate-display:1] Set("PJSIP/anonymou                                                                                        s-0000002b", "PRESENCESTATE_DISPLAY=") in new stack
    -- Executing [state-not_set@sub-presencestate-display:2] Return("PJSIP/anony                                                                                        mous-0000002b", "") in new stack
    -- Executing [754@followme-sub:5] Set("PJSIP/anonymous-0000002b", "CONNECTED                                                                                        LINE(name)=test") in new stack
    -- Executing [754@followme-sub:6] Set("PJSIP/anonymous-0000002b", "FM_DIALST                                                                                        ATUS=UNAVAILABLE") in new stack
    -- Executing [754@followme-sub:7] Set("PJSIP/anonymous-0000002b", "__EXTTOCA                                                                                        LL=754") in new stack
    -- Executing [754@followme-sub:8] Set("PJSIP/anonymous-0000002b", "__PICKUPM                                                                                        ARK=754") in new stack
    -- Executing [754@followme-sub:9] Macro("PJSIP/anonymous-0000002b", "blkvm-s                                                                                        etifempty,") in new stack
    -- Executing [s@macro-blkvm-setifempty:1] GotoIf("PJSIP/anonymous-0000002b",                                                                                         "1?init") in new stack
    -- Goto (macro-blkvm-setifempty,s,4)
    -- Executing [s@macro-blkvm-setifempty:4] Set("PJSIP/anonymous-0000002b", "_                                                                                        _BLKVM_CHANNEL=PJSIP/anonymous-0000002b") in new stack
    -- Executing [s@macro-blkvm-setifempty:5] Set("PJSIP/anonymous-0000002b", "S                                                                                        HARED(BLKVM,PJSIP/anonymous-0000002b)=TRUE") in new stack
    -- Executing [s@macro-blkvm-setifempty:6] Set("PJSIP/anonymous-0000002b", "G                                                                                        OSUB_RETVAL=TRUE") in new stack
    -- Executing [s@macro-blkvm-setifempty:7] MacroExit("PJSIP/anonymous-0000002                                                                                        b", "") in new stack
    -- Executing [754@followme-sub:10] GotoIf("PJSIP/anonymous-0000002b", "1?ski                                                                                        pov") in new stack
    -- Goto (followme-sub,754,13)
    -- Executing [754@followme-sub:13] Set("PJSIP/anonymous-0000002b", "RRNODEST                                                                                        =") in new stack
    -- Executing [754@followme-sub:14] Set("PJSIP/anonymous-0000002b", "__NODEST                                                                                        =754") in new stack
    -- Executing [754@followme-sub:15] GosubIf("PJSIP/anonymous-0000002b", "0?su                                                                                        b-fmsetcid,s,1()") in new stack
    -- Executing [754@followme-sub:16] GotoIf("PJSIP/anonymous-0000002b", "1?ski                                                                                        pprepend") in new stack
    -- Goto (followme-sub,754,18)
    -- Executing [754@followme-sub:18] Set("PJSIP/anonymous-0000002b", "RecordMe                                                                                        thod=Group") in new stack
    -- Executing [754@followme-sub:19] Gosub("PJSIP/anonymous-0000002b", "sub-re                                                                                        cord-check,s,1(exten,754,)") in new stack
    -- Executing [s@sub-record-check:1] GotoIf("PJSIP/anonymous-0000002b", "0?in                                                                                        itialized") in new stack
    -- Executing [s@sub-record-check:2] Set("PJSIP/anonymous-0000002b", "__REC_S                                                                                        TATUS=INITIALIZED") in new stack
    -- Executing [s@sub-record-check:3] Set("PJSIP/anonymous-0000002b", "NOW=156                                                                                        7074031") in new stack
    -- Executing [s@sub-record-check:4] Set("PJSIP/anonymous-0000002b", "__DAY=2                                                                                        9") in new stack
    -- Executing [s@sub-record-check:5] Set("PJSIP/anonymous-0000002b", "__MONTH                                                                                        =08") in new stack
    -- Executing [s@sub-record-check:6] Set("PJSIP/anonymous-0000002b", "__YEAR=                                                                                        2019") in new stack
    -- Executing [s@sub-record-check:7] Set("PJSIP/anonymous-0000002b", "__TIMES                                                                                        TR=20190829-102031") in new stack
    -- Executing [s@sub-record-check:8] Set("PJSIP/anonymous-0000002b", "__FROME                                                                                        XTEN=anonymous") in new stack
    -- Executing [s@sub-record-check:9] Set("PJSIP/anonymous-0000002b", "__MON_F                                                                                        MT=wav") in new stack
    -- Executing [s@sub-record-check:10] NoOp("PJSIP/anonymous-0000002b", "Recor                                                                                        dings initialized") in new stack
    -- Executing [s@sub-record-check:11] ExecIf("PJSIP/anonymous-0000002b", "1?S                                                                                        et(ARG3=dontcare)") in new stack
    -- Executing [s@sub-record-check:12] Set("PJSIP/anonymous-0000002b", "REC_PO                                                                                        LICY_MODE_SAVE=") in new stack
    -- Executing [s@sub-record-check:13] ExecIf("PJSIP/anonymous-0000002b", "0?S                                                                                        et(REC_STATUS=NO)") in new stack
     -- Executing [exten@sub-record-check:14] ExecIf("PJSIP/anonymous-0000002b",                                                                                         "1?Set(RECMODE=dontcare)") in new stack
    -- Executing [exten@sub-record-check:15] ExecIf("PJSIP/anonymous-0000002b",                                                                                         "1?Set(RECMODE=dontcare)") in new stack
    -- Executing [exten@sub-record-check:16] Gosub("PJSIP/anonymous-0000002b", "                                                                                        recordcheck,1(dontcare,internal,754)") in new stack
    -- Executing [recordcheck@sub-record-check:1] NoOp("PJSIP/anonymous-0000002b                                                                                        ", "Starting recording check against dontcare") in new stack
    -- Executing [recordcheck@sub-record-check:2] Goto("PJSIP/anonymous-0000002b                                                                                        ", "dontcare") in new stack
    -- Goto (sub-record-check,recordcheck,3)
    -- Executing [recordcheck@sub-record-check:3] Return("PJSIP/anonymous-000000                                                                                        2b", "") in new stack
    -- Executing [exten@sub-record-check:17] Return("PJSIP/anonymous-0000002b",                                                                                         "") in new stack
    -- Executing [754@followme-sub:20] GotoIf("PJSIP/anonymous-0000002b", "1?ski                                                                                        pdring") in new stack
    -- Goto (followme-sub,754,23)
    -- Executing [754@followme-sub:23] Set("PJSIP/anonymous-0000002b", "STRATEGY                                                                                        =ringallv2-prim") in new stack
    -- Executing [754@followme-sub:24] Set("PJSIP/anonymous-0000002b", "__RVOL="                                                                                        ) in new stack
    -- Executing [754@followme-sub:25] GotoIf("PJSIP/anonymous-0000002b", "1?ski                                                                                        psimple") in new stack
    -- Goto (followme-sub,754,28)
    -- Executing [754@followme-sub:28] Set("PJSIP/anonymous-0000002b", "RingGrou                                                                                        pMethod=ringallv2-prim") in new stack
    -- Executing [754@followme-sub:29] Set("PJSIP/anonymous-0000002b", "_FMGRP=7                                                                                        54") in new stack
    -- Executing [754@followme-sub:30] GotoIf("PJSIP/anonymous-0000002b", "1?DIA                                                                                        LGRP") in new stack
    -- Goto (followme-sub,754,34)
    -- Executing [754@followme-sub:34] ExecIf("PJSIP/anonymous-0000002b", "1?Set                                                                                        (DOPTS=TtrI):Set(DOPTS=m(Ring)TtI)") in new stack
    -- Executing [754@followme-sub:35] Set("PJSIP/anonymous-0000002b", "__ALT_CO                                                                                        NFIRM_MSG=") in new stack
    -- Executing [754@followme-sub:36] GotoIf("PJSIP/anonymous-0000002b", "0?doc                                                                                        onfirm") in new stack
    -- Executing [754@followme-sub:37] GotoIf("PJSIP/anonymous-0000002b", "1?rin                                                                                        gallv21") in new stack
    -- Goto (followme-sub,754,40)
    -- Executing [754@followme-sub:40] Macro("PJSIP/anonymous-0000002b", "dial,3                                                                                        ,TtrI,754") in new stack
    -- Executing [s@macro-dial:1] NoOp("PJSIP/anonymous-0000002b", "Blind Transf                                                                                        er: , Attended Transfer: , User: , Alert Info: ") in new stack
    -- Executing [s@macro-dial:2] ExecIf("PJSIP/anonymous-0000002b", "0?Set(ALER                                                                                        T_INFO=)") in new stack
    -- Executing [s@macro-dial:3] ExecIf("PJSIP/anonymous-0000002b", "0?Set(ALER                                                                                        T_INFO=)") in new stack
    -- Executing [s@macro-dial:4] ExecIf("PJSIP/anonymous-0000002b", "0?Set(ALER                                                                                        T_INFO=)") in new stack
    -- Executing [s@macro-dial:5] ExecIf("PJSIP/anonymous-0000002b", "0?Set(CHAN                                                                                        NEL(musicclass)=)") in new stack
    -- Executing [s@macro-dial:6] AGI("PJSIP/anonymous-0000002b", "dialparties.a                                                                                        gi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
 dialparties.agi: Starting New Dialparties.agi
 dialparties.agi: Caller ID name is 'unknown' number is 'anonymous'
 dialparties.agi: CW Ignore is:
 dialparties.agi: CF Ignore is:
 dialparties.agi: CW IN_USE/BUSY is: 1
       > dialparties.agi: USE_CONFIRMATION:  'FALSE'
       > dialparties.agi: RINGGROUP_INDEX:   ''
 dialparties.agi: Methodology of ring is  'ringallv2-prim'
    -- dialparties.agi: Added extension 754 to extension map
       > dialparties.agi: got fmgrp_prering: 2, fmgrp_grptime: 2
       > dialparties.agi: fmgrp_totalprering: 4
       > dialparties.agi: found extension in pre-ring and array
       > dialparties.agi: ringallv2 ring times: REALPRERING: 4, PRERING: 2
    -- dialparties.agi: Extension 754 cf is disabled
    -- dialparties.agi: Extension 754 do not disturb is disabled
       > dialparties.agi: extnum 754 has:  cw: 1; hascfb: 0 [] hascfu: 0 []
 dialparties.agi: EXTENSION_STATE: 4 (UNAVAILABLE)
 dialparties.agi: Extension 754 has ExtensionState: 4
  == dialparties.agi: Discovered PJSIP Endpoint PJSIP/754
    -- dialparties.agi: Ended up with no PJSIP contacts
    -- dialparties.agi: DbDel CALLTRACE/754 - Caller ID is not defined
    -- dialparties.agi: Filtered ARG3: 754
    -- dialparties.agi: RING ALL V2 :
       > dialparties.agi: NODEST: 754 adding M(auto-blkvm) to dialopts: TtrIM(au                                                                                        to-blkvm)
       > dialparties.agi: NODEST: 754 blkvm enabled macro already in dialopts: T                                                                                        trIM(auto-blkvm)
 dialparties.agi: Setting default NOANSWER DIALSTATUS since no extensions availa                                                                                        ble
 dialparties.agi: RVOL_MODE ''
 dialparties.agi: RVOL is:
 dialparties.agi: RVOLPARENT is:
    -- <PJSIP/anonymous-0000002b>AGI Script dialparties.agi completed, returning                                                                                         0
    -- Executing [s@macro-dial:7] NoOp("PJSIP/anonymous-0000002b", "Returned fro                                                                                        m dialparties with no extensions to call and DIALSTATUS: NOANSWER") in new stack
    -- Executing [s@macro-dial:8] MacroExit("PJSIP/anonymous-0000002b", "") in n                                                                                        ew stack
    -- Executing [754@followme-sub:41] Goto("PJSIP/anonymous-0000002b", "nextste                                                                                        p") in new stack
    -- Goto (followme-sub,754,46)
    -- Executing [754@followme-sub:46] Set("PJSIP/anonymous-0000002b", "RingGrou                                                                                        pMethod=") in new stack
    -- Executing [754@followme-sub:47] GotoIf("PJSIP/anonymous-0000002b", "0?nod                                                                                        est") in new stack
    -- Executing [754@followme-sub:48] Set("PJSIP/anonymous-0000002b", "__NODEST                                                                                        =") in new stack
    -- Executing [754@followme-sub:49] Set("PJSIP/anonymous-0000002b", "__PICKUP                                                                                        MARK=") in new stack
    -- Executing [754@followme-sub:50] Macro("PJSIP/anonymous-0000002b", "blkvm-                                                                                        clr,") in new stack
    -- Executing [s@macro-blkvm-clr:1] Set("PJSIP/anonymous-0000002b", "SHARED(B                                                                                        LKVM,PJSIP/anonymous-0000002b)=") in new stack
    -- Executing [s@macro-blkvm-clr:2] Set("PJSIP/anonymous-0000002b", "GOSUB_RE                                                                                        TVAL=") in new stack
    -- Executing [s@macro-blkvm-clr:3] MacroExit("PJSIP/anonymous-0000002b", "")                                                                                         in new stack
    -- Executing [754@followme-sub:51] Set("PJSIP/anonymous-0000002b", "DIALSTAT                                                                                        US=CHANUNAVAIL") in new stack
    -- Executing [754@followme-sub:52] GotoIf("PJSIP/anonymous-0000002b", "0?doh                                                                                        angup") in new stack
    -- Executing [754@followme-sub:53] Goto("PJSIP/anonymous-0000002b", "app-ann                                                                                        ouncement-1,s,1") in new stack
    -- Goto (app-announcement-1,s,1)
    -- Executing [s@app-announcement-1:1] GotoIf("PJSIP/anonymous-0000002b", "0?                                                                                        begin") in new stack
    -- Executing [s@app-announcement-1:2] Answer("PJSIP/anonymous-0000002b", "")                                                                                         in new stack
       > 0x73f04470 -- Strict RTP learning after remote address set to: 78.83.22.287                                                                                        2.187:61878
<--- Transmitting SIP response (903 bytes) to UDP:192.168.189.1:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 78.83.22.287:61877;rport=5060;received=192.168.189.1;branch=z9                                                                                        hG4bKD070C3BB80E2C5FA
Call-ID: [email protected]
From: <sip:[email protected]>;tag=BE86F76F88149A82
To: <sip:[email protected]>;tag=0fa20040-638c-4020-a37d-cd92c8c8f26b
CSeq: 190 INVITE
Server: FPBX-14.0.5.9(13.27.0)
Contact: <sip:192.168.189.39:5060>
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PR                                                                                        ACK, REGISTER, REFER, MESSAGE
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length:   310

v=0
o=- 766034 766036 IN IP4 192.168.189.39
s=Asterisk
c=IN IP4 192.168.189.39
t=0 0
m=audio 14526 RTP/AVP 0 8 2 97 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:97 iLBC/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Received SIP request (463 bytes) from UDP:192.168.189.1:5060 --->
ACK sip:192.168.189.39:5060 SIP/2.0
Via: SIP/2.0/UDP 78.83.22.287:5060;branch=z9hG4bKA99DE06B7A356731
From: <sip:[email protected]>;tag=BE86F76F88149A82
To: <sip:[email protected]>;tag=0fa20040-638c-4020-a37d-cd92c8c8f26b
Call-ID: [email protected]
CSeq: 190 ACK
Contact: <sip:[email protected];uniq=D61805C4A256BE2CFFF00B2AF766D>
Max-Forwards: 70
User-Agent: AVM FRITZ!Box 7490 113.07.12 (Jul  3 2019)
Content-Length: 0

       > 0x73f04470 -- Strict RTP qualifying stream type: audio
       > 0x73f04470 -- Strict RTP switching source address to 192.168.189.1:7078
    -- Executing [s@app-announcement-1:3] Wait("PJSIP/anonymous-0000002b", "1")                                                                                         in new stack
    -- Executing [s@app-announcement-1:4] NoOp("PJSIP/anonymous-0000002b", "Play                                                                                        ing announcement test") in new stack
    -- Executing [s@app-announcement-1:5] Playback("PJSIP/anonymous-0000002b", "                                                                                        ,noanswer") in new stack
    -- Executing [s@app-announcement-1:6] Goto("PJSIP/anonymous-0000002b", "app-                                                                                        blackhole,hangup,1") in new stack
    -- Goto (app-blackhole,hangup,1)
    -- Executing [hangup@app-blackhole:1] NoOp("PJSIP/anonymous-0000002b", "Blac                                                                                        khole Dest: Hangup") in new stack
    -- Executing [hangup@app-blackhole:2] Hangup("PJSIP/anonymous-0000002b", "")                                                                                         in new stack
  == Spawn extension (app-blackhole, hangup, 2) exited non-zero on 'PJSIP/anonym                                                                                        ous-0000002b'

<--- Transmitting SIP request (467 bytes) to UDP:78.83.22.287:61877 --->
BYE sip:[email protected]:61877;uniq=D61805C4A256BE2CFFF00B2AF766D SIP/2.0
Via: SIP/2.0/UDP 192.168.189.39:5060;rport;branch=z9hG4bKPjfd3d195d-84a0-47d8-be                                                                                        10-0e12006e0f22
From: <sip:[email protected]>;tag=0fa20040-638c-4020-a37d-cd92c8c8f26b
To: <sip:[email protected]>;tag=BE86F76F88149A82
Call-ID: [email protected]
CSeq: 335 BYE
Reason: Q.850;cause=16
Max-Forwards: 70
User-Agent: FPBX-14.0.5.9(13.27.0)
Content-Length:  0
>

The “rewrite_contact” option needs to be set to “yes” in order to have requests sent to the source IP address/port instead of what the remote side says (which in this case is a public IP address and port). I don’t know how that is done in FreePBX, but that would send the BYE to the right IP address/port.

This is probably due to the fritz box having some type of SIP NAT helper / ALG