CDR(userfield) for dialed channel

Hi every body,
I am doing a radius authentication & routing using portaone perl scripts in Asterisk I have modified the script so that it sets some globally inherited variables for the incoming call (channel). That part sounds like below.

then in extensions.conf I have this:

exten => _X.,n,agi,|AuthorizeBy=Account&Password=SecReT exten => _X.,n,Set(CDR(userfield)=${CDR(userfield)}something) exten => _X.,n,Dial(${LEGDIAL1},60) exten => _X.,n,Hangup
Without having to define the ITSP in sip.conf, Dial to ITSP is finely done and call gets connected. As I expected, 2 CDR events were generated in manager API. The CDR belonging to first incoming call contains userfield but the second CDR does not.

Now my problem is that I need to set CDR(userfield) for the second call dialed using Dial command. I need to set this value for billing purposes. But how?

It would be appreciated if you share your experiments with me.


I am a student in telecommunication. I have a project and I must develloped an authenticate with freeradius and Asterisk (Portaone).

I installed asterisk-1.4.11, freeradius-1.7, radiusclient-1.4

And I test this with x-lite and don’t work.

I need your help please because I don’t found an example for this configuration.

my sip. conf is

context= sip_auth ; When they register, create extension 1234
callerid= <77777>
host=dynamic ; This device needs to register

context= sip_auth ; When they register, create extension 1234
host=dynamic ; This device needs to register

my extensions is:


exten => 77777,1,Set(SIP_Authorization=${SIP_HEADER(Proxy-Authorization)})
exten => 77777,n,AGI(agi-rad-auth.agi|Mode=SIP)
exten => 77777,n,Goto(default,${EXTENSION},1)
exten => 77777,n,Hangup()
exten => 88888,1,Set(SIP_Authorization=${SIP_HEADER(Proxy-Authorization)})
exten => 88888,n,AGI(agi-rad-auth.agi|Mode=SIP)
exten => 88888,n,Goto(default,${EXTENSION},1)
exten => 88888,n,Hangup()

exten => 88888,1,Dial(SIP/${EXTEN})
exten => 77777,1,Dial(SIP/${EXTEN})

I suppose my problem is a wrong configuration in sip.conf or in my extensions.conf?
I need use a sip provider? I don’t understand what is?

Thank you for help…I have a short time for my work and i am bloqued since one week. Please Please Please Please Please…help!!! avascript:emoticon(’:cry:’)
If you don’t have a time, you can send me your extensions.conf and sip.conf…please

thank you.



As the first glance I see that in your sip.conf your 2 friends are set in context sip_auth but in extensions.conf you have writen radius authentication extension commands in context global.

In this way extensions are matched.



Thank you for your response. No i do my radius extensions in context [sip_conf]. But when I send my email, I don’t see this.

What is my problem? I do a sniffer, I have no package radius received and receipted. I think Asterisk is no communicate with Freeradius!!!

Do you have a similar configuration in sip.conf and extensions.conf with me???

Thank you…


I think you should run a troubleshooting step by step.

First check if your endpoint can get registered to asterisk. “sip show users” or “sip show user 77777” can help you find this.

if your endpoint is registered to asterisk, enable sip debugging by “sip set debug” and then make a test call.

in debugs you can find that the extensions of which contexts are running for your call.

Again, I think your problem is related to contexts but with above procedure you can make sure what the problem can be.



I do sip show users and sip set debug. The problem is context [sip_auth] in sip.conf and in extensions [sip-auth].

I changed this and when I test a call, I have this mistake in console mode debug of Asterisk: agi-rad-auth.agi¦Mode=SIP: No responce from Radius serveur.

Where I can see a configuration for my install Authen:Radius with CPAN. I think , he have a file configuration for this module CPAN and enregistred parameter of IP radius server, port…???

Thank you very much…!!!


As far as I remember, I made a lot of changes to PortaOne RADIUS AGI sample so that it started to work. Unfortunately since I have made a lot of changes and my current AGI is very complicated, I can not send it for you.

I remember I ran step by step debugging for AGI and also I sniffed (using tcpdump) the RADIUS packets between ASTERISK and radius server.

I also remember that in my environment, the part of AGI perl script which was checking receipt of reply from radius server was deciding wrongly and I remarked that part. Although the reply was received from radius server, it was reporting that it was not received and was stopping the perl script.

This is the whole I remember. Hope it helps you.