[Serusers] Re: checking called number
Kamran Ahmad
p_kami at yahoo.com
Fri Aug 19 18:18:55 CEST 2005
here is my routes
route {
#-----------------------------------------------------------------
# Sanity Check Section
#-----------------------------------------------------------------
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483", "Too Many Hops");
break;
};
if (msg:len > max_len) {
sl_send_reply("513", "Message
Overflow");
break;
};
#-----------------------------------------------------------------
# Record Route Section
#-----------------------------------------------------------------
if (method!="REGISTER") {
record_route();
};
if (method=="BYE" || method=="CANCEL") {
unforce_rtp_proxy();
#-----------------------------------------------------------------
# Loose Route Section
#-----------------------------------------------------------------
if (loose_route()) {
if (has_totag() && method=="INVITE") {
if (nat_uac_test("19")) {
setflag(6);
force_rport();
fix_nated_contact();
};
#log("hello");
force_rtp_proxy("l");
};
route(1);
break;
};
#-----------------------------------------------------------------
# Call Type Processing Section
#-----------------------------------------------------------------
if (uri==myself) {
if (method=="INVITE") {
route(3);
break;
} else if (method=="REGISTER") {
route(2);
break;
};
if (!lookup("location")) {
sl_send_reply("404", "User Not
Found");
break;
};
route(1);
};
}
route[1] {
#-----------------------------------------------------------------
# Default Message Handler
#-----------------------------------------------------------------
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" && isflagset(6))
{
unforce_rtp_proxy();
};
sl_reply_error();
};
}
route[2] {
#-----------------------------------------------------------------
# REGISTER Message Handler
#----------------------------------------------------------------
if (!search("^Contact: \*") &&
nat_uac_test("19")) {
setflag(6);
fix_nated_register();
force_rport();
};
sl_send_reply("100", "Trying");
if (!save("location")) {
sl_reply_error();
};
}
route[3] {
#-----------------------------------------------------------------
# INVITE Message Handler
#-----------------------------------------------------------------
exec_msg("cat >> /tmp/withoutstrip.log");
if(uri=="^sip:00[1-9].*@.*") {
route(4);
break;
} else if (uri=="^sip:0[1-9].*@.*") {
strip(1);
route(5);
break;
} else {
route(4);
break;
}
}
route[4] {
rewritehostport("127.0.0.1:5970");
force_rport();
fix_nated_contact();
t_relay();
}
route[5] {
if (nat_uac_test("19")) {
setflag(6);
}
if (!lookup("location")) {
break;
}
if (isflagset(6)) {
force_rport();
fix_nated_contact();
force_rtp_proxy();
};
t_on_reply("1");
if (!t_relay()) {
if(isflagset(6)) {
unforce_rtp_proxy();
}
sl_reply_error();
};
}
onreply_route[1] {
if (isflagset(6) &&
status=~"(180)|(183)|2[0-9][0-9]") {
fix_nated_contact();
if (!search("^Content-Length:\ 0")) {
force_rtp_proxy();
};
}
else if (nat_uac_test("1")) {
fix_nated_contact();
};
}
--- Iqbal <iqbal at gigo.co.uk> wrote:
> loop detected, when the call gets to asterisk what
> are you telling
> asterisk to do, send it back to ser, or out
> somewhere else.
> Calls are not workinf after the change or before.
>
> iqbal
>
> Kamran Ahmad wrote:
>
> >i m only sending invite to asterisk one when i try
> >bindaddr=0.0.0.0
> >
> >calls are not working. now i changed sip.conf
> >bindaddr=0.0.0.0
> >and in ser.cfg
> >port=5060
> >
> >with these changes now register messages are stoped
> >but still getting 482 "Loop Detected".
> >
> >
> >--- Iqbal <iqbal at gigo.co.uk> wrote:
> >
> >
> >
> >>Hi
> >>
> >>The register messages what username are they for,
> >>and from what IP
> >>address, do a sip debug in asterisk for this.
> >>Also why are you sending register messages to
> >>asterisk, just send your
> >>INVITES there.
> >>
> >>As for debug run ngrep, to pick up your messages ,
> >>and see what is going
> >>on, and to look at the uri problem, remove 2 out
> of
> >>3 of the routes, and
> >>see what happens, if call fails then matching is
> not
> >>correctly being
> >>done, or the uri is not correct.
> >>
> >>iqbal
> >>
> >>Kamran Ahmad wrote:
> >>
> >>
> >>
> >>>i tried to do debug (put messages in
> /tmp/call.log)
> >>>
> >>>
> >>>but there is no Invite having only one zero(like
> >>>06999786) all call were 0097937223 or 46364736.
> >>>
> >>>
> >>this
> >>
> >>
> >>>means that only third else part is always active
> >>>
> >>>
> >>but
> >>
> >>
> >>>if third part is active then there must be some
> >>>
> >>>
> >>invite
> >>
> >>
> >>>starting with only one zero. it means second time
> >>>invite call is not comming here .
> >>>
> >>>My from main invites are only comming here
> >>>
> >>>
> >>route(3). i
> >>
> >>
> >>>think all messages are going to asterisk because
> >>>
> >>>
> >>there
> >>
> >>
> >>>is only one statement in ser.cfg having port 5970
> >>>(this is for asterisk) and all my register
> messages
> >>>are also going there to asterisk.
> >>>
> >>>there are too many register messages on my
> >>>
> >>>
> >>asterisk. i
> >>
> >>
> >>>dont know why they are comming to asterisk as
> this
> >>>port is not available for any user nobody uses
> this
> >>>port only ser is routing calls to asterisk
> >>>
> >>>route {
> >>> if (uri==myself) {
> >>> if (method=="INVITE") {
> >>> route(3);
> >>> break;
> >>> }
> >>> }
> >>>}
> >>>route[3] {
> >>> exec_msg("cat >> /tmp/call.log");
> >>> if(uri=="^sip:00[1-9].*@.*") {
> >>> route(4);
> >>> break;
> >>> } else if (uri=="^sip:0[1-9].*@.*") {
> >>> strip(1);
> >>> route(5);
> >>> break;
> >>> } else {
> >>> route(4);
> >>> break;
> >>> }
> >>>
> >>>}
> >>>--- Iqbal <iqbal at gigo.co.uk> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>dump a call trace showing your uri
> >>>>
> >>>>Iqbal
> >>>>
> >>>>Kamran Ahmad wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>hello
> >>>>>
> >>>>>i m using ser-0.9.0 on 5060 and asterisk-1.0.9
> on
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>5970
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>but problem is that i cannot send my ser back
> to
> >>>>>asterisk.
> >>>>>the problem is that it always goto route(4)
> >>>>>
> >>>>>
> >>second
> >>
> >>
> >>>>>else if is not properly checked how to check
> this
> >>>>>condition. i m adding 0 when asterisk is
> sending
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>call
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>back.
> >>>>>
> >>>>>
> >>>>> if(uri=="^sip:00[1-9]+ at .*") {
> >>>>> route(4);
> >>>>> break;
> >>>>> } else if (uri=="^sip:0[1-9]+ at .*") {
> >>>>> strip(1);
> >>>>> route(5);
> >>>>> break;
> >>>>> } else {
> >>>>> route(4);
> >>>>> break;
> >>>>> }
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>__________________________________
> >>>>>Do you Yahoo!?
> >>>>>Read only the mail you want - Yahoo! Mail
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the sr-users
mailing list