Link to home
Start Free TrialLog in
Avatar of JAY186
JAY186

asked on

Asterisk - Caller ID not displayed.

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.
Avatar of Ron Malmstead
Ron Malmstead
Flag of United States of America image

If you put the callerid in the iax.conf/sip.conf file..it will override whatever is in the softphone.  If you hard code the callerid in the dialplan just before Dial()..it will override whatever is in the softphone and whatever is configured in sip.conf/iax.conf.

example...

exten => _NXXNXXXXXX,1,Set(CALLERID(name)=YOURNAME)
exten => _NXXNXXXXXX,n,Set(CALLERID(num)=5555555555)
exten => _NXXNXXXXXX,n,Dial(zap/r2/${EXTEN},60)

You can also set it all in one line...
exten => _NXXNXXXXXX,1,Set(CALLERID(all)=YOURNAME <5555555555>)
ps:...the way to do the ANI is to use the "a" argument.
exten => _NXXNXXXXXX,n,Set(CALLERID(num)=5555555555,a)
Avatar of JAY186
JAY186

ASKER

We've already tried all the various ways of setting the CallerID, with and without name, all in one line vs seperate lines - nothing works, the result is always that if the softphone has anything at all in the callerid field, then Asterisk correctly sets the callerid as defined in extensions.conf, however if the softphone has no callerid set, then Asterisk seems to completely ignore the callerid settings, even though we can see the lines being processed in the log.

We've also tried setting the callerid in iax.conf, however the effect of that was that regardless of whether anything was set in the softphone, no callerid was set by Asterisk.

None of this behaviour is documented anywhere, hence wondering if anyone else has seen similar problems, or if there's some kind of deep-level problem with either our Asterisk install, or the machine it's running on.
What does your zapata.conf file look like ?


hidecallerid=yes | no
restrictcid=yes | no
oh ,never mind that is for pri channels... you are using a sip provider correct ?
Avatar of JAY186

ASKER

The non-comment bits of zapata.conf look like this:

[trunkgroups]

[channels]
context=default
switchtype=national
signalling=fxo_ls
usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
canpark=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=yes
rxgain=0.0
txgain=0.0
group=1
callgroup=1
pickupgroup=1

immediate=no


Yes, we're going out via a SIP trunk, and can both make and receive calls between the voip system and standard mobile phones.

Here's the Asterisk log for a call made with "gibberish" in the CallerID field of Zoiper, this call arrived at my mobile phone with the correct 01133326209 CLI shown::

[2009-04-08 17:06:34] DEBUG[2647] frame.c: Could not find preferred codec - Returning zero codec
[2009-04-08 17:06:34] DEBUG[2647] chan_iax2.c: We don't do requested format gsm, falling back to peer capability 1550
[2009-04-08 17:06:34] VERBOSE[2647] logger.c: [2009-04-08 17:06:34]     -- Accepting AUTHENTICATED call from 83.136.121.65:
       > requested format = gsm,
       > requested prefs = (),
       > actual format = gsm,
       > host prefs = (),
       > priority = mine
[2009-04-08 17:06:34] DEBUG[24625] pbx.c: Launching 'Set'
[2009-04-08 17:06:34] VERBOSE[24625] logger.c: [2009-04-08 17:06:34]     -- Executing [07xxxxxx503@01133326209:1] Set("IAX2/01133326209-6339", "CALLERID(num)=01133326209") in new stack
[2009-04-08 17:06:34] DEBUG[24625] pbx.c: Launching 'Set'
[2009-04-08 17:06:34] VERBOSE[24625] logger.c: [2009-04-08 17:06:34]     -- Executing [07xxxxxx503@01133326209:2] Set("IAX2/01133326209-6339", "CALLERID(ANI)=01133326209") in new stack
[2009-04-08 17:06:34] DEBUG[24625] pbx.c: Launching 'Dial'
[2009-04-08 17:06:34] VERBOSE[24625] logger.c: [2009-04-08 17:06:34]     -- Executing [07xxxxxx503@01133326209:3] Dial("IAX2/01133326209-6339", "SIP/toSwitchConnectVoIP/447783967503") in new stack
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: Asked to create a SIP channel with formats: 0x2 (gsm)
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: Allocating new SIP dialog for (No Call-ID) - INVITE (With RTP)
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: Setting NAT on RTP to Off
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: *** Our native formats are 0x3f0008 (alaw|jpeg|png|h261|h263|h263p|h264)
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: *** Joint capabilities are 0x0 (nothing)
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: *** Our capabilities are 0x3f1fff (g723|gsm|ulaw|alaw|g726|adpcm|slin|lpc10|g729|speex|ilbc|g726aal2|g722|jpeg|png|h261|h263|h263p|h264)
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: *** AST_CODEC_CHOOSE formats are 0x8 (alaw)
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: *** Our preferred formats from the incoming channel are 0x2 (gsm)
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: This channel will not be able to handle video.
[2009-04-08 17:06:34] DEBUG[24625] rtp.c: Channel 'IAX2/01133326209-6339' has no RTP, not doing anything
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: Outgoing Call for 447783967503
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: Updating call counter for outgoing call
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: Our T38 capability (0), joint T38 capability (0)
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: ** Our capability: 0x3f08fe (gsm|ulaw|alaw|g726|adpcm|slin|lpc10|g726aal2|jpeg|png|h261|h263|h263p|h264) Video flag: False
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: ** Our prefcodec: 0x2 (gsm)
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: This call needs video offers, but there's no video support enabled!
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: -- Done with adding codecs to SDP
[2009-04-08 17:06:34] DEBUG[24625] channel.c: Internal timing is disabled (option_internal_timing=0 chan->timingfd=-1)
[2009-04-08 17:06:34] DEBUG[24625] chan_sip.c: Done building SDP. Settling with this capability: 0x3f08fe (gsm|ulaw|alaw|g726|adpcm|slin|lpc10|g726aal2|jpeg|png|h261|h263|h263p|h264)
[2009-04-08 17:06:34] VERBOSE[24625] logger.c: [2009-04-08 17:06:34]     -- Called toSwitchConnectVoIP/447783967503
[2009-04-08 17:06:34] DEBUG[24625] channel.c: Set channel SIP/toSwitchConnectVoIP-08374570 to read format slin
[2009-04-08 17:06:34] DEBUG[24625] channel.c: Set channel IAX2/01133326209-6339 to write format slin
[2009-04-08 17:06:34] DEBUG[24625] channel.c: Set channel IAX2/01133326209-6339 to read format slin
[2009-04-08 17:06:34] DEBUG[24625] channel.c: Set channel SIP/toSwitchConnectVoIP-08374570 to write format slin


And here's the log for a call made with the CallerID field of Zoiper blanked, this call arrived with no CallerID, the mobile showed "Private" and the people provding the trunk to the PSTN saw no CLI:

[2009-04-08 17:16:22] DEBUG[2645] frame.c: Could not find preferred codec - Returning zero codec
[2009-04-08 17:16:22] DEBUG[2645] chan_iax2.c: We don't do requested format gsm, falling back to peer capability 1550
[2009-04-08 17:16:22] VERBOSE[2645] logger.c: [2009-04-08 17:16:22]     -- Accepting AUTHENTICATED call from 83.136.121.65:
       > requested format = gsm,
       > requested prefs = (),
       > actual format = gsm,
       > host prefs = (),
       > priority = mine
[2009-04-08 17:16:22] DEBUG[24858] pbx.c: Launching 'Set'
[2009-04-08 17:16:22] VERBOSE[24858] logger.c: [2009-04-08 17:16:22]     -- Executing [07xxxxxx503@01133326209:1] Set("IAX2/01133326209-11936", "CALLERID(num)=01133326209") in new stack
[2009-04-08 17:16:22] DEBUG[24858] pbx.c: Launching 'Set'
[2009-04-08 17:16:22] VERBOSE[24858] logger.c: [2009-04-08 17:16:22]     -- Executing [07xxxxxx503@01133326209:2] Set("IAX2/01133326209-11936", "CALLERID(ANI)=01133326209") in new stack
[2009-04-08 17:16:22] DEBUG[24858] pbx.c: Launching 'Dial'
[2009-04-08 17:16:22] VERBOSE[24858] logger.c: [2009-04-08 17:16:22]     -- Executing [07xxxxxx503@01133326209:3] Dial("IAX2/01133326209-11936", "SIP/toSwitchConnectVoIP/447783967503") in new stack
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: Asked to create a SIP channel with formats: 0x2 (gsm)
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: Allocating new SIP dialog for (No Call-ID) - INVITE (With RTP)
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: Setting NAT on RTP to Off
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: *** Our native formats are 0x3f0008 (alaw|jpeg|png|h261|h263|h263p|h264)
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: *** Joint capabilities are 0x0 (nothing)
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: *** Our capabilities are 0x3f1fff (g723|gsm|ulaw|alaw|g726|adpcm|slin|lpc10|g729|speex|ilbc|g726aal2|g722|jpeg|png|h261|h263|h263p|h264)
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: *** AST_CODEC_CHOOSE formats are 0x8 (alaw)
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: *** Our preferred formats from the incoming channel are 0x2 (gsm)
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: This channel will not be able to handle video.
[2009-04-08 17:16:22] DEBUG[24858] rtp.c: Channel 'IAX2/01133326209-11936' has no RTP, not doing anything
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: Outgoing Call for 447xxxxxx503
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: Updating call counter for outgoing call
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: Our T38 capability (0), joint T38 capability (0)
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: ** Our capability: 0x3f08fe (gsm|ulaw|alaw|g726|adpcm|slin|lpc10|g726aal2|jpeg|png|h261|h263|h263p|h264) Video flag: False
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: ** Our prefcodec: 0x2 (gsm)
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: This call needs video offers, but there's no video support enabled!
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: -- Done with adding codecs to SDP
[2009-04-08 17:16:22] DEBUG[24858] channel.c: Internal timing is disabled (option_internal_timing=0 chan->timingfd=-1)
[2009-04-08 17:16:22] DEBUG[24858] chan_sip.c: Done building SDP. Settling with this capability: 0x3f08fe (gsm|ulaw|alaw|g726|adpcm|slin|lpc10|g726aal2|jpeg|png|h261|h263|h263p|h264)
[2009-04-08 17:16:22] VERBOSE[24858] logger.c: [2009-04-08 17:16:22]     -- Called toSwitchConnectVoIP/447xxxxxx503
[2009-04-08 17:16:22] DEBUG[24858] channel.c: Set channel SIP/toSwitchConnectVoIP-08374570 to read format slin
[2009-04-08 17:16:22] DEBUG[24858] channel.c: Set channel IAX2/01133326209-11936 to write format slin
[2009-04-08 17:16:22] DEBUG[24858] channel.c: Set channel IAX2/01133326209-11936 to read format slin
[2009-04-08 17:16:22] DEBUG[24858] channel.c: Set channel SIP/toSwitchConnectVoIP-08374570 to write format slin
Please post, sip.conf  -  remove any authentication and IP information before posting..

Looking for the settings for SIP/toSwitchConnectVoIP.
Avatar of JAY186

ASKER

The relevant section of sip.conf, minus commented out lines:

[toSwitchConnectVoIP]
type=peer
host=xxx.xxx.45.109
port=5066
canreinvite=no
dtmfmode=rfc2833
allow=all
deny=0.0.0.0/0
permit=xxx.xxx.45.109/32
insecure=very ;invite,port
I'm wondering if the cellphone provider is blocking the name...

Setting the callerid in the dialplan should force it to use whatever is there..... so i'm leaning toward provider setup issue, or the cell phone provider is blocking the name portion. Have you tried calling a land line with the call id name set ?
Avatar of JAY186

ASKER

I don't think it'd down to the cellphone people (O2 in this case), as when there is something in the Zoiper Callerid field, then the CLI comes through just fine.

Also, Switch Telecom (who are providing the trunk via which Asterisk connects to the outside world) are also saying that the calls which come through to my mobile with no CLI also have no CLI when they pass through Switch's network.

The really weird thing is how the presence or absense of data in the callerid field of the softphone appears to somehow control this behaviour.

Put *anything at all* in the number field in Zoiper, whether it's a phone numbr or just random text (as I've said, I've tested this by typing the word "gibberish" into that field), and then the extensions.conf settings work, and the correct CLI (not the nonsense in the Zoiper fields) is provided when the call goes out.  But if the callerid number field in Zoiper is left blank, then even though Asterisk's log shows the "Set" commands being carried out, no CLI is set on the line, and both Switch and O2 see the calls with no CLI.

As the upstream trunk needs the CLIs to be able to accurately bill the calls, we absolutely have to get this working properly - it's driving me up the wall at the moment!
For now I would hard code the CLI in the zoiper until we can get this sorted.  This is strange issue that i've never encountered before...

Hardcoding callerid(name) in the dialplan should always override whatever the soft/hard phone sends.
I guess I should have already asked you this...but what version of Asterisk are you running ?
Avatar of JAY186

ASKER

Version: Asterisk 1.4.19.2

Unfortunately we don't control all the phones that will be connecting, when the service launches end users will make calls and be billed for them, so it's absolutely vital that every caller's CLI is set by Asterisk.

(sorry, meant to post this last night, but evidently forgot to click submit!)
I'm at a loss on this one....it should "just work"...especially if it already works from the softphone.


I've never had to do this myself, but i'm pretty sure it is possible to run a sniffer such as wireshark to examine the SIP header for callerid information.

I would try that, so that you can verify if the server is actually sending the information, and whether or not the carrier just isn't recieving it for whatever reason...
....normally I would never suggest this.... but when all else fails, maybe it's time to upgrade to the latest version.
Ok...I think this might be it....

Have you tried using the........ fromuser="yourcallername" <5555555555>  
......in the peer entry ?

[your_provider]
type=peer
fromuser="Yourname" <5555555555>
canreinvite=no
insecure=very
host= xxx.xxx.xxx.xxx
disallow=all
allow=ulaw
qualify=yes
nat=no

http://www.voip-info.org/wiki-Asterisk+config+sip.conf
fromuser = <from_ID> : Specify user to put in "from" instead of $CALLERID(number) (overrides the callerid) when placing calls _to_ peer (another SIP proxy). Valid only for type=peer.
Avatar of JAY186

ASKER

Won't that mean that all outbound calls will end up with the same CLI?  We need a different CallerID per connected user, this isn't an internal PBX type setup, it'll have general users, each with their own CallerID.  Will have a bash though and see what happens.  Ta!
True.... I think that would send the same clid for every call sent to the trunk.

I'm not sure if there is a way to programatically change it within the dialplan though...
I wonder if adding sip headers could fix this.

I found this on the wiki.

Sip header manipulation examples
These examples may be beneficial when interfacing Asterisk with a Nortel SST or an Acme Packet SBC.

Sending RFC-3323 compliant privacy headers in sip calls

ftp://ftp.rfc-editor.org/in-notes/rfc3323.txt 

  exten => _9.,1,SIPAddHeader(P-Asserted-Identity: <sip:+1${CALLERID(num)}\;user=phone>)  
  exten => _9.,n,SIPAddHeader(Privacy: user\; header\; session)  
  exten => _9.,n.SetCallerPres(prohib_not_screened) ; this might not be needed --- needs further testing
  exten => _9.,n,Set(CALLERID(num)=)  
  exten => _9.,n,Set(CALLERID(name)=Anonymous)  
  exten => _9.,n,Dial(SIP/+${EXTEN:1}@sipcarrier)  
  exten => _9.,n,Hangup()

Sending RFC-3325 compliant privacy headers in sip calls

ftp://ftp.rfc-editor.org/in-notes/rfc3325.txt 

  exten => _9.,1,SIPAddHeader(P-Preferred-Identity: <sip:+1${CALLERID(num)}\;user=phone>)  
  exten => _9.,n,SIPAddHeader(Privacy: id)  
  exten => _9.,n.SetCallerPres(prohib_not_screened) ; this might not be needed --- needs further testing
  exten => _9.,n,Set(CALLERID(num)=)
  exten => _9.,n,Set(CALLERID(name)=Anonymous)
  exten => _9.,n,Dial(SIP/+${EXTEN:1}@sipcarrier)
  exten => _9.,n,Hangup()
Avatar of JAY186

ASKER

I tried it like this:

exten => _07.,1,SIPAddHeader(P-Asserted-Identity: <sip:+1${CALLERID(num)};user=phone>)
exten => _07.,n,SIPAddHeader(Privacy: user\; header\; session)
exten => _07.,n,SetCallerPres(prohib_not_screened)
exten => _07.,n,Set(CALLERID(num)=01133326209)
exten => _07.,n,Set(CALLERID(name)=01133326209)
exten => _07.,n,Dial(SIP/toSwitchConnectVoIP/44${EXTEN:1})

Still no joy - now the CallerID doesn't come through at all, regardless of what is in the CallerID box on the softphone.

We're going to try upgrading to 1.4.24.1 (from 1.4.19.2), and see if that changes anything.
Avatar of JAY186

ASKER

Update: Tried upgrading to 1.4.24.2, still no joy - behaviour is exactly the same.
Avatar of JAY186

ASKER

More info:

This problem only appears to affect Zoiper softphones.  One of our engineers has tried a variety of other softphones, and not encountered the same problem, so whatever is clearing the CallerID (and over-riding the setting of it in Asterisk) is specific to Zoiper.  Anyone got any theories on this?
Avatar of JAY186

ASKER

Update:  The problem is with the server running Asterisk.

Having exhausted all possible configuration options, we installed Asterisk on a different system (SuSE based), duplicated the config exactly (bar the local IP in sip.conf) and repeated the tests.  Asterisk performed correctly with the dial plan (extensions.conf) settings over-riding whatever was set in the softphone, or adding them if the softphone was cleared of CallerID.

The server in question will now be replaced by a SuSE-based system.

The configuration which displayed the problem was Asterisk 1.4.x running on CentOS.

Thanks to everyone for looking at the issue with us, it was a very bizarre and seemingly one-off fault.
ASKER CERTIFIED SOLUTION
Avatar of JAY186
JAY186

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,
I'm having exactly the same issue, Asterisk on PBX in a Flash isn't displaying caller ID on my home land line or mobile. Please can you tell me how you set Asterisk to run as root?