Hi, Mihai!

Yes, if your agents are behind NAT, I'd go with "Mid registrar" and "RTPProxy".

Best regards,

Răzvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com

On 10/22/20 2:18 PM, Mihai wrote:
Hi Razvan,
By agent, I am referring the softphone (zoiper or microsip). I will look into "Path" or "Mid registar".
I still need to use the rtpproxy module, correct for all of this ?

On Thu, Oct 22, 2020 at 11:57 AM Răzvan Crainea <raz...@opensips.org <mailto:raz...@opensips.org>> wrote:

    What does "connect an agent" mean? Register on a specific asterisk
    server? If so, you should be using the Path module[1] to add
    OpenSIPS as
    an extra hop between the agent and Asterisk. An alternative is the Mid
    registrar module[2], which can itself store the location of the agent,
    and relay calls to it.

    [1] https://opensips.org/docs/modules/3.1.x/path.html
    [2] https://opensips.org/docs/modules/3.1.x/mid_registrar.html

    Răzvan Crainea
    OpenSIPS Core Developer
    http://www.opensips-solutions.com

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

    _______________________________________________
    Users mailing list
    Users@lists.opensips.org <mailto:Users@lists.opensips.org>
    http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to