Hi
It was come to my attention that sometimes CANCEL request does not pass through proxy to destination. Failing scenario feature - proxy receives CANCEL request from call originator BEFORE provisional response 100 come from destination. Sippipe sends cancel request to client transaction but this cannot be canceled being in state 'calling' until received 100 response and changed state to 'proceeding'. The code has all required logic, but minor bug did not allow this work properly. clienttransaction:act_on_new_sipstate/4 function had too curled set of guards causing invalid arguments match behavior. Also minor correction to act_on_new_sipstate2 required.
Attached patch looks working properly in my tests.
Thanks.

Index: lib/yxa/src/clienttransaction.erl
===================================================================
--- lib/yxa/src/clienttransaction.erl   (revision 1151)
+++ lib/yxa/src/clienttransaction.erl   (working copy)
@@ -809,18 +809,18 @@
 %%           NewState        = state record()
 %%           NewBranchAction = atom(), ignore | tell_parent
 %%--------------------------------------------------------------------
-act_on_new_sipstate(OldSipState, NewSipState, BranchAction, State)
-  when is_atom(OldSipState), is_atom(NewSipState), is_atom(BranchAction),
-       BranchAction == ignore; BranchAction == tell_parent,
-       is_record(State, state), OldSipState == NewSipState ->
-    %% State has not changed
-    {State, BranchAction};
-act_on_new_sipstate(OldSipState, NewSipState, BranchAction, State)
-  when is_atom(OldSipState), is_atom(NewSipState), is_atom(BranchAction),
-       BranchAction == ignore; BranchAction == tell_parent,
-       is_record(State, state) ->
-    %% State has changed
-    act_on_new_sipstate2(NewSipState, BranchAction, State).
+%% State has not changed
+act_on_new_sipstate(SipState, SipState, ignore, State = #state{}) when 
is_atom(SipState) ->
+    {State, ignore};
+act_on_new_sipstate(SipState, SipState, tell_parent, State = #state{}) when 
is_atom(SipState) ->
+    {State, tell_parent};
+%% State has changed
+act_on_new_sipstate(OldSipState, NewSipState, ignore, State = #state{})
+when is_atom(OldSipState), is_atom(NewSipState) ->
+    act_on_new_sipstate2(NewSipState, ignore, State);
+act_on_new_sipstate(OldSipState, NewSipState, tell_parent, State = #state{})
+when is_atom(OldSipState), is_atom(NewSipState) ->
+    act_on_new_sipstate2(NewSipState, tell_parent, State).
 
 %%--------------------------------------------------------------------
 %% Function: act_on_new_sipstate2(proceeding, BranchAction, State)
@@ -853,7 +853,7 @@
                    ?LOG_DEBUG("~s: A previously cancelled transaction (INVITE 
~s) "
                               "entered state 'proceeding' upon receiving a '~p 
~s' response. "
                               "CANCEL ourselves!", [State#state.logtag, 
sipurl:print(URI), Status, Reason]),
-                   NewState1 = State#state{do_cancel=false},
+                   NewState1 = State#state{cancelled=false, do_cancel=false},
                    NewState2 = cancel_request(NewState1, ExtraHeaders),
                    {NewState2, ignore};
                false ->
_______________________________________________
Yxa-devel mailing list
Yxa-devel@lists.su.se
https://lists.su.se/mailman/listinfo/yxa-devel

Reply via email to