sms - kannel to send WAP push. WARNING: PPG: pap control entity erroneous, the request unacceptable -
i trying send wap using wap=box kannel. example referring http://www.kannel.org/pipermail/users/2011-september/016716.html receiving error while substitution. not able find-out error.
error on kannel is.
2014-03-06 12:00:06 [25702] [14] warning: ppg: pap control entity erroneous, request unacceptable <?xml version="1.0"?><!doctype pap public "-//wapforum//dtd pap 1.0//en" "http://www.wapforum.org/dtd/pap_1.0.dtd"><pap><badmessage-response code="2000" desc="not understood due malformed syntax" bad-message-fragment="<?xml version="1.0"?> <!doctype pap public "-//wapforum//dtd pap1.0//en" "http://www.wapforum.org/dtd/pap_1.0.dtd"> <pap> <push-message push-id="71417"> <address address-value="wappush=+919971132145/type=plmn @ ppg.nokia.com"/> <quality-of-service delivery-method="unconfirmed" network-required="true" network="gsm" bearer-required="true" bearer="sms"/> </push-message> </pap>"></badmessage-response></pap>
my php code is:
<?php $country_code = '91'; $phone = '9971132145'; $push_url = "http://m.yahoo.com"; $text = 'test yahoo wap'; $smsc_id = 'test-wap'; $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 = '127.0.0.1'; $port = '10166'; $url = "http://$host:$port"; $ppg_user = 'userid'; $ppg_pass = 'pwd'; $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 pap1.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=plmn @ 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 /cgi-bin/wap-push.cgi?username=msgbroker&password=msgbroker 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; } ?>
complete response after execute code:
http/1.1 202 accepted server: kannel/svn-runknown date: thu, 06 mar 2014 07:02:03 gmt content-length: 786 content-type: application/xml <?xml version="1.0"?><!doctype pap public "-//wapforum//dtd pap 1.0//en" "http://www.wapforum.org/dtd/pap_1.0.dtd"><pap><badmessage-response code="2000" desc="not understood due malformed syntax" bad-message-fragment="<?xml version="1.0"?> <!doctype pap public "-//wapforum//dtd pap1.0//en" "http://www.wapforum.org/dtd/pap_1.0.dtd"> <pap> <push-message push-id="24502"> <address address-value="wappush=+919971132145/type=plmn @ ppg.nokia.com"/> <quality-of-service delivery-method="unconfirmed" network-required="true" network="gsm" bearer-required="true" bearer="sms"/> </push-message> </pap>"></badmessage-response></pap>
kannel configuraiton file:
group = core admin-port = 10162 smsbox-port = 10163 wapbox-port = 10164 admin-password = xs197 wdp-interface-name = "*" status-password = xs198 admin-deny-ip = "*.*.*.*" admin-allow-ip = "127.0.0.1;10.2.96.71" log-file = "./1234-kannel.log" log-level = 1 box-deny-ip = "*.*.*.*" box-allow-ip = "127.0.0.1" access-log = "./kannel-access.log" sms-resend-retry=0 sms-outgoing-queue-limit=2500000 sms-incoming-queue-limit= -1 # smsc connections group = smsc smsc = smpp smsc-id = test-wap host=*.*.*.* port=4321 transceiver-mode = false smsc-username = "*****" smsc-password = "*****" system-type = "" enquire-link-interval = 30 throughput = 2 interface-version = 34 source-addr-ton = 5 source-addr-npi = 0 source-addr-autodetect = no dest-addr-ton = 1 dest-addr-npi = 1 max-pending-submits=1000 wait-ack=10 wait-ack-expire=0x00 # smsbox setup group = smsbox bearerbox-host = localhost sendsms-port = 10165 log-file = "./smsbox.log" log-level = 3 access-log = "./smsaccess.log" reply-requestfailed = "sorry, request failed, please try again!" group = wapbox bearerbox-host = localhost log-file = "./wap_log.log" log-level = 0 syslog-level = none group = ppg ppg-url = /cgi-bin/wap-push.cgi ppg-port = 10166 concurrent-pushes = 100 trusted-pi = false users = 1024 ppg-allow-ip = "*.*.*.*" # ppg user setup, authorizing specific push user group = wap-push-user wap-push-user = wapuser ppg-username = userid ppg-password = pwd # services group = sms-service keyword = default get-url = "http://*.*.*.*/123470.php?cli=%p&content=%a&shortcode=%p" max-messages=5 concatenation = true # default service - make - should return blank message group = sendsms-user username = userid password = pwd user-deny-ip = "*.*.*.*" user-allow-ip = "127.0.0.1" max-messages = 5 #split-chars="*" concatenation = true
Comments
Post a Comment