[OpenSIPS-Users] Opensips and Callcontroll KeyError

Davide Dal Frà lab at dalfra.com
Fri Feb 22 13:11:58 CET 2013


Hi Saul,

The endpoints send the Invite twice (Time 0.000 and Time 0.099), after 
that The proxy (opensips) send back a 500 . It seems like the endpoints 
consider timed out the  first invite and it resend again.

My routing flow is:

1. Check if is an INVITE from a GW ( is_method("INVITE") && is_from_gw() )
2. do a "dp_translate"
3. route to "check_channels" block that is composed in this mode:

      *   Check the available channels , script idea taken from
        http://www.opensips.org/Resources/DocsTutConcurrentCalls
      *   Call the "call_control()" functions  as described in
        call_cc.txt (attached)

4. call "topology_hidding()" function
5. engage_mediaproxy()
6. call do_routing, and add some helper routes (t_on_branch("2"); 
t_on_reply("2"); t_on_failure("2");) and call the t_relay() . The block 
is  attached in helper.txt file.




Thanks again for your time


Regards
Davide


On 02/22/2013 12:18 PM, Saúl Ibarra Corretgé wrote:
> I analyzed the traces you sent and I'm seeing very weird things on the OnAnswer set:
>
> An endpoint sends an INVITE to the proxy, the proxy sends a 500 and the device acknowledges it with an ACK. Yet the proxy seems to forward the INVITE anyway! As you can see from the response on the BYE request (481) the proxy is confused and so is CallControl.
>
> Can you better describe how you are doing the routing and when do you call call_control in your OpenSIPS script? (an overview, please don't attach a full configuration file).
>
>
> Regards,
>
> --
> Saúl Ibarra Corretgé
> AG Projects
>
>
>
>
> _______________________________________________
> 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/20130222/c8481e53/attachment.htm>
-------------- next part --------------
 
route[check_whs_channels]{

    if ( !isflagset(30) ){

        avp_db_load("$si" , "$avp(channels)");
        get_profile_size("caller" , "sip:$avp(diverter-avp)", "$avp(calls)");

        xlog("AVAIL CHANS: $avp(channels) IN USE: $avp(calls)");


        if ( is_avp_set("$avp(channels)") ) {


	    if ( $avp(channels) > $avp(calls) ) {
                xlog("--- MAX SESSION IS OK --");   
                $var(setprofile)=1;
            }
            else{
                xlog("---  MAX SESSION REACHED ---");
                send_reply("487" , "Channel limit exceeded\n");
                exit;
            }
        }
        else{
            $var(setprofile)=0;
        }

        call_control();

        switch ($retcode){

            case 2:
                    #chiamata senza limiti
                    xlog("call with no limit");
                    send_reply("503","call with no limit not allowed");
                    exit;
                    break;

            case 1:
                   
                    xlog("---  CALL UNDER CALLCONTROL ---");
                    break;

            case -1:
                  
                    acc_aaa_request("402");
                    sl_send_reply("402", "Not enough credit");
                    exit;
                    break;

            case -2:
                    #locked by call in progress
                    xlog("Call control: prepaid call locked by another call in progress\n");
                    acc_aaa_request("403");
                    sl_send_reply("403", "Call locked by another call in progress");
                    exit;
                    break;

            default:
                    xlog("Call control internal server error");
                    acc_aaa_request("500");
                    sl_send_reply("500", "Internal server error");
                    exit;


        }


        if ( $var(setprofile) > 0 ) {

            if(create_dialog("PpB")) {
               xlog("************************* DIALOG CREATO CORRETTAMENTE *****************************");
               set_dlg_profile("caller","sip:$avp(diverter-avp)");
            }

        }


        setflag(30);

    }

}

-------------- next part --------------
route[helper_route]{

        if (is_method("INVITE")) {
                t_on_branch("2");
                t_on_reply("2");
                t_on_failure("2");
        }


        if (!t_relay()) {
                send_reply("500","Internal Error");
        };
        xlog("--------- PACKET RELAYED ----------");
        xlog("\n\n");
        exit;

}



failure_route[2] {
     if (t_was_cancelled()) {
                xlog("transaction was cancelled");
                exit;
      }

      if ( isflagset(10) ) {


        if ( t_check_status("(404)|(503)|(500)|(502)") ){
               if ( use_next_gw() ){
                    xlog("using next gw $ru\n");
                    $fs = $avp(gw_attrs);
                    t_on_failure("2");
                    t_relay();
                    exit;
               }
               else{
		   xlog("no more gateway")
		   send_reply("503" , "No more gw");
               }
        }
    }


}
onreply_route[2] {


        if ( isbflagset(6)){
                xlog("fixing nated contact");
                search_append('Contact:.*sip:[^>[:cntrl:]]*' , ';nat=yes');
                fix_nated_contact();
        }
        exit;


}
branch_route[2] {
        xlog("new branch at $ru\n");

}



More information about the Users mailing list