Hello.

I’m trying to count the calls to a specific gateway.  So I’m using the dialog module.  This route  is done before the final relay.

 

 

route[CHANNELS] {

        if( is_method("INVITE") ) {

                if(!isflagset(31) ) {

                        # user has max channel limit set as preference

                        if(is_avp_set("$avp(s:channels)") && avp_check("$avp(s:channels)", "gt/s:0")) {

                                # get current calls for uuid

                                xlog("L_INFO","[$ci] : avp_channels existe y es mayor que 0 ?");

                                if (get_profile_size("gws","$rd","$var(calls)")) {

                                        xlog("L_INFO","Actualmente el gateway $rd tiene $var(calls) llamadas simultaneas\n");

                                }

 

                                # check within limit

 

                                if($avp(s:channels) > $var(calls)) {

                                        xlog("L_INFO", "CHANNELS : terminador '$rd' tiene '$var(calls)' de '$avp(s:channels)' active

calls before this one\n");

                                        $var(setprofile) = 1;

                                } else {

                                        xlog("L_INFO", "Call crtl: user channel limit exceeded [$var(calls)/$avp(s:channels)]\n");

                                        send_reply("487", "Request Terminated: Channel limit exceeded");

                                        exit;

                                }

 

                        } else {

                                xlog("L_INFO","[$ci] : the value if channels is $avp(s:channels)");

                                if( !is_avp_set("$avp(s:channels)") ) {

                                        xlog("L_INFO","[$ci] : avp_channel not set");

                                };

 

                                if(!avp_check("$avp(s:channels)", "gt/s:0") ) {

                                        xlog("L_INFO","[$ci] : avp_channel menor que 0?");

                                };

 

                                $var(setprofile) = 0;

                        }

                }

 

                if($var(setprofile) > 0) {

 

                        if ( set_dlg_profile("gws","$rd") ) {

                                xlog("L_INFO","set_dlg_profile exitoso");

                        }

 

                }

 

 

When i made the call and try to see the profile with this command :

 

[root@sipvoiss kamailio]# kamctl fifo profile_get_size gws 10.0.0.220      

profile::  name=gws value=10.0.0.220 count=0

 

I’m not seeing the call added to the profile, despite the fact I using the set_dlg_profile("gws","$rd")

What could be happening?

 

 

This is part of the debug :

 

Jan 11 18:07:03 .: INFO: <script>: [71492292-34f2-a3ed-814e-0002a400d53d@10.0.0.214] INVITE dominio:10.0.0.208 LOCAL DOMAIN

Jan 11 18:07:03 .: DEBUG: misc_radius [functions.c:212]: success

Jan 11 18:07:03 .: DEBUG: misc_radius [functions.c:133]: AVP 'tranum'/0='sip:02444444444@10.0.0.208'/0 has been added

Jan 11 18:07:03 .: DEBUG: misc_radius [functions.c:133]: AVP 'channels'/0='2'/0 has been added

Jan 11 18:07:03 .: DEBUG: avpops [avpops_impl.c:1047]: 1 avps were processed

Jan 11 18:07:03 .: INFO: <script>: [71492292-34f2-a3ed-814e-0002a400d53d@10.0.0.214] INVITE con dominio:10.0.0.208 checks de usuario via avp_radius OK

Jan 11 18:07:03 .: INFO: <script>: [71492292-34f2-a3ed-814e-0002a400d53d@10.0.0.214] CHECKS SECTION :: INVITE:sip:02444444444@10.0.0.208 checks ok...

Jan 11 18:07:03 .: DEBUG: lcr [lcr_mod.c:1748]: added matched_gws[0]=[1, 4, 1, 8207736]

Jan 11 18:07:03 .: DEBUG: lcr [lcr_mod.c:1645]: added gw_uri_avp <1|1|4|550|3700771904||5060||1|0> with weight <8207736>

Jan 11 18:07:03 .: DEBUG: lcr [lcr_mod.c:1911]: r_uri <sip:5504444444@10.0.0.220:5060>, dst_uri <>

Jan 11 18:07:03 .: DEBUG: lcr [lcr_mod.c:2015]: added ruri_user_avp <02444444444>

Jan 11 18:07:03 .: DEBUG: lcr [lcr_mod.c:2050]: added flags_avp <0>

Jan 11 18:07:03 .: DEBUG: lcr [lcr_mod.c:2057]: added defunct_gw_avp <3700771904>

Jan 11 18:07:03 .: INFO: <script>: [71492292-34f2-a3ed-814e-0002a400d53d@10.0.0.214] Ruta LCR : cambiando sip:02444444444@10.0.0.208 por sip:5504444444@10.0.0.220:5060

Jan 11 18:07:03 .: INFO: <script>: [71492292-34f2-a3ed-814e-0002a400d53d@10.0.0.214] : entro en ruta 39 de call control

Jan 11 18:07:03 .: INFO: <script>: [71492292-34f2-a3ed-814e-0002a400d53d@10.0.0.214] : no esta seteado el flag 31

Jan 11 18:07:03 .: DEBUG: avpops [avpops_impl.c:1180]: check <2> against <0> as str /16

Jan 11 18:07:03 .: INFO: <script>: [71492292-34f2-a3ed-814e-0002a400d53d@10.0.0.214] : avp_channels existe y es mayor que 0 ?

Jan 11 18:07:03 .: INFO: <script>: Actualmente el gateway 10.0.0.220 tiene 0 llamadas simultaneas

Jan 11 18:07:03 .: INFO: <script>: CHANNELS : terminador '10.0.0.220' tiene '0' de '2' active calls before this one

Jan 11 18:07:03 .: INFO: <script>: set_dlg_profile exitoso

 

 

 

Thanks in advance,

Regards,

Ricardo.-