Rebuilding phone server

Recently our phone server died with the raid failing, need some help ironing out some issues I am having.
Server:
CentOS 5
Asterisk version is 1.4.11
Not sure what other information is worth providing, let me know if i need to add anything.

Why 1.4.11?
1.6 looked like i was going to need to rewrite a lot of scripts that we have from our old 1.2 install so i avoided that for now.
1.4.11 was the first version i looked at that had chan_zap.c in it, the newest version of 1.4 did not have that and we take alot of calls on our analog lines.

We run a call center and i needed to setup something quickly to take calls again and answer them. I would like to setup 1.6 once i get the situation back to something manageable but right now I am not ready for that. I have a few more things that I need to solve.

1. The queue_log, the event ENTERQUEUE before would log the callid as “Name” . Currently it is just Number. I have located this in the source inside app_queue.c

ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ENTERQUEUE", "%s|%s", S_OR(args.url, ""), S_OR(chan->cid.cid_num, ""));
I belive this where i want to edit to get the callid name and num, I dont know how to get bot options in that spot where S_OR(chan->cid.cid_num, “”) if that is the way, also i have not tried putting S_OR(chan->cid.cid_all, “”) which sounds like it would give me what i want and look how i remember it from the old install.

2. When running

The bottom where it shows the calls in the queue displays the channel, wait, prio if i wanted to add the callid to this line what would I need to do? I found this area in the app_queue.c:

if (s) astman_append(s, " %d. %s (wait: %ld:%2.2ld, prio: %d)%s", pos++, qe->chan->name, (long) (now - qe->start) / 60, (long) (now - qe->start) % 60, qe->prio, term); else ast_cli(fd, " %d. %s (wait: %ld:%2.2ld, prio: %d)%s", pos++, qe->chan->name, (long) (now - qe->start) / 60, (long) (now - qe->start) % 60, qe->prio, term);
I want that line to look like:

I dont know what the difference is between astman_append and ast_cli, I could guess that one is appending to something and the other is for the CLI output.
the line im guessing might need to look like this

ast_cli(fd, " %d. %s (wait: %ld:%2.2ld, prio: %d name: %d)%s", pos++, qe->chan->name, (long) (now - qe->start) / 60, (long) (now - qe->start) % 60, qe->prio, chan->cid.cid_name, term);

3. Last question (for now)
Some times when an agent logs in to the queue it will say they logged in but they will not appear in the queue nor will calls start coming to them. In the debug log this is what i see:

[Jun 15 07:37:52] DEBUG[31039] chan_agent.c: Hungup, howlong is 0, autologoff is 40 [Jun 15 07:37:57] DEBUG[31039] chan_agent.c: Hungup, howlong is 0, autologoff is 40 [Jun 15 07:37:57] DEBUG[31039] chan_agent.c: Hungup, howlong is 0, autologoff is 40 [Jun 15 07:38:10] DEBUG[31039] chan_agent.c: Hungup, howlong is 0, autologoff is 40 [Jun 15 07:38:18] DEBUG[31039] chan_agent.c: Bridge on 'SIP/5211-0725bfe0' being set to 'Agent/045' (3) [Jun 15 07:38:44] DEBUG[18085] chan_agent.c: Hungup, howlong is 0, autologoff is 40 [Jun 15 07:38:54] DEBUG[31610] chan_agent.c: Bridge on 'SIP/5223-07259560' being set to 'Agent/093' (3) [Jun 15 07:39:17] DEBUG[31610] chan_agent.c: Bridge on 'SIP/5223-07259560' being cleared (2)
From what i can tell the Bridge being set is a successful log on and the bridge being cleared is a log off. The last one, the hungup line, looks like the successful failed log on lines. i can find and get information about the autologoff but im not sure what ‘howlong is 0’ means or what could be going on.
Agents also say that after taking a call they get logged out from the queue, right after that call, so when they are done talking to someone from the queue, the have to log back in. Instead of logging on and taking a number of calls and logging out only when they log out. Im not sure where to look for either of the agent issues.


Any help would be fantastic, if there is anything else I need to provide let me know.

Thanks
-Bryan

we would need to see the pertinent parts of the extensions.conf.
Also zaptel is gone and dahdi replaced it. If it were my job to have the phone system running I would have a backup running some sort of HA and make sure it is up to date…It would really be worth it to have a testing system that you can work with the newer version of asterisk to iron stuff out with.

I understand the status of zaptel and dahdi. It was not an option for me to mess with currently. I would also love to have something setup where I could just switch over on a failure. Sadly its not an option for me currently. Anytime I get new hardware its put in to production replacing some other piece of failed hardware.

Back on topic,
This is the bit from the exten file for the agent login. Im not sure what else you could have referred to as the rest is in the source files.

exten => *1,1,Answer()
exten => *1,2,Wait(1)
exten => *1,3,AgentCallbackLogin
exten => *1,4,Hangup()

The first and second question would be just source related on how to get those setup. I have ran through some possible ideas that might work but im not familar with C at all. One would be to concat the strings.

while it would put the two together its not the same as the
"Name" format iv seen before and on voip-info for the callid
i could try to code alot more in as well but again my C knowledge is next to nothing, its more like shooting in the dark.