< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index Next in Thread >

Re: [reSIProcate-users] InviteSession::reject Assertion '0' failed. How to handle multithread ?


Aurelien Grimaud a écrit :
Hi,
I have a problem with InviteSession usage.

I have an application based on resiprocate which has different sources of event. SipStack is one of them, but also two other sources which interacts with initial client or server dialog. Each source runs in a different thread and can interact with a SIP dialog, by rejecting the call for instance.

My problem is syncronization with the ServerInviteSession state.
The application thread receives a new ServerSession commands from InviteSessionHandler. The application thread pushes a 100 provisional to dum using dum.post() (which is later sent via ServerInviteSessionHandler) The application thread receives an offer commands from InviteSessionHandler.
then in parallel :
The application thread wants to reject the call and schedule a reject by pushing a reject command with dum::post() The UAC cancels the call, the application threads receives an onTerminated() dum treats the reject command -> assert(0) because ServerInviteSession is in state Terminated.

How should it be handled if I do not want to run everything in one thread ?
I could test the mState but it is private ...
Well, I guess I could use InviteSession->isTerminated() to test state, and not call reject() on a terminated session. Note that if you cannot call reject() on a Terminated session, calling provisional(), end() or accept() will lead to no-op, calling provideOffer(), requestOffer() or provideAnswer() will throw a DialogUsageException.
Should not all command lead to throw, or assert, or no-op ?

The other problem is that I am actually testing wether handler is valid or not before calling reject, and it is valid. But, when receiving CANCEL, the handler should have been invalidated in dispatchCancel, right ?

I'll have a closer look to output and find out what is happening there.
Meanwhile, any comment is welcome.

Aurelien
Thanks.

Aurelien




_______________________________________________
resiprocate-users mailing list
resiprocate-users@xxxxxxxxxxxxxxx
List Archive: http://list.resiprocate.org/archive/resiprocate-users/