Hi M S,
Thank you so much for your quick response.
I should mention that I don’t have deep expertise in Kamailio. I’ve been doing 
a lot of browsing and research (including ChatGPT), and based on that I found a 
few possible approaches to make outbound calls directly from Kamailio using a 
SIP trunk.
Some of the methods I came across are:

  *
uac_send_request
  *
app_lua
  *
jsonrpc_exec

My goal is to originate outbound calls directly from Kamailio (without 
Asterisk) toward a GSM/SIP gateway. I’m not fully sure which approach is the 
most appropriate or recommended in a production setup.
I would really appreciate your guidance on the correct and supported way to 
achieve this.
Thanks again for your time and support.
For your reference I am sharing some sample code of two method

1st method

event_route[xhttp:request] {

    if ($hu =~ "^/obd") {

        $avp(msisdn) = $(hu{param.value,msisdn});

        if ($avp(msisdn) == $null) {
            xhttp_reply("400", "Bad Request", "text/plain",
                "Missing msisdn\n");
            exit;
        }

        # Destination URI for the call
        $var(dst_uri) = "sip:" + $avp(msisdn) + "@182.77.59.145:5060";

        # From URI (mandatory)
        $var(from_uri) = "sip:[email protected]";

        xlog("L_INFO", "Calling GSM number: $var(dst_uri)\n");

        # Send INVITE using UAC
        uac_req_send(
            "INVITE",
            $var(dst_uri),
            $var(from_uri),
            "",
            ""
        );

        xhttp_reply("200", "OK", "text/plain",
            "Call initiated\n");
        exit;
    }

    xhttp_reply("404", "Not Found", "text/plain", "Not Found\n");
    exit;
}

2nd method .

event_route[xhttp:request] {
    if ($hu !~ "^/obd/") {
        xhttp_reply("404", "Not Found", "", "");
        exit;
    }

    $var(uri) = $hu;
    $var(callee) = $(var(uri){s.select,3,/});

    if ($var(callee) == "") {
        xhttp_reply("400", "Missing MSISDN", "", "");
        exit;
    }

    xlog("L_INFO", "OBD HTTP caller=9999909109 callee=$var(callee)\n");

    $var(json) = "{\"jsonrpc\":\"2.0\",\"method\":\"dialog.bridge_dlg\","
                 "\"params\":[\"sip:[email protected]\","
                 "\"sip:$var(callee)@182.77.59.145\"],\"id\":1}";

    jsonrpc_exec($var(json));
    xhttp_reply("200", "OK", "", "OBD triggered\n");
    exit;
}

Regards
Chandra Bhan Kumar
________________________________
From: M S <[email protected]>
Sent: Monday, January 26, 2026 7:30 PM
To: Kamailio (SER) - Development Mailing List <[email protected]>
Cc: Daniel-Constantin Mierla <[email protected]>; Chandra Bhan 
<[email protected]>
Subject: Re: [sr-dev] OBD Based Missed Call issue

Kamailio is NOT a media endpoint nor a media gateway. It is a SIP proxy that 
routes call between two endpoints, gateways or proxies. What you seems to do is 
trying to originate a call from Kamailio to some provider, which will simply 
not work.

For Outbound Dialer service you need to setup some media gateway like Asterisk, 
Freeswitch or CUCM (Cisco Unified Media Gateway) etc.

Regards.

--
Muhammad Shahzad Shafi.
Tel: +49 176 99 83 10 85

On Mon, 26 Jan 2026, 13:45 Chandra Bhan via sr-dev, 
<[email protected]<mailto:[email protected]>> wrote:
Hi Daniel

I hope you are doing well. Looking for your support on kamailio.

I am a new for kamailio. I want to build setup OBD Based Missed Call Solution


  1.
I able to send http request on kamailio but call not getting dial due to some 
reason

Here is my code. Could you help me to resolve the issue.

#!KAMAILIO

####### Global Parameters #########

debug=3
log_stderror=yes
memdbg=5
memlog=5
children=8

tcp_accept_no_cl=yes
auto_aliases=no

listen=udp:172.26.12.138:5060<http://172.26.12.138:5060>
listen=tcp:0.0.0.0:8080<http://0.0.0.0:8080>

alias=your.public.ip   # optional

####### Modules Section ########

loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "tmx.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "xlog.so"
loadmodule "textops.so"
loadmodule "maxfwd.so"
loadmodule "sanity.so"
loadmodule "siputils.so"
loadmodule "xhttp.so"
loadmodule "uac.so"

####### Module Parameters ########

# --- TM
modparam("tm", "fr_timer", 5000)
modparam("tm", "fr_inv_timer", 30000)

# --- RR
modparam("rr", "enable_double_rr", 1)
modparam("rr", "append_fromtag", 1)

# --- UAC (authentication profile)
# format:
# name => sip:proxy, username, password
modparam("uac", "uac_reg",
    "obd => sip:GSM-Gateway-IP:5060,2555,123456"
)

####### Routing Logic ########

request_route {

    # Sanity checks
    if (!sanity_check("1511", "7")) {
        xlog("L_ERR", "Sanity failed\n");
        drop;
    }

    if (!mf_process_maxfwd_header("10")) {
        sl_send_reply("483", "Too Many Hops");
        exit;
    }

    # Handle HTTP requests
    if ($Rp == 8080 && $rm == "GET") {
        route(HTTP);
        exit;
    }

    # SIP requests (only outbound calls expected)
    if (is_method("INVITE")) {
        record_route();
        t_relay();
        exit;
    }

    if (is_method("ACK|BYE|CANCEL")) {
        t_relay();
        exit;
    }

    sl_send_reply("404", "Not Here");
    exit;
}

####### HTTP ROUTE ########

route[HTTP] {

    if ($hu =~ "^/call") {

        # Example:
        # http://IP:8080/call?msisdn=9999909109

        $var(msisdn) = $param(msisdn);

        if ($var(msisdn) == "") {
            xhttp_reply("400", "text/plain", "Missing msisdn\n");
            exit;
        }

        xlog("L_INFO", "HTTP Call request for $var(msisdn)\n");

        route(OBD_CALL);
        xhttp_reply("200", "text/plain", "Call initiated\n");
        exit;
    }

    xhttp_reply("404", "text/plain", "Invalid URL\n");
    exit;
}

####### OUTBOUND CALL ROUTE ########

route[OBD_CALL] {

    $var(dst_uri) = "sip:" + $var(msisdn) + "@GSM-Gateway-IP:5060";

    xlog("L_INFO", "Calling $var(dst_uri)\n");

    uac_req_send(
        "INVITE",
        $var(dst_uri),
        "sip:[email protected]",
        "sip:" + $var(msisdn) + "@your.domain",
        "",
        "obd"
    );

    exit;
}


_______________________________________________
Kamailio - Development Mailing List -- 
[email protected]<mailto:[email protected]>
To unsubscribe send an email to 
[email protected]<mailto:[email protected]>
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to