Hey guys, I’m using php to generate a variable random number, which is then going to be the passcode the caller enters to connect through the pbx.
Does anyone know if php and free pbx share functionality to the extent that free pbx could access a variable stored via php? The process would be:
- User generates random number code on website.
- Website stores code.
- User calls pbx.
- User enters code. PBX confirms code is same as random number code generated on website.
Many thanks for any suggestions here, much appreciated.
Asterisk has an integrated database that you can access from almost any application.
Hosting the page on your pbx would be bad juju. So don’t.
The best method to accomplish this would be polling.
User goes to site makes code-> Code saved to database.
PBX on interval polls database for new codes and stores them locally or polls in real time.
Thanks, that’s super helpful, I had no idea that freepbx had that level of functionality.
You do know that FreePBX is basically written in PHP don’t you?
The database in asterisk is sqlite3 (/var/lib/asterisk/astdb.sqlite3) and PHP has a complete library to read and write to it as , if you use the pbx box’es apache server, it will have full access to that database, just add your “families and keys” as appropriate using PHP’s random function inline for the keys and to present it back to the user and use a custom context leveraging on dbget (http://www.asteriskdocs.org/en/2nd_Edition/asterisk-book-html-chunk/asterisk-APP-F-7.html) to query your hopefully ephemeral entries, don’t forget to delete your added keys after the call. That is a very light weight solution and pretty well instantaneous.
James and I will have to disagree about “bad juju”, anything under your document root is exposed, and even admin/* has been compromised in living memory , just be careful and limit your code to only allow very well sanitized actions against the database, Many have been doing it for years.
This assumes your clients will be connecting a sip/iax2 device to connect to the PBX with a preexisting account, if not than as James said “Don’t do it”, at least for a while until you have a much better understanding of how things work.
(A wild guess is that you want to make a bridged call between two external numbers, very scary over any web page)
Yes, that’s right, the sole telephony aimed for is bridged calls between 2 external numbers, the caller having purchased a passcode. As such the PBX only exists as a/ a firewall between caller and agent (legal advisers fyi), and b/ a means of time-limiting the call duration (to 10 minutes).
I wonder if there isn’t a simpler means of achieving this, but a modified PBX seemed the most sensible solution. None the less thanks for your comments.
In fact a PBX is exactly what you don’t want, it will just get in the way, see :- :
A2billing is possibly the longest survivor. However a real SIP proxy would be cheaper for you in the long run, look into Kamailio and perhaps:-
A couple of points on your business plan :-
The bottom fell out of that market 10 years ago.
What is left of the market is owned by the likes of Vonage and Walmart at sub penny a minute rates. Your solution requires that you pay for both incoming and outgoing legs if you use a B2BUA. Unless you are in the hundreds of thousands a month the can’t get close to that.
It will be very hard to find an billing agency to accept payments that knowingly accept VOIP business due to the level of fraud.
If you knew how sip works , then a three digit passcode on a “guest” call would be cracked by the black-hats in a few seconds and your server’s IP would be shared around the Gaza Strip and the Chinese Universities in a few more.
Anyway, don’t say you were not warned
Ok, thanks, and clarity/brutality appreciated, seriously!
Laid bare, the business plan is:
- Customer makes $20 paypal payment
- On receipt, passcode sent to customer
- Customer phones service, enters passcode to access advisers
- Call directed to requested adviser.
I hoped this would simplify payment, leaving -
a. passcode access feature
b. automated switchboard to link caller with adviser
c. time limitation on calls
Kamailio looks powerful, I’ll take a closer look. Any other thoughts are very much welcome, thanks.
Paypal will not accept businesses involved with VOIP.
So your business plan dies at step 1
You need more/better due diligence.