<div dir="ltr"><div>Hi Razvan,</div><div>By agent, I am referring the softphone (zoiper or microsip). I will look into "Path" or "Mid registar".</div><div>I still need to use the rtpproxy module, correct for all of this ?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 22, 2020 at 11:57 AM Răzvan Crainea <<a href="mailto:razvan@opensips.org">razvan@opensips.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">What does "connect an agent" mean? Register on a specific asterisk <br>
server? If so, you should be using the Path module[1] to add OpenSIPS as <br>
an extra hop between the agent and Asterisk. An alternative is the Mid <br>
registrar module[2], which can itself store the location of the agent, <br>
and relay calls to it.<br>
<br>
[1] <a href="https://opensips.org/docs/modules/3.1.x/path.html" rel="noreferrer" target="_blank">https://opensips.org/docs/modules/3.1.x/path.html</a><br>
[2] <a href="https://opensips.org/docs/modules/3.1.x/mid_registrar.html" rel="noreferrer" target="_blank">https://opensips.org/docs/modules/3.1.x/mid_registrar.html</a><br>
<br>
Răzvan Crainea<br>
OpenSIPS Core Developer<br>
<a href="http://www.opensips-solutions.com" rel="noreferrer" target="_blank">http://www.opensips-solutions.com</a><br>
<br>
On 10/22/20 11:37 AM, Mihai wrote:<br>
> Any hints about this?<br>
> <br>
> On Tue, Sep 29, 2020 at 4:46 PM Mihai <<a href="mailto:m@mokalife.ro" target="_blank">m@mokalife.ro</a> <br>
> <mailto:<a href="mailto:m@mokalife.ro" target="_blank">m@mokalife.ro</a>>> wrote:<br>
> <br>
>     Hi all,<br>
> <br>
>     I need some help on getting to work my scenario:<br>
> <br>
>     I have 3 asterisk servers, and, every agent is connecting  to which<br>
>     server they need by contacting the PublicIP. (the problem is that I<br>
>     need to reuse the IP address on others servers) . I want if is<br>
>     possible to use Opensips as proxy, so that agents can connect to<br>
>     those asterisk servers by virtualhost (example.<br>
>     asterisk1.behindproxy.example, asterisk2.behindproxy.example ).<br>
>     Basically I want to proxy everything thru OpenSIPs.<br>
> <br>
> <br>
>     I am using centos 7 with the following packages installed:<br>
>     opensips-dialplan-module-3.1.0-1.el7.x86_64<br>
>     opensips-yum-releases-3.1-5.el7.noarch<br>
>     opensips-b2bua-module-3.1.0-1.el7.x86_64<br>
>     opensips-regex-module-3.1.0-1.el7.x86_64<br>
>     opensips-mysql-module-3.1.0-1.el7.x86_64<br>
>     opensips-3.1.0-1.el7.x86_64<br>
> <br>
> <br>
> <br>
>     What I tried so far is this config, it dose send my users to<br>
>     required Asterisk servers, but on the asterisk server I don't see<br>
>     their IP ( i see the IP of the proxy) and that's it ....<br>
>     the dispatcher list is  this from mysql:<br>
> <br>
>     Any help is apreciated.<br>
>     +----+-------+----------------+--------+-------+--------+----------+-------+-------------+<br>
>     | id | setid | destination    | socket | state | weight | priority |<br>
>     attrs | description |<br>
>     +----+-------+----------------+--------+-------+--------+----------+-------+-------------+<br>
>     |  1 |     1 | sip:172.16.0.2 | NULL   |     2 | 1      |        0<br>
>     |       | sip1        |<br>
>     |  2 |     2 | sip:172.16.0.3 | NULL   |     2 | 1      |        0<br>
>     |       | sip2        |<br>
>     |  3 |     3 | sip:172.16.0.4 | NULL   |     2 | 1      |        0<br>
>     |       | sip3        |<br>
>     +----+-------+----------------+--------+-------+--------+----------+-------+-------------+<br>
> <br>
> <br>
>     ####### Global Parameters #########<br>
>     #debug_mode=yes<br>
>     log_level=4<br>
>     log_stderror=no<br>
>     log_facility=LOG_LOCAL0<br>
>     udp_workers=4<br>
>     socket=udp:<a href="http://0.0.0.0:5060" rel="noreferrer" target="_blank">0.0.0.0:5060</a> <<a href="http://0.0.0.0:5060" rel="noreferrer" target="_blank">http://0.0.0.0:5060</a>><br>
>     ####### Modules Section ########<br>
> <br>
>     #set module path<br>
>     mpath="/usr/lib64/opensips/modules"<br>
> <br>
>     #### SIGNALING module<br>
>     loadmodule "signaling.so"<br>
> <br>
>     loadmodule "db_mysql.so"<br>
>     loadmodule "db_text.so"<br>
> <br>
>     #### StateLess module<br>
>     loadmodule "sl.so"<br>
> <br>
>     #### Transaction Module<br>
>     loadmodule "tm.so"<br>
>     modparam("tm", "fr_timeout", 5)<br>
>     modparam("tm", "fr_inv_timeout", 30)<br>
>     modparam("tm", "restart_fr_on_each_reply", 0)<br>
>     modparam("tm", "onreply_avp_mode", 1)<br>
> <br>
>     #### Record Route Module<br>
>     loadmodule "rr.so"<br>
>     modparam("rr", "append_fromtag", 0)<br>
> <br>
>     #### MAX ForWarD module<br>
>     loadmodule "maxfwd.so"<br>
> <br>
>     #### SIP MSG OPerationS module<br>
>     loadmodule "sipmsgops.so"<br>
> <br>
>     #### FIFO Management Interface<br>
>     loadmodule "mi_fifo.so"<br>
>     modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")<br>
>     modparam("mi_fifo", "fifo_mode", 0666)<br>
> <br>
>     #### USeR LOCation module<br>
>     loadmodule "usrloc.so"<br>
>     modparam("usrloc", "nat_bflag", "NAT")<br>
>     modparam("usrloc", "working_mode_preset", "single-instance-no-db")<br>
> <br>
>     #### REGISTRAR module<br>
>     loadmodule "registrar.so"<br>
>     modparam("registrar", "retry_after", 30)<br>
> <br>
>     #### DIALOG module<br>
>     loadmodule "dialog.so"<br>
>     modparam("dialog", "enable_stats", 0)<br>
>     modparam("dialog", "hash_size", 1024)<br>
>     modparam("dialog", "log_profile_hash_size", 4)<br>
>     modparam("dialog", "default_timeout", 21600) # 6h<br>
>     modparam("dialog", "dlg_extra_hdrs", "Hint: credit expired\r\n")<br>
>     modparam("dialog", "dlg_match_mode", 0)<br>
>     modparam("dialog", "options_ping_interval", 20)<br>
>     modparam("dialog", "reinvite_ping_interval", 600)<br>
> <br>
>     ### nat_traversal<br>
>     loadmodule "nat_traversal.so"<br>
>     modparam("nat_traversal", "keepalive_interval", 60)<br>
>     modparam("nat_traversal", "keepalive_method", "OPTIONS")<br>
>     modparam("nat_traversal", "keepalive_from",<br>
>     "sip:keepalive@opensips.proxy")<br>
>     modparam("nat_traversal", "keepalive_extra_headers", "User-Agent:<br>
>     OpenSIPS\r\nX-NAT: yes\r\n")<br>
>     modparam("nat_traversal", "keepalive_state_file",<br>
>     "/var/run/opensips/keepalive_state")<br>
> <br>
> <br>
>     ######################################################################<br>
>     ## Dispatcher Module Parameters<br>
>     ######################################################################<br>
>     loadmodule "dispatcher.so"<br>
>     #modparam("dispatcher", "list_file", "/etc/opensips/dispatcher.list")<br>
>     modparam("dispatcher", "db_url",<br>
>     "mysql://opensips:opensipsrw@localhost/opensips")<br>
>     modparam("dispatcher", "dst_avp", "$avp(271)")<br>
>     modparam("dispatcher", "attrs_avp", "$avp(272)")<br>
>     modparam("dispatcher", "grp_avp", "$avp(273)")<br>
>     modparam("dispatcher", "cnt_avp", "$avp(274)")<br>
>     modparam("dispatcher", "hash_pvar", "$avp(273)")<br>
>     modparam("dispatcher", "ds_ping_method", "OPTIONS")<br>
>     modparam("dispatcher", "ds_ping_from", "sip:sipcheck@opensips.proxy")<br>
>     modparam("dispatcher", "ds_ping_interval", 10)<br>
>     modparam("dispatcher", "ds_probing_threshhold", 3)<br>
>     modparam("dispatcher", "ds_probing_mode", 1)<br>
>     modparam("dispatcher", "options_reply_codes", "501,403,404,400,200")<br>
> <br>
>     loadmodule "proto_udp.so"<br>
> <br>
>     ####### Routing Logic ########<br>
>     # main request routing logic<br>
> <br>
>     route{<br>
> <br>
>     if (!mf_process_maxfwd_header(10)) {<br>
>     send_reply(483,"Max hops reached");<br>
>     exit;<br>
>     }<br>
> <br>
>     if (has_totag()) {<br>
> <br>
>     # handle hop-by-hop ACK (no routing required)<br>
>     if ( is_method("ACK") && t_check_trans() ) {<br>
>     t_relay();<br>
>     exit;<br>
>     }<br>
> <br>
>     # sequential request within a dialog should<br>
>     # take the path determined by record-routing<br>
>     if ( !loose_route() ) {<br>
>     # we do record-routing for all our traffic, so we should not<br>
>     # receive any sequential requests without Route hdr.<br>
>     send_reply(404,"Not here");<br>
>     exit;<br>
>     }<br>
> <br>
>     # route it out to whatever destination was set by loose_route()<br>
>     # in $du (destination URI).<br>
>     route(relay);<br>
>     exit;<br>
>     }<br>
> <br>
>     # CANCEL processing<br>
>     if (is_method("CANCEL")) {<br>
>     if (t_check_trans())<br>
>     t_relay();<br>
>     exit;<br>
>     }<br>
> <br>
>     # absorb retransmissions, but do not create transaction<br>
>     t_check_trans();<br>
> <br>
>     if ( !(is_method("REGISTER")  ) ) {<br>
>     if (is_myself("$fd")) {<br>
>     # do nothing<br>
>     } else {<br>
>     # if caller is not local, then called number must be local<br>
>     if (!is_myself("$rd")) {<br>
>     send_reply(403,"Relay Forbidden On: $si ");<br>
>     #send_reply(200,"Relay $fd ");<br>
>     exit;<br>
>     }<br>
>     }<br>
> <br>
>     }<br>
> <br>
>     # preloaded route checking<br>
>     if (loose_route()) {<br>
>     xlog("L_ERR",<br>
>     "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");<br>
>     if (!is_method("ACK"))<br>
>     send_reply(403,"Preload Route denied");<br>
>     exit;<br>
>     }<br>
> <br>
>     # record routing<br>
>     if (!is_method("REGISTER|MESSAGE"))<br>
>     record_route();<br>
> <br>
>     if (!is_myself("$rd")) {<br>
>     append_hf("P-hint: outbound\r\n");<br>
>     route(relay);<br>
>     }<br>
> <br>
>     # requests for my domain<br>
>     if (is_method("PUBLISH|SUBSCRIBE")) {<br>
>     send_reply(503, "Service Unavailable");<br>
>     exit;<br>
>     }<br>
> <br>
>     if (is_method("REGISTER")) {<br>
>     if (!save("location"))<br>
>     sl_reply_error();<br>
> <br>
>     exit;<br>
>     }<br>
> <br>
>     if ($rU==NULL) {<br>
>     # request with no Username in RURI<br>
>     send_reply(484,"Address Incomplete");<br>
>     exit;<br>
>     }<br>
> <br>
>     # do lookup with method filtering<br>
>     if (!lookup("location","m")) {<br>
>     t_reply(404, "Not Found");<br>
>     exit;<br>
>     }<br>
> <br>
>     route(relay);<br>
>     }<br>
> <br>
> <br>
>     route[relay] {<br>
>     # for INVITEs enable some additional helper routes<br>
>     if (is_method("INVITE")) {<br>
>     t_on_branch("per_branch_ops");<br>
>     t_on_reply("handle_nat");<br>
>     t_on_failure("missed_call");<br>
>     }<br>
> <br>
>     if (!t_relay()) {<br>
>     send_reply(500,"Internal Error");<br>
>     }<br>
>     exit;<br>
> <br>
> <br>
>     switch ($fd){<br>
>     case "<a href="http://asterisk1.example.com" rel="noreferrer" target="_blank">asterisk1.example.com</a> <<a href="http://asterisk1.example.com" rel="noreferrer" target="_blank">http://asterisk1.example.com</a>>":<br>
>     if (!ds_select_dst(1, 0)) {<br>
>     log("ERROR: no active destinations found!\n");<br>
>     send_reply(503, "Service Unavailable");<br>
>     exit;<br>
>     }<br>
>     ds_select_dst(1, 8, "ud", "default", 1);<br>
>     break;<br>
>     case "<a href="http://asterisk1.example.com" rel="noreferrer" target="_blank">asterisk1.example.com</a> <<a href="http://asterisk1.example.com" rel="noreferrer" target="_blank">http://asterisk1.example.com</a>>":<br>
>     if (!ds_select_dst(2, 0)) {<br>
>     log("ERROR: no active destinations found!\n");<br>
>     send_reply(503, "Service Unavailable");<br>
>     exit;<br>
>     }<br>
>     ds_select_dst(2, 8, "ud", "default", 1);<br>
>     break;<br>
>     case "<a href="http://asterisk1.example.com" rel="noreferrer" target="_blank">asterisk1.example.com</a> <<a href="http://asterisk1.example.com" rel="noreferrer" target="_blank">http://asterisk1.example.com</a>>":<br>
>     if (!ds_select_dst(3, 0)) {<br>
>     log("ERROR: no active destinations found!\n");<br>
>     send_reply(503, "Service Unavailable");<br>
>     exit;<br>
>     }<br>
>     ds_select_dst(3, 8, "ud", "default", 1);<br>
>     log("---- flag value is $dd -- branch $fd \n");<br>
>     break;<br>
>     default:<br>
>          log("unknow destination");<br>
>          exit;<br>
>     }<br>
>     }<br>
> <br>
> <br>
> <br>
> <br>
>     branch_route[per_branch_ops] {<br>
>     xlog("new branch at $ru\n");<br>
>     }<br>
> <br>
> <br>
>     onreply_route[handle_nat] {<br>
>     xlog("incoming reply\n");<br>
>     }<br>
> <br>
> <br>
>     failure_route[missed_call] {<br>
>     if (t_was_cancelled()) {<br>
>     exit;<br>
>     }<br>
>     }<br>
> <br>
> <br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
> <br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div></div>