FreePBX push notify alternative solution

Hi,
I need to wake up Linhome when I receive a call from the video door phone and I can do it using Home Assistant App Companion notification.
I need FreePBX/asterisk to send a timestamp via mqtt to Home Assistant when one of the 2 video entry phones starts a call. I would like to use an AGI written in PHP but I don’t quite understand how to instruct FreePBX. Can you help me?

Especially if this is really triggered by origin, rather than destination, I think AMI may be a better approach. It would be much less intrusive to FreePBX, as you are basically passively monitoring.

The other approach would be a custom initial context for those extensions, but I think the GUI only supports those for trunks so you might have to override parts of pjsip.conf as well as adding custom dialplan. Maybe you could treat the doorphones as trunks - you probably don’t want to be able to make outgoing calls from them, anyway. (Turns out you can set the context for extensions as well, see below.)

I think @david55’s idea of locating the door phones in their own context might work. You can edit the advanced tab of the extension, and change the context from from-internal to from-internal-doorphone or something similar. Then in extensions_custom.conf a block of dialplan that looks like this

[from-internal-doorphone]
exten => _.,1,NoOp(Entering user defined context from-internal-doorphone in extensions_custom.conf)
; add'l lines as required
exten => _.,n,GoTo(from-internal,${EXTEN},1)

The above dialplan all by itself will work on it’s own, tho it doesn’t do anything. Watching the asterisk console when you dial outbound from an extension set to that context looks like this:

  == Using SIP RTP Audio TOS bits 184
  == Using SIP RTP Audio TOS bits 184 in TCLASS field.
  == Using SIP RTP Audio CoS mark 5
    -- Executing [*43@from-internal-doorphone:1] NoOp("PJSIP/7004-00000031", "Entering user defined context from-internal-doorphone in extensions_custom.conf") in new stack
    -- Executing [*43@from-internal-doorphone:2] Goto("PJSIP/7004-00000031", "from-internal,*43,1") in new stack
    -- Goto (from-internal,*43,1)
    -- Executing [*43@from-internal:1] Set("PJSIP/7004-00000031", "__COS_DEST=echotest") in new stack
    *snip*

Good idea, it works fine for me.

1 Like

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