Sending GET request whenever there is a missed call

I am trying to figure out how to send an Http request to a remote server with the phone number once a missed call has occurred.
I am new to asterisk and Freepbx , I tried to read on the docs and I came out with this solution
which unfortunately does not work.

I have placed this code at the end of the file: extensions.conf

Capture1

Any help would be highly appreciated.

  1. Custom code goes at the end (or beginning or middle) of extensions_custom.conf.
  2. exten=>s,1,system(…) would be the correct syntax. The arguments for exten are “exten=>extension,priority,command” where the extension number is a dialable extension number, “s”, or “h”. Macros always use “s”.

Your code, while not being incorrect assumes structure not in your context - the s-answer priotity needs to be the destination of a ‘goto’ or ‘gosub’. Adding more punctuation (like quotes) would make the code easier to read.

The real question is “what instantiates your context?” Somewhere in the dial plan, a call gets identified as “no answer” and then you have opportunity to do stuff. If you are trying to supplement the existing code, you’ll need to figure out what you need to do to get to your custom context.

I think this is the main problem that I don’t understand what is the hook the connects to the event
of a missed call , which should be trigger my code.
can you tell me how can I find that event/hook to trigger the code ?

As @jfinstrom pointed out, ARI would probably be a better way to handle this. Check out the code he linked to and see if you can figure that out.

Well there are a couple things wrong with all of this right now.

  1. It’s missing proper extension,priority setup.
  2. The cURL command is wrong.

[macro-missed-call]
exten => s,1,CURL(http://example.com?Phone=${CALLERID(num)}&Event=missed_call)

You probably should look at both: https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Function_CURL and https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Function_CURLOPT for how to do cURL commands from Asterisk.

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