fsockopen

2008-06-16 Thread Iain Dooley

hi all,

i was using fopen from PHP to hit my kannel URL. i switched to fsockopen 
and it is roughly 10 times faster. here's a snippet:


$fp = fsockopen(HOSTNAME,PORTNUM);
$out = 'GET 
/cgi-bin/sendsms?username='.USER.'&password='.PASS.'&to='.$to.'&text='.urlencode($message).'&from='.urlencode($from).'&dlr-url='.$dlr_url.'&dlr-mask=3 
HTTP/1.1'."\r\n";

$out .= 'Host: '.HOSTNAME."\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp,$out);
fclose($fp);

cheers

iain



Re: fsockopen

2008-06-16 Thread seikath
after some tests

i do prefer libcurl ..   :)
faster, nice errors handling and easy XML post setup


-Original Message-
From: users@kannel.org [EMAIL PROTECTED]
Sent: 16 Юни 2008 г.
To: seikath
Subject:fsockopen 

> hi all,

> i was using fopen from PHP to hit my kannel URL. i switched to fsockopen
> and it is roughly 10 times faster. here's a snippet:

> $fp = fsockopen(HOSTNAME,PORTNUM);
> $out = 'GET 
> /cgi-bin/sendsms?username='.USER.'&password='.PASS.'&to='.$to.'&text='.urlencode($message).'&from='.urlencode($from).'&dlr-url='.$dlr_url.'&dlr-mask=3
> HTTP/1.1'."\r\n";
> $out .= 'Host: '.HOSTNAME."\r\n";
> $out .= "Connection: Close\r\n\r\n";
> fwrite($fp,$out);
> fclose($fp);

> cheers

> iain







RE: Http relay issue with kannel

2008-06-16 Thread info.ubichip
Thanks, it was helpfull.
 
it is working now,despite the dlr but it is for cdma and my other gw does
not support it.
 
 

  _  

From: Alvaro Cornejo [mailto:[EMAIL PROTECTED] 
Sent: vendredi 13 juin 2008 16:26
To: info.ubichip
Cc: users@kannel.org
Subject: Re: Http relay issue with kannel


define your php "smsc" as generic. there you can define regex for the
accepted/rejected/etc status.

Note that in order to use "generic" smsc you must use CVS. 


I use this setup:


group = smsc
smsc = http
smsc-id = kan2mail
log-level = 0
log-file = "/var/log/kannel/kan2mail.log"
system-type = generic
port = 13017
send-url = http://localhost/sms/kannel/kan2mail.php?u=usr
 &p
=pass&to=%p&from=%P&msg=%a
connect-allow-ip = localhost
denied-smsc-id = modem, smsc1
allowed-smsc-id = kan2mail
preferred-smsc-id-regex = kan2mail
status-success-regex = "OK"
status-permfail-regex = "failure"
status-tempfail-regex = "retry later"

hope helps

Alvaro

On 6/13/08, info.ubichip <[EMAIL PROTECTED]> wrote: 

Hello,

I would like to achieve the following schema to send sms:

app ---> kannel gw 1---> php code

I would like the php code is seen as another kannel gw by the kannel gw #1.

In the php code, I wrote some code answering "0: Accepted for delivery" or
"Sent." but the GW1 saw it as NACK and so make it as failed in the kannel
database.

I take a look in the kannel source and I found that in the
/gw/smsc/smsc_http.c :


static void kannel_parse_reply(SMSCConn *conn, Msg *msg, int status,
   List *headers, Octstr *body)
{
/* Test on three cases:
 * 1. an smsbox reply of an remote kannel instance
 * 2. an smsc_http response (if used for MT to MO looping)
 * 3. an smsbox reply of partly successful sendings */
if ((status == HTTP_OK || status == HTTP_ACCEPTED)
&& (octstr_case_compare(body, octstr_imm("Sent.")) == 0 ||
octstr_case_compare(body, octstr_imm("Ok.")) == 0 ||
octstr_ncompare(body, octstr_imm("Result: OK"),10) == 0)) {
bb_smscconn_sent(conn, msg, NULL);
} else {
bb_smscconn_send_failed(conn, msg,
SMSCCONN_FAILED_MALFORMED, octstr_duplicate(body));
}
}

So I assume kannel saw a good transmission when it receive a HTTP OK and a
message like "Sent." or "Ok."

Does I forget something ?

Does someone got similar issue ?

Regards







-- 
|---
--|
Envíe y Reciba Datos y mensajes de Texto (SMS) hacia y desde cualquier
celular y
Nextel en México y en mas de 180 paises. Use aplicaciones 2 vias via SMS y
GPRS online
  Visitenos en www.smsglobal.com.mx y www.pravcom.com 


Re: fsockopen

2008-06-16 Thread Alvaro Cornejo
How do you get/capture returned data from your snippet?

On Mon, Jun 16, 2008 at 2:13 AM, Iain Dooley <[EMAIL PROTECTED]>
wrote:

> hi all,
>
> i was using fopen from PHP to hit my kannel URL. i switched to fsockopen
> and it is roughly 10 times faster. here's a snippet:
>
> $fp = fsockopen(HOSTNAME,PORTNUM);
> $out = 'GET
> /cgi-bin/sendsms?username='.USER.'&password='.PASS.'&to='.$to.'&text='.urlencode($message).'&from='.urlencode($from).'&dlr-url='.$dlr_url.'&dlr-mask=3
> HTTP/1.1'."\r\n";
> $out .= 'Host: '.HOSTNAME."\r\n";
> $out .= "Connection: Close\r\n\r\n";
> fwrite($fp,$out);
> fclose($fp);
>
> cheers
>
> iain
>
>


-- 
|-|
Envíe y Reciba Datos y mensajes de Texto (SMS) hacia y desde cualquier
celular y
Nextel en México y en mas de 180 paises. Use aplicaciones 2 vias via SMS y
GPRS online
Visitenos en www.smsglobal.com.mx y www.pravcom.com


Re: Http relay issue with kannel

2008-06-16 Thread Alvaro Cornejo
How do you handle cdma with kannel??

On Mon, Jun 16, 2008 at 3:35 AM, info.ubichip <[EMAIL PROTECTED]> wrote:

>  Thanks, it was helpfull.
>
> it is working now,despite the dlr but it is for cdma and my other gw does
> not support it.
>
>
>
>  --
> *From:* Alvaro Cornejo [mailto:[EMAIL PROTECTED]
> *Sent:* vendredi 13 juin 2008 16:26
> *To:* info.ubichip
> *Cc:* users@kannel.org
> *Subject:* Re: Http relay issue with kannel
>
>   define your php "smsc" as generic. there you can define regex for the
> accepted/rejected/etc status.
>
> Note that in order to use "generic" smsc you must use CVS.
>
>
> I use this setup:
>
>
> group = smsc
> smsc = http
> smsc-id = kan2mail
> log-level = 0
> log-file = "/var/log/kannel/kan2mail.log"
> system-type = generic
> port = 13017
> send-url = http://localhost/sms/kannel/kan2mail.php?u=usr&p
> =pass&to=%p&from=%P&msg=%a
> connect-allow-ip = localhost
> denied-smsc-id = modem, smsc1
> allowed-smsc-id = kan2mail
> preferred-smsc-id-regex = kan2mail
> status-success-regex = "OK"
> status-permfail-regex = "failure"
> status-tempfail-regex = "retry later"
>
> hope helps
>
> Alvaro
> On 6/13/08, info.ubichip <[EMAIL PROTECTED]> wrote:
>>
>> Hello,
>>
>> I would like to achieve the following schema to send sms:
>>
>> app ---> kannel gw 1---> php code
>>
>> I would like the php code is seen as another kannel gw by the kannel gw
>> #1.
>>
>> In the php code, I wrote some code answering "0: Accepted for delivery" or
>> "Sent." but the GW1 saw it as NACK and so make it as failed in the kannel
>> database.
>>
>> I take a look in the kannel source and I found that in the
>> /gw/smsc/smsc_http.c :
>>
>>
>> static void kannel_parse_reply(SMSCConn *conn, Msg *msg, int status,
>>List *headers, Octstr *body)
>> {
>> /* Test on three cases:
>>  * 1. an smsbox reply of an remote kannel instance
>>  * 2. an smsc_http response (if used for MT to MO looping)
>>  * 3. an smsbox reply of partly successful sendings */
>> if ((status == HTTP_OK || status == HTTP_ACCEPTED)
>> && (octstr_case_compare(body, octstr_imm("Sent.")) == 0 ||
>> octstr_case_compare(body, octstr_imm("Ok.")) == 0 ||
>> octstr_ncompare(body, octstr_imm("Result: OK"),10) == 0)) {
>> bb_smscconn_sent(conn, msg, NULL);
>> } else {
>> bb_smscconn_send_failed(conn, msg,
>> SMSCCONN_FAILED_MALFORMED, octstr_duplicate(body));
>> }
>> }
>>
>> So I assume kannel saw a good transmission when it receive a HTTP OK and a
>> message like "Sent." or "Ok."
>>
>> Does I forget something ?
>>
>> Does someone got similar issue ?
>>
>> Regards
>>
>>
>>
>
>
> --
>
> |-|
> Envíe y Reciba Datos y mensajes de Texto (SMS) hacia y desde cualquier
> celular y
> Nextel en México y en mas de 180 paises. Use aplicaciones 2 vias via SMS y
> GPRS online
>   Visitenos en www.smsglobal.com.mx y www.pravcom.com
>



-- 
|-|
Envíe y Reciba Datos y mensajes de Texto (SMS) hacia y desde cualquier
celular y
Nextel en México y en mas de 180 paises. Use aplicaciones 2 vias via SMS y
GPRS online
Visitenos en www.smsglobal.com.mx y www.pravcom.com


Kannel crash with segmentation fault

2008-06-16 Thread soumya r prabhu
Hello,

Whenever  I send bulk sms, kannel crashes with segmentation fault. It also 
happens sometimes when sending single sms also. That is, I can't expect when it 
can crash. I can't trace any error in my config file. 

I start kannel as follows :
/usr/local/kannel/sbin/bearerbox -v 0 /usr/local/kannel/smskannel.conf
and
/usr/local/kannel/sbin/smsbox -v 0 /usr/local/kannel/smskannel.conf

I also tried using 
/usr/local/kannel/sbin/bearerbox -v 0 --daemonize --parachute 
/usr/local/kannel/smskannel.conf

and

/usr/local/kannel/sbin/smsbox -v 0 --daemonize --parachute 
/usr/local/kannel/smskannel.conf

I also tried by setting a script to start bearbox and smsbox when they crash. 

Both has problems. It does not send sms to all numbers and miss many. May be 
because bearbox or smsbox crash in between. 

I have set a dlr-table and it shows lots of queued messages. Even when kannel 
restarts it does not check the dlr-table for queue.

Status shown : 
---
SMS: received 2 (0 queued), sent 1 (0 queued), store size 0
SMS: inbound 0.00 msg/sec, outbound 0.00 msg/sec

DLR: 125 queued, using mysql storage

Box connections:
smsbox:(none), IP 127.0.0.1 (0 queued), (on-line 0d 2h 29m 46s)  


SMSC connections:
route1SMPP:smsc_hostname:port/port:username:NULL (online 155s, rcvd 2, 
sent 1, failed 0, queued 0 msgs)
route2SMPP:smsc_Ip:port/port:ceedaz:system_type (online 8986s, rcvd 0, 
sent 0, failed 0, queued 0 msgs)
---

We are developing a web-based software in PHP to send single and bulk sms. We 
searched a lot in mail-archives and other sites about this problem. But did not 
find any solution out of this. We have got stuck as we can't move further with 
this problem.

Do kannel normally has this problem? What all can cause it ? What's the 
solution out of this ?

Please help.


OS version: Red Hat Enterprise Linux Server release 5.2 (Tikanga)
Kannel version: 1.4.1
libxml version: libxml2
Used Client: Creating the client using PHP
Single or multi processor machine. : Intel(R) Pentium(R) 4 CPU 1.70GHz
Attach Kannel configuration file (remove passwords and login information!). : 
attached
Attach Kannel log files from the failed attempt. : I have attached the only 
error or panic message I can see in log files.
--



  Meet people who discuss and share your passions. Go to 
http://in.promos.yahoo.com/groups/bestofyahoo/

smskannel.conf
Description: Binary data
I have not attached the entire log.

In bearerbox log
---
2008-06-16 07:29:25 [32589] [10] DEBUG: send_msg: sending msg to box: 
<127.0.0.1>
2008-06-16 07:29:25 [32589] [6] DEBUG: SMPP[route1]: Manually forced source 
addr ton = 0, source add npi = 1
2008-06-16 07:29:25 [32589] [6] DEBUG: SMPP[route1]: Manually forced dest addr 
ton = 1, dest add npi = 1
...AFTER SOME LINES..
2008-06-16 07:29:25 [32589] [6] DEBUG:   short_message: "test2..."
2008-06-16 07:29:25 [32589] [6] DEBUG: SMPP PDU dump ends.
2008-06-16 07:29:25 [32589] [10] DEBUG: send_msg: sending msg to box: 
<127.0.0.1>
2008-06-16 07:29:25 [32589] [10] DEBUG: boxc_receiver: sms received
2008-06-16 07:29:25 [825] [0] INFO: Added logfile `/var/log/kannel/kannel.log' 
with level `0'.
2008-06-16 07:29:25 [825] [0] INFO: Started access logfile 
`/var/log/kannel/access.log'.
2008-06-16 07:29:25 [825] [0] INFO: HTTP: Opening server at port 13000.
2008-06-16 07:29:25 [825] [0] DEBUG: Started thread 1 (gwlib/fdset.c:poller)
2008-06-16 07:29:25 [825] [0] DEBUG: Started thread 2 
(gwlib/http.c:server_thread)
2008-06-16 07:29:25 [825] [0] DEBUG: Started thread 3 
(gw/bb_http.c:httpadmin_run)
2008-06-16 07:29:25 [825] [0] DEBUG: starting smsbox connection module
2008-06-16 07:29:25 [825] [0] INFO: BOXC: 'smsbox-max-pending' not set, using 
default (100).
2008-06-16 07:29:25 [825] [0] DEBUG: Started thread 4 
(gw/bb_boxc.c:sms_to_smsboxes)
2008-06-16 07:29:25 [825] [0] DEBUG: Started thread 5 (gw/bb_boxc.c:smsboxc_run)
2008-06-16 07:29:25 [32589] [6] DEBUG:   short_message: "test2..."
2008-06-16 07:29:25 [32589] [6] DEBUG: SMPP PDU dump ends.
2008-06-16 07:29:25 [32589] [10] DEBUG: send_msg: sending msg to box: 
<127.0.0.1>
2008-06-16 07:29:25 [32589] [10] DEBUG: boxc_receiver: sms received
2008-06-16 07:29:25 [825] [0] INFO: Added logfile `/var/log/kannel/kannel.log' 
with level `0'.
2008-06-16 07:29:25 [825] [0] INFO: Started access logfile 
`/var/log/kannel/access.log'.
2008-06-16 07:29:25 [825] [0] INFO: HTTP: Opening server at port 13000.
2008-06-16 07:29:25 [825] [0] DEBUG: Started thread 1 (gwlib/fdset.c:poller)
2008-06-16 07:29:25 [825] [0] DEBUG: Started thread 2 
(gwlib/http.c:server_thread)
2008-06-16 07:29:25 [825] [0] DEBUG: Started thread 3 
(gw/bb_http.c:httpadmin_run)
2008-06-16 07:29:25 [825] [0] DEBUG: starting smsbox

RE: Http relay issue with kannel

2008-06-16 Thread info.ubichip
Hello,
 
I set up a small other application which deal with cdma, and I setup a
generic http sms that handle the link from this application to kannel.
 
regards
 

  _  

From: Alvaro Cornejo [mailto:[EMAIL PROTECTED] 
Sent: lundi 16 juin 2008 07:00
To: info.ubichip; users@kannel.org
Subject: Re: Http relay issue with kannel


How do you handle cdma with kannel??


On Mon, Jun 16, 2008 at 3:35 AM, info.ubichip <[EMAIL PROTECTED]> wrote:


Thanks, it was helpfull.
 
it is working now,despite the dlr but it is for cdma and my other gw does
not support it.
 
 

  _  

From: Alvaro Cornejo [mailto:[EMAIL PROTECTED] 
Sent: vendredi 13 juin 2008 16:26
To: info.ubichip
Cc: users@kannel.org
Subject: Re: Http relay issue with kannel


define your php "smsc" as generic. there you can define regex for the
accepted/rejected/etc status.

Note that in order to use "generic" smsc you must use CVS. 


I use this setup:


group = smsc
smsc = http
smsc-id = kan2mail
log-level = 0
log-file = "/var/log/kannel/kan2mail.log"
system-type = generic
port = 13017
send-url = http://localhost/sms/kannel/kan2mail.php?u=usr
 &p
=pass&to=%p&from=%P&msg=%a
connect-allow-ip = localhost
denied-smsc-id = modem, smsc1
allowed-smsc-id = kan2mail
preferred-smsc-id-regex = kan2mail
status-success-regex = "OK"
status-permfail-regex = "failure"
status-tempfail-regex = "retry later"

hope helps

Alvaro

On 6/13/08, info.ubichip <[EMAIL PROTECTED]> wrote: 

Hello,

I would like to achieve the following schema to send sms:

app ---> kannel gw 1---> php code

I would like the php code is seen as another kannel gw by the kannel gw #1.

In the php code, I wrote some code answering "0: Accepted for delivery" or
"Sent." but the GW1 saw it as NACK and so make it as failed in the kannel
database.

I take a look in the kannel source and I found that in the
/gw/smsc/smsc_http.c :


static void kannel_parse_reply(SMSCConn *conn, Msg *msg, int status,
   List *headers, Octstr *body)
{
/* Test on three cases:
 * 1. an smsbox reply of an remote kannel instance
 * 2. an smsc_http response (if used for MT to MO looping)
 * 3. an smsbox reply of partly successful sendings */
if ((status == HTTP_OK || status == HTTP_ACCEPTED)
&& (octstr_case_compare(body, octstr_imm("Sent.")) == 0 ||
octstr_case_compare(body, octstr_imm("Ok.")) == 0 ||
octstr_ncompare(body, octstr_imm("Result: OK"),10) == 0)) {
bb_smscconn_sent(conn, msg, NULL);
} else {
bb_smscconn_send_failed(conn, msg,
SMSCCONN_FAILED_MALFORMED, octstr_duplicate(body));
}
}

So I assume kannel saw a good transmission when it receive a HTTP OK and a
message like "Sent." or "Ok."

Does I forget something ?

Does someone got similar issue ?

Regards







-- 
|---
--|
Envíe y Reciba Datos y mensajes de Texto (SMS) hacia y desde cualquier
celular y
Nextel en México y en mas de 180 paises. Use aplicaciones 2 vias via SMS y
GPRS online
  Visitenos en www.smsglobal.com.mx
  y www.pravcom.com 





-- 
|---
--|
Envíe y Reciba Datos y mensajes de Texto (SMS) hacia y desde cualquier
celular y
Nextel en México y en mas de 180 paises. Use aplicaciones 2 vias via SMS y
GPRS online
Visitenos en www.smsglobal.com.mx y www.pravcom.com