Index: channels/chan_sip.c
===================================================================
--- channels/chan_sip.c	(.../trunk)	(revision 16389)
+++ channels/chan_sip.c	(.../team/oej/stopshrinkinguris)	(revision 16389)
@@ -7234,7 +7234,8 @@
 			*c = '\0';
 		tmp = ast_strdupa(of);
 		if (tmp) {
-			ast_shrink_phone_number(tmp);
+			if (ast_is_shrinkable_phonenumber(tmp))
+				ast_shrink_phone_number(tmp);
 			ast_string_field_set(p, cid_num, tmp);
 		} else {
 			ast_string_field_set(p, cid_num, of);
@@ -7265,7 +7266,8 @@
 				ast_string_field_set(p, cid_name, calleridname);
 			tmp = ast_strdupa(rpid_num);
 			if (tmp) {
-				ast_shrink_phone_number(tmp);
+				if (ast_is_shrinkable_phonenumber(tmp))
+					ast_shrink_phone_number(tmp);
 				ast_string_field_set(p, cid_num, tmp);
 			} else {
 				ast_string_field_set(p, cid_num, rpid_num);
@@ -7301,7 +7303,8 @@
 			if (!ast_strlen_zero(user->cid_num) && !ast_strlen_zero(p->cid_num)) {
 				char *tmp = ast_strdupa(user->cid_num);
 				if (tmp) {
-					ast_shrink_phone_number(tmp);
+					if (ast_is_shrinkable_phonenumber(tmp))
+						ast_shrink_phone_number(tmp);
 					ast_string_field_set(p, cid_num, tmp);
 				} else {
 					ast_string_field_set(p, cid_num, user->cid_num);
@@ -7376,7 +7379,8 @@
 				if (*calleridname)
 					ast_string_field_set(p, cid_name, calleridname);
 				if (tmp) {
-					ast_shrink_phone_number(tmp);
+					if (ast_is_shrinkable_phonenumber(tmp))
+						ast_shrink_phone_number(tmp);
 					ast_string_field_set(p, cid_num, tmp);
 				} else {
 					ast_string_field_set(p, cid_num, rpid_num);
@@ -7430,7 +7434,8 @@
 				if (!ast_strlen_zero(peer->cid_num) && !ast_strlen_zero(p->cid_num)) {
 					char *tmp = ast_strdupa(peer->cid_num);
 					if (tmp) {
-						ast_shrink_phone_number(tmp);
+						if (ast_is_shrinkable_phonenumber(tmp))
+							ast_shrink_phone_number(tmp);
 						ast_string_field_set(p, cid_num, tmp);
 					} else {
 						ast_string_field_set(p, cid_num, peer->cid_num);
Index: channels/chan_iax2.c
===================================================================
--- channels/chan_iax2.c	(.../trunk)	(revision 16389)
+++ channels/chan_iax2.c	(.../team/oej/stopshrinkinguris)	(revision 16389)
@@ -7973,7 +7973,7 @@
 		case IAX_IOSTATE_SCHEDREADY:
 			thread->actions++;
 			thread->iostate = IAX_IOSTATE_PROCESSING;
-#ifdef SCHED_MULTITHREADED
+#ifdef SCHED_MULTITHREAD
 			thread->schedfunc(thread->scheddata);
 #endif		
 			break;
Index: include/asterisk/callerid.h
===================================================================
--- include/asterisk/callerid.h	(.../trunk)	(revision 16389)
+++ include/asterisk/callerid.h	(.../team/oej/stopshrinkinguris)	(revision 16389)
@@ -193,12 +193,19 @@
  */
 extern void ast_shrink_phone_number(char *n);
 
-/*! \brief Check if a string consists only of digits.   
+/*! \brief Check if a string consists only of digits and + \#
     \param n number to be checked.
     \return Returns 0 if n is a number, 1 if it's not.
  */
 extern int ast_isphonenumber(char *n);
 
+/*! \brief Check if a string consists only of digits and and + \# ( ) - .
+	(meaning it can be cleaned with ast_shrink_phone_number)
+    \param exten The extension (or URI) to be checked.
+    \return Returns 0 if n is a number, 1 if it's not.
+ */
+extern int ast_is_shrinkable_phonenumber(char *exten);
+
 extern int ast_callerid_split(const char *src, char *name, int namelen, char *num, int numlen);
 
 extern char *ast_callerid_merge(char *buf, int bufsiz, const char *name, const char *num, const char *unknown);
Index: callerid.c
===================================================================
--- callerid.c	(.../trunk)	(revision 16389)
+++ callerid.c	(.../team/oej/stopshrinkinguris)	(revision 16389)
@@ -905,21 +905,42 @@
 	n[y] = '\0';
 }
 
-/*! \brief checks if string consists only of digits and * \# and + 
-	\return 1 if string is valid AST phone number
-	\return 0 if not
+/*! \brief Checks if phone number consists of valid characters 
+	\param exten	String that needs to be checked
+	\param valid	Valid characters in string
+	\return 1 if valid string, 0 if string contains invalid characters
 */
-int ast_isphonenumber(char *n)
+static int ast_is_valid_string(char *exten, char *valid)
 {
 	int x;
-	if (ast_strlen_zero(n))
+
+	if (ast_strlen_zero(exten))
 		return 0;
-	for (x=0;n[x];x++)
-		if (!strchr("0123456789*#+", n[x]))
+	for (x=0; exten[x]; x++)
+		if (!strchr(valid, exten[x]))
 			return 0;
 	return 1;
 }
 
+/*! \brief checks if string consists only of digits and * \# and + 
+	\return 1 if string is valid AST phone number
+	\return 0 if not
+*/
+int ast_isphonenumber(char *n)
+{
+	return ast_is_valid_string(n, "0123456789*#+");
+}
+
+/*! \brief checks if string consists only of digits and ( ) - * \# and + 
+	Pre-qualifies the string for ast_shrink_phone_number()
+	\return 1 if string is valid AST shrinkable phone number
+	\return 0 if not
+*/
+int ast_is_shrinkable_phonenumber(char *exten)
+{
+	return ast_is_valid_string(exten, "0123456789*#+()-.");
+}
+
 /*! \brief parse string for caller id information 
 	\return always returns 0, as the code always returns something.
   XXX note that 'name' is not parsed consistently e.g. we have

