I can't receive calls

I have tried literally every configuration of the provider extensions in sip.conf, but cannot find out how to
receive calls: every time I receive the following error:

Blockquote [May 15 18:16:22] NOTICE [4705][C-000000ec]: chan_sip.c : 26512 handle_request_invite : Call from ‘asterisk’ (192.168.2.1:5060) to extension ‘FritzBS’ rejected because extension not found in context ‘incoming_TIM_BS’.

I have an extensions FritzBS which has context=incoming_TIM_BS SO, why the hell asterisk is saying that I don’t have it???

Have you configured the context in extensions.conf with something that would match it?

Fritzbox 192.168.2.1 (telephony provider)
Asterisk 192.168.2.81

[general]
allowguest=no
alwaysauthreject=yes
prematuremedia=no
progressinband=yes

register => asterisk:**************@192.168.2.1/FritzBS

[FritzBS]
type=friend
context=incoming_TIM_BS
allow=all
defaultuser=asterisk
fromuser=asterisk
fromdomain=192.168.2.1
secret=**************
host=192.168.2.1
insecure=port,invite
qualify=yes

[matejipad]
type=friend
host=dynamic
secret=**************
context=internal
disallow=all
allow=alaw
qualify=yes

Extensions.conf

[cellulari]

exten=> 1003,1,NoOp()
same => n,Dial(SIP/matejipad,60)
same => n,Hangup()

exten => _0039X.,1,NoOp()
same => n,GoTo(outgoing_TIM_TS,${EXTEN:4},1)

exten => _+39X.,1,NoOp()
same => n,GoTo(outgoing_TIM_TS,${EXTEN:3},1)

[outgoing_TIM_BS]

exten => _X.,1,NoOp()
same  => n,Dial(SIP/${EXTEN}@FritzBS)
same  => n,Playtones(congestion)
same  => n,hangup()

[incoming_TIM_BS]

exten => _X.,1,NoOp()
same  => n,GoTo(cellulari,matejipad,1)
same  => n,Playtones(congestion)
same  => n,hangup()

When I call my landline number I get this messages from asterisk (sip set debug peer FritzBS):
SIP Debugging Enabled for IP: 192.168.2.1

Reliably Transmitting (no NAT) to 192.168.2.1:5060:

OPTIONS sip:192.168.2.1 SIP/2.0

Via: SIP/2.0/UDP 192.168.2.81:5060;branch=z9hG4bK40879e8a

Max-Forwards: 70

From: "asterisk" <sip:asterisk@192.168.2.81>;tag=as0c850d33

To: <sip:192.168.2.1>

Contact: <sip:asterisk@192.168.2.81:5060>

Call-ID: 3c75659e3dcec1a67542f6c426eec573@192.168.2.81:5060

CSeq: 102 OPTIONS

User-Agent: Asterisk PBX 15.6.0

Date: Wed, 15 May 2019 17:36:43 GMT

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE

Supported: replaces, timer

Content-Length: 0

---

<--- SIP read from UDP:192.168.2.1:5060 --->

SIP/2.0 401 Unauthorized

Via: SIP/2.0/UDP 192.168.2.81:5060;branch=z9hG4bK40879e8a

From: "asterisk" <sip:asterisk@192.168.2.81>;tag=as0c850d33

To: <sip:192.168.2.1>;tag=6A2D4BFACFE0F3EE

Call-ID: 3c75659e3dcec1a67542f6c426eec573@192.168.2.81:5060

CSeq: 102 OPTIONS

Contact: <sip:9892EDC79FF9AFE681FD7C235B7D2@192.168.2.1>

WWW-Authenticate: Digest realm="fritz.box", nonce="1F8E84585EE20CA9"

User-Agent: FRITZ!OS

Content-Length: 0

<------------->

--- (10 headers 0 lines) ---

Really destroying SIP dialog '3c75659e3dcec1a67542f6c426eec573@192.168.2.81:5060' Method: OPTIONS

<--- SIP read from UDP:192.168.2.1:5060 --->

INVITE sip:FritzBS@192.168.2.81:5060 SIP/2.0

Via: SIP/2.0/UDP 192.168.2.1:5060;branch=z9hG4bKF8D9D6EB756C36BB

From: "Unsubscribed" <sip:anonymous@fritz.box>;tag=5C8ECD031AFD4A73

To: <sip:FritzBS@192.168.2.81:5060>

Call-ID: F864E3C3700E8413@192.168.2.1

CSeq: 33 INVITE

Contact: <sip:9892EDC79FF9AFE681FD7C235B7D2@192.168.2.1>

Max-Forwards: 70

P-Called-Party-ID: <sip:030820276@fritz.box>

Expires: 120

Session-Expires: 600;refresher=uac

Min-SE: 90

User-Agent: AVM FRITZ!Box 7590 154.07.01 (Oct 9 2018)

Supported: 100rel,replaces,timer

Allow-Events: telephone-event,refer

Allow: INVITE,ACK,OPTIONS,CANCEL,BYE,UPDATE,PRACK,INFO,SUBSCRIBE,NOTIFY,REFER,MESSAGE,PUBLISH

Content-Type: application/sdp

Accept: application/sdp, multipart/mixed

Accept-Encoding: identity

Content-Length: 379

v=0

o=user 7910081 7910081 IN IP4 192.168.2.1

s=call

c=IN IP4 192.168.2.1

t=0 0

m=audio 7094 RTP/AVP 8 0 2 102 100 99 97 101 18

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=fmtp:18 annexb=no

a=rtcp:7095

<------------->

--- (20 headers 17 lines) ---

Sending to 192.168.2.1:5060 (no NAT)

Sending to 192.168.2.1:5060 (no NAT)

Using INVITE request as basis request - F864E3C3700E8413@192.168.2.1

Found peer 'FritzBS' for 'anonymous' from 192.168.2.1:5060

**==** Using SIP RTP CoS mark 5

Found RTP audio format 8

Found RTP audio format 0

Found RTP audio format 2

Found RTP audio format 102

Found RTP audio format 100

Found RTP audio format 99

Found RTP audio format 97

Found RTP audio format 101

Found RTP audio format 18

Found audio description format G726-32 for ID 2

Found audio description format G726-32 for ID 102

Found unknown media description format G726-40 for ID 100

Found unknown media description format G726-24 for ID 99

Found audio description format iLBC for ID 97

Found audio description format telephone-event for ID 101

Capabilities: us - (ulaw|alaw|gsm|h263|codec2|g723|g726|g726aal2|adpcm|slin|slin|slin|slin|slin|slin|slin|slin|slin|lpc10|g729|speex|speex|speex|ilbc|g722|siren7|siren14|testlaw|g719|opus|jpeg|png|h261|h263p|h264|mpeg4|vp8|vp9|red|t140|t38|silk|silk|silk|silk), peer - audio=(ulaw|g726|alaw|g729|ilbc)/video=(nothing)/text=(nothing), combined - (ulaw|alaw|g726|g729|ilbc)

Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)

Peer audio RTP is at port 192.168.2.1:7094

Looking for FritzBS in incoming_TIM_BS (domain 192.168.2.81)

<--- Reliably Transmitting (no NAT) to 192.168.2.1:5060 --->

SIP/2.0 404 Not Found

Via: SIP/2.0/UDP 192.168.2.1:5060;branch=z9hG4bKF8D9D6EB756C36BB;received=192.168.2.1

From: "Unsubscribed" <sip:anonymous@fritz.box>;tag=5C8ECD031AFD4A73

To: <sip:FritzBS@192.168.2.81:5060>;tag=as7bbc520e

Call-ID: F864E3C3700E8413@192.168.2.1

CSeq: 33 INVITE

Server: Asterisk PBX 15.6.0

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE

Supported: replaces, timer

Content-Length: 0

<------------>

[May 15 19:37:05] **NOTICE** [4705][C-000000f2]: **chan_sip.c** : **26512** **handle_request_invite** : Call from 'asterisk' (192.168.2.1:5060) to extension 'FritzBS' rejected because extension not found in context 'incoming_TIM_BS'.

Scheduling destruction of SIP dialog 'F864E3C3700E8413@192.168.2.1' in 6400 ms (Method: INVITE)

<--- SIP read from UDP:192.168.2.1:5060 --->

ACK sip:FritzBS@192.168.2.81:5060 SIP/2.0

Via: SIP/2.0/UDP 192.168.2.1:5060;branch=z9hG4bKF8D9D6EB756C36BB

From: "Unsubscribed" <sip:anonymous@fritz.box>;tag=5C8ECD031AFD4A73

To: <sip:FritzBS@192.168.2.81:5060>;tag=as7bbc520e

Call-ID: F864E3C3700E8413@192.168.2.1

CSeq: 33 ACK

User-Agent: AVM FRITZ!Box 7590 154.07.01 (Oct 9 2018)

Content-Length: 0

<------------->

--- (8 headers 0 lines) ---

Really destroying SIP dialog 'F864E3C3700E8413@192.168.2.1' Method: ACK

Reliably Transmitting (no NAT) to 192.168.2.1:5060:

OPTIONS sip:192.168.2.1 SIP/2.0

Via: SIP/2.0/UDP 192.168.2.81:5060;branch=z9hG4bK63ac889d

Max-Forwards: 70

From: "asterisk" <sip:asterisk@192.168.2.81>;tag=as02592c01

To: <sip:192.168.2.1>

Contact: <sip:asterisk@192.168.2.81:5060>

Call-ID: 300812951f34a5cf191fe19137ea70db@192.168.2.81:5060

CSeq: 102 OPTIONS

User-Agent: Asterisk PBX 15.6.0

Date: Wed, 15 May 2019 17:37:43 GMT

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE

Supported: replaces, timer

Content-Length: 0

---

<--- SIP read from UDP:192.168.2.1:5060 --->

SIP/2.0 401 Unauthorized

Via: SIP/2.0/UDP 192.168.2.81:5060;branch=z9hG4bK63ac889d

From: "asterisk" <sip:asterisk@192.168.2.81>;tag=as02592c01

To: <sip:192.168.2.1>;tag=E78AA7905CA190B0

Call-ID: 300812951f34a5cf191fe19137ea70db@192.168.2.81:5060

CSeq: 102 OPTIONS

Contact: <sip:9892EDC79FF9AFE681FD7C235B7D2@192.168.2.1>

WWW-Authenticate: Digest realm="fritz.box", nonce="2082B41384E71DAB"

User-Agent: FRITZ!OS

Content-Length: 0

Outbound calls are working like a charm, while incoming calls are not

Define an extension called ‘FritzBS’ in your ‘incoming_TIM_BS’ context. Your pattern match is not matching because the extension does not start with a number.

Could you please be clearer?

Is sip.conf I already have [FritzBS]. How should I modify the [incoming_TIM_BS] context in extensions.conf?

If I change _X. with FritzBS

[incoming_TIM_BS]

exten => FritzBS,1,NoOp()
same  => n,GoTo(cellulari,matejipad,1)
same  => n,Playtones(congestion)
same  => n,hangup()

I get this log:

<------------>
    -- Executing [FritzBS@incoming_TIM_BS:1] NoOp("SIP/FritzBS-0000013e", "") in new stack
    -- Executing [FritzBS@incoming_TIM_BS:2] Goto("SIP/FritzBS-0000013e", "cellulari,matejipad,1") in new stack
    -- Goto (cellulari,matejipad,1)
[May 15 19:51:28] WARNING[6403][C-000000f6]: pbx.c:4461 __ast_pbx_run: Channel 'SIP/FritzBS-0000013e' sent to invalid extension but no invalid handler: context,exten,priority=cellulari,matejipad,1
Scheduling destruction of SIP dialog '2C0A63CADA9710D2@192.168.2.1' in 6400 ms (Method: INVITE)

<--- Reliably Transmitting (no NAT) to 192.168.2.1:5060 --->
SIP/2.0 603 Declined
Via: SIP/2.0/UDP 192.168.2.1:5060;branch=z9hG4bK0BED098DC29E88D1;received=192.168.2.1
From: "Unsubscribed" <sip:anonymous@fritz.box>;tag=32413F780DE28D78
To: <sip:FritzBS@192.168.2.81:5060>;tag=as5e1aa734
Call-ID: 2C0A63CADA9710D2@192.168.2.1
CSeq: 36 INVITE
Server: Asterisk PBX 15.6.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 600;refresher=uac
Content-Length: 0


<------------>

<--- SIP read from UDP:192.168.2.1:5060 --->
ACK sip:FritzBS@192.168.2.81:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.1:5060;branch=z9hG4bK0BED098DC29E88D1
From: "Unsubscribed" <sip:anonymous@fritz.box>;tag=32413F780DE28D78
To: <sip:FritzBS@192.168.2.81:5060>;tag=as5e1aa734
Call-ID: 2C0A63CADA9710D2@192.168.2.1
CSeq: 36 ACK
User-Agent: AVM FRITZ!Box 7590 154.07.01 (Oct 9 2018)
Content-Length: 0

<------------->
--- (8 headers 0 lines) ---
Really destroying SIP dialog '2C0A63CADA9710D2@192.168.2.1' Method: ACK
Reliably Transmitting (no NAT) to 192.168.2.1:5060:
OPTIONS sip:192.168.2.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.81:5060;branch=z9hG4bK7705154d
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.168.2.81>;tag=as65a98751
To: <sip:192.168.2.1>
Contact: <sip:asterisk@192.168.2.81:5060>
Call-ID: 4af5bd5d1a0e7fd17b20ee556838f73c@192.168.2.81:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 15.6.0
Date: Wed, 15 May 2019 17:51:44 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---

<--- SIP read from UDP:192.168.2.1:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.2.81:5060;branch=z9hG4bK7705154d
From: "asterisk" <sip:asterisk@192.168.2.81>;tag=as65a98751
To: <sip:192.168.2.1>;tag=D57F857EDD6071AD
Call-ID: 4af5bd5d1a0e7fd17b20ee556838f73c@192.168.2.81:5060
CSeq: 102 OPTIONS
Contact: <sip:9892EDC79FF9AFE681FD7C235B7D2@192.168.2.1>
WWW-Authenticate: Digest realm="fritz.box", nonce="13FD7B9098644F46"
User-Agent: FRITZ!OS
Content-Length: 0


Now it is working!!:grinning:

[incoming_TIM_BS]

exten => FritzBS,1,NoOp()
same  => n,GoTo(cellulari,1003,1)
same  => n,Playtones(congestion)
same  => n,hangup()

I exchanged “matejipad” with “1003” and now I receive calls!!

Last problem: when I answer to the incoming call and then hang up, call from caller side doesn’t and continues:

 -- Executing [FritzBS@incoming_TIM_BS:1] NoOp("SIP/FritzBS-0000014a", "") in new stack
    -- Executing [FritzBS@incoming_TIM_BS:2] Goto("SIP/FritzBS-0000014a", "cellulari,1003,1") in new stack
    -- Goto (cellulari,1003,1)
    -- Executing [1003@cellulari:1] NoOp("SIP/FritzBS-0000014a", "") in new stack
    -- Executing [1003@cellulari:2] Goto("SIP/FritzBS-0000014a", "internal,1003,1") in new stack
    -- Goto (internal,1003,1)
    -- Executing [1003@internal:1] NoOp("SIP/FritzBS-0000014a", "") in new stack
    -- Executing [1003@internal:2] Dial("SIP/FritzBS-0000014a", "SIP/matejipad,60") in new stack
  == Using SIP RTP CoS mark 5
    -- Called SIP/matejipad
    -- SIP/matejipad-0000014b is ringing

<--- Transmitting (no NAT) to 192.168.2.1:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 192.168.2.1:5060;branch=z9hG4bK87277B532E1D0E57;received=192.168.2.1
From: "Unsubscribed" <sip:anonymous@fritz.box>;tag=7C09CE68A7A2D756
To: <sip:FritzBS@192.168.2.81:5060>;tag=as31572a8c
Call-ID: AA0CFCAEDDC331F7@192.168.2.1
CSeq: 44 INVITE
Server: Asterisk PBX 15.6.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 600;refresher=uac
Contact: <sip:FritzBS@192.168.2.81:5060>
Content-Length: 0


<------------>
Audio is at 17278
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec g726 to SDP
Adding codec g729 to SDP
Adding codec ilbc to SDP
Adding non-codec 0x1 (telephone-event) to SDP

<--- Transmitting (no NAT) to 192.168.2.1:5060 --->
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP 192.168.2.1:5060;branch=z9hG4bK87277B532E1D0E57;received=192.168.2.1
From: "Unsubscribed" <sip:anonymous@fritz.box>;tag=7C09CE68A7A2D756
To: <sip:FritzBS@192.168.2.81:5060>;tag=as31572a8c
Call-ID: AA0CFCAEDDC331F7@192.168.2.1
CSeq: 44 INVITE
Server: Asterisk PBX 15.6.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 600;refresher=uac
Contact: <sip:FritzBS@192.168.2.81:5060>
Content-Type: application/sdp
Require: timer
Content-Length: 380

v=0
o=root 861482549 861482549 IN IP4 192.168.2.81
s=Asterisk PBX 15.6.0
c=IN IP4 192.168.2.81
t=0 0
m=audio 17278 RTP/AVP 0 8 2 18 97 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=sendrecv

<------------>
    -- SIP/matejipad-0000014b answered SIP/FritzBS-0000014a
Audio is at 17278
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec g726 to SDP
Adding codec g729 to SDP
Adding codec ilbc to SDP
Adding non-codec 0x1 (telephone-event) to SDP

<--- Reliably Transmitting (no NAT) to 192.168.2.1:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.2.1:5060;branch=z9hG4bK87277B532E1D0E57;received=192.168.2.1
From: "Unsubscribed" <sip:anonymous@fritz.box>;tag=7C09CE68A7A2D756
To: <sip:FritzBS@192.168.2.81:5060>;tag=as31572a8c
Call-ID: AA0CFCAEDDC331F7@192.168.2.1
CSeq: 44 INVITE
Server: Asterisk PBX 15.6.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 600;refresher=uac
Contact: <sip:FritzBS@192.168.2.81:5060>
Content-Type: application/sdp
Require: timer
Content-Length: 380

v=0
o=root 861482549 861482549 IN IP4 192.168.2.81
s=Asterisk PBX 15.6.0
c=IN IP4 192.168.2.81
t=0 0
m=audio 17278 RTP/AVP 0 8 2 18 97 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=sendrecv

<------------>
    -- Channel SIP/matejipad-0000014b joined 'simple_bridge' basic-bridge <53c23476-a6f7-4f62-8777-fa901efd154c>
    -- Channel SIP/FritzBS-0000014a joined 'simple_bridge' basic-bridge <53c23476-a6f7-4f62-8777-fa901efd154c>
Retransmitting #1 (no NAT) to 192.168.2.1:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.2.1:5060;branch=z9hG4bK87277B532E1D0E57;received=192.168.2.1
From: "Unsubscribed" <sip:anonymous@fritz.box>;tag=7C09CE68A7A2D756
To: <sip:FritzBS@192.168.2.81:5060>;tag=as31572a8c
Call-ID: AA0CFCAEDDC331F7@192.168.2.1
CSeq: 44 INVITE
Server: Asterisk PBX 15.6.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 600;refresher=uac
Contact: <sip:FritzBS@192.168.2.81:5060>
Content-Type: application/sdp
Require: timer
Content-Length: 380

v=0
o=root 861482549 861482549 IN IP4 192.168.2.81
s=Asterisk PBX 15.6.0
c=IN IP4 192.168.2.81
t=0 0
m=audio 17278 RTP/AVP 0 8 2 18 97 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=sendrecv

---
Retransmitting #2 (no NAT) to 192.168.2.1:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.2.1:5060;branch=z9hG4bK87277B532E1D0E57;received=192.168.2.1
From: "Unsubscribed" <sip:anonymous@fritz.box>;tag=7C09CE68A7A2D756
To: <sip:FritzBS@192.168.2.81:5060>;tag=as31572a8c
Call-ID: AA0CFCAEDDC331F7@192.168.2.1
CSeq: 44 INVITE
Server: Asterisk PBX 15.6.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 600;refresher=uac
Contact: <sip:FritzBS@192.168.2.81:5060>
Content-Type: application/sdp
Require: timer
Content-Length: 380

v=0
o=root 861482549 861482549 IN IP4 192.168.2.81
s=Asterisk PBX 15.6.0
c=IN IP4 192.168.2.81
t=0 0
m=audio 17278 RTP/AVP 0 8 2 18 97 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=sendrecv

---

<--- SIP read from UDP:192.168.2.1:5060 --->
ACK sip:FritzBS@192.168.2.81:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.1:5060;branch=z9hG4bK705F0D0CAED209FC
From: "Unsubscribed" <sip:anonymous@fritz.box>;tag=7C09CE68A7A2D756
To: <sip:FritzBS@192.168.2.81:5060>;tag=as31572a8c
Call-ID: AA0CFCAEDDC331F7@192.168.2.1
CSeq: 44 ACK
Contact: <sip:9892EDC79FF9AFE681FD7C235B7D2@192.168.2.1>
Max-Forwards: 70
User-Agent: AVM FRITZ!Box 7590 154.07.01 (Oct 9 2018)
Content-Length: 0

<------------->
--- (10 headers 0 lines) ---

<--- SIP read from UDP:192.168.2.1:5060 --->
ACK sip:FritzBS@192.168.2.81:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.1:5060;branch=z9hG4bK6AEDCA5FD5D92241
From: "Unsubscribed" <sip:anonymous@fritz.box>;tag=7C09CE68A7A2D756
To: <sip:FritzBS@192.168.2.81:5060>;tag=as31572a8c
Call-ID: AA0CFCAEDDC331F7@192.168.2.1
CSeq: 44 ACK
Contact: <sip:9892EDC79FF9AFE681FD7C235B7D2@192.168.2.1>
Max-Forwards: 70
User-Agent: AVM FRITZ!Box 7590 154.07.01 (Oct 9 2018)
Content-Length: 0

<------------->
--- (10 headers 0 lines) ---

<--- SIP read from UDP:192.168.2.1:5060 --->
ACK sip:FritzBS@192.168.2.81:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.1:5060;branch=z9hG4bKF36265CDCBB8DBA1
From: "Unsubscribed" <sip:anonymous@fritz.box>;tag=7C09CE68A7A2D756
To: <sip:FritzBS@192.168.2.81:5060>;tag=as31572a8c
Call-ID: AA0CFCAEDDC331F7@192.168.2.1
CSeq: 44 ACK
Contact: <sip:9892EDC79FF9AFE681FD7C235B7D2@192.168.2.1>
Max-Forwards: 70
User-Agent: AVM FRITZ!Box 7590 154.07.01 (Oct 9 2018)
Content-Length: 0

<------------->
--- (10 headers 0 lines) ---
    -- Channel SIP/matejipad-0000014b left 'simple_bridge' basic-bridge <53c23476-a6f7-4f62-8777-fa901efd154c>
    -- Channel SIP/FritzBS-0000014a left 'simple_bridge' basic-bridge <53c23476-a6f7-4f62-8777-fa901efd154c>
  == Spawn extension (internal, 1003, 2) exited non-zero on 'SIP/FritzBS-0000014a'
Scheduling destruction of SIP dialog 'AA0CFCAEDDC331F7@192.168.2.1' in 6400 ms (Method: ACK)
set_destination: Parsing <sip:9892EDC79FF9AFE681FD7C235B7D2@192.168.2.1> for address/port to send to
set_destination: set destination to 192.168.2.1:5060
Reliably Transmitting (no NAT) to 192.168.2.1:5060:
BYE sip:9892EDC79FF9AFE681FD7C235B7D2@192.168.2.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.81:5060;branch=z9hG4bK4fae0f92
Max-Forwards: 70
From: <sip:FritzBS@192.168.2.81:5060>;tag=as31572a8c
To: "Unsubscribed" <sip:anonymous@fritz.box>;tag=7C09CE68A7A2D756
Call-ID: AA0CFCAEDDC331F7@192.168.2.1
CSeq: 102 BYE
User-Agent: Asterisk PBX 15.6.0
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0


---
Retransmitting #1 (no NAT) to 192.168.2.1:5060:
BYE sip:9892EDC79FF9AFE681FD7C235B7D2@192.168.2.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.81:5060;branch=z9hG4bK4fae0f92
Max-Forwards: 70
From: <sip:FritzBS@192.168.2.81:5060>;tag=as31572a8c
To: "Unsubscribed" <sip:anonymous@fritz.box>;tag=7C09CE68A7A2D756
Call-ID: AA0CFCAEDDC331F7@192.168.2.1
CSeq: 102 BYE
User-Agent: Asterisk PBX 15.6.0
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0


---
Retransmitting #2 (no NAT) to 192.168.2.1:5060:
BYE sip:9892EDC79FF9AFE681FD7C235B7D2@192.168.2.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.81:5060;branch=z9hG4bK4fae0f92
Max-Forwards: 70
From: <sip:FritzBS@192.168.2.81:5060>;tag=as31572a8c
To: "Unsubscribed" <sip:anonymous@fritz.box>;tag=7C09CE68A7A2D756
Call-ID: AA0CFCAEDDC331F7@192.168.2.1
CSeq: 102 BYE
User-Agent: Asterisk PBX 15.6.0
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0


---
Retransmitting #3 (no NAT) to 192.168.2.1:5060:
BYE sip:9892EDC79FF9AFE681FD7C235B7D2@192.168.2.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.81:5060;branch=z9hG4bK4fae0f92
Max-Forwards: 70
From: <sip:FritzBS@192.168.2.81:5060>;tag=as31572a8c
To: "Unsubscribed" <sip:anonymous@fritz.box>;tag=7C09CE68A7A2D756
Call-ID: AA0CFCAEDDC331F7@192.168.2.1
CSeq: 102 BYE
User-Agent: Asterisk PBX 15.6.0
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0


---
Retransmitting #4 (no NAT) to 192.168.2.1:5060:
BYE sip:9892EDC79FF9AFE681FD7C235B7D2@192.168.2.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.81:5060;branch=z9hG4bK4fae0f92
Max-Forwards: 70
From: <sip:FritzBS@192.168.2.81:5060>;tag=as31572a8c
To: "Unsubscribed" <sip:anonymous@fritz.box>;tag=7C09CE68A7A2D756
Call-ID: AA0CFCAEDDC331F7@192.168.2.1
CSeq: 102 BYE
User-Agent: Asterisk PBX 15.6.0
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0


---

<--- SIP read from UDP:192.168.2.1:5060 --->
BYE sip:FritzBS@192.168.2.81:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.1:5060;branch=z9hG4bKB9119907795D9D1A
From: "Unsubscribed" <sip:anonymous@fritz.box>;tag=7C09CE68A7A2D756
To: <sip:FritzBS@192.168.2.81:5060>;tag=as31572a8c
Call-ID: AA0CFCAEDDC331F7@192.168.2.1
CSeq: 45 BYE
X-RTP-Stat: CS=139;PS=620;ES=712;OS=99200;SP=0/0;SO=0;QS=-;PR=425;ER=712;OR=68000;CR=0;SR=0;QR=-;PL=0,73;BL=1;LS=6;RB=230/255;SB=-/-;EN=PCMU;DE=PCMU;JI=59,23;DL=330,284,377;IP=192.168.2.1:7082,192.168.2.81:17278
X-RTP-Stat-Add: DQ=6;DSS=0;DS=0;PLCS=26624;JS=57
X-SIP-Stat: DRT=10;IR=0
Reason: Q.850; cause=16
Max-Forwards: 70
User-Agent: AVM FRITZ!Box 7590 154.07.01 (Oct 9 2018)
Supported: 100rel,replaces,timer
Allow-Events: telephone-event,refer
Content-Length: 0

<------------->
--- (15 headers 0 lines) ---
Sending to 192.168.2.1:5060 (no NAT)
Scheduling destruction of SIP dialog 'AA0CFCAEDDC331F7@192.168.2.1' in 6400 ms (Method: BYE)

<--- Transmitting (no NAT) to 192.168.2.1:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.2.1:5060;branch=z9hG4bKB9119907795D9D1A;received=192.168.2.1
From: "Unsubscribed" <sip:anonymous@fritz.box>;tag=7C09CE68A7A2D756
To: <sip:FritzBS@192.168.2.81:5060>;tag=as31572a8c
Call-ID: AA0CFCAEDDC331F7@192.168.2.1
CSeq: 45 BYE
Server: Asterisk PBX 15.6.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<------------>
Really destroying SIP dialog 'AA0CFCAEDDC331F7@192.168.2.1' Method: BYE
Reliably Transmitting (no NAT) to 192.168.2.1:5060:
OPTIONS sip:192.168.2.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.81:5060;branch=z9hG4bK4fa6b22d
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.168.2.81>;tag=as4ef39c06
To: <sip:192.168.2.1>
Contact: <sip:asterisk@192.168.2.81:5060>
Call-ID: 39449ee668700b0675356e95518d172c@192.168.2.81:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 15.6.0
Date: Wed, 15 May 2019 18:20:36 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---

<--- SIP read from UDP:192.168.2.1:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.2.81:5060;branch=z9hG4bK4fa6b22d
From: "asterisk" <sip:asterisk@192.168.2.81>;tag=as4ef39c06
To: <sip:192.168.2.1>;tag=0B2106A707867040
Call-ID: 39449ee668700b0675356e95518d172c@192.168.2.81:5060
CSeq: 102 OPTIONS
Contact: <sip:9892EDC79FF9AFE681FD7C235B7D2@192.168.2.1>
WWW-Authenticate: Digest realm="fritz.box", nonce="CABC2CFE162CA8E8"
User-Agent: FRITZ!OS
Content-Length: 0

Last problem: when I answer to the incoming call and then hang up, call from caller side doesn’t and continues

How to solve it?

I found the solution by myself. I turned “FritzBS” to “asterisk” both is sip.conf and extensions.conf.

It this way, hangup works perfectly

register => asterisk:**************@192.168.2.1/**asterisk**

[**asterisk**]
type=friend
context=incoming_TIM_BS
allow=all
defaultuser=asterisk
fromuser=asterisk
fromdomain=192.168.2.1
secret=**************
host=192.168.2.1
insecure=invite
qualify=yes
[cellulari]

exten=> 1003,1,NoOp()
same => n,Dial(SIP/matejipad,60)
same => n,Hangup()
[incoming_TIM_BS]

exten  => **asterisk**,1,NoOp()
same  => n,GoTo(cellulari,1003,1)
same  => n,Playtones(congestion)
same  => n,hangup()

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