Do you have these lines that on your email look like more than 1 line
each as 1 line or more than 1 line? (should be 1)
'<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP
1.0//EN"'."\r\n".
'<address address-value="WAPPUSH=
+'.$country_code.$phone.'/TYPE=p...@ppg.nokia.com"/>'."\r\n\t".
'<quality-of-service delivery-method="unconfirmed"
network-required="true" network="GSM" bearer-required="true"
bearer="SMS"/>'.
'<?xml version="1.0"?>'."\r\n".
'<!DOCTYPE si PUBLIC "-//WAPFORUM//DTD SI 1.0//EN"'."\r
\n".
'<indication action="signal-high" si-id="'.$wap_push_id.'" href="'.
$push_url .'">'.$text.'</indication>'."\r\n".
"X-Kannel-SMSC: $smsc_id\r\n".'Content-Type: multipart/related;
boundary=multipart-boundary; type="application/xml"'."\r\n".
On 9/20/11 4:38 PM, chris wrote:
I have installed kannel 1.5.0 on ubuntu 10.0.4 and configured
bearerbox,smsbox and wapbox. All are working well except that i can't
send wap pushes through ppg from the php sample script posted in the
mailing lists named "wappush.conf". i have checked all the related
postings on the matter and implemented the suggestions without
success.So i need help. The error message i get from the browser is;
This XML file does not appear to have any style information associated
with it. The document tree is shown below.
−
<pap>
<badmessage-response code="2000" desc="Not understood due to malformed
syntax" bad-message-fragment="No MIME content"/>
</pap>
The wappush.php script(with corrected line feeds and indentation) used
is as below;
<?php
$country_code = 'xxx';
$phone = 'xxxxxxxx';
$push_url = "http://m.yahoo.com";
$text = 'Test yahoo wap';
$smsc_id = 'mysmsc-id';
$out = send_wap_push($smsc_id, $country_code, $phone, $push_url,
$text);
echo $out;
function send_wap_push($smsc_id, $country_code, $phone, $push_url,
$text)
{
$host = 'localhost';
$port = '8080';
$url = "http://$host:$port";
$ppg_user = 'push';
$ppg_pass = 'push';
$wap_push_id = get_rand_numbers(5);
$body = "--multipart-boundary\r\n".
"Content-type: application/xml\r\n\r\n".
'<?xml version="1.0"?>'."\r\n".
'<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP
1.0//EN"'."\r\n".
'"http://www.wapforum.org/DTD/pap_1.0.dtd">'."\r\n".
'<pap>'."\r\n".
'<push-message push-id="'.$wap_push_id.'">'."\r\n\t".
'<address address-value="WAPPUSH=
+'.$country_code.$phone.'/TYPE=p...@ppg.nokia.com"/>'."\r\n\t".
'<quality-of-service delivery-method="unconfirmed"
network-required="true" network="GSM" bearer-required="true"
bearer="SMS"/>'.
"\r\n</push-message>\r\n".
"</pap>\r\n\r\n".
"--multipart-boundary\r\n".
"Content-type: text/vnd.wap.si\r\n\r\n".
'<?xml version="1.0"?>'."\r\n".
'<!DOCTYPE si PUBLIC "-//WAPFORUM//DTD SI 1.0//EN"'."\r
\n".
'"http://www.wapforum.org/DTD/si.dtd">'."\r\n".
"<si>\r\n".
'<indication action="signal-high" si-id="'.$wap_push_id.'"
href="'.
$push_url .'">'.$text.'</indication>'."\r\n".
"</si>\r\n"."--multipart-boundary--\r\n";
$post = "POST /wappush.php HTTP/1.1\r\n"."Host: $host:$port\r\n".
"Authorization: Basic
".base64_encode("$ppg_user:$ppg_pass")."\r\n".
"X-Kannel-SMSC: $smsc_id\r\n".'Content-Type: multipart/related;
boundary=multipart-boundary; type="application/xml"'."\r\n".
"Content-Length: ".strlen($body)."\r\n"."\r\n".$body;
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt ($ch,CURLOPT_CUSTOMREQUEST , $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$reply = curl_exec($ch);
curl_close ($ch);
return $reply;
//print_r($post.$body);
}
function assign_rand_value($num)
{
// accepts 1 - 36
switch($num)
{
case "1":
$rand_value = "a";
break;
case "2":
$rand_value = "b";
break;
case "3":
$rand_value = "c";
break;
case "4":
$rand_value = "d";
break;
case "5":
$rand_value = "e";
break;
case "6":
$rand_value = "f";
break;
case "7":
$rand_value = "g";
break;
case "8":
$rand_value = "h";
break;
case "9":
$rand_value = "i";
break;
case "10":
$rand_value = "j";
break;
case "11":
$rand_value = "k";
break;
case "12":
$rand_value = "l";
break;
case "13":
$rand_value = "m";
break;
case "14":
$rand_value = "n";
break;
case "15":
$rand_value = "o";
break;
case "16":
$rand_value = "p";
break;
case "17":
$rand_value = "q";
break;
case "18":
$rand_value = "r";
break;
case "19":
$rand_value = "s";
break;
case "20":
$rand_value = "t";
break;
case "21":
$rand_value = "u";
break;
case "22":
$rand_value = "v";
break;
case "23":
$rand_value = "w";
break;
case "24":
$rand_value = "x";
break;
case "25":
$rand_value = "y";
break;
case "26":
$rand_value = "z";
break;
case "27":
$rand_value = "0";
break;
case "28":
$rand_value = "1";
break;
case "29":
$rand_value = "2";
break;
case "30":
$rand_value = "3";
break;
case "31":
$rand_value = "4";
break;
case "32":
$rand_value = "5";
break;
case "33":
$rand_value = "6";
break;
case "34":
$rand_value = "7";
break;
case "35":
$rand_value = "8";
break;
case "36":
$rand_value = "9";
break;
}
return $rand_value;
}
function get_rand_numbers($length)
{
if($length>0)
{
$rand_id="";
for($i=1; $i<=$length; $i++)
{
mt_srand((double)microtime() * 1000000);
$num = mt_rand(27,36);
$rand_id .= assign_rand_value($num);
}
}
return $rand_id;
}
?>
and from the wap log file;
2011-09-20 21:02:23 [1833] [14] INFO: PPG: Accept request</wappush.php>
from<127.0.0.1>
2011-09-20 21:02:23 [1833] [14] WARNING: PPG: No MIME content received,
the request unacceptable
2011-09-20 21:02:23 [1833] [14] DEBUG: PPG: send_bad_message_response:
telling pi
2011-09-20 21:02:23 [1833] [14] DEBUG: HTTP: Resetting HTTPClient for
`127.0.0.1'.
2011-09-20 21:02:23 [1833] [11] DEBUG: HTTP: Creating HTTPClient for
`127.0.0.1'.
2011-09-20 21:02:23 [1833] [11] DEBUG: HTTP: Created HTTPClient area
0x99ec880.
2011-09-20 21:02:24 [1833] [14] ERROR: Request</favicon.ico> from
<127.0.0.1>: service not found
2011-09-20 21:02:24 [1833] [14] DEBUG: your configuration
uses /wappush.php
2011-09-20 21:02:24 [1833] [14] DEBUG: HTTP: Resetting HTTPClient for
`127.0.0.1'.
2011-09-20 21:03:23 [1833] [10] DEBUG: HTTP: Destroying HTTPClient area
0x99ec880.
2011-09-20 21:03:23 [1833] [10] DEBUG: HTTP: Destroying HTTPClient for
`127.0.0.1'.
and my kannel configuration file;
group = core
admin-port = 13050
smsbox-port = 13051
wapbox-port= 13052
admin-password= chris
dlr-storage = mysql
wdp-interface-name="*"
log-file = "/var/log/kannel/bearerbox.log"
log-level=0
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"
group=smsc
smsc-id=mysmsc-id
port=13053
smsc=at
modemtype=huawei
device=/dev/ttyUSB0
#speed=115200
my-number=xxxxxxxxxx
validityperiod=167
pin=7172
sim-buffering=true
#keepalive=5
sms-center=+xxxxxxxxxx
group=modems
id=huawei
name="huawei E230"
detect-string="huawei"
init-string="ATZ"
init-string="AT+CNMI=2,1,2,2,0"
enable-hwhs=false
message-storage=SM
message-start=0
#speed=115200
group=smsbox
#smsbox-id=smsbox1
bearerbox-host=127.0.0.1
sendsms-port=13054
global-sender=xxxxxxxxxxx
sendsms-chars="0123456789+-"
log-file = "/var/log/kannel/smsbox.log"
log-level=0
group=sendsms-user
username=kannel
password=kannel
concatenation=true
max-messages=10
#Receive MO sms and direct to specified url
group=sms-service
keyword=default
get-url="http://localhost/receivesms.php?sender=%p&text=%b"
#accept-x-kannel-headers=true
#accepted-smsc=smsbox1
max-messages=1
catch-all=true
#Set up wap pushes
group=wapbox
bearerbox-host=127.0.0.1
log-file = "/var/log/kannel/wapbox.log"
access-log="/var/log/kannel/wapacess.log"
log-level=0
syslog-level=none
group=ppg
ppg-url=/wappush.php
ppg-port=8080
concurrent-pushes=100
global-sender="xxxxxxxxxxx"
users=1024
ppg-allow-ip="127.0.0.1"
trusted-pi=true
group=wap-push-user
wap-push-user=wappusher
ppg-username=push
ppg-password=push
allow-ip="*.*.*.*"
#Use mysql database for storing delivery reports for MT sms
group=mysql-connection
id=mydlr
host=localhost
username=root
password=xxxxxxxx
database=dlr
max-connections=1
group=dlr-db
id=mydlr
table=dlr
field-smsc=smsc
field-timestamp=ts
field-destination=destination
field-source=source
field-service=service
field-url=url
field-mask=mask
field-status=status
field-boxc-id=boxc
#group = sqlbox
#id = sqlbox-db
#smsbox-id = smsbox
#bearerbox-host = 127.0.0.1
#bearerbox-port = 13003
#smsbox-port = 13005
#log-file = “/var/log/kannel/sqlbox.log”
#log-level = 0
# Example MYSQL Connection
#group = mysql-connection
#id = sqlbox-db
#host = localhost
#username = root
#password = xxxxxxxx
#database = dlr
i would really appreciate as comprehensive help as possible.