Re: Introducing certain delay between messages
Rodrigo Montiel <[email protected]> Tue, 19 Nov 2013 13:03:39 -0300
| Newsgroups | gmane.linux.drivers.gnokii |
|---|---|
| Message-ID | <1384877019.2160.15.camel@condor> |
Hi Jan, just to let you know this worked out as expected, many thanks!
I have just modified the first static declaration as follow:
static time_t timer; // added
timer = time (NULL); // added
instead of:
static time_t timer = time (NULL); // added
I will try to get a way to have the initial delay as a variable (i.e, 60
secs, then 40, then 50, ).
This is because I have noticed different behaviors in different GSM
telcos with regards to the sms speed.
Anyway, your input was flawlessly. Thanks so much.
-Rod
On Fri, 2013-11-15 at 09:02 -0300, Rodrigo Montiel wrote:
> Thank you Jan!
>
> Let's give a try, will let you know the results as soon as I test it.
>
> Kind Rgds,
>
> -Rod
>
> On Fri, 2013-11-15 at 08:56 +0100, Jan Derfinak wrote:
>
> > Jan Derfinak wrote:
> >
> > Hello
> >
> > A accidentally hit the Send button instead of Save. :)
> >
> > So the last sentence should be:
> > It is written from scratch, so maybe you need some debugging and tuning.
> >
> > Best regards.
> > Jan
> >
> >
> > >
> > >
> > > Rodrigo Montiel wrote:
> > >
> > > Hello.
> > >
> > >> I was researching a little bit about how to introduce a sleep() function
> > >> before each message is sent.
> > >> The reason here is because in my country we are being blocked by telcos
> > >> for any massive sms campaign attempt in order to preserve the gsm network.
> > >>
> > > ...
> > >
> > >>
> > >> I also have been trying to put some sleep() functions sms_send_single /
> > >> sms_send_long functions, for instance:
> > >>
> > >> ------
> > >> static gn_error sms_send_single(gn_data *data, struct gn_statemachine
> > >> *state)
> > >> {
> > >> sleep(60);
> > >> ------
> > >>
> > >> Im not a guru in C coding, have made just some little (stupid) programs.
> > >> Could you please kindly point me to which function I should review? I do
> > >> not want to destroy this excellent/complex source code.
> > >
> > > I think it can work. But if you need it because of smsd, I recommend not
> > > to touch libgnokii code and implement it in smsd code.
> > >
> > > You can introduce such delay in smsd/lowlevel.c:A_SendSMSMessage()
> > > function. This code add dynamic delay added only if dealy from previous
> > > message was less than 60 seconds.
> > >
> > > Add
> > >
> > > #include <time.h>
> > >
> > > to includes section of lowlevel.c
> > >
> > > Them modify A_SendSMSMessage function:
> > > static gint A_SendSMSMessage (gpointer data)
> > > {
> > > D_SMSMessage *d = (D_SMSMessage *) data;
> > > gn_data *dt;
> > > gn_error status;
> > > static time_t timer = time (NULL); // added
> > > time_t timer_tmp; // added
> > >
> > > if (!d)
> > > ...
> > > gn_data_clear (dt);
> > > dt->sms = d->sms;
> > > timer_tmp = time (NULL); // added
> > > if ((timer_tmp - timer) < 60) // added
> > > sleep (60 - (timer_tmp - timer)); // added
> > > d->status = gn_sms_send (dt, sm);
> > > timer = time (NULL); // added
> > > status = d->status;
> > > /* we do not use sms reference numbers in smsd */
> > > free (dt->sms->reference);
> > > ...
> > > }
> > >
> > >
> > > It is written from scratch, so maybe you n
> > >>
> > >> Thanks in advanced,
> > >>
> > >>
> > >>
> > >>
> > >> _______________________________________________
> > >> gnokii-users mailing list
> > >> [email protected]
> > >> https://lists.nongnu.org/mailman/listinfo/gnokii-users
> > >>
> >
> >
> > _______________________________________________
> > gnokii-users mailing list
> > [email protected]
> > https://lists.nongnu.org/mailman/listinfo/gnokii-users
>
>
> _______________________________________________
> gnokii-users mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/gnokii-users
>
>
>
--
Rodrigo Montiel
Ing. en Telecomunicaciones
Elastix Certified Engineer ECE#209728189
Mikrotik Certified MTCNA#1210NA066
Cel: +549 351 2581376
Freetech Solutions
www.freetechsolutions.com.ar
Tel/Fax: +54 351 6387585
_______________________________________________
gnokii-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/gnokii-users
logo.jpg
(image/jpeg, 3.9 KB) - not displayed