Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asterisk : originate call doesn't set the CALLERID in the dialplan

Tags:

sip

asterisk

I am using Asterisk PBX to call a softphone, i use thise command : "originate SIP/100 extension 4004" , in the dialplan, I have to get the CALLERID variable, but in this case, it's always empty!

P.S : if i call the extension (4004), from the softphone(100), the CALLERID is set, and I can get it with : ${CALLERID(num)}.

How to get the caller id in the originate case?

like image 441
Ahmed Laatabi Avatar asked Apr 06 '12 15:04

Ahmed Laatabi


2 Answers

When you're originating a call, you set the Caller ID yourself. There are two ways of doing this - either in the originate application yourself, or in the dialplan. An example of this is below.

Action: Originate
Channel: local/12345@outgoing
Application: Echo
CallerID: Asterisk <12345>

extensions.conf:

[outgoing]
exten => 12345,1,NoOp()
same => n,Verbose(1, Outgoing Caller ID: {$CALLERID(all)})
same => n,Dial(SIP/${EXTEN})
same => n,Hangup()

or you could do something like:

exten => 12345,1,NoOp()
same => n,Set(CALLERID(num)=54321)
same => n,Set(CALLERID(name)=Asterisk)
same => n,Verbose(1, Outgoing Caller ID: {$CALLERID(all)})
same => n,Dial(SIP/${EXTEN})
same => n,Hangup()

You should see your caller ID set either in the AMI originate or, if you choose to override it in the dialplan, those values.

For more information, see Manager Action Originate and CallerID Function.

like image 126
Matt Jordan Avatar answered Sep 28 '22 10:09

Matt Jordan


I know this is way late but if your on Asterisk 1.8 the Originate app just does not allow it normally.

I had asked in the forums before and they said that feature would be added at a later point. So what I did was modify the app_originate.c to allow number and name to be passed.

Here is the one I wrote up last year: https://github.com/cmendes0101/asterisk-originate-callerid

Been in production for over a year and has been working good. Was written for 1.8. It was a easy modification so if your using a different version you can simple diff the changes and make those small changes to your version to make it happen.

like image 26
Chris Avatar answered Sep 28 '22 08:09

Chris