how can i do?

Dani AI

Generated

Goal: route an incoming support email for a given product to the technician assigned to that product who currently has the lightest active workload. already has the product→technician mapping idea; pointed out the need for an ingest process and to track counts. A reliable design computes current load from the tickets table (open/in_progress), chooses the tech with the lowest active-tickets count, creates the ticket with that tech, then notifies the tech and customer — rather than relying on a simple incrementing counter that can drift.

Suggested minimal schema and selection (example only):

  • technicians(id, email, active, max_concurrent)
  • products(id, name)
  • product_assignment(product_id, tech_id, priority)
  • tickets(id, product_id, tech_id, status, created_at)

Sample SQL to pick the least-loaded tech for a product:

SELECT t.id, t.email, COALESCE(l.open_count,0) AS load
FROM technicians t
JOIN product_assignment pa ON pa.tech_id = t.id
LEFT JOIN (
  SELECT tech_id, COUNT(*) AS open_count
  FROM tickets
  WHERE status IN ('open','in_progress')
  GROUP BY tech_id
) l ON l.tech_id = t.id
WHERE pa.product_id = :product_id AND t.active = 1
ORDER BY load ASC, pa.priority ASC
LIMIT 1

Assign atomically (sketch using PDO):

$db->beginTransaction();
$stmt = $db->prepare($sql_above);
$stmt->execute([':product_id'=>$pid]);
$tech = $stmt->fetch();
// create ticket assigned to $tech['id']
$ins = $db->prepare("INSERT INTO tickets (product_id, tech_id, status, created_at) VALUES (?, ?, 'open', NOW())");
$ins->execute([$pid, $tech['id']]);
$db->commit();

Important notes and gotchas:

  • Prefer calculating load from the tickets table; do not rely solely on a separate counter column unless carefully synchronized.
  • Protect against race conditions: run selection + insert in one transaction and, where needed, lock the technician rows (InnoDB SELECT ... FOR UPDATE) or implement a short retry loop.
  • Product detection: use product-specific recipient addresses (android@support...), strict subject tags, or an inbound webhook rather than brittle body parsing.
  • Log assignment decisions, include a fallback (round-robin or escalation) when a technician is offline, and test with concurrent message bursts to validate locking behavior.

Recommended Answers

All 8 Replies

Try to explain what you want in more detail please, your question is vague.

m devloping one support system in that i assign technician for soulving tha bug that customer facing
so,, i want to do the if customer send mail for query that mail will be transfer to the assign technicain in that the that technician who have less mail ..
and that customer mail directly assign to technician who have less mail

So, customer sends an email to support@example.com and you want to have a script that checks that incoming email address, and forwards that email to one of your technicians, namely the technician with the least emails already sent to him.

  1. You need to store somewhere how many emails each technician has received already.
  2. You'll need a cron job (scheduled task) to check for new emails and decide to whom to send it.

Correct so far?

some what is correct
i mean when i assing to technicain with the product then customer having problem in that product then that mail to be assing that technicain

i want some coding plzz for idea how ill do that??????????

How do you determine the product from the email?

on product id i ll assing the thechnicain if product is anroid mobile then the mail coding will be write nd then user will select anriod's product then the mail shoud be sent to that assign technician...
that way...

Here's the function reference for IMAP, you'll need that to get and forward the emails.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.