Context for scripts (incoming calls)

@lgaetz thank you and I hope so… :slight_smile:

Are you looking for the CallerID number of the caller? If so you can use ${CALLERID(number)}

Thanks a lot! That was exactly what I am looking for!
Just have to find out where to get more info about that “special vars”…

Everything here would probably make an excellent Superfecta module, send-to-MQTT. It would have to be written in PHP, but then you could just input your host, port, user, pass and have the API call made from Superfecta on inbound calls instead of fussing with custom dialplan.

Well, yes. but the last time I dealt with PHP was 20 years ago…
Actually I am into bash, python and perl…
And I want even more. I want to get every movement (hook on/off, dialing and so on) of every extension signalled using mqtt…

For your next adventure: Fun with AMI (node-red)

hm. could possibly be. but AMI is a polling thing, isnt it?
actually with mqtt I am on a rather pushing setup.
my goal is to have my home automation (fhem) know the states of the telephony.
maybe in the future I also will have to push things to asterisk (eg: nobody at home --> forward calls to cell phones or something)…

when you have both python2 and python3 available you need to expressly call pip2 or pip3 to avoid confusiob

thank you!
yes, I did…

install mosquitto-utils and let them to the grunt work, both pub and sub, then its just a system call

thank you! I know, this is not the problem. I know mosquitto_pub, but for several reasons I did not want just a mosquitto_pub call here…
The python script is working fine - so is everything else right now. Until I start the next change with asterisk :wink:

No, AMI and the better written ARI does not ‘poll’ . write it properly (in PHP, Ruby, Go, bash whatever) and you can follow every event on an opened tcp/5038 connection , then publish mqtt pubs as appropriate, conversely instigate asterisk ‘actions’ as a result of mqtt subs , forwarding, redirecting, transferring,DND, call files whatever all best done outside a limited php wrapper library, integrate with homeassistant,fhem whatever and ‘Bob’s your uncle’

Maybe a ‘next step’


Wow, wow, wow!
I think I have to take a closer look at that stuff
Thanks for the hint!

Hm. Just played around a little bit with ARI and AMI.
As far as I have seen, ARI needs modifications of dialplanes and/or extensions (what is still a little bit dangerous for me)
But I have run a demo-script for event-listening with python. And man, this gives TONS of output. I think, this could be a source of lots of fun ^^


It is fun. Please share your progress in a new thread when you get there.

I will. But it will take some time. Have plenty of other stuff to do (like we all have)

1 Like

We have a contribution out of the blue on Github from Udo Hartmann that adds MQTT support to Superfecta. I am unable to test, so if anyone has MQTT running and is willing to give it a spin, the pull request is here:

To give it a spin, you’ll need to install mosquitto, which on the Distro should just be yum install mosquitto. Then you need to download the Superfecta module:

cd /var/www/html/admin/modules/superfecta/sources
chown asterisk:asterisk source-Send_to_MQTT.module

Then browse to Superfecta, configure and test.

1 Like

looks promising - but I do not know Superfecta yet. Isnt this only for incoming calls?

Kind of. It’s a destination in the selector, so you can use it lots of places, but the one that makes the most sense is on an Incoming Call.

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