[Kamailio-Users] Forward calls from Asterisk to SIP provider via Kamailio for termination

Slot Zero slotzero1 at yahoo.com
Tue Feb 23 14:55:12 CET 2010


Hi Henning,

There is no error. Just it doesn't behave the way it should. By the way the thread you replied to has an error in the config I had sent. Please find it corrected below. Thank you

#------CONFIG BEGINS------------------
mpath="/lib/kamailio/modules_k/"

debug=3
fork=yes

children=4
auto_aliases=no
alias=localhost
alias=192.168.10.1
alias=192.168.10.2
alias=192.168.10.3
alias=192.168.10.4
alias=192.168.10.5
alias=192.168.10.6

disable_tcp=yes

loadmodule "sl.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "/lib/kamailio/modules/tm.so"
loadmodule "textops.so"

modparam("rr", "enable_full_lr", 1)

route {
        # Sanity Check
        # ------------

        # filter too old messages
        if (!mf_process_maxfwd_header("10")) {
                log("LOG: Too many hops\n");
                sl_send_reply("483","Too Many Hops");
                break;
        };


        if(msg:len>2048) {
               sl_send_reply("413", "message too large to be forwarded over UDP without fragmentation");
               exit;
        };

        # Record Route
        # --------------
        if (method != "REGISTER") {
                record_route();
        };

        # Loose Route

        # -----------
        if (loose_route()) {

                route(1);
                return;
        };

        # Call Type Processing
        # --------------------
        if (uri != myself) {
                route(1);
                return;
        };

        if (uri == myself) {
                if (method == "BYE") {
                        route(4);
                        return;
                } else if (method == "CANCEL") {
                        route(4);
                        return;
                } else if (method == "INVITE") {
                        route(3);
                        return;
                } else if (method == "NOTIFY") {
                        sl_send_reply("200", "Understood");
                        return;
                } else if (method == "OPTIONS") {
                        sl_send_reply("200", "Got it");
                        return;
                }
        };
        route(1);
}

# Default Message Handling
# -----------------------
route[1] {
       t_on_reply("1");
        if (!t_relay()) {
                sl_reply_error();
        };
}

# INVITE Message Handling
# ----------------------------------

# ----------------------------------
route[3] {
        if (uri =~ "^sip:011[0-9]@*") {
                rewritehostport("sip.voipprovider.com:5060");
                if (search("^(Contact|m): .*user01*@(127\.0\.0\.1|localhost)")) {
                force_send_socket(192.168.10.2:5060);
                };
                route(1);
                return;
        };

}

# CANCEL and BYE Message Handling
# ----------------------------------
route[4] {
        route(1);
}

Cheers

--- On Tue, 2/23/10, Henning Westerholt <henning.westerholt at 1und1.de> wrote:

> From: Henning Westerholt <henning.westerholt at 1und1.de>
> Subject: Re: [Kamailio-Users] Forward calls from Asterisk to SIP provider via Kamailio for termination
> To: users at lists.kamailio.org
> Cc: "Slot Zero" <slotzero1 at yahoo.com>
> Date: Tuesday, February 23, 2010, 7:57 AM
> On Saturday 20 February 2010, Slot
> Zero wrote:
> > I am a Kamailio noob :). I am trying to get Asterisk
> to forward calls to
> > my SIP provider via Kamailio.
> > The same machine is running Kamailio and
> > Asterisk. I do not want to consume credentials as they
> have to be passed
> > on all the way to my SIP provider. There is no NAT of
> any sorts. SIP
> > Phone/Users connect to Asterisk. I do not need to
> authenticate when
> >  forwarding call from Asterisk to Kamailio as
> they are both running on the
> >  same server but I do need to make sure that
> Kamailio dials and forwards
> >  011+number to be sent from local host port
> > 5062(Asterisk listener) to SIP provider only.
> > I have 6 Public IP addresses
> > mapped on the server. I want to use the
> force_send_socket to allow me to
> > change source IP of SIP requests when being sent to
> the SIP provider on the
> >  basis of credentials username in the request. I
> have pasted my config
> >  below. Please tell me what am I doing wrong
> here. In the kamctlrc file i
> >  have SIP_DOMAIN=localhost
> 
> Hi Slot,
> 
> do you observe an error with your quoted configuration, or
> it does not behave 
> like you expect?
> 
> Cheers,
> 
> Henning
> 


      




More information about the sr-users mailing list