Re: Introducing certain delay between messages

Rodrigo Montiel <[email protected]> Fri, 15 Nov 2013 09:02:54 -0300
Newsgroups gmane.linux.drivers.gnokii
Message-ID <1384516974.2411.2.camel@condor>
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


-- 
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