[SR-Users] create loop for REGISTER SEND in Kamailio.cfg

ANTHONY HESNAUX anthony.hesnaux at gmail.com
Fri Aug 15 11:29:00 CEST 2014


hello everybody,

I would like loop in kamailio.cfg because I want register soft phone on all asterisk system so I have this configuration

but also if I want add another asterisk system

my Kamailio.cfg

#!define WITH_ASTERISK
#!define WITH_CLUST_AST


#!ifdef WITH_ASTERISK
asterisk.bindip = "asterisk.home.fr" desc "Asterisk IP Address"
asterisk.bindport = "5080" desc "Asterisk Port"
kamailio.bindip = « kamailio.home.fr" desc "kamailio IP Address"
kamailio.bindport = "5060" desc "Kamailio Port"
#!endif

#!ifdef WITH_CLUST_AST
#!define HOST 2
asterisk1.bindip = "192.168.0.10" desc « Asterisk - 1 - IP Address"
asterisk1.bindport = "5080" desc "Asterisk Port"
asterisk2.bindip = "192.168.0.20" desc « Asterisk - 2 - IP Address"
asterisk2.bindport = "5080" desc "Asterisk Port"
#!endif




# Forward REGISTER to Asterisk
route[REGFWD] {
        if(!is_method("REGISTER"))
        {
                return;
        }

        $var(rip) = $sel(cfg_get.asterisk1.bindip);
        $uac_req(method)="REGISTER";
        $uac_req(ruri)="sip:" + $var(rip) + ":" + $sel(cfg_get.asterisk1.bindport);
        $uac_req(furi)="sip:" + $au + "@" + $var(rip);
        $uac_req(turi)="sip:" + $au + "@" + $var(rip);
        $uac_req(hdrs)="Contact: <sip:" + $au + "@"
                                + $sel(cfg_get.kamailio.bindip)
                                + ":" + $sel(cfg_get.kamailio.bindport) + ">\r\n";
        if($sel(contact.expires) != $null)
                $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + "\r\n";
        else
                $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n";
        uac_req_send();

	$var(rip) = $sel(cfg_get.asterisk2.bindip);
        $uac_req(method)="REGISTER";
        $uac_req(ruri)="sip:" + $var(rip) + ":" + $sel(cfg_get.asterisk2.bindport);
        $uac_req(furi)="sip:" + $au + "@" + $var(rip);
        $uac_req(turi)="sip:" + $au + "@" + $var(rip);
        $uac_req(hdrs)="Contact: <sip:" + $au + "@"
                                + $sel(cfg_get.kamailio.bindip)
                                + ":" + $sel(cfg_get.kamailio.bindport) + ">\r\n";
        if($sel(contact.expires) != $null)
                $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + "\r\n";
        else
                $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n";
        uac_req_send();

}
#!endif
 

thank you for your help

anthony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140815/196beb3d/attachment.html>


More information about the sr-users mailing list