Send SMS through DINSTAR Gateway

I have a server running asterisk 13 and a Dinstar DWG2000E gateway
Now by using both these, I would like to send an sms to every hangup call in asterisk.
Dinstar gave me an api to send sms through CURL, which is working fine in asterisk box, when run the command manually.
Need your advise on how to achieve my goal?
Thanks in advance.
Vijay DSK

Thanks for the speedy reply.
The feeling I got by seeing you reply is, it’s going to be a big project.
Is there any workaround or simple way to get this done?
I think, this is not a new requirement.

david551 gave you (almost) all the references you will need.

An overview would be you need to ‘handle’ the hangup with either the ‘h’ extension or a ‘hangup handler.’

Then, you can either:

  1. Use the ‘system()’ dialplan application to execute the cURL command line.
  2. Use the 'CURL() dialplan function to access the cURL library.
  3. Use the ‘agi()’ dialplan application to execute an AGI written in the language of your choice to access the cURL library.

My personal preference would be to write an AGI (because it gives me the most control and ability to parse the result and handle errors), but if your goal is to just ‘grip it and rip it’ the system() application may suffice.

Thanks for the response.
Would appreciate, if you guide me how to write in AGI?

The purpose of this forum is for members to help each other by suggesting potential solutions, ‘work-arounds’, or ‘outside the box’ approaches.

Going out on a limb and assuming you are just getting started with Asterisk, I would suggest starting with the ‘system()’ dialplan application. It is literally just a couple of lines of dialplan. If you get that working and you are happy with the result, great.

If you want more control and better error handling, try the ‘CURL()’ function. It’s probably less than a dozen lines of dialplan.

If your needs expand to deciding only some calls should send an SMS or keeping track (in a database) of who was sent an SMS and when they called the caller back or routing SMS for specific callers to specific agents or keeping track of how many SMS were sent to each agent and how long they took to reply… then you’re definitely in AGI territory :slight_smile: The link in my previous post is to the reference on AGI.

Whichever path you choose, there are examples on the web. Google is your friend. If you get stuck, ask for help, but show what you tried and what went wrong. When you post code or console output, please remember to use preformatted text tags (the ‘</>’ in the icon bar at the top of the reply box) so the forum doesn’t eat special characters like ‘$’ and reduce your carefully crafted code to an unreadable mess.

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