Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Tue Oct 24, 2017 4:06 am
VoIP Billing solution


All times are UTC




Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: SMS callback - Integrating Kannel and a2billing
PostPosted: Sun Jun 07, 2009 12:27 pm 
Offline

Joined: Fri Feb 27, 2009 5:43 pm
Posts: 33
Location: Germany, Berlin
Really great work man!

I adjusted it a bit to use it without kannel with my sms provider which provides SMS Shared Inbound Numbers with URL Notification.

So I don't need my own SMS Gateway Hardware which is cool, cause my server runs in a datacentre (hard to install a GSM-Modem there ;-) )

I just had to rename the GET variables and add some checks and reformating scripts, cause the SMS content has to start with a keywork (as the Inbound number is shared!)

The only thing I'm working on is the callerid.
I want to use the called number as callerid for the callback and the users number as callerid for the second leg.
I already solved this issue for CID Callback. (look here: viewtopic.php?f=7&t=4870)

Thanks a lot for this really cool addon!!!

:punk:


Top
 Profile  
 
 Post subject: Re: SMS callback - Integrating Kannel and a2billing
PostPosted: Sat Jan 30, 2010 9:25 pm 
Offline

Joined: Sun Aug 17, 2008 1:52 pm
Posts: 93
very nice job,
except there are a few catches,
it is easier for the user just type the destination number inside the text
and send it
therefore I had to change the keyword from callback to default

also + in front created some problems and the date which was wrong causes immidiate hangup,
so we had to correct the callerID and the call initiation date to current date

you also have to change the url to :
Code:
"http://server.address.com/api/SOAP/sms-callback.php?n=%q&dest=%a"




then change the code to below.

sms-callback
Code:
<?php
//#!/usr/bin/php -q
/***************************************************************************
*
* sms-callback.php : PHP A2Billing - SMS Callback Soap Client
* Written for PHP 5.X versions. Might work with PHP 5+
* Copyright (C) 2007 Abdoulaye Siby <asiby _atl_ gmail com>
*
* A2Billing -- Asterisk billing solution.
* Copyright (C) 2004, 2007 Belaid Arezqui <areski _atl_ gmail com>
*
* See http://www.asterisk2billing.org for more information about
* the A2Billing project.
* Please submit bug reports, patches, etc. regarding this file to <asiby _atl_ gmail com>
* For all other bug reports, patches, etc. submit them to <areski _atl_ gmail com>
*
* This software is released under the terms of the GNU Lesser General Public License v2.1
* A copy of which is available from http://www.gnu.org/copyleft/lesser.html
*
****************************************************************************/

/***************************************************************************
*
* USAGE : http://your.server.here/A2Billing_ADMIN_PATH/api/SOAP/sms-callback.php?n=phone_number_to_be_called_back   
*
****************************************************************************/


$allowed_hosts = array(
   '127.0.0.1',
//   '10.1.2.26',
//   '10.1.1.101',
);

// Please replace xx.xx.xx.xx with any valide IP of any hosts that are allowed to have access to this script.
// Note that the trailing coma in the array is not a typo.

if(in_array($_SERVER['REMOTE_ADDR'], $allowed_hosts)){
   // This will reject any access attempts being made from outside your box. You can add any IP of any
   exit;
}

error_reporting(E_ALL ^E_NOTICE);
ini_set("display_errors", "on");

if ($argc > 1 && ($argv[1] == '--version' || $argv[1] == '-v'))
{
        echo "A2Billing - SOAP CLI Callback Server Version 1.0\n";
        exit;
}

$callback_number = str_replace("+","", trim($_GET['n']));
$destination_number = trim($_GET['dest']);

//mod by mohammad, check if there is anything except number in dnid, if yes exchange the
if ( (substr($destination_number,0,2) <> "00" ) or (strlen($destination_number) < 5) or
   ( (strlen(preg_replace("/[^0-9]/","", $destination_number))) < (strlen($destination_number)) ))  {

   $destination_number = $callback_number;
}


if (!is_numeric($callback_number)){
   echo "Bad request\n";
   exit(1);
}

include ("../../lib/defines.php");

$security_key = API_SECURITY_KEY;
// echo "$security_key<br />". md5($security_key).'<br />';

$endpoint = 'http://admin.server.address.com/api/SOAP/callback-server.php';

$client = new SoapClient(null, array(
   'location' => $endpoint,
   'uri'      => 'urn://admin.server.address.com/api/SOAP',
   'trace'    => 1,
   'exceptions' => 1,
   'encoding' => 1,
   )
);

$fault = null;

// ADD ON THE SPEC SECURITY KEY

// echo "<hr>#############   Request CallBack   #############   <hr>";

$method = 'Request';

$params = array(
   'security_key' => md5($security_key),
   'called' => $callback_number,
   'calling' => $destination_number,
   'callerid' => $callback_number,
   'callback_time' => date("Y-m-d H:i:s", mktime()), /* 2007-09-25 01:00:00,     Don't worry about this for now. It's work anyway */
   'uniqueid' => '',            /* No sweat. It will be generated automatically */
   );

list($result, $status, $details) = $client->__soapCall($method, $params);

echo "Result (insert_id_callback): $result\nStatus: $status\nDetails: $details\n\n";

// echo "<hr>#############   Check Status  #############   </hr>";
$method = 'Status';
$insert_id_callback = $result;
$params = array(
   'security_key' => md5($security_key),
   'id' => $insert_id_callback,
   );

list($result, $status, $details) = $client->__soapCall($method, $params);
echo "Result (Status): $result\nStatus: $status\nDetails: $details\n\n";



Last edited by hellbound on Sat Jan 24, 2015 5:54 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: SMS callback - Integrating Kannel and a2billing
PostPosted: Sat Jan 30, 2010 9:31 pm 
Offline

Joined: Sun Aug 17, 2008 1:52 pm
Posts: 93
There is still one problem though,
sometimes the caller is sending callback either by sms or miss-call

they server will call their number but for some GSM stupid reason the phone is not reachable
and the call is diverted to the voice-mail.

server immidiately initiate the second leg of the call and the person on the other side which
has no clue of someone is actually calling him will bump into the voicemail

work around:

request the user to PRESS 1 to initiate the call to make sure there is actually someone picking up the first leg of the call.

how to do this in callback?


Top
 Profile  
 
 Post subject: Re: SMS callback - Integrating Kannel and a2billing
PostPosted: Sun Jun 27, 2010 10:02 pm 
Offline

Joined: Fri Feb 27, 2009 5:43 pm
Posts: 33
Location: Germany, Berlin
sorry for the late answer.

i use www.sms77.de .
it's german. you can configure up to 3 keywords and you can use several numbers.


Top
 Profile  
 
 Post subject: Re: SMS callback - Integrating Kannel and a2billing
PostPosted: Fri May 13, 2011 3:41 pm 
Offline

Joined: Tue Mar 01, 2011 3:08 pm
Posts: 10
will this work on A2B 1.4.1? I just wanted to ask before trying... THANKS


Top
 Profile  
 
 Post subject: Re: SMS callback - Integrating Kannel and a2billing
PostPosted: Sat Apr 28, 2012 12:08 am 
Offline

Joined: Wed Jun 16, 2010 11:22 pm
Posts: 32
Nice article sounds very interesting, I have not tried sms callback, but I have tried web callback and cid callback.

I have a question, I have a server on the internet on a remote location, I have a local server that is behind a firewall.

Could it be possible to configure this setup in such a way, that all the dialing and callback is done by the server I have on the remote location with very good bandwidth, and the gms modem is attached to the local server with poor bandwidth, so that somehow the local server gets the sms for the callback and it passes the information to the server on the internet, and the server on the internet takes care of the dialing. None of the dialing is done by the local server only the sms part.

How could this be done?
What modifications to the instructions above would have to be done, since the instructions above assumes that the gsm modem and the server doing the callback are the same machine ?

I am running a2b 1.8.1 and asterisk 1.4.44


Top
 Profile  
 
 Post subject: Re: SMS callback - Integrating Kannel and a2billing
PostPosted: Mon Sep 03, 2012 5:02 am 
Offline

Joined: Thu Feb 08, 2007 12:54 pm
Posts: 14
Hi,
We realized that offering SMS Callback is a pain for many providers, in terms of setting up Kannel/setting up GSM modem, etc. This prompted us to develop an android based application which can act a SMS gateway for SMS callback functionality.
The installation is follows:
-You install the application on an Android phone and give out this number to your customers where they will send requests.
-Install the demo scripts for making callback and returning SMS response with balance in the a2billing folder.
-Enter this script url in the application setting in android phone.

Since the phone forwards each incoming message matching the keyword to your server url, an-always working net connection (3g/wifi/gprs) is required.
-Customers can send "MAKECALLBACK NUM1,NUM2" to the phone number given by you, and the phone will initiate callback (You can customize the format as per your wish eg:MAKECALLBACK NUM1,NUM2,PIN etc. In this case, please remember to use proper parsing modifications in the script file).
Know more about the application, and download the scripts from http://mobisnow.com/VoIP-SMS-CallBack.php.
The application is FREE OF COST for a2billing community, and can be downloaded from Google Play https://play.google.com/store/apps/details?id=com.mobisnow.voipsmscallback

In case you want customizable keywords other than the 2 default supplied keywords, please write to [email protected] for a customized version.

This application can also work with other billing solutions which expose callback functionality via REST/HTTP API.
Feel free to buzz us on [email protected] in case you face any problems.

Thanks!
MobiSnow


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
VoIP Billing solution


All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group