I was wondering how hard it would be to create a delay in milliseconds between the time a support ticket is piped into osTicket and when the New Ticket Autoresponse (or all auto responses) is sent.

If anyone would be willing to share code that would achieve this I'd be extremely appreciative and likely to gush praise. ;)

5 days later

I'm not certain this is the solution you need but I think it may be. This will make the system sleep for a time before beginning the auto response code.

1.6ST

Find the following in include/class.ticket.php

//SEND OUT NEW TICKET AUTORESP && ALERTS.

//New Ticket AutoResponse..

if($autorespond && $cfg->autoRespONNewTicket() && $dept->autoRespONNewTicket()){

1.6RC5

Find the following in include/class.ticket.php

//If enabled...send confirmation to user. ( New Message AutoResponse )

if($autorespond && $cfg->autoRespONNewMessage() && $dept && $dept->autoRespONNewMessage()){

And after that add the following:

function slaap($seconds)

{

$seconds = abs($seconds);

if ($seconds < 1):

usleep($seconds*1000000);

else:

sleep($seconds);

endif;

}

slaap(0.5);

The above assumes you want to sleep for 0.5 seconds, modify to your desired time.

I don't know how to test this as for starters I don't send autoresponders because of all the outscatter it will cause with as many spam messages that we receive to our tickets (we have filtering off so people can report phish). And also I don't know how I'd be able to confirm such a short delay. Hopefully this works for you though, good luck!

I think that will do exactly what I need. I mentioned milliseconds because I figured that's the unit that would be used, but I should have specified that ultimately had minutes in mind.

Would there be any problem extending this type of delay up to 5 minutes or so? or would that require another approach?

thanks for the help!

In that case you could just get rid of all that garbage above for the function and use something like

sleep(300);

Ok, perfect, I'll give that a shot.

Thanks again mate!

10 years later

Hi,
this was very helpful but is there also a solution the ticket creator gets forwarded after the creation?
When i add the lines above, the creator sees the turning wheel in the opened windows for the time the script is sleeping.

@ceracon this thread is 10 years old.
The solution was written for osTicket 1.6ST and 1.6RC5. The product has changed significantly in the last decade.

I would recommend that you start a new post after reading and following the posting guidelines located in this thread: Please read before requesting assistance. The more information you give us the better we will be able to assist you. Thank you.

Killing zombie thread with a headshot.

Write a Reply...