File send_sms.php of Package yate-datacard
#!/usr/bin/php -q
<?php
/* Script to send SMS
To test add new listener in extmodule.conf and run this script from command line
[listener sms_ussd_handler]
; For each socket listener there should be a section starting with the
; "listener" keyword
; type: keyword: Type of socket - "unix" or "tcp"
type=tcp
; path: string: Path of the UNIX socket to create
; addr: string: IP address to bind the TCP socket to
addr=127.0.0.1
; port: int: TCP port to bind to, must be positive
port=7777
; role: keyword: Role of incoming connections - "global", "channel" or don't set
role=global
*/
require_once("libyate.php");
/* Always the first action to do */
Yate::Init(false, "127.0.0.1", 7777);
/* Create new message */
$m = new Yate("datacard.sms");
$m->id = "";
$m->SetParam("type", "outgoing");
$m->SetParam("protocol", "datacard");
$m->SetParam("device", "datacard0");
$m->SetParam("called", "380911234567");
$m->SetParam("text", "Hello!");
$m->Dispatch();
Yate::Output("PHP: bye!");
/* vi: set ts=4 sw=4 sts=4 noet: */
?>