[SR-Users] www_challenge(realm, flags) question

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Oct 7 16:04:25 CEST 2010


On Oct 07, 2010 at 16:36, Juha Heinanen <jh at tutpro.com> wrote:
> Andrei Pelinescu-Onciul writes:
> 
> > Sorry, it's slb.freply(), but you also need to send reason as str
> > (in auth_send_reply reason is char, but slb.freply() expects a str*
> > reason).
> 
> thanks.  i made the changes to auth_send_reply() and after that
> proxy_challenge()/www_challenge() worked ok both when t_newtran() was
> called earlier or not.  also the warnings about unreleased transactions
> disappeared.
> 
> changed function is below?  is it ok to commit it to master and 3.1?
> 
> -- juha
> 
> static int auth_send_reply(struct sip_msg *msg, int code, char *reason,
> 					char *hdr, int hdr_len)
> {
>         str reason_str;
> 
> 	/* Add new headers if there are any */
> 	if ((hdr!=NULL) && (hdr_len>0)) {
> 		if (add_lump_rpl(msg, hdr, hdr_len, LUMP_RPL_HDR)==0) {
> 			LM_ERR("failed to append hdr to reply\n");
> 			return -1;
> 		}
> 	}
> 
> 	reason_str.s = reason;
> 	reason_str.len = strlen(reason);
> 
> 	return slb.freply(msg, code, &reason_str);
> }


I would add a new modparam: force_stateless_reply, default 0 and then

return force_stateless_reply ?
        slb.sreply(msg, code, &reason_str) :
        lb.freply(msg, code, &reason_str);

This way if I'm paranoid about performance and I want stateless reply, I
can avoid a transaction lookup.


Andrei



More information about the sr-users mailing list