[OpenSIPS-Users] Using b2bua top hiding plus dispatcher module
David Santiago
david.santiago at almiralabs.com
Mon Oct 18 16:29:36 CEST 2010
Hi again,
I have made several changes to the script so that I can successfully add,
for instance, a custom header to the INVITE request that the b2bua generates
after receiving an external one. I'm doing it in a local_route block which
is the supposed way to process an outgoing INVITE request that is going to
be sent by the b2bua module, right?
but.. I'm not being able to set the destination of such INVITE to the place
I want. I have tried the following:
- ds_select_dst() function: it works in the main route block, but it
cannot be used in a local_route block.
- modifying $du variable. I can successfully modify this variable, but it
has no effect on where the INVITE is being sent to.
- rewriteuri() function: same result as modifying $du variable.
I need that outgoing INVITE to be sent to a specific host and port, but I do
not see how to modify the current behaviour which is that the INVITE is
being sent to the public ip address of the opensips server, which in turn
generates a loop as that INVITE is processed by the b2bua and a new INVITE
is sent out to that same address again.
Regards,
David
On Thu, Oct 14, 2010 at 9:08 AM, Anca Vamanu <anca at opensips.org> wrote:
> Hi David,
>
> The dispatcher is working right - just that if you use b2bua it doesn't
> have no effect as it does not use the newly set $du. Since it is sent
> again to your opensips you can do a filter after the source address of
> the message and do processing needed for the Invite going out if the
> source is itself.
>
> if (!has_totag() && is_method("INVITE") && !(src_ip=="MY_IP" &&
> src_port=="MY_PORT")) {
> b2b_init_request("top hiding");
> exit;
> }
> ....
> the rest of the changes needed.
>
> Anyhow, I should add using the $du as the outbound proxy for the newly
> generated request on the features to implement list.
>
> Regards,
> Anca
>
>
> On 10/13/2010 12:19 PM, David Santiago wrote:
> > I'll check it later, but the fact is that I have to solve first the
> > problem that prevents the INVITEs generated by OpenSIPs to be sent to
> > the internal jain slee server.
> >
> > I have confirmed that after the call to ds_select(), the value of $du
> > points to such server (which has been obtained from the
> > /opt/opensipsnotls/etc/opensips/dispatcher.list file), but the INVITEs
> > are not sent there, but to the public IP address of the OpenSIPs
> > server. Without the b2bua "setup", the dispatcher has been working
> > fine in other tests I've made...
> >
> >
> > Regards,
> > David
> >
> > On Tue, Oct 12, 2010 at 11:22 AM, Anca Vamanu<anca at opensips.org> wrote:
> >
> >> Hi David,
> >>
> >> The only thing that won't work as you like is the append_hf - it won't
> >> work as you like since the b2bua module won't see that header. You need
> >> to do that for the new request generated by the b2bua and put that code
> >> in the local_route.
> >>
> >> Regards,
> >>
> >> --
> >> Anca Vamanu
> >> www.voice-system.ro
> >>
> >>
> >>
> >> On 10/11/2010 01:48 PM, David Santiago wrote:
> >>
> >>> Hi all,
> >>>
> >>> After cleaning up the initialization problems in the b2bua related
> >>> modules I'm testing a configuration I want to use in order to enable
> >>> the "top hiding" scenario, plus using the dispatcher module so I can
> >>> configure the internal jain slee server that receives the requests
> >>> from the opensips proxy, like this:
> >>>
> >>> VOIP PROVIDER<-------> OPENSIPS<-------> INTERNAL JAIN SLEE
> SERVER
> >>>
> >>> I will write here the configuration I'm using, taken from the
> >>> configuration example available, that results in the INVITEs received
> >>> from the VOIP PROVIDER being sent by OPENSIPS to itself (to its public
> >>> address, in particular), ad infinitum.
> >>>
> >>> The modparam("dispatcher", "list_file",
> >>> "/opt/opensipsnotls/etc/opensips/dispatcher.list") entry points to the
> >>> file required by the dispatcher module to determine the ip and port
> >>> where the internal jain slee server is running. Furthermore, our
> >>> service implementation requires the addition of the
> >>> P-Preferred-Service header, which is done with append_hf().
> >>>
> >>> Any hint would be appreciated. Thanks in advance!
> >>>
> >>>
> >>>
> >>> # Debugging mode:
> >>> debug=9
> >>> memlog=6
> >>> fork=yes
> >>> auto_aliases=no
> >>> log_stderror=no
> >>>
> >>> disable_dns_blacklist=yes
> >>>
> >>> listen=10.122.54.163:5060 # private opensips ip
> >>> # alias=OSIPS_REALM
> >>> #port=OSIPS_PORT
> >>>
> >>>
> >>> sip_warning=0
> >>> #server_header="SRV_SIGNATURE"
> >>> #user_agent_header="PP_USER_AGENT"
> >>>
> >>> #mhomed=yes
> >>> #memlog=2
> >>> check_via=no
> >>> dns=off
> >>> rev_dns=off
> >>> children=8
> >>> disable_tcp=yes
> >>> log_facility=LOG_LOCAL0
> >>> # for more info: opensips -h
> >>>
> >>> # ------------------ module loading ----------------------------------
> >>>
> >>> mpath="/opt/opensipsnotls/lib/opensips/modules/"
> >>>
> >>> #loadmodule "db_mysql.so"
> >>> #loadmodule "xlog.so"
> >>> loadmodule "textops.so"
> >>> loadmodule "maxfwd.so"
> >>> loadmodule "rr.so"
> >>> loadmodule "sl.so"
> >>> loadmodule "tm.so"
> >>> loadmodule "signaling.so"
> >>> loadmodule "b2b_entities.so"
> >>> loadmodule "b2b_logic.so"
> >>> loadmodule "usrloc.so"
> >>> loadmodule "registrar.so"
> >>> loadmodule "mi_fifo.so"
> >>> loadmodule "dispatcher.so"
> >>>
> >>> # ----------------- setting module-specific parameters ---------------
> >>> modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
> >>>
> >>>
> >>> #modparam("usrloc", "db_url", "mysql://opensips:opensipsrw@localhost
> /opensips")
> >>> #modparam("usrloc", "db_mode", 2)
> >>>
> >>> modparam("tm", "pass_provisional_replies", 1)
> >>>
> >>> modparam("dispatcher", "list_file",
> >>> "/opt/opensipsnotls/etc/opensips/dispatcher.list")
> >>>
> >>> modparam("b2b_entities", "server_address",
> >>> "sip:MY_OPENSIPS_PUBLIC_IP_GOES_HERE:5060")
> >>>
> >>>
> >>> #modparam("b2b_logic", "script_scenario",
> >>> "/home/anca/work/opensips/modules/b2b_logic/scenario_script.xml")
> >>> #modparam("b2b_logic", "extern_scenario",
> >>> "/home/anca/work/opensips/modules/b2b_logic/scenario_extern.xml")
> >>> modparam("b2b_entities", "script_req_route", "b2b_request")
> >>> modparam("b2b_entities", "script_reply_route", "b2b_reply")
> >>>
> >>> route[b2b_request] {
> >>> xlog("b2b_request ($ci)\n");
> >>> }
> >>>
> >>>
> >>> route[b2b_reply] {
> >>> xlog("b2b_reply ($ci)\n");
> >>> }
> >>>
> >>>
> >>> route {
> >>>
> >>> xlog("mozaa - Here we go...");
> >>>
> >>> if (!mf_process_maxfwd_header("10")) {
> >>> sl_send_reply("483","Too Many Hops");
> >>> exit;
> >>> };
> >>>
> >>> if (msg:len>= 2380 ) {
> >>> sl_send_reply("513", "Message too big");
> >>> exit;
> >>> };
> >>>
> >>> if (!method=="REGISTER")
> >>> record_route();
> >>>
> >>> # subsequent messages withing a dialog should take the
> >>> # path determined by record-routing
> >>> if (loose_route()) {
> >>> # mark routing logic in request
> >>> append_hf("P-hint: rr-enforced\r\n");
> >>> route(1);
> >>> };
> >>>
> >>> if(is_method("INVITE")&& /* only for Invite messages from
> bob*/
> >>> !(src_ip == "10.122.54.163"&& src_port ==5060)) /* skip
> >>> Invite messages generated by the server*/
> >>> {
> >>> # DO NOT call t_newtran() on this request -> it will result in
> the
> >>> transaction never being deleted
> >>> ##b2b_init_request("prepaid", "sip:320 at opensips.org:5070",
> >>> "sip:321 at opensips.org:5070");
> >>>
> >>> xlog("mozaa ft - [$ft]");
> >>> xlog("mozaa fu - [$fu]");
> >>> xlog("mozaa tt - [$tt]");
> >>> xlog("mozaa tu - [$tu]");
> >>> xlog("mozaa du - [$du]");
> >>> xlog("mozaa si - [$si]");
> >>>
> >>> $var(to) = $tu;
> >>> $var(to) = $(var(to){s.substr,4,0});
> >>> $var(to) = $(var(to){s.select,0,@});
> >>> $var(proxy_public_addr) = $(var(to){s.select,1,@});
> >>>
> >>> xlog("mozaa to - [$var(to)]");
> >>>
> >>> xlog("mozaa contact - $hdr(Contact)");
> >>>
> >>> $var(from) = $fu;
> >>> $var(from) = $(var(from){s.substr,4,0});
> >>>
> >>>
> if($var(to)=="THE_NUMBER_REGISTERED_IN_MY_VOIP_PROVIDER_GOES_HERE") {
> >>> xlog("mozaa x - SPAIN");
> >>> if (
> >>>
> subst('/^From:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/From:\1sip:34$var(from)\2/ig')
> >>> ) {
> >>> xlog("mozaa from modified!");
> >>> };
> >>> append_hf("P-Preferred-Service: OneService\r\n");
> >>> } else {
> >>> xlog("mozaa x - USA");
> >>> append_hf("P-Preferred-Service:
> AnotherService\r\n");
> >>> }
> >>>
> >>> ds_select_dst("1", "0");
> >>>
> >>> xlog("mozaa - Launching top hiding scenario for du = $du");
> >>>
> >>> b2b_init_request("top hiding");
> >>> exit;
> >>> };
> >>>
> >>> if (!uri==myself) {
> >>> # mark routing logic in request
> >>> append_hf("P-hint: outbound\r\n");
> >>> route(1);
> >>> };
> >>>
> >>>
> >>> if (uri==myself) {
> >>>
> >>> if (method=="REGISTER") {
> >>> save("location");
> >>> exit;
> >>> };
> >>>
> >>> # native SIP destinations are handled using our USRLOC DB
> >>> if (!lookup("location")) {
> >>> sl_send_reply("404", "Not Found");
> >>> exit;
> >>> };
> >>> append_hf("P-hint: usrloc applied\r\n");
> >>> };
> >>>
> >>> route(1);
> >>> }
> >>>
> >>>
> >>> route[1] {
> >>> # send it out now; use stateful forwarding as it works reliably
> >>> # even for UDP2TCP
> >>>
> >>> if (!t_relay()) {
> >>> sl_reply_error();
> >>> };
> >>> exit;
> >>> }
> >>>
> >>> _______________________________________________
> >>> Users mailing list
> >>> Users at lists.opensips.org
> >>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >>>
> >>>
> >> _______________________________________________
> >> Users mailing list
> >> Users at lists.opensips.org
> >> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >>
> >>
> > _______________________________________________
> > Users mailing list
> > Users at lists.opensips.org
> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >
> >
>
>
> --
> Anca Vamanu
> www.voice-system.ro
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20101018/e24e1012/attachment-0001.htm
More information about the Users
mailing list