PJSIP is not using the correct branch on a reinit send with AUTH.
I have a client which uses PJSIP to send SIP commands to OfficeSIP
Server. I cannot make it ALWAYS send AUTH with CANCEL on early media
(i.e. the called phone is in RINGING state), so I am using
pjsua_call_hangup with 487. This sends a CANCEL request which is
rejected as unauthorised, so it reinitialises it in sip_auth_client.c
(pjsip_auth_clt_reinit_req) but this sets the branch length to zero and
reculates it (incorrectly because it tries to send the branch for the
unauthorised INVITE, not the authorised one).
The only way I have managed to "fix" this is to add the line
if (tdata->msg->line.req.method.id != PJSIP_CANCEL_METHOD)
before
via->branch_param.slen = 0;
in pjsip_auth_clt_reinit_req()
This then causes "Unable to register CANCEL transaction (key
exists)", so I have had to take out the "return PJ_EEXISTS" in
mod_tsx_layer_register_tsx()
which in turn causes a throw on pj_mutex_unlock() later in that routine.
In RELEASE mode, it works though, reliably.
It would be nice to have it working "properly", i.e. make it so it
ALWAYS used the correct branch for CANCEL, even if that means sending it
AUTHORISED first rather than having it retry after the 401 response, or
alternatively to have it calculate the correct branch on reinit.
I can't believe that I am the only one to have this problem.
_______________________________________________
Visit our blog: http://blog.pjsip.org
pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org