Summary:ASTERISK-05118: IAX sets CALLERPRES to NOT AVAILABLE if no number is in CALLERID
Reporter:Jesse Keating (jkeating)Labels:
Date Opened:2005-09-21 01:46:26Date Closed:2005-10-13 20:30:59
Versions:Frequency of
Description:If a call is being made through IAX, if there is no number in CALLERID, IAX sets CALLERPRES to NOT AVAILABLE.


This causes problems in my case specifically as I hard set CALLERID to "Outside Caller" when calls originate from one of my Zap trunks.  (callerid=Outside Caller  in zapata.conf).  Because I don't use a number (which I don't want to show a number), IAX causes CallerID to show as Unknown/Unknown on my phones.  If I use Setcallerpres(enabled) after the IAX call and prior to the SIP call to my phone, my phone will show the correct information (other than autofilling in 'asterisk' for a number).  Twisted helped me in diagnosing this problem.
Comments:By: twisted (twisted) 2005-09-21 01:52:08

The problem here is on line 2900 in chan_iax2.c.  if we don't recieve a number, we CHANGE the calling presentation.  We shouldn't change it, but pass it as it's set from either the network on the other end, or by using setcallingpres().  

By running a test between two boxes, if we recieve a call into box A which presents no number, and before we pass the call across iax2 to box b, the CALLINGPRES var is 0 (presentation allowed).  Once we recieve the call on the other side, the CALLINGPRES var is 67, which indicates we're saying "NETWORK NUMBER NOT AVAILABLE".  This would be OK if iax2 was the network, but since we had a callingpres set by the originating server, we should have passed exactly what we recieved.

I understand how we're doing the presentation here, but we're assuming that any iax2 call made should be treated as if the originator is the network, which is not always the case.  perhaps we need to expand this out to a configurable option for iax2 similar to the one in zaptel for usecallingpres, or perhaps a per-peer config variable of sorts to let us determine if we are going to pretend to be the network and set the callingpres based on what we see, or simply pass it along.

By: twisted (twisted) 2005-09-21 01:54:18

sorry, i should have specified that it was on line 2900 of CVS-HEAD.   The presentation code has not been modified since 1.2.0-b1, therefore it should be around the same location or at least somewhere close.  you can search for AST_PRES_NUMBER_NOT_AVAILABLE and there will only be one match.

By: Kevin P. Fleming (kpfleming) 2005-09-25 21:58:47

I don't believe chan_iax2 is at fault here; the real issue is that you if don't want to send any CLID/CNAM from your Zap-attached phones, then chan_zap should provide you a way to indicate that calls placed via those phones should have the presentation set to 'restricted'. This is a much better solution than forcing the CLID to be a non-numeric value, which many devices will reject anyway.

However, this leads into a discussion that oej and I have already had related to SIP; we need to be able to define each peer as a 'trusted' or 'untrusted' endpoint (phone vs. network, etc.), and handle the outbound CLID/CNAM/CLIR appropriately. This is a much larger change than we can do for 1.2, though.

By: twisted (twisted) 2005-09-26 12:40:34

This  has abosolutely nothing to do with text in the numeric field.    Did you actually read and understand the problem?   The problem is that iax2 decides for itself that since there is no number, that it should set the callingpres bits, which is not proper.  It should follow the bits set by the call wherever it originated, and NOT TOUCH THEM.

As of present, it modifies the calilngpres bits based on what it sees fit.

By: Kevin P. Fleming (kpfleming) 2005-09-26 14:35:56

Yes, I did read it :-) I just think that this is _also_ a configuration problem and we should support setting the outgoing presentation from chan_zap, rather than asking people to put bogus information in the CLID to accomplish the same thing. If the OP had chosen to put '000-000-0000' in CLID instead of 'Outside Caller' it would have been carried over chan_iax2 without a problem, since it would not be stripped away for being non-numeric.

Note also that chan_iax2 is _NOT_ setting the presentation to restricted, it is setting it to 'unavailable', which is exactly correct, since there is no number available. At this time we do not have the ability in Asterisk to handle presentation settings separately for CLID and CNAM, so when the number is not available, the whole thing gets marked 'unavailable'.

On the PSTN (using signaling capable of carrying presentation information), there will never be a situation where the CLID is not provided _and_ the presentation is not _also_ set to 'unavailable'. chan_iax2 is doing the same thing a telco switch speaking PRI would do when it sends out a call that does not have any CLID.

This whole area in Asterisk is a bit of a mess at the moment... but I'm hesitant to change chan_iax2 to no longer send 'unavailable' when it's not going to send CLID.

By: Jesse Keating (jkeating) 2005-10-03 11:36:03

There is no callerID information coming in through the ZAP.  This particular ZAP channel is connected to a Legacy PBX that is not sending any CID information.  This is why I am overriding it with 'Outside Caller'.  I do not want any number information as it clutters the phone screen and could potentially confuse callers.  I want just name.  The current way that chan_iax is coded prevents me from accomplishing what I need.

By: Kevin P. Fleming (kpfleming) 2005-10-04 19:46:08

But the PSTN (which Asterisk is designed around) does not support sending CNAM _only_ :-) There is always an associated CLID. That is why UNAVAILABLE is the right setting when no number has been provided, and also why the CNAM gets overridden in that situation. Without changing to some system that supports separate presentation controls for CLID and CNAM, I don't see a reasonable way to accomplish what you want to do.

By: Jesse Keating (jkeating) 2005-10-04 19:50:36

But you already code around the possibility of this, because the missing number info is replaced by 'asterisk' on my phones.  I suppose I could jump the gun and set the CIDNUM to 'asterisk' but I wasn't sure how the systme would take chars instead of digits.

By: Kevin P. Fleming (kpfleming) 2005-10-13 20:30:26

Mark has already updated CVS HEAD to allow the existing presentation settings to be used if -either- the CLID or CNAM are provided, which should provide a solution to this problem.