< Previous by Date | Date Index | Next by Date > |
< Previous in Thread | Thread Index | Next in Thread > |
I found that resiprocate already provides some methods to post commands to the dum thread. But there is no endCommand that takes an user reason as argument so I created a patch for this. It was done using 1.9.10 but it is small so you can apply manually if you think it is worth. And this solved my problem. Thanks again , regards.
--- a/resiprocate-1.9.10/resip/dum/InviteSession.cxx
+++ b/resiprocate-1.9.10/resip/dum/InviteSession.cxx
@@ -736,9 +736,10 @@ InviteSession::end(EndReason reason)
class InviteSessionEndCommand : public DumCommandAdapter
{
public:
- InviteSessionEndCommand(const InviteSessionHandle& inviteSessionHandle, InviteSession::EndReason reason)
+ InviteSessionEndCommand(const InviteSessionHandle& inviteSessionHandle, InviteSession::EndReason reason, const Data& userReason = "")
: mInviteSessionHandle(inviteSessionHandle),
- mReason(reason)
+ mReason(reason),
+ mUserEndReason(userReason)
{
}
@@ -746,7 +747,14 @@ public:
{
if(mInviteSessionHandle.isValid())
{
- mInviteSessionHandle->end(mReason);
+ if (mReason == InviteSession::UserSpecified)
+ {
+ mInviteSessionHandle->end(mUserEndReason);
+ }
+ else
+ {
+ mInviteSessionHandle->end(mReason);
+ }
}
}
@@ -757,6 +765,7 @@ public:
private:
InviteSessionHandle mInviteSessionHandle;
InviteSession::EndReason mReason;
+ Data mUserEndReason;
};
void
@@ -766,6 +775,12 @@ InviteSession::endCommand(EndReason reason)
}
void
+InviteSession::endCommand(const Data& userReason)
+{
+ mDum.post(new InviteSessionEndCommand(getSessionHandle(), UserSpecified, userReason));
+}
+
+void
InviteSession::reject(int statusCode, WarningCategory *warning)
{
switch (mState)
--- a/resiprocate-1.9.10/resip/dum/InviteSession.hxx
+++ b/resiprocate-1.9.10/resip/dum/InviteSession.hxx
@@ -122,6 +122,7 @@ class InviteSession : public DialogUsage
virtual void provideAnswerCommand(const Contents& answer);
/** Asynchronously makes the specific dialog end. Will send a BYE (not a CANCEL) */
virtual void endCommand(EndReason reason = NotSpecified);
+ virtual void endCommand(const Data& userReason);
/** Asynchronously rejects an offer at the SIP level. Can also be used to
send a 488 to a reINVITE or UPDATE */
virtual void rejectCommand(int statusCode, WarningCategory *warning = 0);
From: slgodin@xxxxxxxxx [mailto:slgodin@xxxxxxxxx] On Behalf Of Scott Godin
Sent: quinta-feira, 25 de fevereiro de 2016 18:22
To: Diego Carvalho Domingos <ddomingos@xxxxxxxxxxxxxxx>
Cc: resiprocate-devel@xxxxxxxxxxxxxxx
Subject: Re: [reSIProcate] assertion: "DUM let me send a BYE at an incorrectstate"
The dum/test/basicClient sample app is a good sample for getting started. resip/recon is a more comprehensive example.
Scott
On Thu, Feb 25, 2016 at 4:02 PM, Diego Carvalho Domingos <ddomingos@xxxxxxxxxxxxxxx> wrote:
Thank you for answering. I indeed need to change my code to use this post mechanism to make it thread safe.
By the way, what’s the best example to follow on how to use dum?
Thanks again.
From: slgodin@xxxxxxxxx [mailto:slgodin@xxxxxxxxx] On Behalf Of Scott Godin
Sent: quarta-feira, 24 de fevereiro de 2016 17:56
To: Diego Carvalho Domingos <ddomingos@xxxxxxxxxxxxxxx>
Cc: resiprocate-devel@xxxxxxxxxxxxxxx
Subject: Re: [reSIProcate] assertion: "DUM let me send a BYE at an incorrectstate"
If I'm reading this correctly I think you might be using DUM in an unsupported way. (Almost) All calls to DUM methods (including end()) MUST occur from the DUM processing thread.
More information is here. You can use the methods described in the link to post messages to the DUM thread for legal calls.
Scott
On Wed, Feb 24, 2016 at 1:24 PM, Diego Carvalho Domingos <ddomingos@xxxxxxxxxxxxxxx> wrote:
Hi all,
I’m reopening this topic because I think it is not totally fixed. I had the exact same problem due to thread concurrency.
So, the original fix was:if(!isTerminated()) // make sure application didn't call end()
{
dispatchConnected(msg); // act as if we received message in Connected state
}
else
{
dispatchTerminated(msg);
}
But imagine that the application did not call end() from onOfferRequestRejected but pushed an event for another thread (in my case I call it CallManager). In this case, the !isTerminated test will pass and dispatchConnected will be executed. Inside this method, there is this code:
case OnInviteReliableOffer:*mLastRemoteSessionModification = msg;
transition(ReceivedReinvite);
If the context switches to the other thread before transition(ReceivedReinvite) and my CallManager thread sends a BYE (calls end()), the code would end up in the same situation when receiving the 200-OK for the BYE and would crash (assert(0)).
I don’t know what would be the final solution for this since I don’t know much of resiprocate code. Does anyone have a solution for this? Thanks in advance.
_______________________________________________
resiprocate-devel mailing list
resiprocate-devel@xxxxxxxxxxxxxxx
https://list.resiprocate.org/mailman/listinfo/resiprocate-devel
_______________________________________________
resiprocate-devel mailing list
resiprocate-devel@xxxxxxxxxxxxxxx
https://list.resiprocate.org/mailman/listinfo/resiprocate-devel
_______________________________________________
resiprocate-devel mailing list
resiprocate-devel@xxxxxxxxxxxxxxx
https://list.resiprocate.org/mailman/listinfo/resiprocate-devel