Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

FOP2 Community Forum

  1. Home
  2. Support
  3. Trunk multi-tenant

Trunk multi-tenant

Scheduled Pinned Locked Moved Support
10 Posts 2 Posters 114 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    S
    secathor
    wrote on last edited by
    #1

    Hi everyone !

    I have trouble with trunk and multi-tenant environement.

    For extension, everything work fine.
    But trunk not

    [DAHDI/1]
    type=trunk
    label=Test line
    
    [DAHDI/2]
    type=trunk
    label=Line Office 1
    channel=DAHDI/3&DAHDI/4&DAHDI/5&DAHDI/6&DAHDI/7&DAHDI/8&DAHDI/9&DAHDI/10&DAHDI/11&DAHDI/12&DAHDI/13
    
    [DAHDI/1]
    type=trunk
    label=Line Office 2
    channel=DAHDI/2&DAHDI/3&DAHDI/4&DAHDI/5&DAHDI/6
    server=192.168.1.18
    

    All DAHDI channel are show under "Line Office 2"

    Also, does it's possible to monitor ring group ?

    1 Reply Last reply
    0
    • N
      N
      nicolas
      wrote on last edited by
      #2

      multi tenant or not is not the question. FOP2 monitor channels by device name, so if you have distinct device names for each tenant, or provider, or whatever, then you can have separate buttons for them. Look at the channel names when you make a call from one tenant or the other, and check names with

      asterisk -rx "core show channels concise"

      Are the root of the names unique to each tenant? Think of it as this for a channel name:

      TECH/name-session

      session part is random and it is ignored. Anything before the last dash is the name fop2 uses to match, so if you have

      DAHDI/1-aabbccdd for tenant 1

      and

      DAHDI/2-eeffgghh for tenant 2

      Then you can use two separate buttons (DAHDI/1 and DAHDI/2) for each tenant. In the other hand if you have DAHDI/1-xxxx and DAHDI/1-yyyyy for those tenants, then there is no way to discern who is who.

      Regarding ringgroups, they are not devices, just a logical dialplan config that can be done in a zillion ways, so they cannot be monitored as an entity, as they are not. You can have ring group buttons but only for use as a transfer target.

      Best regards,

      1 Reply Last reply
      0
      • S
        S
        secathor
        wrote on last edited by
        #3

        ok I understand

        So the line

        server=ip of second server
        

        is totaly useless (I see it somewhere on the forum)

        Do you know how to rename DAHDI channel ?

        I also get same trouble for parking slot.
        Do you known how to rename it ?

        Thank you

        1 Reply Last reply
        0
        • N
          N
          nicolas
          wrote on last edited by
          #4

          As far as I know, dahdi channels cannot be reanamed, they are set by the channel driver depending on the card/line number set in your chan_dahdi.conf file or similar.

          As for parking, you can create a separate channel parking lot name in features.conf. This is the sample provided in the asterisk sample config files:

          [parkinglot_edvina]
          context => edvinapark
          parkext => 799
          parkpos => 800-850
          findslot => next
          ...
          

          The only button type where the server=x.x.x.x line is relevant is the queue button.

          Best regards,

          1 Reply Last reply
          0
          • S
            S
            secathor
            wrote on last edited by
            #5

            As for parking, you can create a separate channel parking lot name in features.conf. This is the sample provided in the asterisk sample config files:

            [parkinglot_edvina]
            context => edvinapark
            parkext => 799
            parkpos => 800-850
            findslot => next
            ...
            

            I got it working, thanks you

            As far as I know, dahdi channels cannot be reanamed, they are set by the channel driver depending on the card/line number set in your chan_dahdi.conf file or similar.

            multi tenant or not is not the question. FOP2 monitor channels by device name, so if you have distinct device names for each tenant, or provider, or whatever, then you can have separate buttons for them. Look at the channel names when you make a call from one tenant or the other, and check names with

            asterisk -rx "core show channels concise"

            Are the root of the names unique to each tenant? Think of it as this for a channel name:

            TECH/name-session

            session part is random and it is ignored. Anything before the last dash is the name fop2 uses to match, so if you have

            DAHDI/1-aabbccdd for tenant 1

            and

            DAHDI/2-eeffgghh for tenant 2

            Then you can use two separate buttons (DAHDI/1 and DAHDI/2) for each tenant. In the other hand if you have DAHDI/1-xxxx and DAHDI/1-yyyyy for those tenants, then there is no way to discern who is who.

            So, how can we add something before the last dash ?

            Thanks you

            1 Reply Last reply
            0
            • N
              N
              nicolas
              wrote on last edited by
              #6

              So, how can we add something before the last dash ?

              Thanks you

              Not sure if its possible, but I am really not very into dahdi config or cards. If channels are from the same interface card, then I do not think you can add/remove or set anything. If you have different cards, then their names will be DAHDI/i1 /i2, and so forth.

              1 Reply Last reply
              0
              • S
                S
                secathor
                wrote on last edited by
                #7

                ok

                multi-tenant + trunk = not possible
                if DAHDI card are the same in both server

                1 Reply Last reply
                0
                • N
                  N
                  nicolas
                  wrote on last edited by
                  #8

                  What it is not possible is to track same channel names on separate asterisk boxes and have them represented by distinct buttons on fop2: nor dahdi, nor sip or any other tech. Same device name calls will show up on the same fop2 button regardless the server, as fop2 tracks by name.

                  Maybe the wording is not correct, but multi tenant does not mean separate asterisk boxes, much like the opposite: having multiple clients/customers on ONE asterisk box. So the original question did not make sense to me at all.

                  There are plenty of FOP2 installations on multitennant systems like Thirdlane, or custom built.

                  Best regards,

                  1 Reply Last reply
                  0
                  • S
                    S
                    secathor
                    wrote on last edited by
                    #9

                    I slove my trouble with this PHP script.
                    It's not perfect, but work
                    The script rename channel to have unique channel name

                    <?
                      // Debug
                        $debug = false;
                    
                      // Asterisk server
                        $asterisk_ip = "192.168.0.20";
                        $asterisk_port = 5038;
                    
                      // Listen IP and port
                        $listen_ip = '0.0.0.0';
                        $listen_port = '5858';
                    
                      // Start as daemon
                        become_daemon();
                    
                      // Init some value
                        set_time_limit(0);
                        ob_implicit_flush(); 
                    
                      // Replace channel name
                        $rename_chan = array( 'DAHDI/2-1' => 'DAHDM/2-1',
                                               'DAHDI/3-1' => 'DAHDM/3-1',
                                               'DAHDI/4-1' =>'DAHDM/4-1',
                                               'DAHDI/5-1' => 'DAHDM/5-1',
                                               'DAHDI/6-1' => 'DAHDM/6-1',
                                               'DAHDI/7-1' => 'DAHDM/7-1',
                                               'DAHDI/8-1' => 'DAHDM/8-1',
                                               'DAHDI/9-1' => 'DAHDM/9-1',
                                               'DAHDI/10-1' => 'DAHDM/10-1',
                                               'DAHDI/11-1' => 'DAHDM/11-1',
                                               'DAHDI/12-1' => 'DAHDM/12-1',
                                               'DAHDI/13-1' => 'DAHDM/13-1',
                                               'IAX2/' => 'IAX2M/',
                                               'Parkinglot: default' => 'Parkinglot: defaultm',
                                           );
                    
                    
                      // Main loop
                        $infinite_loop = true;
                        if ($debug) { $infinite_loop = false; }
                        do {
                          AddToLog("Main loop start.\n");
                          // Start listen
                            unset ($socket);
                            unset($conn_client);
                            $socket = stream_socket_server("tcp://0.0.0.0:" . $listen_port, $errno, $errstr);
                            if (!$socket) {
                              die("Unable to bind socket : $errstr ($errno) \n");
                            } else {
                              $conn_client = stream_socket_accept($socket);
                              stream_set_blocking($conn_client, 0);
                            }
                    
                          // Connect to Asterisk
                            unset ($conn_asterisk);
                    	      $conn_asterisk = @fsockopen($asterisk_ip, $asterisk_port, $errno, $errstr, 30);
                    	      if (!$conn_asterisk) {
                        	    die("Unable to connect to Asterisk : $errstr ($errno) \n");
                    	      } else {
                      	      stream_set_blocking($conn_asterisk, 0);
                    	      }
                    
                          // Start loop
                    	      $loop = true;
                    	      do {
                              // Read from Client
                                $from_Client = @fread($conn_client, 2048);	
                    	          if (@feof($conn_client) || (!$conn_client)) {
                      	          // Client disconnect
                    	    		    $loop = false;
                      	        } elseif ( strlen($from_Client) > 0) {
                    	            // Send to Asterisk
                    	            $from_Client = RenameChannel(1,$from_Client);
                                  fwrite($conn_asterisk, $from_Client);
                                  if ($debug) { echo ">>> (" . strlen($from_Client) . ")" . $from_Client . "\n"; }
                      	          AddToLog(">>> (" . strlen($from_Client) . ")" . $from_Client . "\n");
                                }
                              // Read from Asterisk
                                $from_Asterisk = @fread($conn_asterisk, 2048);	
                      	        if (@feof($conn_asterisk) || (!$conn_asterisk)) {
                    	            // Client disconnect
                      			      $loop = false;
                    	          } elseif ( strlen($from_Asterisk) > 0) {
                    	            // Send to client
                    	            $from_Asterisk = RenameChannel(0,$from_Asterisk);
                    	            fwrite($conn_client, $from_Asterisk);
                      	          if ($debug) { echo "<<< (" . strlen($from_Asterisk) . ")" . $from_Asterisk . "\n"; }
                      	          AddToLog("<<< (" . strlen($from_Asterisk) . ")" . $from_Asterisk . "\n");
                                }
                              // Little break
                                usleep(100);
                        	  } while($loop);
                    
                          // Close everyone
                            // Close Asterisk
                              @fclose($conn_asterisk);
                              unset($conn_asterisk);
                            // Close client
                              @fclose($conn_client);
                              unset ($socket);
                              unset($conn_client);
                          // Big break before restarting
                            usleep(3000);
                        } while($infinite_loop);
                        AddToLog("Bye!\n");
                    
                    
                    
                    
                    
                    
                    // Rename channel
                      function RenameChannel($direction, $data) {
                        GLOBAL $rename_chan;
                        $r = $data;
                        foreach ($rename_chan as $key => $value) {
                          if ($direction == 0) {
                            $r = str_ireplace($key, $value, $r);
                          } else {
                            $r = str_ireplace($value, $key, $r);
                          }
                        }
                        return $r;
                      }
                    
                    
                    // Add to log
                      function AddToLog($data) {
                        GLOBAL $debug;
                        if ($debug) {
                          $i = file_put_contents( "/tmp/php_relay.log",
                                                  $data,
                                                  FILE_APPEND);
                        }
                      }
                    
                    
                    // Daemon
                      function become_daemon() {
                        $pid = pcntl_fork();
                        if ($pid == -1) {
                          /* fork failed */
                          echo "fork failure!\n";
                          exit();
                        }elseif ($pid) {
                          /* close the parent */
                          exit();
                        } else {
                          /* child becomes our daemon */
                          posix_setsid();
                          chdir('/');
                          umask(0);
                          return posix_getpid();
                        }
                      }
                    ?>
                    
                    1 Reply Last reply
                    0
                    • N
                      N
                      nicolas
                      wrote on last edited by
                      #10

                      Many thanks for sharing your solution!

                      1 Reply Last reply
                      0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      Powered by NodeBB Contributors
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups