[Users] Re: get_redirects("*"), serialize_branches(0), next_branches() not working for me

Greg Fausak lgfausak at gmail.com
Mon Jun 5 05:58:42 CEST 2006


Reply to my own message!

I've been working on this all weekend.
Had an issue with a firewall which was blocking redirect
packets, that cleared up a bunch.

Now, I have the get_redirects("*") working, serialize_branches(0) is
working (kinda, it says it has
nothing to do because all data has the same
q value), and I see a debug message when I call next_branches() which says
DEBUG:next_branches: no AVPs -- we are done!

My ser.cfg file is below.  How do I get rid of 'no AVPs' error?  I thought the
domain modparam would activate them?

-g
# 1 "config.pre"
# 32 "config.pre"
# 1 "/usr/local/etc/ser/include/opensererror.pre" 1
# 33 "config.pre" 2
# 140 "config.pre"
mpath="/usr/local/lib/openser/modules"

loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "xlog.so"
loadmodule "dbtext.so"
loadmodule "domain.so"
loadmodule "uac_redirect.so"


log_stderror=no
log_facility=LOG_LOCAL5
listen=12.46.104.47
port=5060
children=4
disable_tcp=yes
dns_try_ipv6=no
server_signature=no
sip_warning=0

alias="redirect.node-1.com"
alias="proxy.redirect.node-1.com"
alias="12.46.104.47"

fifo="/tmp/ser_fifo/proxy"

modparam("tm","fr_inv_timer",180)
modparam("domain", "db_url", "dbtext:///var/openserdb")







route
{




if (!mf_process_maxfwd_header("13")) {
xlog("L_WARN","redirect.node-1.com-483: time_t=$Ts ^LINE=184
^FILE=config.pre ^call_id=$ci ^cseq=$cs ^contact=$ct ^from=$fu
^fromtag=$ft ^to=$tu ^totag=$tt ^method=$rm ^ruri=$ru
^messageid=$mi^remark=Too many hops"); sl_send_reply("483", "Too many
hops"); return; };

xlog("L_WARN","redirect.node-1.com-REDIRECTOR: time_t=$Ts ^LINE=186
^FILE=config.pre ^call_id=$ci ^cseq=$cs ^contact=$ct ^from=$fu
^fromtag=$ft ^to=$tu ^totag=$tt ^method=$rm ^ruri=$ru
^messageid=$mi^remark=Starting");

if(loose_route()) { xlog("L_WARN","redirect.node-1.com-LOOSE:
time_t=$Ts ^LINE=188 ^FILE=config.pre ^call_id=$ci ^cseq=$cs
^contact=$ct ^from=$fu ^fromtag=$ft ^to=$tu ^totag=$tt ^method=$rm
^ruri=$ru ^messageid=$mi^remark=Doing it"); record_route(); t_relay();
return; };

xlog("L_WARN","redirect.node-1.com-REDIRECTOR: time_t=$Ts ^LINE=190
^FILE=config.pre ^call_id=$ci ^cseq=$cs ^contact=$ct ^from=$fu
^fromtag=$ft ^to=$tu ^totag=$tt ^method=$rm ^ruri=$ru
^messageid=$mi^remark=Starting");

if(!uri==myself) { xlog("L_WARN","redirect.node-1.com-NOTUS:
time_t=$Ts ^LINE=192 ^FILE=config.pre ^call_id=$ci ^cseq=$cs
^contact=$ct ^from=$fu ^fromtag=$ft ^to=$tu ^totag=$tt ^method=$rm
^ruri=$ru ^messageid=$mi^remark=forward packet"); record_route();
t_relay(); return; };

xlog("L_WARN","redirect.node-1.com-REDIRECTOR: time_t=$Ts ^LINE=194
^FILE=config.pre ^call_id=$ci ^cseq=$cs ^contact=$ct ^from=$fu
^fromtag=$ft ^to=$tu ^totag=$tt ^method=$rm ^ruri=$ru
^messageid=$mi^remark=Starting");




if(src_ip==12.46.104.62)
{
� xlog("L_INFO","redirect.node-1.com-OUTBOUNDCALL: time_t=$Ts
^LINE=201 ^FILE=config.pre ^call_id=$ci ^cseq=$cs ^contact=$ct
^from=$fu ^fromtag=$ft ^to=$tu ^totag=$tt ^method=$rm ^ruri=$ru
^messageid=$mi^remark=OUT");
� if(is_method("INVITE"))
� {
�� xlog("L_WARN","redirect.node-1.com-OUTBOUNDCALL: time_t=$Ts
^LINE=204 ^FILE=config.pre ^call_id=$ci ^cseq=$cs ^contact=$ct
^from=$fu ^fromtag=$ft ^to=$tu ^totag=$tt ^method=$rm ^ruri=$ru
^messageid=$mi^remark=OUT");

�� t_on_failure("3");

�� record_route();

�� rewritehostport("198.212.169.6:5060");

�� if(!t_relay())
�� {
� � sl_reply_error();
�� }
�� return;
� }
}





xlog("L_WARN","redirect.node-1.com-404: time_t=$Ts ^LINE=224
^FILE=config.pre ^call_id=$ci ^cseq=$cs ^contact=$ct ^from=$fu
^fromtag=$ft ^to=$tu ^totag=$tt ^method=$rm ^ruri=$ru
^messageid=$mi^remark=no route found"); sl_send_reply("404", "no route
found"); return;
}
# 235 "config.pre"
failure_route[3]
{
xlog("L_WARN","redirect.node-1.com-FAILUREROUTE: time_t=$Ts ^LINE=237
^FILE=config.pre ^call_id=$ci ^cseq=$cs ^contact=$ct ^from=$fu
^fromtag=$ft ^to=$tu ^totag=$tt ^method=$rm ^ruri=$ru
^messageid=$mi^remark=here we are");

if(t_check_status("3[0-9][0-9]"))
{
� xlog("L_WARN","redirect.node-1.com-FAILUREROUTE: time_t=$Ts
^LINE=241 ^FILE=config.pre ^call_id=$ci ^cseq=$cs ^contact=$ct
^from=$fu ^fromtag=$ft ^to=$tu ^totag=$tt ^method=$rm ^ruri=$ru
^messageid=$mi^remark=status is 3xx");
� get_redirects("*");
� serialize_branches(0);
}
next_branches();
� xlog("L_WARN","redirect.node-1.com-FAILUREROUTE: time_t=$Ts
^LINE=246 ^FILE=config.pre ^call_id=$ci ^cseq=$cs ^contact=$ct
^from=$fu ^fromtag=$ft ^to=$tu ^totag=$tt ^method=$rm ^ruri=$ru
^messageid=$mi^remark=next branch");
� t_on_failure("3");
� t_relay();
� return;
xlog("L_WARN","redirect.node-1.com-FAILUREROUTE: time_t=$Ts ^LINE=250
^FILE=config.pre ^call_id=$ci ^cseq=$cs ^contact=$ct ^from=$fu
^fromtag=$ft ^to=$tu ^totag=$tt ^method=$rm ^ruri=$ru
^messageid=$mi^remark=no branches left");
t_reply("404", "No branches left");
}



On 6/3/06, Greg Fausak <lgfausak at gmail.com> wrote:
> I'm trying to play around with the current cvs head but can't get it to
> work.  I wonder if somebody could give me a hint!
>
>
> I built a redirect server:
> It basically does:
>
> rewritehost("ab5350.node-1.com");
> sl_send_reply("302", "Redirect");
>
> I forward to the redirect server setting up a failure block:
>
>                 if(is_method("INVITE"))
>                 {
>                         _QLOG(L_INFO, OUTBOUNDCALL, OUT);
>
>                         t_on_failure("3");
>
>                         record_route();
>                         setflag(1);
>                         setflag(2);
>
>                         rewritehostport(_QSTR
> (REDIRECTOBGATEWAYIP:REDIRECTOBGATEWAYPORT));
>
>                         if(!t_relay())
>                         {
>                                 sl_reply_error();
>                         }
>                 }
>
> The response below comes back from my redirect server:
>
> SIP/2.0 302 Redirect
> Via: SIP/2.0/UDP 12.46.104.47;branch=z9hG4bKa86.09801851.0
> Via: SIP/2.0/UDP 12.46.104.62:5061;branch=z9hG4bKa86.191c2c81.0
> Via: SIP/2.0/UDP 12.46.104.59;branch=z9hG4bKa86.dafc0771.0
> Via: SIP/2.0/UDP 71.252.176.37:5060;branch=z9hG4bK-d0702751
> From: +19722200434 <sip:+19722200434 at var-2.com>;tag=3a553a2b9373c699
> To: <sip:2143357976 at var-2.com>;tag=5531b0101f56e37a4889ece4b0eb40fa.417f
> Call-ID: f27483a5-50532031 at 71.252.176.37
> CSeq: 101 INVITE
> Contact: sip:+12143357976 at ab5350.node-1.com:5060
> Content-Length: 0
>
> My failure_route block picks up the routing:
>
> failure_route[3]
> {
>         _QLOG(L_WARN, FAILUREROUTE, here we are);
>
>         if(status =~ "3[0-9][0-9]")
>         {
>                 _QLOG(L_WARN, FAILUREROUTE, status is 3xx);
>                 get_redirects("*");
>                 serialize_branches(0);
>         }
>         if(next_branches())
>         {
>                 _QLOG(L_WARN, FAILUREROUTE, next branch);
>                 t_on_failure("3");
>                 t_relay();
>         }
>         _QLOG(L_WARN, FAILUREROUTE, no branches left);
>         if(!t_reply("404", "Not Found"))
>         {
>                 _QLOG(L_WARN, FAILUREROUTE, Error);
>         }
> }
>
> My syslog shows QLOG messages.
> I see the 'status is 3xx' message, which shows the
> next command to be get_redirects("*");
>
> The next output I see in my syslog is 'no branches left', which
> indicates that the
> serialize_branches(0) and next_branches() aren't working as I expected.
>
> I've also tried getting rid of the serialize_branches and next_branches and just
> doing a t_relay() after the get_redirects(), that doesn't work either.
>
> Since I'm trying to simulate the redirect server, and the redirect
> client, I'm sure I
> got one of them wrong.  Can somebody give me a hint?
>
> Thanks!
>
> -g
>
>
>
> --
> Greg Fausak
> greg at thursday.com
>


-- 
Greg Fausak
greg at thursday.com


More information about the Users mailing list