sql=switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q' AND (abandoned_epoch = '%ld' OR joined_epoch = '%q')",argv[1],abandoned_epoch,argv[4]);
/* Check of we have a queued abandoned member we can resume from */
if(queue->abandoned_resume_allowed==SWITCH_TRUE){
charres[256];
/* Check to see if agent already exist */
sql=switch_mprintf("SELECT abandoned_epoch FROM members WHERE caller_number = '%q' AND state = '%q'",switch_str_nil(switch_channel_get_variable(member_channel,"caller_id_number")),cc_member_state2str(CC_MEMBER_STATE_ABANDONED));
sql=switch_mprintf("SELECT abandoned_epoch FROM members WHERE queue = '%q' AND caller_number = '%q' AND state = '%q' ORDER BY abandoned_epoch DESC",
sql=switch_mprintf("UPDATE members SET uuid = '%q', state = '%q', rejoined_epoch = '%q' WHERE caller_number = '%q' AND abandoned_epoch = '%q' AND state = '%q'"
sql=switch_mprintf("UPDATE members SET uuid = '%q', state = '%q', rejoined_epoch = '%ld' WHERE caller_number = '%q' AND abandoned_epoch = '%ld' AND state = '%q' AND queue = '%q'",
sql=switch_mprintf("SELECT abandoned_epoch FROM members WHERE uuid = '%q' AND state = '%q'",uuid,cc_member_state2str(CC_MEMBER_STATE_WAITING));
sql=switch_mprintf("SELECT abandoned_epoch FROM members WHERE uuid = '%q' AND state = '%q' AND queue = '%q'",uuid,cc_member_state2str(CC_MEMBER_STATE_WAITING),queue_name);