Summary:ASTERISK-04451: [patch] Characters are removed from caller ID numbers that are not phone numbers
Reporter:jcomellas (jcomellas)Labels:
Date Opened:2006-02-09 15:03:56.000-0600Date Closed:2009-10-07 09:08:48
Versions:Frequency of
Environment:Attachments:( 0) invalid_sip_caller_id_when_not_phonenumber.diff
( 1) stopshrinkinguris.diff
Description:When Asterisk receives a call from a party that is sending a SIP URI as its caller ID number, it calls ast_shrink_phone_number() on it even if it's not a phone number. For example, if the SIP message contains this "From" header:

From: "Juan Jose Comellas" <sip:juan.comellas@novamens.com>;tag=as16ac88e2

Asterisk will set the caller ID name to "Juan Jose Comellas" and the caller ID number to "juancomellas", which is obviously invalid. To solve this problem I've added a new function in callerid.{h,c} called ast_is_fancy_phonenumber() that checks whether the caller ID number is a phone number (including characters normally used to display human-readable phone numbers). I've also added a call to this function before trying to shrink the phone number in all the places where this is done in channels/chan_sip.c

This problem may affect other parts or channels in Asterisk, but I don't have enough knowledge of them to change the other calls to ast_shrink_phone_number().

Please let me know if I should do the same for the other calls to ast_shrink_phone_number().
Comments:By: jcomellas (jcomellas) 2006-02-09 15:05:28.000-0600

BTW, Asterisk also removes the domain of the SIP URI when calculating the caller ID number, even if it's not the local domain/realm.

By: jcomellas (jcomellas) 2006-02-27 15:35:34.000-0600

Was the patch OK? Is there anything I need to change to deem the patch acceptable in Asterisk?

By: Olle Johansson (oej) 2006-02-28 01:31:40.000-0600

I will look at this soon and try to decide a proper path here. In SIP theory, we should never remove anything from a SIP uri. From a Tel: uri we can run ast_shrink, but never ever a SIP uri. I need to discuss which way is the best way to pursue this.

I've known about this problem for a long time, just waited for a bug report to get some wood for my fire, so thank you for reporting this.

By: jcomellas (jcomellas) 2006-03-20 12:25:31.000-0600

Do you need anything from me to move forward with the correction for this bug?

By: Fred (fjean) 2006-03-26 10:24:47.000-0600

Hello, it's my first time I post to this list; I notice that since I installed 1.2.5, I lost my caller IDs, I'll give you an example: I use to get this:  "Tripagel - Abratel" <883169> and now I get only the latest part: "883169"


At first I thought it was because I had implemented SIP realtime and all my callerid were set to NULL in the DB, but I removed the column and it continues the same way. I really need to resolve this problem and I was wondering if this bug is related to my mine, I am not 100% sure. Thank you for your feedback.
If necessary I will apply this patch as soon as I get a confirmation from you.

fjean @ sunnet group dot net

By: jcomellas (jcomellas) 2006-03-26 11:15:52.000-0600

I don't think your problem is related to this bug at all. I'm not using realtime myself, but I would advise you to make sure that all the users have their names set in Asterisk's configuration. I do that with my sip.conf and I've never had any problems with the caller ID name.

By: Olle Johansson (oej) 2006-03-26 18:14:45.000-0600

Will discuss solutions to this with kpfleming this week.

By: Olle Johansson (oej) 2006-03-29 11:27:06.000-0600

I now have a plan that is approved by Mark on how to fix this. Stay tuned.

By: Olle Johansson (oej) 2006-03-29 16:11:52.000-0600

Test the branch "team/oej/stopshrinkinguris"

By: Olle Johansson (oej) 2006-03-29 16:12:37.000-0600

The patch is basically your patch with different naming...

By: Olle Johansson (oej) 2006-03-29 22:18:23.000-0600

Patch committed in svn trunk rev 16425