Semplice pagina WEB per inviare SMS con chan_dongle

sezione dedicata alle tecnologie Voice Over IP

Semplice pagina WEB per inviare SMS con chan_dongle

Messaggio da leggereda root » 16/05/2015, 10:18

http://www.lovisolo.com/asterisk/softwa ... MS-DONGLE/

Ci sono solo due files: "index.php" e "style.css", da mettere all'interno di una directory dedicata sotto "/var/www" (es. /var/www/messaggi) e che va poi possibilmente protetta con .htaccess.

-------------------
- File index.php:
-------------------

<?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: http://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.
* Versione in Italiano di pilovis
************************************************** *******************/

$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(',',$phonen umber));
}
foreach ($phonenumberarray2 as $phonenumber)
{
$phonenumberarray3 = array_merge($phonenumberarray3,explode("\n",$phone number));
}

$output = "Testo: $message<br><br>\n";
foreach ($phonenumberarray3 as $phonenumber)
{
$runcommand = '/usr/sbin/asterisk -rx' . $ini . $dongle . $phonenumber . " " . $message . $ini;
$output .= "Invio messaggio a: $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>
<script type="text/javascript">
/**
* Подсчет количества символов и стоимость написание текста в JavaScript
**/
function countChar() {
//Записываем ссылки на элементы в переменные
var count_char_textarea = document.getElementById("message");
// count_char_textarea.value = count_char_textarea.value.length;
var char_length = document.getElementById("char_length");
//Считаем
if ( count_char_textarea.value.length > 160 ) {
count_char_textarea.value = count_char_textarea.value.substr(0, 160);
}
char_length.innerHTML = count_char_textarea.value.length;
}
</script>

<hr>
<body bgcolor="#84b0fd" text="#030303" link="#9abcde">

<a href="./index.php"><h2 align="center"></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><b><?php echo $output; ?></b></td>
</tr>
<tr><form action="index.php" method="post">
<p><b>Numero di cellulare:</b> <br><font size="-2">(Formato: +39XXXXXXXX)</font></p>
<textarea id="phonenumbers" name="phonenumbers"></textarea>

<p><b>Testo del messaggio:</b> <br> <font size="-2">(Massimo 160 caratteri, se superiore il messaggio verra' troncato) </font></p>
<textarea id="message" name="message" size="160" rows="6" cols="30" onchange="countChar()" onkeyup="countChar()"></textarea><br /><br/>
<font size="2">conteggio caratteri del messaggio: <span id="char_length"> 0 </span></font>
<p>
<button type="submit">Invia Messaggio</button><br /><br />
</form></tr>
</table>
</dd>
<p></td>
</tr>
<tr>
<td bgcolor="#ffffff"><a href="javascript:history.back()">Invia lo stesso messaggio ad altro numero</a></td>
</tr>
</table>
</td>
</tr>
</table>
<p>
</td>
</tr>
</table>
<hr>
</body>
</html>


-------------------
- File style.css:
-------------------


<style type="text/css">
<!--
body,td,form,textarea,input,p {
font-family: Arial, Helvetica;
font-size: 12pt;
color: #030303;
}
a {
text-decoration: none;
color: #456789;
font-weight: bold;
}
h1 {
color: #ffffff;
font-size: 16pt;
font-weight: bold;
}
h2 {
color: #ffffff;
font-size: 14pt;
font-weight: bold;
}
-->
</style>
Maurizio
Avatar utente
root
Amministratore
 
Messaggi: 348
Iscritto il: 10/04/2012, 10:55
Località: Ovada

Torna a Asterisk e VOIP

Chi c’è in linea

Visitano il forum: Nessuno e 1 ospite

cron