Caller ID problems with Asterisk 1.4.26

Hello, using Asterisk 1.4.26 with A2Billing, and I’m trying to get the caller-id of an outbound call to match the caller-id of the inbound call. But once a call comes in, the caller-id seems to get replaced with the account_id number.

I know, sounds like an A2Billing issue, but here’s why I posted it on this forum; my extension.conf looks like this:

[a2billing]
exten => _X.,1,Verbose(CID = ${CALLERID(num)})
exten => _X.,2,DeadAGI(a2billing.php|1)

. . . and when I run this, the Verbose() line prints the account number, not the caller_id. So in other words, I believe the caller_id is being modified before the call ever gets into A2Billing.

I should mention that I’m using Asterisk realtime for the sip_buddies table, and it contains a “callerid” field. If I populate the field with a caller_id, then this caller_id will be used. But leaving it blank causes the effect described above; the original caller Id is overwritten with the account number, which is also contained in this table.

I know there’s a “o” parameter for the Dial command, but the problem is that the original caller id already seems to be overwritten before I get to the point of dialing a call. I have tried it anyway, and it did not cause the original caller id to come back - it still displays the account number on the outbound leg.

I’d be very appreciative of any help.

Thanks,
Adam

Anybody?

I’ve done a bit more testing; I got rid of the Asterisk realtime. Now I simply have a profile like this in the sip.conf file:

[02884] type=friend username=02884 accountcode=02884 regexten=02884 ;callerid= amaflags=billing secret=084354354 nat=yes dtmfmode=RFC2833 ;qualify=no allow=ulaw allow=alaw allow=gsm allow=g729 host=dynamic context=a2billing regseconds=0 cancallforward=yes

When a call comes in, it automatically sets the caller-id to 02884, regardless of the caller id of the inbound call. I’ve tried every setting I could find, and nothing will allow me to see the original caller id.

Please help!