-2

I am starting a small topup buisness in my country and for different reasons, I had to use a usb modem to make the USSD request which my buisness depends on

The best modem I found is Huwaui e3531 usb modem

The way I was thinking on buidling my website is create a small deamon that constantly check the website for new orders and execute the USSD requests using mmcli ( that's the best utility I could find , but I am open to suggestions)

The problem with this solution is I have to edit mmcli source code to output the USSD response only ( the normal response have a lot of extra words in it) also mmcli cancel USSD request is not working ( not sure why) not to mention the different things that can go wrong and stop the deamon which affect the buisness

the second choice I have is using the Hilink firmware which give me an API to make USSD request directly from my website (exactly what I am looking for), but that also have 2 small problems, the first is that it doesn't give me the option to cancel USSD request, and the second is that it's kind of slow to make the requests

So I am looking for something in the middle, the ability to have an API so I can run USSD commands from my website that it is fast and reliable

the best I could find is this project but I found after reading the source that it is using the Hilink firmware API to work.

1 Answers1

0

We had to do a 'hack' solution for this in our company. Since we didn't have enough time to learn the mmcli library, our solution was to pipe linux terminal commands using 'popen' in C++ and parse it to produce and adequate respond to the USSD commands we were passing; ie. we sent the USSD command through 'popen' and parsed the response and sent the required response. We ran our server on Ubuntu which came default with the mmcli lib installed, which is what we used. So we didn't have to look at the source code, just used simple pipes to pipe our commands to the terminal. I should note it produces just the perfect output we are expecting and no extra information, and you can set a retry count in case of errors.

Here's how we setup our architecture just in case it helps:

Webserver

  • Has an open websocket running on a dedicated port, which listens for incoming request from the server and does a push to all clients (local servers) connected to it.

Local linux terminal

  • Has an websocket client waiting for a message from the server
  • When it receives a message, it parses and executes the USSD code, then sends a message to our call back api url about the state of the execution.

    We have been running this for months now and our only worry is with power and stable internet connections; our local server has to always be powered on and online.

I would be happy to share the code we used for the linux commands, it's on github.

Wisdom Nji
  • 13
  • 4