top hiding and BYE problem

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

top hiding and BYE problem

saneku
This post has NOT been accepted by the mailing list yet.
Hello!
Please help! I am ready to broke my head  . dont know how to solve this...

i have next:          PSTN<-------->OPENSIPS<-------->ASTERISK (IVR)
                                   (10.107.10.10)  (10.130.0.140)           (10.130.0.136)
and all i want to do is top hiding between PSTN and ASTERISK.

So I adjusted opensips.cfg so i can hear asterisk ivr. When the caller hangs up the call everything goes as it should be (PSTN send BYE, BYE precessed by opensips and sended to asterisk. asterisk returns 200, opensips sends 200 to PSTN and call drops).

But when asterisk hangs up the call it sends BYE to OPENSIPS. On the next step opensips trying to process it and send BYE to PSTN. After that PSTN gives " 481 Call/Transaction Does Not Exist"...
I think I understand why it response such way. Because there are two different calls with different call-id's. So please tell me what i have to do in such situation? Do I have to keep two different call-id's and replace one to another when recive BYE from ASTERISK or there is another solution. Any advice will be appresiated. opensips.cfg is attached.
thanks!

---------------------------------------------
port=5061
listen=udp:10.130.0.140:5061
listen=tcp:10.130.0.140:5061
#modparam("dialog", "dlg_flag", 13)
#modparam("dialog", "db_mode", 2)

modparam("b2b_entities", "server_address", "sip:10.130.0.140:5061")
modparam("tm", "pass_provisional_replies", 1)

modparam("b2b_entities", "script_reply_route", "b2b_reply")

route[b2b_reply]
{
        xlog("\n\n\n\n-------");
        xlog("GOT REPLY FROM $src_ip\n");
        xlog("($ci)\n");
        xlog("-------\n\n\n\n");
}

route
{
        xlog("\n\n\n\n-----------------------------START-----------------------------\n");
        if (!mf_process_maxfwd_header("10")){
                sl_send_reply("483","Too Many Hops");
                exit;};

        if (msg:len >= 1380 ){
                sl_send_reply("513", "Message too big");
                exit;};
       
        if(is_method("BYE")&& (src_ip=="10.130.0.136"))
        {
                route(2);
        }
               
        if (!method=="REGISTER")
        {
                xlog("+++++++++Recording route...\n");
                record_route();
        }
       
        if (loose_route())
        {
                append_hf("P-hint: rr-enforced\r\n");
                route(1);
        };
                       
        #skip Invite messages generated by the server
        if(is_method("INVITE") && !(src_ip=="10.130.0.140"))
        {
                b2b_init_request("top hiding");
                exit;
        };

        route(1);
}

route[1]
{
              rewritehostport("10.130.0.136:5060");
        xlog("+++++++++++++ROUTE 1: SENDING TO ASTERISK\n");
        # send it out now
        if (!t_relay()){
                sl_reply_error();};
        exit;
}


route[2]
{
        xlog("+++++++++++++SENDING TO PSTN\n");
        rewritehostport("10.107.10.10:5060");
        # send it out now
        if (!t_relay()){
                sl_reply_error();};
        exit;
}
Reply | Threaded
Open this post in threaded view
|

Re: top hiding and BYE problem

Anca Vamanu-3
Hi,

You are looping once the generated Invite to IVR because you are not setting the destination host and port before you call b2b_init_request. Add the rewritehostport("10.130.0.136:5060");  lines before calling b2b function, like this:

  if(is_method("INVITE") && !(src_ip=="10.130.0.140"))
  {
                rewritehostport("10.130.0.136:5060");  
                b2b_init_request("top hiding");

                exit;
  };

Regards,
Anca Vamanu

2011/7/18 Ухов Александр Ильич <[hidden email]>

Hello!
Please help! I am ready to broke my head  . dont know how to solve this...

i have next:          PSTN<-------->OPENSIPS<-------->ASTERISK (IVR)
                                   (10.107.10.10)  (10.130.0.140)           (10.130.0.136)
and all i want to do is top hiding between PSTN and ASTERISK.

So I adjusted opensips.cfg so i can hear asterisk ivr. When the caller hangs up the call everything goes as it should be (PSTN send BYE, BYE precessed by opensips and sended to asterisk. asterisk returns 200, opensips sends 200 to PSTN and call drops).

But when asterisk hangs up the call it sends BYE to OPENSIPS. On the next step opensips trying to process it and send BYE to PSTN. After that PSTN gives " 481 Call/Transaction Does Not Exist"...
I think I understand why it response such way. Because there are two different calls with different call-id's. So please tell me what i have to do in such situation? Do I have to keep two different call-id's and replace one to another when recive BYE from ASTERISK or there is another solution. Any advice will be appresiated. opensips.cfg is attached.
thanks!

---------------------------------------------
port=5061
listen=udp:10.130.0.140:5061
listen=tcp:10.130.0.140:5061
#modparam("dialog", "dlg_flag", 13)
#modparam("dialog", "db_mode", 2)

modparam("b2b_entities", "server_address", "sip:10.130.0.140:5061")
modparam("tm", "pass_provisional_replies", 1)

modparam("b2b_entities", "script_reply_route", "b2b_reply")

route[b2b_reply]
{
        xlog("\n\n\n\n-------");
        xlog("GOT REPLY FROM $src_ip\n");
        xlog("($ci)\n");
        xlog("-------\n\n\n\n");
}

route
{
        xlog("\n\n\n\n-----------------------------START-----------------------------\n");
        if (!mf_process_maxfwd_header("10")){
                sl_send_reply("483","Too Many Hops");
                exit;};

        if (msg:len >= 1380 ){
                sl_send_reply("513", "Message too big");
                exit;};
       
        if(is_method("BYE")&& (src_ip=="10.130.0.136"))
        {
                route(2);
        }
               
        if (!method=="REGISTER")
        {
                xlog("+++++++++Recording route...\n");
                record_route();
        }
       
        if (loose_route())
        {
                append_hf("P-hint: rr-enforced\r\n");
                route(1);
        };
                       
        #skip Invite messages generated by the server
        if(is_method("INVITE") && !(src_ip=="10.130.0.140"))
        {
                b2b_init_request("top hiding");
                exit;
        };

        route(1);
}

route[1]
{
              rewritehostport("10.130.0.136:5060");
        xlog("+++++++++++++ROUTE 1: SENDING TO ASTERISK\n");
        # send it out now
        if (!t_relay()){
                sl_reply_error();};
        exit;
}


route[2]
{
        xlog("+++++++++++++SENDING TO PSTN\n");
        rewritehostport("10.107.10.10:5060");
        # send it out now
        if (!t_relay()){
                sl_reply_error();};
        exit;
}


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: top hiding and BYE problem

saneku
Thanks! you have saved my head from beeing broken.
But now i trying to add load balance functionality between two ASTERISK's servers. I am writing next:

------------
              #skip Invite messages generated by the server
        if(is_method("INVITE") && !(src_ip=="10.130.0.140"))
             {
                load_balance("1","pstn");  
                b2b_init_request("top hiding");
                exit;
        };
--------------
but without success. (

ASTERISK gives me error "404 Not Found". Because of that:
At trace messages i see that $du="sip:10.130.0.136" but it should be "sip:##999@10.130.0.136"

So my question is: where i have to change $du? I tried to change it
(using rewriteuri("sip:##0950@10.130.0.136:5060") and
rewritehostport("sip:##0950@10.130.0.136:5060"))

 in local_route and right after load_balance function but i didnt get correct fucntionality.
Any help is welcome.  thanks
Reply | Threaded
Open this post in threaded view
|

Re: top hiding and BYE problem

Anca Vamanu-3
Hi again,

The 'load_balance' function sets the $du to the address of the asterisk box. This wroks with b2b, the $du is used when routing the Invite out and since you say the message does get to asterisk it proves that it works for you also.
Since asterisk gives '404 Not Found' it means that the RURI is not recognized by asterisk. So you also have to change ruri also. You said that you used rewritehostport before calling b2b_init_request - this is a good solution and it whould work. Another solution is to set $rd and $rp.

Regards,
Anca


On Tue, Jul 19, 2011 at 1:34 PM, saneku <[hidden email]> wrote:
Thanks! you have saved my head from beeing broken.
But now i trying to add load balance functionality between two ASTERISK's
servers. I am writing next:

------------
             #skip Invite messages generated by the server
       if(is_method("INVITE") && !(src_ip=="10.130.0.140"))
            {
               load_balance("1","pstn");
               b2b_init_request("top hiding");
               exit;
       };
--------------
but without success. (

ASTERISK gives me error "404 Not Found". Because of that:
At trace messages i see that $du="sip:10.130.0.136" but it should be
"sip:##[hidden email]"

So my question is: where i have to change $du? I tried to change it
(using rewriteuri("sip:##0950@10.130.0.136:5060")        and
rewritehostport("sip:##0950@10.130.0.136:5060"))

 in local_route and right after load_balance function but i didnt get
correct fucntionality.
Any help is welcome.  thanks

--
View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/top-hiding-and-BYE-problem-tp6594249p6598273.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.

_______________________________________________


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: top hiding and BYE problem

saneku
This post was updated on .
Hello! thanks for you replay!
I did what you been telling me to do. But there is another issue:
OPENSIPS keep receving "ok 200" replyes from ASTERISK server (that has been selected via LB) and doesnt try send it to PSTN. I think there is one more little issue that i cant even think off. for any case i put cfg file. thank you very much.

route
{
              if (!method=="REGISTER")
        {
                        xlog("+++++++++Recording route...\n");
                        record_route();
        }
       
        if (loose_route())
        {
                              append_hf("P-hint: rr-enforced\r\n");
        }

              #skip Invite messages generated by the server
        if(is_method("INVITE") && !(src_ip=="10.130.0.140"))
        {
                load_balance("1","pstn");
       
                #have $du    -> sip:10.130.0.137
                #$du need to be like -> sip:##999@10.130.0.137
                                               
                if($du=="sip:10.130.0.137")
                           {
                        $du="sip:##999@10.130.0.137:5060";
                }
               
                if($du=="sip:10.130.0.136")
                {
                        $du="sip:##999@10.130.0.136:5060";
                }
                b2b_init_request("top hiding");
                exit;
        };
}


Reply | Threaded
Open this post in threaded view
|

Re: top hiding and BYE problem

Anca Vamanu-3
Hi,

A first observation is that setting a user part in $du doesn't have any effect. In those ifs you should have set the $ru.
Concerning the 200 OK that you said are not passed to PSTN, I suggest you to check the OpenSIPS log to see if there is any error when processing the 200 OK. And also you can check if there isn't like a race and a BYE is received from Asterisk almost in the same time or before so that the b2b considers the dialog ended. Watch closely the message trace.

Regards,
Anca Vamanu

On Wed, Jul 20, 2011 at 2:00 PM, saneku <[hidden email]> wrote:
Hello! thanks for you replay!
I did what you been telling me to do. But there is another issue:
OPENSIPS keep receving "ok 200" replyes from ASTERISK server (that has been
selected vai LB) and doesnt try send it to PSTN. I think there is one more
little issue that i cant even think off. for any case i put cfg file. thank
you very much.

route
{
             if (!method=="REGISTER")
       {
                       xlog("+++++++++Recording route...\n");
                       record_route();
       }

       if (loose_route())
       {
                              append_hf("P-hint: rr-enforced\r\n");
       }

             #skip Invite messages generated by the server
       if(is_method("INVITE") && !(src_ip=="10.130.0.140"))
       {
               load_balance("1","pstn");
               xlog("\n\nPROXY 3: Selected dst: $du\n");

               #have $du           -> sip:10.130.0.137
               #$du need to be -> sip:##[hidden email]

               if($du=="sip:10.130.0.137")
               {
                       xlog("\n this is 137\n");
                       $du="sip:##0950@10.130.0.137:5060";
               }

               if($du=="sip:10.130.0.136")
               {
                       xlog("\n this is 136\n");
                       $du="sip:##0950@10.130.0.136:5060";
               }
               b2b_init_request("top hiding");
               exit;
       };
}




--
View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/top-hiding-and-BYE-problem-tp6594249p6602208.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: top hiding and BYE problem

saneku
Hello!
if i remove  <<$du="sip:##0950@10.130.0.137:5060">> from cfg file asterisk gives me 404 error and i see that invite for asterisk looks like
"INVITE sip:10.130.0.137 SIP/2.0" not
"INVITE sip:##999@10.130.0.137:5060 SIP/2.0" how it looks with $du setted

adding <<$ru="sip:##0950@10.130.0.137:5060">> at each if statement doesnt have effect also.

Here is what opensips gives me:
--------------
Selected dst: sip:10.130.0.137
Jul 21 12:13:08 [3881] INFO:core:handle_sigs: child process 3889 exited by a signal 11
Jul 21 12:13:08 [3881] INFO:core:handle_sigs: core was generated
Jul 21 12:13:08 [3881] INFO:core:handle_sigs: terminating due to SIGCHLD
Jul 21 12:13:08 [3905] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3898] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3903] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3893] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3890] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3902] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3895] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3899] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3886] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3887] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3881] ERROR:b2b_logic:b2b_logic_dump: Bridge entities is NULL
Jul 21 12:13:08 [3881] INFO:db_mysql:re_init_statement:  query  is <update dialog set state=?,timeout=?,caller_cseq=?,callee_cseq=?,vars=?,profiles=?,script_flags=? where hash_entry=? AND hash_id=?>, ptr=(nil)
--------------

I little confused about it. What does it mean "Bridge entities is NULL"? and how to fix it.

thank you very much
Reply | Threaded
Open this post in threaded view
|

Re: top hiding and BYE problem

Anca Vamanu-3
Hi,

It is strange that setting $ru doesn't have effect. What version are you using? Please try 1.7 if you haven't.

Regards,
Anca Vamanu

On Thu, Jul 21, 2011 at 9:33 AM, saneku <[hidden email]> wrote:
Hello!
if i remove  <<$du="sip:##0950@10.130.0.137:5060">> from cfg file asterisk
gives me 404 error and i see that invite for asterisk looks like
"INVITE sip:10.130.0.137 SIP/2.0" not
"INVITE sip:##999@10.130.0.137:5060 SIP/2.0" how it looks with $du setted

adding <<$ru="sip:##0950@10.130.0.137:5060">> at each if statement doesnt
have effect also.

Here is what opensips gives me:
--------------
Selected dst: sip:10.130.0.137
Jul 21 12:13:08 [3881] INFO:core:handle_sigs: child process 3889 exited by a
signal 11
Jul 21 12:13:08 [3881] INFO:core:handle_sigs: core was generated
Jul 21 12:13:08 [3881] INFO:core:handle_sigs: terminating due to SIGCHLD
Jul 21 12:13:08 [3905] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3898] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3903] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3893] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3890] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3902] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3895] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3899] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3886] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3887] INFO:core:sig_usr: signal 15 received
Jul 21 12:13:08 [3881] ERROR:b2b_logic:b2b_logic_dump: Bridge entities is
NULL
Jul 21 12:13:08 [3881] INFO:db_mysql:re_init_statement:  query  is <update
dialog set
state=?,timeout=?,caller_cseq=?,callee_cseq=?,vars=?,profiles=?,script_flags=?
where hash_entry=? AND hash_id=?>, ptr=(nil)
--------------

I little confused about it. What does it mean "Bridge entities is NULL"? and
how to fix it.

thank you very much

--
View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/top-hiding-and-BYE-problem-tp6594249p6605584.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users