[SR-Users] dialog module shared memory

Charles Chance charles.chance at sipcentric.com
Mon Jan 19 12:58:55 CET 2015


Hi Grant,

There is no integration with the dialog module directly - that is coming
soon - but for now you can track call profiles across the cluster by doing
something like:

loadmodule "dmq"
loadmodule "htable"
...
modparam("dmq", "server_address", "sip:MY_IP_ADDR:5080") # <--- make sure
you listen on a separate, restricted port!
modparam("dmq", "notification_address", "sip:REMOTE_DMQ_ADDR:5080") # <---
we just need to tell DMQ about one other node - it will learn about any
others itself
...
modparam("htable", "enable_dmq", 1)
modparam("htable", "htable",
"call_profiles=>size=7;autoexpire=3600;dmqreplicate=1;")
...

route {

        if (method == "KDMQ" && $Rp == 5080) {
               dmq_handle_message();
               exit;
        }

        # handle requests within SIP dialogs
        route(WITHINDLG);
...
        # on INVITE, add the call to one or more "profiles"...
        $sht(call_profiles=>$ci) = "external:" + $fu; # you can append more
if required (+ ",international:" + $fu + ",outgoing:" + $fu...)

        t_on_failure("FAILURE");
...

}

route[WITHINDLG] {
...
        if (is_method("BYE")) {
              $sht(call_profiles=>$ci) = $null;
        }
...
}

failure_route[FAILURE] {
...
        $sht(call_profiles=>$ci) = $null;
...
}


Now, any time you need to, you can get the current count of calls in any
profile for any user by doing...

$var(count_external) = $shtcv(call_profiles=>external:$fu);
$var(count_outgoing) = $shtcv(call_profiles=>outgoing:$fu);

The above offers flexibility of adding calls to multiple profiles, but if
that is beyond your requirements, you could equally just
increment/decrement a counter for each user with:

$shtinc(call_count=>$fu)
$shtdec(call_count=>$fu)


I put this together quickly, so please excuse any typos or omissions, but
it should hopefully be enough for illustration purposes.

Regards,

Charles



On 19 January 2015 at 07:05, Grant Bagdasarian <gb at cm.nl> wrote:

>  Hello Charles,
>
>
>
> I’ve looked at the htable and dmq modules, but I don’t understand how to
> integrate this with the dialog module.
>
>
>
> Could you post an example please?
>
>
>
> Thanks!
>
>
>
> Regards,
>
>
>
> Grant
>
>
>
> *From:* sr-users [mailto:sr-users-bounces at lists.sip-router.org] *On
> Behalf Of *Charles Chance
> *Sent:* Friday, January 16, 2015 12:23 PM
> *To:* SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) -
> Users Mailing List
> *Subject:* Re: [SR-Users] dialog module shared memory
>
>
>
> Hello,
>
> Currently, this is work in progress. But in the meantime, it is possible
> to achieve using htable with dmq enabled.
>
> I can post an example later if required.
>
> Cheers,
> Charles
>
> On 16 Jan 2015 07:54, "Grant Bagdasarian" <gb at cm.nl> wrote:
>
> Hello,
>
>
>
> I’m using the dialog module to control the maximum number of calls allowed
> to be passed through.
>
> Is it possible to share the dialogs stored in memory with multiple
> instances of kamailio?
>
>
>
> So if both kamailio instances process calls, and the maximum is set to a
> global of 10, both combined should never let more than 10 calls through.
>
>
>
> Regards,
>
>
>
> Grant
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
> www.sipcentric.com
>
> Follow us on twitter @sipcentric <http://twitter.com/sipcentric>
>
> Sipcentric Ltd. Company registered in England & Wales no. 7365592. Registered
> office: Faraday Wharf, Innovation Birmingham Campus, Holt Street,
> Birmingham Science Park, Birmingham B7 4BB.
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>

-- 
www.sipcentric.com

Follow us on twitter @sipcentric <http://twitter.com/sipcentric>

Sipcentric Ltd. Company registered in England & Wales no. 7365592. Registered 
office: Faraday Wharf, Innovation Birmingham Campus, Holt Street, 
Birmingham Science Park, Birmingham B7 4BB.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150119/f996c5c1/attachment.html>


More information about the sr-users mailing list