Context for scripts (incoming calls)


(O T To001) #36

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


(Lorne Gaetz) #37

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


(O T To001) #38

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”…


(Lorne Gaetz) #39

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.


(O T To001) #40

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…


(Lorne Gaetz) #41

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


(O T To001) #42

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)…


#43

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


(O T To001) #44

thank you!
yes, I did…


#45

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


(O T To001) #46

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:


#47

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’

BTDT


(O T To001) #48

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


(O T To001) #49

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 ^^


(Lorne Gaetz) #50

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


(O T To001) #51

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


(Lorne Gaetz) #52

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
wget https://raw.githubusercontent.com/FreePBX/superfecta/e12f9b5d21f209064426a80ff1443cf6190163c5/sources/source-Send_to_MQTT.module
chown asterisk:asterisk source-Send_to_MQTT.module

Then browse to Superfecta, configure and test.


Dialplan hook following execution of caller id superfecta for caller id name announcment
(O T To001) #53

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


(Dave Burgess) #54

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.


(system) closed #55

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