Commit e7210cbc authored by Simon Morlat's avatar Simon Morlat

Add proprerty to prevent flexisip to send self-generated provisional responses during call forking.

parent 7ca8dc84
......@@ -27,17 +27,16 @@ namespace flexisip {
class OnContactRegisteredListener;
class ForkContextConfig {
public:
ForkContextConfig();
int mDeliveryTimeout; /* in seconds, used for "late" forking*/
int mUrgentTimeout; /*timeout for sending buffered urgent or retryable reponses (like 415).*/
int mPushResponseTimeout; /*timeout for receiving response to push */
bool mForkLate;
bool mTreatAllErrorsAsUrgent; /*treat all SIP response code as urgent replies in the fork mechanism.*/
bool mForkNoGlobalDecline;
bool mTreatDeclineAsUrgent; /*treat 603 declined as a urgent response, only useful is mForkNoGlobalDecline==true*/
int mCurrentBranchesTimeout; /*timeout for receiving response on current branches*/
struct ForkContextConfig {
int mDeliveryTimeout = 0; /* in seconds, used for "late" forking*/
int mUrgentTimeout = 5; /*timeout for sending buffered urgent or retryable reponses (like 415).*/
int mPushResponseTimeout = 0; /*timeout for receiving response to push */
int mCurrentBranchesTimeout = 0; /*timeout for receiving response on current branches*/
bool mForkLate = false;
bool mTreatAllErrorsAsUrgent = false; /*treat all SIP response code as urgent replies in the fork mechanism.*/
bool mForkNoGlobalDecline = false;
bool mTreatDeclineAsUrgent = false; /*treat 603 declined as a urgent response, only useful is mForkNoGlobalDecline==true*/
bool mPermitSelfGeneratedProvisionalResponse = true; /* Self explicit. Ex: 110 Push sent, 180 Ringing*/
};
class ForkContext;
......
......@@ -158,6 +158,11 @@ void ForkCallContext::onResponse(const shared_ptr<BranchInfo> &br, const shared_
// This is actually called when we want to simulate a ringing event by sending a 180, or for example to signal the caller that we've sent
// a push notification.
void ForkCallContext::sendResponse(int code, char const *phrase) {
if (!mCfg->mPermitSelfGeneratedProvisionalResponse){
LOGD("ForkCallContext::sendResponse(): self-generated provisional response are disabled by configuration.");
return;
}
int previousCode = getLastResponseCode();
if (previousCode > code || !mIncoming){
/* Don't send a response with status code lesser than last transmitted response. */
......
......@@ -28,12 +28,6 @@ const int ForkContext::sUrgentCodes[] = {401, 407, 415, 420, 484, 488, 606, 603,
const int ForkContext::sAllCodesUrgent[] = {-1, 0};
ForkContextConfig::ForkContextConfig()
: mDeliveryTimeout(0), mUrgentTimeout(5), mForkLate(false), mTreatAllErrorsAsUrgent(false),
mForkNoGlobalDecline(false), mTreatDeclineAsUrgent(false),
mCurrentBranchesTimeout(0) {
}
ForkContextListener::~ForkContextListener() {
}
......
......@@ -61,6 +61,13 @@ void ModuleRouter::onDeclare(GenericStruct *mc) {
"targets of the "
"INVITE.",
"false"},
{Boolean, "permit-self-generated-provisional-response",
"Whether the proxy is allowed to generate and send provisional responses during a call forking process. "
"A typical example for this is the '110 Push sent' emitted by the proxy when at least one push notification has "
"been sent to a target UA while routing an INVITE. "
"Some old versions of Linphone (below linphone-sdk 4.2) suffer from an issue when receiving such kind of provisional "
"responses that don't come from a remote client. This setting is mainly intended to temporarily workaround this situation.",
"true"},
{String, "generated-contact-route",
"Generate a contact from the TO header and route it to the above destination. [sip:host:port]", ""},
{String, "generated-contact-expected-realm",
......@@ -108,6 +115,7 @@ void ModuleRouter::onLoad(const GenericStruct *mc) {
mForkCfg->mDeliveryTimeout = mc->get<ConfigInt>("call-fork-timeout")->read();
mForkCfg->mTreatDeclineAsUrgent = mc->get<ConfigBoolean>("treat-decline-as-urgent")->read();
mForkCfg->mCurrentBranchesTimeout = mc->get<ConfigInt>("call-fork-current-branches-timeout")->read();
mForkCfg->mPermitSelfGeneratedProvisionalResponse = mc->get<ConfigBoolean>("permit-self-generated-provisional-response")->read();
//Forking configuration for MESSAGEs
mMessageForkCfg = make_shared<ForkContextConfig>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment