SIP client card, as intercom

Regarding the sub domain

Can you please let me know what is this IP address? Thank you

Dear all,

I also try to implement the SIP client card into my HomeAssistant card, to communicate with my Auerswald TFS-201 Doorphone, which is connected to my FritzBox. The Doorphone itself works very good with the FritzBox and I can pick-up calls via the connected phones. Now I would like to see on my tablet, when someones rings at the door.

What I did until now:

  1. Set-up Duck-DNS → works on port 8123
  2. Set-up my FritzBox for Duck-DNS → done
  3. Set-up Asterisk according the instruction → asterisk is running
ami_password: PASSWORD
auto_add: true
auto_add_secret: PASSWORD
video_support: false
generate_ssl_cert: false
certfile: fullchain.pem
keyfile: privkey.pem
additional_sounds: []
mailbox: false
mailbox_port: 12345
mailbox_password: ""
mailbox_extension: "100"
mailbox_google_api_key: ""
log_level: info
  1. Set-up the sip-card → Showing up without any failure
type: custom:sipjs-card
server: https://192.168.1.86
port: '8089'
button_size: '48'
state_color: true
auto_answer: false
hide_me: false
custom_title: Test
video: true
custom:
  - name: Doorbell
    number: '100'
    secret: PASSWORD
    icon: mdi:phone-classic
    edit: true
dtmfs:
  - name: dtmf1
    signal: 1
    icon: mdi:door
iceTimeout: 5
prefix: ''
ringtone: /local/asterisk/ringtone.mp3
ringbacktone: /local/asterisk/backtone.mp3
extensions:
  - person: person.MYUSERNAME
    name: USER
    extension: '100'
    secret: PASSWORD
    icon: mdi:monitor
    entity: binary_sensor.sensor1
    camera: ''

I´m now wondering, how I get the connection to my FritzBox, so that the FritzBox calls Asterisk and the card reacts?
Would be really great, if someone could give me a hint, how to do it!

Thank you in advance

I don’t know, frizbox, but if you have connected phones to it, it’s also a PBX? Why not drop frizbox and use asterisk instead? And connect phones to asterisk?

Or if you want to keep it, setup a outbound trunk from asterisk to Fritz, then just define in your Dialplan, if you receive an incoming call on trunk to dial the card…

Also, drop the http:// in your server section on the card config, it’s not needed

I think that what they are talking about is this:

Hi pergola.fabio,

thanks for the answer.
As danbutter wrote, Fritz!Box is the standard internet router in germany with a lot of functions and it is very stable, so I wouldn´t like to disconnect my phones from it.
I would like to set up te outbound trunk as you propose. I had a look into the pjsip_wizard.conf and copied the “Example wizard configuration” for an itsp trunk into “custom/pjsip_custom.conf”.
What do I have to change to make it work? What did I miss?
This is what I did:

[fritzbox]
type = wizard
sends_auth = yes
sends_registrations = yes
transport = ipv4
remote_hosts = 192.168.1.1
outbound_auth/username = USER
outbound_auth/password = PASSWORD
endpoint/allow = ulaw
endpoint/context = default

Look here for an example I use on my hikvsion indoor station , that I use as trunk

Hi,

thanks for the instruction. It still doesn´t work, but at least I can see some logs in asterisk log which make me think, that we are on the right track.
I put following code into /config/asterisk/custom/pjsip_custom.conf,
but what do I have to put for “mydomain.com” and “YOURDOMAIN.COM”?

#### Setup this in pjsip_custom.conf:

[mytrunk-auth]
type=auth
auth_type=userpass
password=PASSWORD
username=USER
 
[mytrunk-aor]
type=aor
contact=sip:192.168.1.1

[mytrunk-registration]
type=registration
outbound_auth=mytrunk-auth
server_uri=sip:192.168.1.1
client_uri=sip:[email protected]
retry_interval=10
contact_user=USER
expiration=600
 
[mytrunk]
type=endpoint
context=default
disallow=all
allow=ulaw,alaw
allow=h264,vp8
outbound_auth=mytrunk-auth
aors=mytrunk-aor
rewrite_contact=yes
from_domain=mydomain.com
 
[mytrunk]
type=identify
endpoint=mytrunk
match=192.168.1.1

[outgoing]
type=endpoint
disallow=all
allow=ulaw,alaw
allow=h264
from_domain=YOURDOMAIN.com

The next problem is, that I try to adjust the extensions.conf in the [default] section but every time i restart asterisk the file is beeing restored to the original file.
This is the original file:

; Note: this file has been modified from the Asterisk defaults for the add-on

[general]
static=yes

[default]
include => parkedcalls
;
exten => 444,1,Park(,s)
;
exten => 555,1,ParkedCall(default,701)
;
exten => _X!,1,Dial(${PJSIP_DIAL_CONTACTS(${EXTEN})})
;
;extension for dialing chan_sip devices.
;exten => _X!,1,Dial(SIP/${EXTEN})

[parkedcallstimeout]
exten => s,1,Hangup()

exten => USER,1,NoOp() 
 same => n,Progress()
 same => n,Set(CALLERID(num)=Doorbell)
 same => n,Set(CALLERID(name)=Doorbell) 
 same => n,Set(DIALGROUP(mygroup,add)=PJSIP/outgoing/sip:[email protected])  
 same => n,Dial(${DIALGROUP(mygroup)},40)
 same => n,Hangup()

What I at least see is, that when I try to call the internal number from “homeassistant” the log from Asterisk reacts and shows following:

[Oct 16 14:02:37] DEBUG[693]: threadpool.c:536 grow: Increasing threadpool pjsip/pool's size by 5
[Oct 16 14:02:37] DEBUG[753]: res_pjsip_outbound_registration.c:852 handle_client_registration: Outbound REGISTER attempt 1 to 'sip:192.168.1.1' with client 'sip:[email protected]'
[Oct 16 14:02:37] DEBUG[753]: res_pjsip/pjsip_resolver.c:475 sip_resolve: Performing SIP DNS resolution of target '192.168.1.1'
[Oct 16 14:02:37] DEBUG[753]: res_pjsip/pjsip_resolver.c:502 sip_resolve: Transport type for target '192.168.1.1' is 'UDP transport'
[Oct 16 14:02:37] DEBUG[753]: res_pjsip/pjsip_resolver.c:523 sip_resolve: Target '192.168.1.1' is an IP address, skipping resolution
[Oct 16 14:02:37] DEBUG[695]: res_pjsip/pjsip_distributor.c:519 distributor: No dialog serializer for Response msg 401/REGISTER/cseq=40226 (rdata0x7f10001148).  Using request transaction as basis.
[Oct 16 14:02:37] DEBUG[695]: res_pjsip/pjsip_distributor.c:127 find_request_serializer: Found transaction tsx0x7f04032c58 for Response msg 401/REGISTER/cseq=40226 (rdata0x7f10001148).
[Oct 16 14:02:37] DEBUG[695]: res_pjsip/pjsip_distributor.c:137 find_request_serializer: Found serializer pjsip/outreg/mytrunk-registration-0000005b on transaction tsx0x7f04032c58
[Oct 16 14:02:37] DEBUG[753]: res_pjsip_outbound_registration.c:1446 sip_outbound_registration_response_cb: Received REGISTER response 401(Unauthorized)
[Oct 16 14:02:37] DEBUG[753]: res_pjsip_outbound_registration.c:1239 handle_registration_response: Processing REGISTER response 401 from server 'sip:192.168.1.1' for client 'sip:[email protected]'
[Oct 16 14:02:37] DEBUG[753]: res_pjsip_outbound_authenticator_digest.c:227 set_outbound_authentication_credentials: Searching auths to find matching ones for header with realm 'fritz.box' and algorithm ''
[Oct 16 14:02:37] DEBUG[753]: res_pjsip_outbound_authenticator_digest.c:271 set_outbound_authentication_credentials: Found wildcard auth 'mytrunk-auth' for realm 'fritz.box'
[Oct 16 14:02:37] DEBUG[753]: res_pjsip_outbound_authenticator_digest.c:301 set_outbound_authentication_credentials: Using wildcard auth 'mytrunk-auth' for realm 'fritz.box'
[Oct 16 14:02:37] DEBUG[753]: res_pjsip_outbound_authenticator_digest.c:387 set_outbound_authentication_credentials: Set 1 credentials in auth session
[Oct 16 14:02:37] DEBUG[753]: res_pjsip_outbound_registration.c:1302 handle_registration_response: Sending authenticated REGISTER to server 'sip:192.168.1.1' from client 'sip:[email protected]'
[Oct 16 14:02:37] DEBUG[695]: res_pjsip/pjsip_distributor.c:519 distributor: No dialog serializer for Response msg 200/REGISTER/cseq=40227 (rdata0x7f10001148).  Using request transaction as basis.
[Oct 16 14:02:37] DEBUG[695]: res_pjsip/pjsip_distributor.c:127 find_request_serializer: Found transaction tsx0x7f0400df08 for Response msg 200/REGISTER/cseq=40227 (rdata0x7f10001148).
[Oct 16 14:02:37] DEBUG[695]: res_pjsip/pjsip_distributor.c:137 find_request_serializer: Found serializer pjsip/outreg/mytrunk-registration-0000005b on transaction tsx0x7f0400df08
[Oct 16 14:02:37] DEBUG[753]: res_pjsip_outbound_registration.c:1446 sip_outbound_registration_response_cb: Received REGISTER response 200(OK)
[Oct 16 14:02:37] DEBUG[753]: res_pjsip_outbound_registration.c:1239 handle_registration_response: Processing REGISTER response 200 from server 'sip:192.168.1.1' for client 'sip:[email protected]'
[Oct 16 14:02:37] DEBUG[753]: res_pjsip_outbound_registration.c:1332 handle_registration_response: Outbound registration to 'sip:192.168.1.1' with client 'sip:[email protected]' successful
[Oct 16 14:02:37] DEBUG[753]: res_pjsip_outbound_registration.c:895 schedule_registration: Scheduling outbound registration to server 'sip:192.168.1.1' from client 'sip:[email protected]' in 290 seconds
[Oct 16 14:02:52] DEBUG[707]: res_pjsip_registrar.c:1384 check_expiration_thread: Expiring 0 contacts
[Oct 16 14:03:07] DEBUG[695]: res_pjsip/pjsip_distributor.c:393 find_dialog: Could not find matching transaction for Request msg INVITE/cseq=11 (rdata0x7f10001148)
[Oct 16 14:03:07] DEBUG[695]: res_pjsip/pjsip_distributor.c:471 ast_sip_get_distributor_serializer: Calculated serializer pjsip/distributor-00000038 to use for Request msg INVITE/cseq=11 (rdata0x7f10001148)
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_endpoint_identifier_ip.c:253 ip_identify_match_check: Source address 192.168.1.1:5060 matches identify 'mytrunk'
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_endpoint_identifier_ip.c:287 common_identify: Identify 'mytrunk' SIP message matched to endpoint mytrunk
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4295 session_on_rx_request:  (null session) Request: INVITE 
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4122 handle_new_invite_request:  Request: 
[Oct 16 14:03:07] DEBUG[753]: res_pjsip/pjsip_distributor.c:471 ast_sip_get_distributor_serializer: Calculated serializer pjsip/distributor-00000038 to use for Request msg INVITE/cseq=11 (rdata0x7f10025868)
[Oct 16 14:03:07] DEBUG[753]: chan_pjsip.c:2904 chan_pjsip_session_begin:  mytrunk
[Oct 16 14:03:07] DEBUG[753]: chan_pjsip.c:2908 chan_pjsip_session_begin:  Direct media no glare mitigation
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:3976 new_invite:  mytrunk
[Oct 16 14:03:07] NOTICE[753]: res_pjsip_session.c:4022 new_invite:  mytrunk: Call (UDP:192.168.1.1:5060) to extension 'homeassistant' rejected because extension not found in context 'default'.
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4022 new_invite:   mytrunk: Call (UDP:192.168.1.1:5060) to extension 'homeassistant' rejected because extension not found in context 'default'.
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4586 handle_outgoing_response:  mytrunk: Method is INVITE, Response is 404 Not Found
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4605 handle_outgoing_response:  mytrunk
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4702 session_inv_on_state_changed:  mytrunk Event: TSX_STATE  Inv State: DISCONNCTD
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4728 session_inv_on_state_changed: mytrunk: Source of transaction state change is TX_MSG
[Oct 16 14:03:07] DEBUG[695]: res_pjsip/pjsip_distributor.c:502 distributor: Searching for serializer associated with dialog dlg0x7f0400df08 for Request msg ACK/cseq=11 (rdata0x7f10001148)
[Oct 16 14:03:07] DEBUG[695]: res_pjsip/pjsip_distributor.c:510 distributor: Found serializer pjsip/distributor-00000038 associated with dialog dlg0x7f0400df08
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4776 session_inv_on_state_changed:  
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4820 session_inv_on_tsx_state_changed:  mytrunk TSX State: Completed  Inv State: DISCONNCTD
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4842 session_inv_on_tsx_state_changed:  Disconnected
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4240 session_on_tsx_state:  (null session) TSX State: Completed  Inv State: DISCONNCTD
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4249 session_on_tsx_state:  
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4105 new_invite:  mytrunk
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4196 handle_new_invite_request:  Request:  Session: mytrunk
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4314 session_on_rx_request:  (null session) Handled request INVITE  ? yes
[Oct 16 14:03:07] DEBUG[753]: chan_pjsip.c:2925 chan_pjsip_session_end:  mytrunk
[Oct 16 14:03:07] DEBUG[753]: chan_pjsip.c:2928 chan_pjsip_session_end:  No channel
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4820 session_inv_on_tsx_state_changed:  (null session) TSX State: Confirmed  Inv State: DISCONNCTD
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4832 session_inv_on_tsx_state_changed:  Session ended
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4240 session_on_tsx_state:  (null session) TSX State: Confirmed  Inv State: DISCONNCTD
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:4249 session_on_tsx_state:  
[Oct 16 14:03:07] DEBUG[753]: res_pjsip_session.c:2912 session_destructor: mytrunk: Destroying SIP session

Do you have a Idea how to solve that?

The domain can be anything you want, for ex asterisk.com …

you need to place the extensions.conf in the custom folder too… every file thats in the custom folder doesnt get overwrited… because in your log, the extension is indeed not found

No I have this two configurations in the custom folder.

extensions.conf

exten => homeassistant,1,NoOp() 
 same => n,Progress()
 same => n,Set(CALLERID(num)=Doorbell)
 same => n,Set(CALLERID(name)=Doorbell) 
 same => n,Set(DIALGROUP(mygroup,add)=PJSIP/outgoing/sip:[email protected])  
 same => n,Dial(${DIALGROUP(mygroup)},40)
 same => n,Hangup()

pjsip_custom.conf

#### Setup this in pjsip_custom.conf:

[mytrunk-auth]
type=auth
auth_type=userpass
password=PASSWORD
username=homeassistant
 
[mytrunk-aor]
type=aor
contact=sip:192.168.1.1:5060

[mytrunk-registration]
type=registration
outbound_auth=mytrunk-auth
server_uri=sip:[email protected]:5060
client_uri=sip:[email protected]:5060
retry_interval=10
contact_user=homeassistant
expiration=600
 
[mytrunk]
type=endpoint
context=default
disallow=all
allow=ulaw,alaw
allow=h264,vp8
outbound_auth=mytrunk-auth
aors=mytrunk-aor
rewrite_contact=yes
from_domain=192.168.1.1
 
[mytrunk]
type=identify
endpoint=mytrunk
match=192.168.1.1

[outgoing]
type=endpoint
disallow=all
allow=ulaw,alaw
allow=h264
from_domain=192.168.1.1

It looks like Asterisk now recognizes when I call “homeassistant” from my softphone, which is registered at the fritzbox with another user. But I get now following message in the log and the call is directly canceled:

[Oct 16 22:15:19] DEBUG[697]: res_pjsip/pjsip_distributor.c:393 find_dialog: Could not find matching transaction for Request msg INVITE/cseq=32 (rdata0x7f38000e58)
[Oct 16 22:15:19] DEBUG[697]: res_pjsip/pjsip_distributor.c:471 ast_sip_get_distributor_serializer: Calculated serializer pjsip/distributor-0000002e to use for Request msg INVITE/cseq=32 (rdata0x7f38000e58)
[Oct 16 22:15:19] DEBUG[695]: threadpool.c:536 grow: Increasing threadpool pjsip/pool's size by 5
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_endpoint_identifier_ip.c:253 ip_identify_match_check: Source address 192.168.1.1:5060 matches identify 'mytrunk'
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_endpoint_identifier_ip.c:287 common_identify: Identify 'mytrunk' SIP message matched to endpoint mytrunk
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4295 session_on_rx_request:  (null session) Request: INVITE 
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4122 handle_new_invite_request:  Request: 
[Oct 16 22:15:19] DEBUG[746]: res_pjsip/pjsip_distributor.c:471 ast_sip_get_distributor_serializer: Calculated serializer pjsip/distributor-0000002e to use for Request msg INVITE/cseq=32 (rdata0x7f38015b28)
[Oct 16 22:15:19] DEBUG[746]: chan_pjsip.c:2904 chan_pjsip_session_begin:  mytrunk
[Oct 16 22:15:19] DEBUG[746]: chan_pjsip.c:2908 chan_pjsip_session_begin:  Direct media no glare mitigation
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:3976 new_invite:  mytrunk
[Oct 16 22:15:19] NOTICE[746]: res_pjsip_session.c:4022 new_invite:  mytrunk: Call (UDP:192.168.1.1:5060) to extension 'homeassistant' rejected because extension not found in context 'default'.
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4022 new_invite:   mytrunk: Call (UDP:192.168.1.1:5060) to extension 'homeassistant' rejected because extension not found in context 'default'.
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4586 handle_outgoing_response:  mytrunk: Method is INVITE, Response is 404 Not Found
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4605 handle_outgoing_response:  mytrunk
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4702 session_inv_on_state_changed:  mytrunk Event: TSX_STATE  Inv State: DISCONNCTD
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4728 session_inv_on_state_changed: mytrunk: Source of transaction state change is TX_MSG
[Oct 16 22:15:19] DEBUG[697]: res_pjsip/pjsip_distributor.c:502 distributor: Searching for serializer associated with dialog dlg0x7efc027198 for Request msg ACK/cseq=32 (rdata0x7f38000e58)
[Oct 16 22:15:19] DEBUG[697]: res_pjsip/pjsip_distributor.c:510 distributor: Found serializer pjsip/distributor-0000002e associated with dialog dlg0x7efc027198
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4776 session_inv_on_state_changed:  
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4820 session_inv_on_tsx_state_changed:  mytrunk TSX State: Completed  Inv State: DISCONNCTD
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4842 session_inv_on_tsx_state_changed:  Disconnected
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4240 session_on_tsx_state:  (null session) TSX State: Completed  Inv State: DISCONNCTD
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4249 session_on_tsx_state:  
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4105 new_invite:  mytrunk
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4196 handle_new_invite_request:  Request:  Session: mytrunk
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4314 session_on_rx_request:  (null session) Handled request INVITE  ? yes
[Oct 16 22:15:19] DEBUG[746]: chan_pjsip.c:2925 chan_pjsip_session_end:  mytrunk
[Oct 16 22:15:19] DEBUG[746]: chan_pjsip.c:2928 chan_pjsip_session_end:  No channel
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4820 session_inv_on_tsx_state_changed:  (null session) TSX State: Confirmed  Inv State: DISCONNCTD
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4832 session_inv_on_tsx_state_changed:  Session ended
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4240 session_on_tsx_state:  (null session) TSX State: Confirmed  Inv State: DISCONNCTD
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:4249 session_on_tsx_state:  
[Oct 16 22:15:19] DEBUG[746]: res_pjsip_session.c:2912 session_destructor: mytrunk: Destroying SIP session

Do you have a Idea what to do?

No, never seen that error before, you can try create a thread on asterisk forums

Also drop the outgoing, you don’t need it if you dial internally

Also change the from domain, don’t use numbers/IP address there, use a DNS name , like home assistant.local

And who is vfoneklingel? Is that also an registered extension on asterisk?? Is that the person you want to call ?

I droped the outgoing and changed the IP adress to homeassistant.local for “from_domain” and “match”.
Yes, Vfoneklingel is a SIP phone registered at my fritzbox not at asterisk. I thought, that when Asterisk is connected to fritzbox it should work. Finally my lovelace “SIP client card” should ring. How should I change the extensions.conf to achieve this?

When I call asterisk I get now the message below. I can see the name of my android phone with the extension **622 which is set up in the fritzbox.

[Oct 17 21:36:10] DEBUG[697]: res_pjsip/pjsip_distributor.c:393 find_dialog: Could not find matching transaction for Request msg INVITE/cseq=41 (rdata0x7f0c001148)
[Oct 17 21:36:10] DEBUG[697]: res_pjsip/pjsip_distributor.c:471 ast_sip_get_distributor_serializer: Calculated serializer pjsip/distributor-00000030 to use for Request msg INVITE/cseq=41 (rdata0x7f0c001148)
[Oct 17 21:36:10] DEBUG[695]: threadpool.c:536 grow: Increasing threadpool pjsip/pool's size by 5
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_endpoint_identifier_ip.c:258 ip_identify_match_check: Source address 192.168.1.1:5060 does not match identify 'mytrunk'
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_endpoint_identifier_user.c:148 username_identify: Attempting identify by From username '**622' domain 'fritz.box'
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_endpoint_identifier_user.c:152 username_identify: Endpoint not found for From username '**622' domain 'fritz.box'
[Oct 17 21:36:10] NOTICE[751]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'INVITE' from '"FRITZ!App Fon (Xiaomi Mi A2 Lite" <sip:**[email protected]>' failed for '192.168.1.1:5060' (callid: [email protected]) - No matching endpoint found
[Oct 17 21:36:10] SECURITY[741]: res_security_log.c:114 security_event_stasis_cb: SecurityEvent="InvalidAccountID",EventTV="2023-10-17T21:36:10.774+0200",Severity="Error",Service="PJSIP",EventVersion="1",AccountID="**622",SessionID="[email protected]",LocalAddress="IPV4/UDP/192.168.1.86/5060",RemoteAddress="IPV4/UDP/192.168.1.1/5060"
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_authenticator_digest.c:358 verify: Realm: asterisk  Username:   Result: NOAUTH
[Oct 17 21:36:10] SECURITY[741]: res_security_log.c:114 security_event_stasis_cb: SecurityEvent="ChallengeSent",EventTV="2023-10-17T21:36:10.884+0200",Severity="Informational",Service="PJSIP",EventVersion="1",AccountID="<unknown>",SessionID="[email protected]",LocalAddress="IPV4/UDP/192.168.1.86/5060",RemoteAddress="IPV4/UDP/192.168.1.1/5060",Challenge=""
[Oct 17 21:36:10] DEBUG[697]: res_pjsip/pjsip_distributor.c:393 find_dialog: Could not find matching transaction for Request msg ACK/cseq=41 (rdata0x7f0c001148)
[Oct 17 21:36:10] DEBUG[697]: res_pjsip/pjsip_distributor.c:471 ast_sip_get_distributor_serializer: Calculated serializer pjsip/distributor-00000030 to use for Request msg ACK/cseq=41 (rdata0x7f0c001148)
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_endpoint_identifier_ip.c:258 ip_identify_match_check: Source address 192.168.1.1:5060 does not match identify 'mytrunk'
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_endpoint_identifier_user.c:148 username_identify: Attempting identify by From username '**622' domain 'fritz.box'
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_endpoint_identifier_user.c:152 username_identify: Endpoint not found for From username '**622' domain 'fritz.box'
[Oct 17 21:36:10] DEBUG[697]: res_pjsip/pjsip_distributor.c:393 find_dialog: Could not find matching transaction for Request msg INVITE/cseq=42 (rdata0x7f0c001148)
[Oct 17 21:36:10] DEBUG[697]: res_pjsip/pjsip_distributor.c:471 ast_sip_get_distributor_serializer: Calculated serializer pjsip/distributor-00000030 to use for Request msg INVITE/cseq=42 (rdata0x7f0c001148)
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_endpoint_identifier_ip.c:258 ip_identify_match_check: Source address 192.168.1.1:5060 does not match identify 'mytrunk'
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_endpoint_identifier_user.c:148 username_identify: Attempting identify by From username '**622' domain 'fritz.box'
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_endpoint_identifier_user.c:152 username_identify: Endpoint not found for From username '**622' domain 'fritz.box'
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_endpoint_identifier_user.c:173 auth_username_identify: Attempting identify by Authorization username 'homeassistant' realm 'asterisk'
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_endpoint_identifier_user.c:178 auth_username_identify: Endpoint not found for Authentication username 'homeassistant' realm 'asterisk'
[Oct 17 21:36:10] NOTICE[751]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'INVITE' from '"FRITZ!App Fon (Xiaomi Mi A2 Lite" <sip:**[email protected]>' failed for '192.168.1.1:5060' (callid: [email protected]) - No matching endpoint found
[Oct 17 21:36:10] SECURITY[741]: res_security_log.c:114 security_event_stasis_cb: SecurityEvent="InvalidAccountID",EventTV="2023-10-17T21:36:10.892+0200",Severity="Error",Service="PJSIP",EventVersion="1",AccountID="**622",SessionID="[email protected]",LocalAddress="IPV4/UDP/192.168.1.86/5060",RemoteAddress="IPV4/UDP/192.168.1.1/5060"
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_authenticator_digest.c:261 check_nonce: Calculated nonce 1697571370/f798ee845d4da67b23a51d8df71b82e9. Actual nonce is 1697571370/f798ee845d4da67b23a51d8df71b82e9
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_authenticator_digest.c:358 verify: Realm: asterisk  Username:   Result: FAIL
[Oct 17 21:36:10] NOTICE[751]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'INVITE' from '"FRITZ!App Fon (Xiaomi Mi A2 Lite" <sip:**[email protected]>' failed for '192.168.1.1:5060' (callid: [email protected]) - Failed to authenticate
[Oct 17 21:36:10] SECURITY[741]: res_security_log.c:114 security_event_stasis_cb: SecurityEvent="ChallengeResponseFailed",EventTV="2023-10-17T21:36:10.893+0200",Severity="Error",Service="PJSIP",EventVersion="1",AccountID="<unknown>",SessionID="[email protected]",LocalAddress="IPV4/UDP/192.168.1.86/5060",RemoteAddress="IPV4/UDP/192.168.1.1/5060",Challenge="1697571370/f798ee845d4da67b23a51d8df71b82e9",Response="a02ea581fe8c63ed039c44c9218b2972",ExpectedResponse=""
[Oct 17 21:36:10] DEBUG[697]: res_pjsip/pjsip_distributor.c:393 find_dialog: Could not find matching transaction for Request msg ACK/cseq=42 (rdata0x7f0c001148)
[Oct 17 21:36:10] DEBUG[697]: res_pjsip/pjsip_distributor.c:471 ast_sip_get_distributor_serializer: Calculated serializer pjsip/distributor-00000030 to use for Request msg ACK/cseq=42 (rdata0x7f0c001148)
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_endpoint_identifier_ip.c:258 ip_identify_match_check: Source address 192.168.1.1:5060 does not match identify 'mytrunk'
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_endpoint_identifier_user.c:148 username_identify: Attempting identify by From username '**622' domain 'fritz.box'
[Oct 17 21:36:10] DEBUG[751]: res_pjsip_endpoint_identifier_user.c:152 username_identify: Endpoint not found for From username '**622' domain 'fritz.box'

well, you already have an outbound trunk called “homeassistant” in asterisk
Within fritzbox, when your doorphone is making a call, also call “homeassistant” , add that in your group the same way you call other phones… then you should the see call coming in, into HA

If you have a lovelace card configured in Asterisk for HA, probably with user 100, then just forward the call from the trunk to extension 100 like this:

exten => homeassistant,1,NoOp() 
 same => n,Progress()
 same => n,Set(CALLERID(num)=Doorbell)
 same => n,Set(CALLERID(name)=Doorbell) 
 same => n,Set(DIALGROUP(mygroup,add)=PJSIP/100)  
 same => n,Dial(${DIALGROUP(mygroup)},40)
 same => n,Hangup()

You were calling vfoneklingel from asterisk, but that doesn’t work, you cannot just call other users on other pbx , it only works on unauthenticated pbx servers

Hello.

I don’t know if I checked the whole thread, but I have trouble to activate early video, and as far as I can see, you seem to be able to use it with freepbx ?
Can you please tell me if you have to activate some configuration parameter or else ?

Sorry if I’m slightly off topic, but I cannot send private message for now (trust level on discourse ?).

Thanks,

No, early media doesn’t work in indoor devices, I never got that to work … I made a workaround as described on my GitHub, using the rtsp app, but its only for softphone clients, not indoor station, I register a trunk on indoor panel to forward the call, so early media is still possible on indoor panels

I decided to wrote steps how to setup everything using own domain. My HA is installed on Debian host. I’m not sure what will be the same/different when HA has been installed in Docker.

  1. Setup https connection is essential here. Please start with that at first because card will not work without secure connection. On the other hand please remember that asterisk server will work – this is for someone who is searching a quick way to create own SIP server. Returning to secure connection, you can setup DuckDns (Access Your Home Assistant Server Remotely With DuckDNS and Let’s Encrypt (makeuseof.com)) or if your router is supporting LetsEncrypt option on DDNS card (like Asus routers are offering), you can use this and export two certificates to your HA machine and store them in SSL folder (/usr/share/hassio/ssl). REMEMBER that the same certificates must be used in Asterisk configuration page (see point 2) and in HA configuration.yaml
  2. Install Asterisk according to Add-on | SIP-HASS (tech7fox.github.io). Sample configuration below (names of your cert files may be different). Please remember that it is pointing to your /SSL folder in HA.
ami_password: !YOUR_SECURE_PASS!
auto_add: true
auto_add_secret: !YOUR_SECURE_PASS!
video_support: false
generate_ssl_cert: false
certfile: cert.pem
keyfile: key.pem
additional_sounds: []
mailbox: false
mailbox_port: 12345
mailbox_password: ""
mailbox_extension: "100"
mailbox_google_api_key: ""
log_level: info

Please note: generate_ssl_cert has been set to false. It is because I’m using certificate created by router. It can be also certificate generated by DuckDNS but this must be the same certificate as you will use in configuration.yaml as below:


# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

http:
  ssl_certificate: /ssl/cert.pem
  ssl_key: /ssl/key.pem

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

  1. Now you can install SIP cards as mentioned here: https://tech7fox.github.io/sip-hass-docs/docs/tutorial/card
    Correct config for own domain is:
type: custom:sipjs-card
server: yourdomain.duckdns.org
port: '8089'
video: false
auto_answer: false
hide_me: false
state_color: true
custom_title: ''
ringtone: /local/asterisk/ringtone.mp3
ringbacktone: /local/asterisk/backtone.mp3
button_size: 42
prefix: ''
extensions:
  - person: person.lukasz
    name: Lukasz
    extension: '100'
    secret: !YOUR_SECURE_PASS!
    icon: mdi:monitor
    camera: ''
custom:
  - name: Doorbell
    number: '8000'
    icon: mdi:doorbell
    camera: ''
dtmfs: []
buttons: []
  1. As you see in the example there is one custom extension which needs to be added in (debian path:)

/usr/share/hassio/homeassistant/asterisk/custom/pjsip_custom.conf

Here is an example of this config:

[8000]
type = endpoint
context = default
disallow = all
allow = alaw,ulaw          ; Audio codecs
allow=h264                 ; Video codecs
direct_media_method=invite
dtmf_mode=info
callerid="Doorbell" <8000>
force_rport=no
aors= 8000
auth = auth8000

[8000]
type = aor
max_contacts = 1

[auth8000]
type=auth
auth_type=userpass
password=!YOUR_SECURE_PASS!        ; Set your password here
username=8000

  1. When everything is ready then you need to open your ports in router:

    Now everything should work and card should register in Asterisk server. Please check logs in dev console in your browser. Additionally for softphones port 5060 must be forwarded to your local machine. Linphone and MicroSIP are working with that config.
2 Likes

It has been a while because I got distracted by personal matters, however, I would like to pick-up where I had left.

In the light of your reply, and lukiz great and detailed description:
is it possible, or has anyone done so, to run the asterisk add-on as a docker standalone container with HA core?

yes, you can also run the asterisk addon as stanalone container, its avaible on github

Exactly, as Fabio mentioned doesn’t matter where SIP server will be located. Doesn’t matter if this will be Asterisk or FusionPBX or something else. If you prefer to have it as Docker container then please use one of existing images (I found one of them dedicated to Docker). Based on my experience with FusionPBX I suggest to find something light and the most easy to run. Most of the configuration which I mentioned above will be similar.
I worked a bit with Docker, tried to establish all those things but then I decided to use my old laptop as main HA platform. I installed there Debian and runned HA. On the other hand for testing I’m using VirtualBox on my main computer where I have installed Debian and HA for playing with new stuff. I have always backup of VM and when I broke something then I simply restoring full image. If something work well in VM then I’m installing it on the main HA machine (on my old laptop). It works really well and I don’t have limitation of docker.