How to set ANI in originate action

Hi all,

I execute the following code in a shell, it is an originate action :

open localhost 5038

Action: Login
UserName: asterisk
Secret: asterisk

ACTION: Originate
Channel: SIP/2614
Exten: 992614
Priority: 1
Context: from-internal
Callerid: Caller
ActionID: id

The action works, SIP/2614 is an extension who call a softphone and 992614 is an application, where 99xxxx is routed to.

My problem : in my application, I would like to get the number of the extension (in my example, 2614 or SIP/2614) but I don’t know how to configure the originate action, I get “Unknown”. When I call the application with a softphone, it works, I get “2614” (I logged the softphone with it).

I am running Asterisk 1.4.12 on Linux.

Thanks for your help;
Yougouff

I resolved my problem.

It was not in the action code, but in the configuration of Asterisk.

In extensions_custom.conf

Before
exten => _99XXXX,1,Dial(SIP/1006@danaos)

After
exten => _99XXXX,1,Set(CALLERID(number)=${EXTEN:2})
exten => _99XXXX,n,Dial(SIP/1006@danaos)

CALLERID(number) is the variable I searched. I get it in my application with ANI=$ani$ .
${EXTEN:2} = XXXX (phone number without ‘99’)

Yougouff