Browse Source

pua: is_dialog() returns 1 if there is a temporary dialog

- reported by Laura Testi
(cherry picked from commit 5f1e2caac5e6d68629a1a0956861bf7da6e05e31)

Conflicts:

	modules_k/pua/pua_db.c
Daniel-Constantin Mierla 13 years ago
parent
commit
17098e42e5
1 changed files with 11 additions and 3 deletions
  1. 11 3
      modules_k/pua/hash.c

+ 11 - 3
modules_k/pua/hash.c

@@ -425,6 +425,9 @@ int get_record_id(ua_pres_t* dialog, str** rec_id)
 	return 0;
 }
 
+/**
+ * return -1 on not found, 0 on established dialog, 1 on temporary dialog
+ */
 int is_dialog(ua_pres_t* dialog)
 {
 	int ret_code= 0;
@@ -433,10 +436,15 @@ int is_dialog(ua_pres_t* dialog)
 	hash_code= core_hash(dialog->pres_uri, dialog->watcher_uri, HASH_SIZE);
 	lock_get(&HashT->p_records[hash_code].lock);
 
-	if(get_dialog(dialog, hash_code)== NULL)
-		ret_code= -1;
-	else
+	if(get_dialog(dialog, hash_code)==NULL)
+	{
+		if(get_temporary_dialog(dialog, hash_code)==NULL)
+			ret_code= -1;
+		else
+			ret_code= 1;
+	} else {
 		ret_code= 0;
+	}
 	lock_release(&HashT->p_records[hash_code].lock);
 	
 	return ret_code;