DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
-DDNS_IP_HACK -DPKG_MALLOC -DSHM_MEM -DSHM_MMAP \
- -DEXTRA_DEBUG \
- -DVQ_MALLOC -DDBG_LOCK #-DSTATS
+ -DVQ_MALLOC -DBRUT_HACK
+ #-DEXTRA_DEBUG -DBRUT_HACK \
+ #-DVQ_MALLOC -DDBG_LOCK #-DSTATS
#-DDBG_QM_MALLOC #-DVQ_MALLOC #-DNO_DEBUG
#-DNO_DEBUG #-DDBG_QM_MALLOC
#-DEXTRA_DEBUG
#-DNO_DEBUG#-DSTATS -DNO_DEBUG
#-DNO_LOG
-PROFILE= -pg #set this if you want profiling
-mode = debug
-#mode = release
+#PROFILE= -pg #set this if you want profiling
+#mode = debug
+mode = release
# platform dependent settings
*/
#define REPLY_OVERBUFFER_LEN 160
+/* character which separates individual parts of MPLS-ized branch */
+#ifdef BRUT_HACK
+# define BRANCH_SEPARATOR 'X'
+#else
+# define BRANCH_SEPARATOR '.'
+#endif
+
#endif
*
*/
-#include "hash_func.h"
-#include "t_funcs.h"
#include "../../dprint.h"
#include "../../config.h"
#include "../../parser_f.h"
#include "../../ut.h"
#include "../../timer.h"
+#include "hash_func.h"
+#include "t_funcs.h"
+#include "config.h"
static int reverse_hex2int( char *c, int len )
{
scan_space=p_msg->via1->branch->value.len;
/* loop detection ... ignore */
- n=eat_token2_end( p, p+scan_space, '.');
+ n=eat_token2_end( p, p+scan_space, BRANCH_SEPARATOR );
scan_space-=n-p;
- if (n==p || scan_space<2 || *n!='.') goto nomatch2;
+ if (n==p || scan_space<2 || *n!=BRANCH_SEPARATOR) goto nomatch2;
p=n+1; scan_space--;
/* hash_id */
- n=eat_token2_end( p, p+scan_space, '.');
+ n=eat_token2_end( p, p+scan_space, BRANCH_SEPARATOR);
hashl=n-p;
scan_space-=hashl;
- if (!hashl || scan_space<2 || *n!='.') goto nomatch2;
+ if (!hashl || scan_space<2 || *n!=BRANCH_SEPARATOR) goto nomatch2;
hashi=p;
p=n+1;scan_space--;
/* sequence id */
- n=eat_token2_end( p, p+scan_space, '.');
+ n=eat_token2_end( p, p+scan_space, BRANCH_SEPARATOR);
synl=n-p;
scan_space-=synl;
- if (!synl || scan_space<2 || *n!='.') goto nomatch2;
+ if (!synl || scan_space<2 || *n!=BRANCH_SEPARATOR) goto nomatch2;
syni=p;
p=n+1;scan_space--;
begin=p_msg->add_to_branch_s+p_msg->add_to_branch_len;
orig_size = size=MAX_BRANCH_PARAM_LEN - p_msg->add_to_branch_len;
- if (size) { *begin='.'; begin++; size--; } else return -1;
+ if (size) { *begin=BRANCH_SEPARATOR; begin++; size--; } else return -1;
if (int2reverse_hex( &begin, &size, trans->hash_index)==-1) return -1;
- if (size) { *begin='.'; begin++; size--; } else return -1;
+ if (size) { *begin=BRANCH_SEPARATOR; begin++; size--; } else return -1;
if (int2reverse_hex( &begin, &size, trans->label)==-1) return -1;
- if (size) { *begin='.'; begin++; size--; } else return -1;
+ if (size) { *begin=BRANCH_SEPARATOR; begin++; size--; } else return -1;
if (int2reverse_hex( &begin, &size, branch)==-1) return -1;
p_msg->add_to_branch_len+=(orig_size-size);
unsigned int len,foo;
struct hdr_field *hdr;
int i;
+#ifdef BRUT_HACK
+ struct hdr_field *to, *from, *callid, *cseq, *via;
+#endif
/* force parsing all headers -- we want to return all
Via's in the reply and they may be scattered down to the
len += SIP_VERSION_LEN + 1/*space*/ + 3/*code*/ + 1/*space*/ + strlen(text) + CRLF_LEN/*new line*/;
/*headers that will be copied (TO, FROM, CSEQ,CALLID,VIA)*/
for ( hdr=msg->headers ; hdr ; hdr=hdr->next )
+#ifdef BRUT_HACK
+ {
+ len += ((hdr->body.s+hdr->body.len ) - hdr->name.s ) + CRLF_LEN;
+ if ( hdr->type==HDR_VIA ) via = hdr;
+ else if ( hdr->type==HDR_FROM) from = hdr;
+ else if (hdr->type==HDR_CALLID) callid = hdr;
+ else if ( hdr->type==HDR_TO) to = hdr;
+ else if ( hdr->type==HDR_CSEQ) cseq = hdr;
+ else len-=((hdr->body.s+hdr->body.len ) - hdr->name.s ) + CRLF_LEN;
+ }
+#else
if ( hdr->type==HDR_VIA || hdr->type==HDR_FROM ||
hdr->type==HDR_CALLID || hdr->type==HDR_TO ||
hdr->type==HDR_CSEQ )
len += ((hdr->body.s+hdr->body.len ) - hdr->name.s ) + CRLF_LEN;
+#endif
/* end of message */
len += CRLF_LEN; /*new line*/
memcpy( p, CRLF, CRLF_LEN );
p+=CRLF_LEN;
/* headers*/
+#ifdef BRUT_HACK
+#define COPY_HF(_hf) memcpy(p, msg->orig+(_hf->name.s-msg->buf), \
+ ((_hf->body.s+_hf->body.len ) - \
+ _hf->name.s )); \
+ p+=((_hf->body.s+_hf->body.len)-_hf->name.s ) ; \
+ memcpy( p, CRLF, CRLF_LEN ); \
+ p+=CRLF_LEN;
+
+ COPY_HF(via);
+ COPY_HF(from);
+ COPY_HF(to);
+ COPY_HF(callid);
+ COPY_HF(cseq);
+#else
for ( hdr=msg->headers ; hdr ; hdr=hdr->next )
if ( hdr->type==HDR_VIA || hdr->type==HDR_FROM ||
hdr->type==HDR_CALLID || hdr->type==HDR_TO || hdr->type==HDR_CSEQ )
memcpy( p, CRLF, CRLF_LEN );
p+=CRLF_LEN;
}
+#endif
memcpy( p, CRLF, CRLF_LEN );
p+=CRLF_LEN;
# $ID: $
#
-debug=4 # debug level (cmd line: -dddddddddd)
+debug=1 # debug level (cmd line: -dddddddddd)
fork=yes # (cmd. line: -D)
#fork=no
-log_stderror=yes # (cmd line: -E)
-#log_stderror=no # (cmd line: -E)
+#log_stderror=yes # (cmd line: -E)
+log_stderror=no # (cmd line: -E)
-children=2
+children=8
check_via=yes # (cmd. line: -v)
dns=on # (cmd. line: -r)
rev_dns=yes # (cmd. line: -R)
port=5080
#listen=127.0.0.1
listen=195.37.77.101
-loop_checks=1
+loop_checks=0
# for more info: sip_router -h
#modules
};
} else {
log("SER: replying\n");
- if (! t_send_reply("100", "trying -- your call is important to us")
+ if (! t_send_reply("100", "Trying")
){
log("SER: ERROR: t_send_reply (100)\n");
} else log("SER: t_send_reply ok\n");
log("SER:ERROR: t_forward (..., 5555)\n");
} else log("SER: t_forward ok\n");
} else if (method=="BYE") {
- if (! t_forward("bat.iptel.org", "5090")){
+ if (! t_forward("bat.iptel.org", "5000")){
log("SER:ERROR: t_forward (..., 5555)\n");
} else log("SER: t_forward ok\n");
} else log("SER: ERROR unknwon request\n");