<div dir="ltr">Hello!<div><br></div><div>I'm new with kamailio, so may be don't understand some basic.</div><div>I'm tryin to load balance asterisk servers with kamailio and dispatcher module. My ip phones registered at kamailio, for example:</div><div><div><br></div><div>[root@sipchel ~]# kamctl ul show 101</div><div>{<br></div><div>  "jsonrpc":  "2.0",</div><div>  "result": {</div><div>    "AoR":  "101",</div><div>    "Contacts": [{</div><div>        "Contact":  {</div><div>          "Address":  "<a href="mailto:sip%3A101@192.168.2.62">sip:101@192.168.2.62</a>;line=4733c4bfa459eea",</div><div>          "Expires":  2953,</div><div>          "Q":  -1,</div><div>          "Call-ID":  "1361221648",</div><div>          "CSeq": 136,</div><div>          "User-Agent": "Linphone/3.6.1 (eXosip2/3.6.0)",</div><div>          "Received": "[not set]",</div><div>          "Path": "[not set]",</div><div>          "State":  "CS_SYNC",</div><div>          "Flags":  0,</div><div>          "CFlags": 0,</div><div>          "Socket": "udp:<a href="http://192.168.10.54:5060">192.168.10.54:5060</a>",</div><div>          "Methods":  -1,</div><div>          "Ruid": "uloc-596f5abc-2ce5-2",</div><div>          "Instance": "[not set]",</div><div>          "Reg-Id": 0,</div><div>          "Last-Keepalive": 1500530337,</div><div>          "Last-Modified":  1500530337</div><div>        }</div><div>      }]</div><div>  },</div><div>  "id": 15024</div><div>}</div><div><br></div><div><br></div><div>I have realtime asterisk server.</div><div><div>[root@sipchel ~]# kamctl dispatcher dump</div><div>{<br></div><div>  "jsonrpc":  "2.0",</div><div>  "result": {</div><div>    "NRSETS": 1,</div><div>    "RECORDS":  [{</div><div>        "SET":  {</div><div>          "ID": 1,</div><div>          "TARGETS":  [{</div><div>              "DEST": {</div><div>                "URI":  "sip:192.168.4.16",</div><div>                "FLAGS":  "IX",</div><div>                "PRIORITY": 0</div><div>              }</div><div>            }, {</div><div>              "DEST": {</div><div>                "URI":  "sip:192.168.10.47",</div><div>                "FLAGS":  "AX",</div><div>                "PRIORITY": 0</div><div>              }</div><div>            }]</div><div>        }</div><div>      }]</div><div>  },</div><div>  "id": 15087</div><div>}</div></div><div><br></div><div><br></div><div><div>So I want if 101 call to 102 it will process by asterisk(for call recording and other features). Now if I call from 101 to 102 kamailio will forward to asterisk and asterisk dialplan cannot find that extesion(as expected, because it is not registed on asterisk)</div></div><div><div>[kamailio]</div><div>exten => _1XX,1,Dial(SIP/${EXTEN})</div><div>exten => _1XX,n,Hangup</div></div><div>If I change dialplan to Dial(SIP/KAMAILIO/${EXTEN}) call wil return to kamailio, but kamailio send it back to asterisk...</div><div><div><br></div><div>I hope I explained correctly, my English is terrible.</div></div><div>Is my screnario proper? How this usually done? Should I forward sip registrations to asterisks?</div><div><br></div><div><br></div><div><br></div><div><br></div><div>My kamailio config</div><div><div># dispatcher params</div><div>modparam("dispatcher", "db_url", "mysql://kamailio:kamailiorw@localhost/kamailio")</div><div>modparam("dispatcher", "ds_ping_interval", 30)</div><div>modparam("dispatcher", "table_name", "dispatcher")</div><div>modparam("dispatcher", "flags", 2)</div><div>modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")</div><div>modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")</div><div>modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")</div></div><div><br></div><div><div>modparam("auth_db", "db_url", DBASTURL)</div><div>modparam("auth_db", "calculate_ha1", yes)</div><div>modparam("auth_db", "user_column", "name")</div><div>modparam("auth_db", "password_column", "sippasswd")</div><div>modparam("auth_db", "load_credentials", "")</div><div>#modparam("auth_db", "version_table", 0)</div></div><div><br></div><div><br></div><div><div><div>request_route {</div><div><br></div><div><------># per request initial checks</div><div><------>route(REQINIT);</div><div><br></div><div><------># NAT detection</div><div><------>route(NATDETECT);</div><div><br></div><div><------># CANCEL processing</div><div><------>if (is_method("CANCEL")) {</div><div><------><------>if (t_check_trans()) {</div><div><------><------><------>route(RELAY);</div><div><------><------>}</div><div><------><------>exit;</div><div><------>}</div><div><br></div><div><------># handle retransmissions</div><div><------>if (!is_method("ACK")) {</div><div><------><------>if(t_precheck_trans()) {</div><div><------><------><------>t_check_trans();</div><div><------><------><------>exit;</div><div><------><------>}</div><div><------><------>t_check_trans();</div><div><------>}</div><div><br></div><div><------># handle requests within SIP dialogs</div><div><------>route(WITHINDLG);</div><div><br></div><div><------>### only initial requests (no To tag)</div><div><br></div><div><------># authentication</div><div><------>route(AUTH);</div><div><br></div><div><------># record routing for dialog forming requests (in case they are routed)</div><div><------># - remove preloaded route headers</div><div><------>remove_hf("Route");</div><div><------>if (is_method("INVITE|SUBSCRIBE")) {</div><div><------><------>record_route();</div><div><------>}</div><div><br></div><div><------># account only INVITEs</div><div><------>if (is_method("INVITE")) {</div><div><------><------>setflag(FLT_ACC); # do accounting</div><div><------>}</div><div><br></div><div><------># dispatch requests to foreign domains</div><div><------>route(SIPOUT);</div></div><div><div>------>### requests for my local domains</div><div><br></div><div><------># handle presence related requests</div><div><------>route(PRESENCE);</div><div><br></div><div><------># handle registrations</div><div><------>route(REGISTRAR);</div><div><br></div><div><------>if ($rU==$null) {</div><div><------><------># request with no Username in RURI</div><div><------><------>sl_send_reply("484","Address Incomplete");</div><div><------><------>exit;</div><div><------>}</div><div><br></div><div><------># dispatch destinations to PSTN</div><div><------>route(PSTN);</div><div><br></div><div><------># user location service</div><div><------>route(LOCATION);</div><div>}</div></div><div><br></div><div># User location service</div><div>route[LOCATION] {</div><div><br></div><div>#!ifdef WITH_SPEEDDIAL</div><div><------># search for short dialing - 2-digit extension</div><div><------>if($rU=~"^[0-9][0-9]$") {</div><div><------><------>if(sd_lookup("speed_dial")) {</div><div><------><------><------>route(SIPOUT);</div><div><------><------>}</div><div><------>}</div><div>#!endif</div><div><br></div><div>#!ifdef WITH_ALIASDB</div><div><------># search in DB-based aliases</div><div><------>if(alias_db_lookup("dbaliases")) {</div><div><------><------>route(SIPOUT);</div><div><------>}</div><div>#!endif</div><div><br></div><div><------>$avp(oexten) = $rU;</div><div><------>if (!lookup("location")) {</div><div><------><------>$var(rc) = $rc;</div><div><------><------>route(TOVOICEMAIL);</div><div><------><------>t_newtran();</div><div><------><------>switch ($var(rc)) {</div><div><------><------><------>case -1:</div><div><------><------><------>case -3:</div><div><------><------><------><------>send_reply("404", "Not Found");</div><div><------><------><------><------>exit;</div><div><------><------><------>case -2:</div><div><------><------><------><------>send_reply("405", "Method Not Allowed");</div><div><------><------><------><------>exit;</div><div><------><------>}</div><div><------>}</div><div><br></div><div><------># when routing via usrloc, log the missed calls also</div><div><------>if (is_method("INVITE")) {</div><div><------><------>setflag(FLT_ACCMISSED);</div><div><------>}</div><div><br></div><div>        route(DISPATCH);</div><div><------>route(RELAY);</div><div><------>exit;</div><div>}</div><div><br></div></div><div><div># Dispatch requests</div><div>route[DISPATCH] {</div><div><------># round robin dispatching on gateways group '1'</div><div><------>if(!ds_select_dst("1", "4"))</div><div><------>{</div><div><------>    xlog("aaaa--- SCRIPT: going to <$ru> via <$du>\n");</div><div><------>    send_reply("404", "No destination");</div><div><------>    exit;</div><div><------>}</div><div><------>xlog("--- SCRIPT: going to <$ru> via <$du>\n");</div><div><------>t_on_failure("RTF_DISPATCH");</div><div><------>return;</div><div>}</div></div><div><br></div><div><br></div>-- <br><div class="gmail_signature">Aydar A. Kamalov</div>
</div></div>