Open GoogleCodeExporter opened 8 years ago
Archive is altered. WARNING: MAY BE A VIRUS!!!
Original comment by sil...@magazinulcuscule.ro
on 24 Jun 2013 at 8:13
lol lol lol virus
<?php
/*********************************************************************
* Chan_Dongle SMS Script v.0.01
* for The Raspberry Asterisk
*
* Author: Troy Nahrwold
* Email: Troy(at)eternalworks(dot)com
* Company: Eternal Works
* Website: www.eternalworks.com
*
* Disclaimer:
* This product is solely a private production of the above named
* author, and is neither endorsed nor supported by Eternal Works.
* Although this product has been thuroughly tested, it is
* distributed AS IS, and the author assumes no liability for any
* damages this script may cause to your system. The author
* has provided full source code and encourages you to review the
* source code to determine any effects it may have on your system.
*
* (c) Copyright 2011, Troy A Nahrwold, Eternal Works, LLC.
* All Rights Reserved.
*
*********************************************************************/
$dongle = "dongle sms dongle0 ";
$ini = "'";
if(isset($_REQUEST['phonenumbers']) && !empty($_REQUEST['phonenumbers']) && !empty($_REQUEST['message']))
{
$message = substr($_REQUEST['message'],0,160);
$phonenumberarray1 = explode(' ',$_REQUEST['phonenumbers']);
$phonenumberarray2 = array();
$phonenumberarray3 = array();
foreach ($phonenumberarray1 as $phonenumber)
{
$phonenumberarray2 = array_merge($phonenumberarray2,explode(',',$phonenumber));
}
foreach ($phonenumberarray2 as $phonenumber)
{
$phonenumberarray3 = array_merge($phonenumberarray3,explode("\n",$phonenumber));
}
$output = "Message: $message<br><br>\n";
foreach ($phonenumberarray3 as $phonenumber)
{
$runcommand = '/usr/sbin/asterisk -rx' . $ini . $dongle . $phonenumber . " " . $message . $ini;
$output .= "Sending message to: $phonenumber<br>\n";
exec($runcommand);
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>SMS Messaging for Asterisk</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="#84b0fd" text="#030303" link="#9abcde">
<a href="./index.php"><h2 align="center">SMS Messaging for Asterisk</h2></a>
<table border="0" cellspacing="0" cellpadding="1" width="600" bgcolor="#ffffff" align="center">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="3" width="100%" bgcolor="#ffffff" align="center">
<tr bgcolor="#abcdef">
<td><?php echo $output; ?></td>
</tr>
<tr><form action="index.php" method="post">
<p>Phone Numbers: <br><font size="-2">(Format: NXXNXXXXXX Separate numbers with commas or newline)</font></p>
<textarea id="phonenumbers" name="phonenumbers"></textarea>
<p>Message: <br> <font size="-2">(Message will be truncated to 160 characters) </font></p>
<textarea id="message" name="message" size="160"></textarea><br /><br />
<button type="submit">Send Message</button><br /><br />
</form></tr>
</table>
</dd>
<p></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td bgcolor="#eeeeee"><a href="javascript:history.back()">Send Another SMS Message</a></td>
</tr>
</table>
</td>
</tr>
</table>
<p>
<table border="0" cellspacing="0" cellpadding="1" width="400" bgcolor="#000000" align="center">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="3" width="100%" bgcolor="#eeeeee" align="center">
<tr>
<td align="center">
Created by <a href="http://www.eternalworks.com">Troy Nahrwold</a>. change by <a href="http://www.dmtg.org">DMTG.org</a>. Optimized for <a href="http://raspberry-asterisk.org/">Asterisk in Raspberry Pi</a>.
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Original comment by deliog...@gmail.com
on 25 Jun 2013 at 1:13
I think many peoples make happy if script rewritten for PDU sending with
additional fields
Original comment by bg_...@mail.ru
on 30 Jul 2013 at 7:07
i've developed a web based application which can send sms using dongle in php
.that application can send sms in PDU mode . so no need to worry about
multiline sms .i can also receive multiline sms with it also (not yet in PDU
mode just decoding Base64encode in php) .i'm only struggling with multipart
sms .i m understanding UDH and multipart part of UDH . anyway i will post it
here in a week . actually i was trying to develop this app for Astlinux and
openwrt which doesn't have php's extended support in it , and have already
compiled chan_dongle for astlinux firmware . official Astlinux firmware doesn't
support chan_dongle but my astlinux firmware build support chan_dongle :).
Regards .
Intizar Ali Kauser
Original comment by alihmd....@gmail.com
on 1 Aug 2013 at 9:18
Hey,
I would like to help, I´m using the code and i found problem.
When you send to many numbers, the sms is not send to all of then.
there is little modification in my code.
Look at the 2°(second) foreach, there is missing the "$key"
and thanks for the great work, It´s awesome!
if(isset($_REQUEST['phonenumbers']) && !empty($_REQUEST['phonenumbers']) && !empty($_REQUEST['message']))
{
$message = substr($_REQUEST['message'],0,160);
$phonenumberarray1 = explode(' ',$_REQUEST['phonenumbers']);
$phonenumberarray2 = array();
$phonenumberarray3 = array();
foreach ($phonenumberarray1 as $phonenumber)
{
$phonenumberarray2 = array_merge($phonenumberarray2,explode(',',$phonenumber));
}
foreach ($phonenumberarray2 as $key => $phonenumber)
{
$phonenumberarray3 = array_merge($phonenumberarray3,explode("\n",$phonenumber));
$output = "Message: $message<br><br>\n";
}
foreach ($phonenumberarray3 as $phonenumber)
{
if (strlen($phonenumber) >= "2")
{
$runcommand = 'sudo /usr/sbin/asterisk -x ' . $ini . $dongle . $phonenumber . " " . $message . $ini;
$output .= "Sending message to: $phonenumber<br>\n";
echo $runcommand. "<br>";
//exec($runcommand);
}
}
}
Original comment by danilogr...@gmail.com
on 2 Aug 2013 at 2:22
danilogr...@gmail.com,
thanks .
yes , i would need your help too . i will give you raw (with out CSS and proper
HTML) working php code . but let me finish this after that i'll give my code
for customization . i m caught up in multipart sms in PDU mode . i'll let you
know as soon as i finish this .
Original comment by alihmd....@gmail.com
on 5 Aug 2013 at 4:03
Great work!
But, actually, if you just execute fast and multiple commands in console - all
msgs would be sent and recieved.
Original comment by Danila.Z...@gmail.com
on 8 Aug 2013 at 11:29
Hi! Im add symbol count and 160 chars limitation. Maybe it be useful …
Original comment by vodkin.i...@gmail.com
on 6 Feb 2014 at 4:58
Attachments:
Hi All i am trying to set this PHP script in my debian workstaion and it does
not send sms to my asterisk in dongle0, which priviliges need to added to this
php script
to let know : asterisk user is owner for the html /var/www/ and /etc/asterisk
can some one help me
thank you
Original comment by allomaro...@gmail.com
on 31 Jul 2015 at 3:16
Hello I would like to make a small change to the script I would like to insert a line where every time a text message is sent an email is sent with the text of the sms Thank you very much Maisx
Hi, I created something a little bit more nicely looking:
Code is here: https://github.com/MatejKovacic/RasPBX-install/blob/main/send-sms.php
And you are welcome to read my guide: https://github.com/MatejKovacic/RasPBX-install
Original issue reported on code.google.com by
deliog...@gmail.com
on 19 Jun 2013 at 3:36