[Serusers] New save_noreply() function for the registrar module

Jan Janak jan at iptel.org
Fri Mar 21 20:52:14 CET 2003


Hello Maxim,

thanks, I will integrate the patch.

  regards, Jan.

On 21-03 18:33, Maxim Sobolev wrote:
> Folks,
> 
> We found that in some cases it is necessary to have a function which
> will save contact without sending reply to the UA. For example, it is
> useful when there is a need to do stateless forwarding of the REGISTER
> request, but at the same time save it in the local registration
> database (sending reply in this case will disable any retransmissions
> that might be necessary to ensure that the request actually reached the
> destination). Attached patch provides necessary functionality, it would
> be nice to have it included into the next release.
> 
> Thanks!
> 
> -Maxim

> --- modules/registrar/reg_mod.c	2003/03/21 13:37:50	1.1
> +++ modules/registrar/reg_mod.c	2003/03/21 13:39:05
> @@ -64,18 +64,21 @@
>  	"registrar", 
>  	(char*[]) {
>  		"save",
> +		"save_noreply",
>  		"lookup"
>  	},
>  	(cmd_function[]) {
>  		save, 
> +		save_noreply,
>  		lookup
>  	},
> -	(int[]){1, 1},
> +	(int[]){1, 1, 1},
>  	(fixup_function[]) {
>  		domain_fixup, 
> +		domain_fixup, 
>  		domain_fixup
>  	},
> -	2,
> +	3,
>  	
>  	(char*[]) { /* Module parameter names */
>  		"default_expires",
> --- modules/registrar/save.c	2003/03/21 13:34:00	1.1
> +++ modules/registrar/save.c	2003/03/21 13:37:00
> @@ -309,11 +309,20 @@
>  	return 0;
>  }
>  
> +int save(struct sip_msg* _m, char* _t, char* _s)
> +{
> +	return save_real(_m, _t, _s, 1);
> +}
> +
> +int save_noreply(struct sip_msg* _m, char* _t, char* _s)
> +{
> +	return save_real(_m, _t, _s, 0);
> +}
>  
>  /*
>   * Process REGISTER request and save it's contacts
>   */
> -int save(struct sip_msg* _m, char* _t, char* _s)
> +int save_real(struct sip_msg* _m, char* _t, char* _s, int doreply)
>  {
>  	contact_t* c;
>  	int st;
> @@ -349,10 +358,10 @@
>  		if (contacts(_m, c, (udomain_t*)_t, &user) < 0) goto error;
>  	}
>  
> -	if (send_reply(_m) < 0) return -1;
> +	if (doreply && send_reply(_m) < 0) return -1;
>  	else return 1;
>  	
>   error:
> -	send_reply(_m);
> +	if (doreply) send_reply(_m);
>  	return 0;
>  }
> --- modules/registrar/save.h	2003/03/21 13:37:14	1.1
> +++ modules/registrar/save.h	2003/03/21 13:37:40
> @@ -39,7 +39,9 @@
>  /*
>   * Process REGISTER request and save it's contacts
>   */
> +int save_real(struct sip_msg* _m, char* _t, char* _s, int);
>  int save(struct sip_msg* _m, char* _t, char* _s);
> +int save_noreply(struct sip_msg* _m, char* _t, char* _s);
>  
>  
>  #endif /* SAVE_H */

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20030321/cd3e2e71/attachment.pgp>


More information about the sr-users mailing list