Search code examples
phpmodemgsmmobile-devices

Establish & Receive Calls via a GSM modem in PHP


I am having a CRM (Customer Relationship Management Software) built on php and running it on localhost (windows XP system). This contains the list of my clients. I want to be able to call these clients directly from my CRM and keep a log of the same. (Call time, call duration and record the calls). For incoming calls, I should be able to link it to my CRM, display the client details and log the data.

I have a voice enabled 3G GSM Modem (with USB connector) which can be used for this purpose. From my search, I understand I would need to send AT commands from PHP to interact with the modem. But I am not able to move ahead as I am completely new to this. I have never done any device interfacing before this.

Can you help me to understand how can I go about solving the above issue? Any leads, resources in this direction will be of great help.


Solution

  • I wouldn't try to do this with pure PHP since then you would have to have PHP interface with the hardware through the webserver, which can be a pain, if it is manageable at all. There are (edit) three options in my view:

    1: AKA the hard way:
    Write a PHP extension in C that does what you want, but this would mean a lot of programming for a relative small task.

    2: The eas[y/ier] way:
    Find a program (Maybe Skype?) that can do voice communication with your modem and has an API or a CLI so you can make PHP run:
    voiceprogram.exe --call=555-000-5555 --saveTo=client1_20113103_1200.mp3
    This allows the application to do what it's good as and only use PHP as the controller. The resulting MP3 (or Wav, OGG, etc) can be saved back to the CRM.

    3: Other options
    If you are able to program in a different language that does communicate easily with your modem you can write some custom code that can be triggered by PHP (sockets/SOAP/CLI) and handles the call. When finished it can 'POST' the call information back to your PHP script.

    The first 2 solutions only work when the CRM runs on localhost, if you plan on using this in a shared network environment complexity will go up. The last option, if done correctly, can be used in a shared environment.