[OpenSIPS-Devel] bug in unset_dlg_profile (dialog module)?

Bogdan-Andrei Iancu bogdan at voice-system.ro
Thu Oct 9 11:33:57 CEST 2008


Hi Herman,

You are right - I haven't foreseen the case of a dialog being multiple 
times part of the same profile. I will apply the fix on the SVN.

Thanks and regards,
Bogdan

Herman Bastiaens wrote:
> Hi,
>
> scenario:
> I'm using the dialog module to get information about active dialogs in
> certain profiles, with certain values. It's possible that a dialog is
> inserted into a profile multiple times, with different values, ex.
> dialog "d1" is in profile "group" with value "A", "B".
> As the values are chosen at runtime, I can't split them up in profiles,
> and I really need the dialog to be in more than one group at a time.
>
> bug?
> when I invoke "unset_dlg_profile ( profile, value )" I get an error that
> the dialog could not be removed from the profile, although I'm sure it is
> in the profile with the value I pass to opensips. I believe this is caused
> by an error in the unset_dlg_profile function in dlg_profile.c (dialog
> module):
>
> <code>
> for( ; linker ; linker_prev=linker,linker=linker->next) {
> 		if (linker->profile==profile) {
> 			if (profile->has_value==0) {
> 				goto found;
> 			} else if (value && value->len==linker->hash_linker.value.len &&
> 			memcmp(value->s,linker->hash_linker.value.s,value->len)==0){
> 				goto found;
> 			}
> 			dlg_unlock( d_table, d_entry);
> 			return -1;
> 		}
> 	}
> </code>
>
> I believe there is a linker for each <profile, value> pair, so the "return
> -1;" in this for loop should be removed. The current routine will only
> work correctly if the value passed, is the value of the first linker.
>
>
> Am I missing something?
> Is it safe to just remove the "return -1" (that does the trick for my
> specific scenario)?
>
> Thanks
>
> - Herman
>
>
> _______________________________________________
> Devel mailing list
> Devel at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>
>   




More information about the Devel mailing list