Agi-mqtt with FREEPBX not just Asterisk?

I’m wanting to use the above with FreePBX - is that possible - using the GUI still but just inserting the agi-mqtt into /etc/asterisk/extensions_custom.conf ? Will it break every time I amend something in the GUI?

To be clear, I want to still manage everything about my Asterisk from the GUI, with the exception of passing incoming call info silently to MQTT. IF that’s possible?!

Instructions
Edit /etc/asterisk/extensions_custom.conf and add: [from-pstn-custom]
exten => _X.,1,AGI(/opt/agi-mqtt/mqtt,/opt/agi-mqtt/mqtt.cfg,calls/pstn-in)

thanks

I would send my inbound calls to something like :-

[from-pstn-mqtt]
exten => _X.,1,AGI(/opt/agi-mqtt/mqtt,/opt/agi-mqtt/mqtt.cfg,calls/pstn-in)
exten => _X.,n,Goto(from-pstn,${EXTEN},1)

(this defined in your /etc/asterisk/extensions_custom.conf )

2 Likes

out of curiosity that project is super old. Have you tested it?

Thanks, Dicko, and I can make those changes to extensions_custom and I can continue to manage the rest of my setup using the GUI and it won’t overwrite or wreck things?

Should be fine, make sure your script exits quickly.

Hmmm, so far, unless I’m doing something wrong (I’ve made the script executable) - I can see no evidence that Asterisk is even looking at my /etc/asterisk/extensions_custom.conf file. Do I need to do any kind of reboot after modifying the file? I clicked the big red rebuild button in the GUI but that doesn’t seem to have helped.
There’s nothing in the Asterisk log that suggests the file is even being parsed.
Sorry to be a pain…

ShOw a log of an inbound call.

Replaced with Paste!

https://wiki.freepbx.org/display/SUP/Providing+Great+Debug#ProvidingGreatDebug-AsteriskLogs-PartII

Thanks for that @PitzKey - & sorry @dicko - have replaced with a proper paste from the log. For interest, piping to pastebin didn’t work, but I installed pastebinit, and that worked.

Hmm… Which version of FreePBX and Asterisk are you running?

FreePBX 14.0.5.25
Asterisk 13.20.0 built by root @ raspbx on a armv6l running Linux on 2018-04-03 18:02:05 UTC

Your pasted calls are going to from-trunk, not the context you created

D’oh. I am a complete novice at all this. I’m sorry. I didn’t realise that [from-pstn-mqtt] should be replaced with my own context.

Woohoo! Progress!

So now I’ve got this:-

Executing [01639628847@from-trunk:1] AGI("SIP/1-pstn-00000016", "/opt/agi-mqtt/mqtt,/opt/agi-mqtt/mqtt.cfg,calls/pstn-in") in new stack
    -- Launched AGI Script /opt/agi-mqtt/mqtt
    -- <SIP/1-pstn-00000016>AGI Script /opt/agi-mqtt/mqtt completed, returning 0

however my broker is showing NO attempted connections from the script/pi. This is probably the limit of where this wonderful forum can help really. I’ve reached out to the developer but he’s not responded yet. I use no authentication on my MQTT broker and I’m not sure how to do that with this script. I’ve left the fields in the config file totally blank but that doesn’t seem to be doing the trick. Oh well, it was great to get this far and I’m sure with a bit more fiddling I’ll get all the way.

THANK YOU!!

Turn on agi logging at the asterik cli

-- Launched AGI Script /opt/agi-mqtt/mqtt
<SIP/1-pstn-00000018>AGI Tx >> agi_request: /opt/agi-mqtt/mqtt
<SIP/1-pstn-00000018>AGI Tx >> agi_channel: SIP/1-pstn-00000018
<SIP/1-pstn-00000018>AGI Tx >> agi_language: en
<SIP/1-pstn-00000018>AGI Tx >> agi_type: SIP
<SIP/1-pstn-00000018>AGI Tx >> agi_uniqueid: 1559921212.66
<SIP/1-pstn-00000018>AGI Tx >> agi_version: 13.20.0
<SIP/1-pstn-00000018>AGI Tx >> agi_callerid: 01639628331
<SIP/1-pstn-00000018>AGI Tx >> agi_calleridname: LANDLINE
<SIP/1-pstn-00000018>AGI Tx >> agi_callingpres: 0
<SIP/1-pstn-00000018>AGI Tx >> agi_callingani2: 0
<SIP/1-pstn-00000018>AGI Tx >> agi_callington: 0
<SIP/1-pstn-00000018>AGI Tx >> agi_callingtns: 0
<SIP/1-pstn-00000018>AGI Tx >> agi_dnid: 01639628847
<SIP/1-pstn-00000018>AGI Tx >> agi_rdnis: unknown
<SIP/1-pstn-00000018>AGI Tx >> agi_context: from-trunk
<SIP/1-pstn-00000018>AGI Tx >> agi_extension: 01639628847
<SIP/1-pstn-00000018>AGI Tx >> agi_priority: 1
<SIP/1-pstn-00000018>AGI Tx >> agi_enhanced: 0.0
<SIP/1-pstn-00000018>AGI Tx >> agi_accountcode:
<SIP/1-pstn-00000018>AGI Tx >> agi_threadid: 1924797472
<SIP/1-pstn-00000018>AGI Tx >> agi_arg_1: /opt/agi-mqtt/mqtt.cfg
<SIP/1-pstn-00000018>AGI Tx >> agi_arg_2: calls/pstn-in
<SIP/1-pstn-00000018>AGI Tx >>
-- <SIP/1-pstn-00000018>AGI Script /opt/agi-mqtt/mqtt completed, returning 0

The only other thing I can think of is that I am running node-red on the same Pi - and listening out for MQTT commands on that - perhaps they might not be able to be run concurrently?

Presumably

/opt/agi-mqtt/mqtt.cfg

Will reflect your brokers identity.

It does, yes.