Set(CALLERID) not working if softphone has no CallerID

I’m building an Asterisk-based VoIP system, and require to ensure that all outbound calls have CallerID (known as CLI here in the UK) information associated with them.

I’m testing this system by using Zoiper on my PC to make calls to my standard mobile phone, and vice versa.

I’m encountering a very strange issue with CallerID. If I set a CallerID in the softphone, regardless of what it’s set to (even the word “gibberish”), when the call leaves the Asterisk box, it has my test VoIP number’s proper CLI set as specified in extensions.conf, and this appears on my mobile.

But if I clear the CallerID field in Zoiper, then when the call leaves the Asterisk box no CLI is set, the call on my mobile comes up as from “Unknown” and I’ve verified with the upstream telephone provider who’s taking the trunk from Asterisk that no CLI is appearing on those calls.

I’m using IAX to test, but we expect the system to also accept SIP when it’s complete.

My IAX user:

[01133326209]
type=friend
host=dynamic
secret=********
context=01133326209

The “to mobiles” (07) outbound part of the user’s entry in extensions.conf, from their [01133326209] context:

exten => _07.,1,Set(CALLERID(number)=01133326209)
exten => _07.,2,Set(CALLERID(ANI)=01133326209)
exten => _07.,n,Dial(SIP/toSwitchConnectVoIP/44${EXTEN:1})

When I tail the logs, I can see the Set command being carried out. Nevertheless the call arrives at destination with “unknown” as its CLI.

[2009-04-01 18:40:11] VERBOSE[2652] logger.c: [2009-04-01 18:40:11] – Accepting AUTHENTICATED call from xxx.xxx.121.65:
> requested format = gsm,
> requested prefs = (),
> actual format = gsm,
> host prefs = (),
> priority = mine
[2009-04-01 18:40:11] DEBUG[9932] pbx.c: Launching ‘Set’
[2009-04-01 18:40:11] VERBOSE[9932] logger.c: [2009-04-01 18:40:11] – Executing [07xxxxxx503@01133326209:1] Set(“IAX2/01133326209-7330”, “CALLERID(number)=01133326209”) in new stack
[2009-04-01 18:40:11] DEBUG[9932] pbx.c: Launching ‘Set’
[2009-04-01 18:40:11] VERBOSE[9932] logger.c: [2009-04-01 18:40:11] – Executing [07xxxxxx503@01133326209:2] Set(“IAX2/01133326209-7330”, “CALLERID(ANI)=01133326209”) in new stack
[2009-04-01 18:40:11] DEBUG[9932] pbx.c: Launching ‘Dial’
[2009-04-01 18:40:11] VERBOSE[9932] logger.c: [2009-04-01 18:40:11] – Executing [07xxxxxx503@01133326209:3] Dial(“IAX2/01133326209-7330”, “SIP/toSwitchConnectVoIP/447xxxxxx503”) in new stack

So this far it all appears to be working correctly, the number and ANI are aparently set - but the upstream doesn’t see them, and they don’t appear at the destination.

The next few lines in the log show:

[2009-04-01 18:40:11] DEBUG[9932] chan_sip.c: Asked to create a SIP channel with formats: 0x2 (gsm)
[2009-04-01 18:40:11] DEBUG[9932] chan_sip.c: Allocating new SIP dialog for (No Call-ID) - INVITE (With RTP)

Does the “No Call-ID” entry indicate that the CLI has been lost by this point?

Is there a reliable way of forcing the CallerID, regardless of whether the connecting softphone has anything set or not?

Edit: I’ve searched extensively for information on this problem, studied the O’Reilly book on Asterisk, and read the info on setting CallerID on voip-info, but nothing I’ve tried so far has solved this problem.

After trying every possible sollution we finally found the problem - it was down to Asterisk running as a non-root user.

What appears to happen is something like this (pure guesswork here):

If the calling device sets a CallerID, then the variable space is initialised, and hence Asterisk can update it. But if the calling device didn’t set the field at all (which is presumably what Zoiper does when no CallerID is set) then the field isn’t initialised in the first place and hence there’s nothing for Asterisk to set, and as it’s not root it doesn’t have permission to create the variable space.

Switching Asterisk to run as root resolves the problem completely.

Hi

If the dialplan you posted is the one you use then you have a minor error

its
Set(CALLERID(num)=value) not (number)

also its not realy a good idea to run asterisk as root

Ian