Skip to content

Commit

Permalink
t_newtran() automatically sends a 100 Tryting for INVITE.
Browse files Browse the repository at this point in the history
TO have a consistent behavior between:
	t_newtran();
	t_relay();
and
	t_relay();

(where in the first case a 100 Trying will not be auto generated), we do not sent the 100 Trying on r_relay (when transaction is built) but on t_newtan().
Reported by MAxim Sobolev.

(cherry picked from commit 0db7789)
  • Loading branch information
bogdan-iancu committed Mar 8, 2016
1 parent f89dfc7 commit 054836a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 45 deletions.
7 changes: 0 additions & 7 deletions modules/b2b_entities/dlg.c
Expand Up @@ -486,7 +486,6 @@ int b2b_prescript_f(struct sip_msg *msg, void *uparam)
str param= {NULL,0};
b2b_table table = NULL;
int method_value;
static str reason = {"Trying", 6};
str from_tag;
str to_tag;
str callid;
Expand Down Expand Up @@ -883,12 +882,6 @@ int b2b_prescript_f(struct sip_msg *msg, void *uparam)
if(tm_tran && tm_tran!=T_UNDEFINED)
tmb.unref_cell(tm_tran);
}

/* send provisional reply 100 Trying */
if(method_value == METHOD_INVITE)
{
tmb.t_reply(msg, 100, &reason);
}
}

b2b_cback = dlg->b2b_cback;
Expand Down
3 changes: 0 additions & 3 deletions modules/b2b_entities/server.c
Expand Up @@ -52,7 +52,6 @@ str* server_new(struct sip_msg* msg, str* local_contact,
{
b2b_dlg_t* dlg;
unsigned int hash_index;
static str reason = {"Trying", 6};
int ret;

if(param && param->len > B2BL_MAX_KEY_LEN)
Expand Down Expand Up @@ -94,8 +93,6 @@ str* server_new(struct sip_msg* msg, str* local_contact,
dlg->uas_tran = tmb.t_gett();
}
tmb.ref_cell(dlg->uas_tran);

tmb.t_reply(msg, 100, &reason);
tmb.t_setkr(REQ_FWDED);

LM_DBG("new server entity[%p]: callid=[%.*s] tag=[%.*s] param=[%.*s] dlg->uas_tran=[%p]\n",
Expand Down
12 changes: 0 additions & 12 deletions modules/cpl-c/cpl_proxy.h
Expand Up @@ -297,7 +297,6 @@ static inline char *run_proxy( struct cpl_interpreter *intr )
int timeout;
str *s;
struct location *loc;
str reason;

intr->proxy.ordering = PARALLEL_VAL;
intr->proxy.recurse = (unsigned short)cpl_env.proxy_recurse;
Expand Down Expand Up @@ -460,17 +459,6 @@ static inline char *run_proxy( struct cpl_interpreter *intr )
return EO_SCRIPT;
}
intr->flags |= CPL_IS_STATEFUL;

/* INVITE processing might take long, particularly because of DNS
* look-ups -- let upstream know we're working on it */
if ( intr->msg->REQ_METHOD==METHOD_INVITE ) {
reason.s = "Trying";
reason.len = 6;
if (cpl_fct.tmb.t_reply(intr->msg, (int)100, &reason) != 1) {
LM_ERR("100 t_reply failed!\n");
goto runtime_error;
}
}
}

/* as I am interested in getting the responses back - I need to install
Expand Down
10 changes: 0 additions & 10 deletions modules/seas/seas.c
Expand Up @@ -247,7 +247,6 @@ static int w_as_relay_t(struct sip_msg *msg, char *entry, char *foo)
char *buffer,processor_id;
struct cell *mycel;
struct as_entry *as;
static str msg100={"Your call is important to us",sizeof("Your call is important to us")-1};
static str msg500={"Server Internal Error!",sizeof("Server Internal Error!")-1};

buffer=(char*)0;
Expand All @@ -268,15 +267,6 @@ static int w_as_relay_t(struct sip_msg *msg, char *entry, char *foo)
ret = 0;
goto done;
}
/*new transaction created, let's pass it to an APP SERVER*/
if (msg->REQ_METHOD==METHOD_INVITE )
{
LM_DBG("new INVITE\n");
if(!seas_f.tmb.t_reply(msg,100,&msg100)){
LM_DBG("t_reply (100)\n");
goto error;
}
}
as=(struct as_entry *)entry;
if(!as->connected){
LM_ERR("app server %.*s not connected\n",as->name.len,as->name.s);
Expand Down
13 changes: 0 additions & 13 deletions modules/tm/t_funcs.c
Expand Up @@ -54,8 +54,6 @@
#include "config.h"
#include "../../context.h"

static str relay_reason_100 = str_init("Giving a try");


/* ----------------------------------------------------- */
int send_pr_buffer( struct retr_buf *rb, void *buf, int len,
Expand Down Expand Up @@ -185,7 +183,6 @@ int t_relay_to( struct sip_msg *p_msg , struct proxy_l *proxy, int flags)
int new_tran;
int reply_ret;
struct cell *t;
context_p ctx_backup;

ret=0;

Expand Down Expand Up @@ -233,16 +230,6 @@ int t_relay_to( struct sip_msg *p_msg , struct proxy_l *proxy, int flags)
if (flags&TM_T_REPLY_nodnsfo_FLAG) t->flags|=T_NO_DNS_FAILOVER_FLAG;
if (flags&TM_T_REPLY_reason_FLAG) t->flags|=T_CANCEL_REASON_FLAG;

/* INVITE processing might take long, particularly because of DNS
look-ups -- let upstream know we're working on it */
if ( p_msg->REQ_METHOD==METHOD_INVITE &&
!(flags&(TM_T_REPLY_no100_FLAG|TM_T_REPLY_repl_FLAG)) ) {
ctx_backup = current_processing_ctx;
current_processing_ctx = NULL;
t_reply( t, p_msg , 100 , &relay_reason_100);
current_processing_ctx = ctx_backup;
}

/* now go ahead and forward ... */
ret=t_forward_nonack( t, p_msg, proxy);
if (ret<=0) {
Expand Down
10 changes: 10 additions & 0 deletions modules/tm/t_lookup.c
Expand Up @@ -145,6 +145,8 @@ static struct cell *cancelled_T;
*/
static struct cell *e2eack_T;

static str relay_reason_100 = str_init("Giving a try");


struct cell *get_t(void) { return T; }
void set_t(struct cell *t) { T=t; }
Expand Down Expand Up @@ -1002,6 +1004,7 @@ static inline int new_t(struct sip_msg *p_msg, int full_uas)
int t_newtran( struct sip_msg* p_msg, int full_uas )
{
int lret, my_err;
context_p ctx_backup;

/* is T still up-to-date ? */
LM_DBG("transaction on entrance=%p\n",T);
Expand Down Expand Up @@ -1102,6 +1105,13 @@ int t_newtran( struct sip_msg* p_msg, int full_uas )
return E_BAD_VIA;
}

if (p_msg->REQ_METHOD==METHOD_INVITE) {
ctx_backup = current_processing_ctx;
current_processing_ctx = NULL;
t_reply( T, p_msg , 100 , &relay_reason_100);
current_processing_ctx = ctx_backup;
}

return 1;
new_err:
UNLOCK_HASH(p_msg->hash_index);
Expand Down

0 comments on commit 054836a

Please sign in to comment.