--- chan_sip.c.orig	2007-10-16 09:08:10.000000000 +0200
+++ chan_sip.c	2007-10-16 09:13:46.000000000 +0200
@@ -7157,6 +7157,10 @@
 		else
 			ast_build_string(&t, &maxbytes, "<dialog id=\"%s\">\n", p->exten);
 		ast_build_string(&t, &maxbytes, "<state>%s</state>\n", statestring);
+	 	if((state & AST_EXTENSION_RINGING) && global_notifyringing && strstr(p->useragent,"THOMSON")){
+                        ast_build_string(&t, &maxbytes, "<local><identity display=\"%s\">%s</identity><target uri=\"%s\"/></local>\n", p->exten, mfrom, mfrom);
+                        ast_build_string(&t, &maxbytes, "<remote><identity display=\"%s\">sip:*8%s</identity><target uri=\"sip:*8%s\"/></remote>\n", "pickup", mto+4, mto+4);
+                }	
 		if (state == AST_EXTENSION_ONHOLD) {
 			ast_build_string(&t, &maxbytes, "<local>\n<target uri=\"%s\">\n"
 			                                "<param pname=\"+sip.rendering\" pvalue=\"no\">\n"
@@ -14795,8 +14799,10 @@
 			for it to expire and send NOTIFY messages to the peer only to have them
 			ignored (or generate errors)
 			*/
-			ast_mutex_lock(&iflock);
-			for (p_old = iflist; p_old; p_old = p_old->next) {
+			
+			if(!strstr(p->useragent,"THOMSON")){
+			    ast_mutex_lock(&iflock);
+			    for (p_old = iflist; p_old; p_old = p_old->next) {
 				if (p_old == p)
 					continue;
 				if (p_old->initreq.method != SIP_SUBSCRIBE)
@@ -14813,8 +14819,9 @@
 					}
 				}
 				ast_mutex_unlock(&p_old->lock);
+			    }
+			    ast_mutex_unlock(&iflock);
 			}
-			ast_mutex_unlock(&iflock);
 		}
 		if (!p->expiry)
 			ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
