- fixed false retransmissions because of wrong cseq in reply

- enabled -c parameter for Inivte mode

git-svn-id: http://svn.berlios.de/svnroot/repos/sipsak/trunk@439 75b5f7c7-cfd4-0310-b54c-e118b2c5249a
(cherry picked from commit 00ccbe03d433cb4e60dce942f74795a3e1f10638)
(cherry picked from commit a63ab0e7ca)
mr3.8.5
nils-ohlmeier 18 years ago committed by Victor Seva
parent 89e2bf8ca1
commit 93ffcf1ce6

@ -431,7 +431,7 @@ int cseq(char *message)
}
/* if it find the Cseq number in the message it will increased by one */
void increase_cseq(char *message)
void increase_cseq(char *message, char *reply)
{
int cs;
char *cs_s, *eol, *backup;
@ -460,6 +460,22 @@ void increase_cseq(char *message)
}
else if (verbose > 1)
printf("'CSeq' not found in message\n");
if (reply != NULL) {
cs_s=STRCASESTR(reply, CSEQ_STR);
if (cs_s) {
cs_s+=6;
eol=strchr(cs_s, ' ');
eol++;
backup=str_alloc(strlen(eol)+1);
strncpy(backup, eol, (size_t)(strlen(eol)));
snprintf(cs_s, 11, "%i ", cs);
cs_s+=strlen(cs_s);
strncpy(cs_s, backup, strlen(backup));
free(backup);
}
else if (verbose > 1)
printf("'CSeq' not found in reply\n");
}
}
/* separates the given URI into the parts by setting the pointer but it
@ -582,9 +598,9 @@ void new_branch(char *message)
}
/* increase the CSeq and insert a new branch value */
void new_transaction(char *message)
void new_transaction(char *message, char *reply)
{
increase_cseq(message);
increase_cseq(message, reply);
new_branch(message);
}

@ -49,7 +49,7 @@ void warning_extract(char *message);
int cseq(char *message);
void increase_cseq(char *message);
void increase_cseq(char *message, char *reply);
void parse_uri(char *uri, char **scheme, char **user, char **host, int *port);
@ -57,7 +57,7 @@ char* uri_from_contact(char *message);
void new_branch(char *message);
void new_transaction(char *message);
void new_transaction(char *message, char *reply);
void print_message_line(char *message);

@ -122,7 +122,6 @@ void create_msg(int action, char *req_buff, char *repl_buff, char *username, int
case REQ_INV:
sprintf(req_buff,
"%s sip:%s%s%s"
"%ssip:sipsak@%s:%i;tag=%x\r\n"
"%ssip:%s%s\r\n"
"%s%u@%s\r\n"
"%s%i %s\r\n"
@ -130,10 +129,8 @@ void create_msg(int action, char *req_buff, char *repl_buff, char *username, int
"%ssip:sipsak@%s:%i\r\n"
"%sDONT ANSWER this test call!\r\n"
"%s70\r\n"
"%s%s\r\n"
"\r\n",
"%s%s\r\n",
INV_STR, username, domainname, SIP20_STR,
FROM_STR, fqdn, lport, c,
TO_STR, username, domainname,
CALL_STR, c, fqdn,
CSEQ_STR, cseq, INV_STR,
@ -142,6 +139,19 @@ void create_msg(int action, char *req_buff, char *repl_buff, char *username, int
SUB_STR,
MAX_FRW_STR,
UA_STR, UA_VAL_STR);
req_buff += strlen(req_buff);
if (from_uri) {
sprintf(req_buff,
"%s%s;tag=%x\r\n"
"\r\n",
FROM_STR, from_uri, c);
}
else {
sprintf(req_buff,
"%ssip:sipsak@%s:%i;tag=%x\r\n"
"\r\n",
FROM_STR, fqdn, lport, c);
}
add_via(req_buf_begin);
sprintf(repl_buff,
"%s"

@ -120,7 +120,7 @@ void handle_3xx(struct sockaddr_in *tadr)
}
/* correct our request */
uri_replace(req, contact);
new_transaction(req);
new_transaction(req, rep);
/* extract the needed information*/
rport = 0;
address = 0;
@ -275,7 +275,7 @@ void handle_default()
}
else {
counters.run++;
new_transaction(req);
new_transaction(req, rep);
delays.retryAfter = timer_t1;
}
}
@ -1023,7 +1023,7 @@ void shoot(char *buf, int buff_size)
exit_code(0, __PRETTY_FUNCTION__, NULL);
}
counters.run++;
new_transaction(req);
new_transaction(req, rep);
delays.retryAfter = timer_t1;
continue;
}
@ -1037,7 +1037,7 @@ void shoot(char *buf, int buff_size)
insert_auth(req, rec);
if (verbose > 2)
printf("\nreceived:\n%s\n", rec);
new_transaction(req);
new_transaction(req, rep);
continue;
} /* if auth...*/
/* lets see if received a redirect */

@ -820,7 +820,7 @@ int check_for_message(char *recv, int size, struct sipsak_con_data *cd,
count->run++;
sd->all_delay += senddiff;
sd->big_delay = senddiff;
new_transaction(req);
new_transaction(req, rep);
sd->retryAfter = timer_t1;
if (timing == 0) {
printf("%.3f/%.3f/%.3f ms\n", sd->small_delay, sd->all_delay / count->run, sd->big_delay);

Loading…
Cancel
Save