Caller ID help, and hopefuly a simple question

I just installed Asterisk from Everything is functioning just as it was with the beta.

My setup:
Linux Centos 5.1 x86_64 VM
Incoming DID from IPCOMMS
Outing SIP Trunk from TalkinIP

I can receive calls just fine from the DID to any internal SIP client. I can also make outgoing calls just from from the SIP trunk.

I would like to have my DID ring all of my SIP phones for a number of seconds then ring my cell phone. I have this working with the following code in my extensions.conf

exten => 5104311370,1,Answer(3)
exten => 5104311370,2,Dial(SIP/office&SIP/livingroom, 14)
exten => 5104311370,3,Dial(SIP/MYCELLNUMBER@OUTGOINGSIPTRUNK, 20)
exten => 5104311370,4,VoiceMail(1@default)
exten => 5104311370,5,PlayBack(vm-goodbye)
exten => 5104311370,6,Wait(2)
exten => 5104311370,7,HangUp()

This works.

Ok, so here’s my problem.

The issue is caller id. Caller ID works fine on the internal SIP extensions. But as soon as it hits priority 3 (my cell phone dial out) Caller ID is now my outgoing SIP CID.

I can change the CID in my SIP.conf at will. I’ve even set it to 5555555555 and it shows up that way on my cell phone. That being said, it seems like it’s a simple config change to dynamically change the SIP trunk’s CID when dialing the cell phone. I’ve looked into “SetCallerID” and “Followme” without luck. Asterisk says SetCallerID isn’t a valid app.

Any thoughts?

Can asterisk even do this? I use CallManager at work which seems to do it just fine.

Any help is much appreciated.


This is not a problem of Asterisk, I think it’s your provider that forces the outogoing calls with your SIP trunk CID, so is your provider that should let you set your outgoing caller id with the “original” caller id instead of the SIP trunk CID; I think they will not let you do this but it’s worth try ask them.


Marco Bruni

I mentioned this in the bottom part of my post.

I can change the fromuser= variable in my sip.conf and it shows up on the remote phone I call. My provider doesn’t care what I set my CID to.

My question is, how do I make Asterisk take a call from a SIP DID and forward it to the PSTN via my outgoing SIP Trunk with the callers original CID?

Any call made by my SIP trunk has a CID of fromuser= in my sip.conf file.

You just capture the incoming caller id as a variable, then set the outgoing caller id with that variable

Something like this ought to do the trick.

exten => _X.,n,Set(CALLERID(number)=${NEWCID}) exten => _X.,n,Dial(SIP/${NUMBER}@flowroute)

As riddlebox said… just capture the incoming caller id in the NEWCID variable and set it.
That of course depends on weather or not your provider lets you do that.

NOTE: I included it in the example because flowroute does let you modify the CID.


I’ll give it a shot and report back.

Thanks for the input.