No DAHDI activity in FOP?

Discussion in 'General' started by Croc, Feb 23, 2010.

  1. Croc

    Joined:
    Jan 29, 2009
    Messages:
    19
    Likes Received:
    0
    in older version zap channels shown activity but DAHDI trunks and extensions stay unchanged no matter what each port is doing.
    is there way to fix this? i searched around but it seem that most people have issue with DAHDI trunks missing from FOP which for me was not a problem, they been there on clean elastix 1.6 install
     
  2. Croc

    Joined:
    Jan 29, 2009
    Messages:
    19
    Likes Received:
    0
    i figured out why this happens but solution isn't perfect
    if i edit /var/www/html/panel/op_buttons_additional.cfg

    and look for [Zap/1] then replace with [DAHDI/1] and so on for other channels FOP works and show correct status for FXO/FXS ports

    but if I add new extensions, etc.. it will be reveresed so best would be to find script that creates this file and correct it there

    if anyone can help with this that would be great, TIA
     
  3. Croc

    Joined:
    Jan 29, 2009
    Messages:
    19
    Likes Received:
    0
    i created script to convert this automatically and restart fop then set it as once an hour cron job.

    it converts all ZAP and Zap to DAHDI and while at it i renamed couple of trunks.

    this way even if i create new extensions FOP will fix itself :)

    still not perfect solution but can't find anything better for now

    here is script(at the bootom), i'm sure there is way to do this more elegant way with sed but i didn't feel like reading manual at 1am so for now this is it
    ZAP and Zap is there for a reason, one for exstensions and one for trunks

    save it as /usr/bin/something.sh
    chmod +x something.sh
    chmod 775 something.sh
    and crontab -e and add 0 * * * * /usr/bin/something.sh (or whatever you think will work for you if once an hour is a problem)


    sed 's/Zap/DAHDI/g' /var/www/html/panel/op_buttons_additional.cfg > /var/www/html/panel/op_buttons_additional1.cfg
    sed 's/ZAP/DAHDI/g' /var/www/html/panel/op_buttons_additional1.cfg > /var/www/html/panel/op_buttons_additional2.cfg
    /var/www/html/admin/modules/framework/bin/bounce_op.sh
     
  4. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    you might want to concentrate on the bastards that create those files :)

    /var/www/html/admin/modules/framework/bin/retrieve_parse_amportal_conf.pl

    and
    /var/www/html/admin/modules/fw_fop/bin/retrieve_op_conf_from_mysql.pl

    and save some time.
     
  5. Acidizer

    Joined:
    Mar 11, 2010
    Messages:
    6
    Likes Received:
    0
    Hello. After an upgrade of Free PBX to 2.7 i found myself in same situation, but i`m far away from programming in Pearl, someone could give me a clue how to solve it in elegant way? I took a look into retrieve_op_conf_from_mysql.pl, what is actually a piece of code what creates the op_buttons_additional.cfg after any change in trunks and\or extentions, but code is too complicated for me to understand. I`ve spent a lot of time with Google and forums, but didnt find an answer. Please, help me.
     
  6. Acidizer

    Joined:
    Mar 11, 2010
    Messages:
    6
    Likes Received:
    0
    After sleepless night i figured out what it has nothing to do with pearl!!! I`t PHP script /var/lib/asterisk/bin/retrieve_op_conf_from_mysql.php
    but where from does it retrieve Zap/* instead of DAHDI/* which is correct. Someone have a clue where it comes from ?
     
  7. Acidizer

    Joined:
    Mar 11, 2010
    Messages:
    6
    Likes Received:
    0
    It was bug in FreePBX 2.7, here is the fix for this specific problem.
    No more renaming scripts :lol:
     
  8. elastix-tob

    Joined:
    Aug 16, 2010
    Messages:
    13
    Likes Received:
    0
    I am currently having the problem that I see my DAHDI extensions and trunks, but on the DAHDI extensions there is no action, e.g when making a call from an analoh phone, I don't see any action on that extension. As far as I understood above posts, I guess I have to edit something in the *.pl files. But not sure what to edit exactly to get activity in my DAHDI extensions?
     
  9. fmvillares

    Joined:
    Sep 8, 2007
    Messages:
    1,785
    Likes Received:
    0
    solved in latest 2.7 and 2.8 freepbx...module admin and upgrade modules ...nothing more...
     
  10. elastix-tob

    Joined:
    Aug 16, 2010
    Messages:
    13
    Likes Received:
    0
    as I am using Elastix 1.6 I am having FreePBX 2.5.1.0 - when going to module admin and check for updates I only get some minor updates (all labeled with 2.5.X.X). So can you tell me what I have to change in this version to get it working? Would be gret, thanks a lot!
     
  11. Karesz

    Joined:
    Nov 30, 2009
    Messages:
    5
    Likes Received:
    0
    "solved in latest 2.7 and 2.8 freepbx...module admin and upgrade modules ...nothing more... " sounds good, but does not seem to be true. I upgraded my FreePBX to the latest 2.7 and the problem still exists.
     
  12. Karesz

    Joined:
    Nov 30, 2009
    Messages:
    5
    Likes Received:
    0
    Well, I upgraded it to 2.8.0, but no luck. 2.8.0 has a sort of fix for DAHDI trunks which does not seem to work, because it resulted that DAHDI trunk cannot even be seen in the FOP. There is no any attempt to fix the DAHDI extensions, though. Could someone from Elastix FOP people comment this?
    And could someone tell us why there are both perl and php codes for the same task (e.g. retrieve_op_conf .pl and .php)? Which one should I fix to make it effective? (Note that I have effectively patched the php so if someone need it I can provide it.)
     
  13. Karesz

    Joined:
    Nov 30, 2009
    Messages:
    5
    Likes Received:
    0
    OK, my PBX was doomed. Trunk works after the latest update. I also realised that I have to change the dial in the extension setup manually (from ZAP to DAHDI). This way the DAHDI extensions are also correct in the FOP.
    So it works, it just wanted some of my sweat :)
     
  14. elastix-tob

    Joined:
    Aug 16, 2010
    Messages:
    13
    Likes Received:
    0
    after some changes by hand I also got it working:

    Problem:
    In op_buttons_additional.cfg there was [ZAP/25] .. instead of [DAHDI/25]

    Solution:
    1. Change every "ZAP/" to "DAHDI/" in
    /var/lib/asterisk/bin/retrieve_op_conf_from_mysql.pl
    and probably also
    /var/www/html/admin/modules/fw_fop/bin/retrieve_op_conf_from_mysql.pl

    2. If you have ZAP compatibility enabled and have "ZAP/XX" in FreePBX as Dial command of the ZAP Extension, you have to insert some code into /var/lib/asterisk/bin/retrieve_op_conf_from_mysql.pl also:

    after

    Code:
    foreach my $row ( @extensionrange ) {
      my $description = @{ $row }[0];
      my $id = @{ $row }[1];
      my $dial = @{ $row }[2];
    
    insert:

    Code:
    if ($dial =~ /ZAP/) {
      $dial =~ s/ZAP/DAHDI/;
    }
    
    Because otherwise it will use the stuff entered as dial command at freepbx and this could be ZAP/XX if you have ZAP to DAHDI compatibility enabled (ZAP2DAHDICOMPAT=true in amportal.conf)

    hope that helps
    greetings
     
  15. MST

    MST

    Joined:
    Sep 25, 2009
    Messages:
    317
    Likes Received:
    0
    Hi elastix-tob

    Just to clarify I have found fallowing lines in retrieve_op_conf_from_mysql.pl :

    #@zaplines=(@zaplines,[ "Zap/*","PSTN" ]);
    #@zaplines=(@zaplines,[ "Zap/1","Zap 1" ]);
    #@zaplines=(@zaplines,[ "Zap/2","Zap 2" ]);
    #@zaplines=(@zaplines,[ "Zap/3","Zap 3" ]);
    #@zaplines=(@zaplines,[ "Zap/4","Zap 4" ]);


    @zaplines=(@zaplines,[ "Zap/*","$2",$1 ]);


    if($tempvalue eq "Zap/$c") {

    @zaplines=(@zaplines,[ "Zap/$c","$newlabel" ]);

    if ($zapdef eq "Zap/*") {

    So should I change all of them to DAHDI/ right?

    Thanks
     
  16. gmaoret

    Joined:
    Nov 13, 2007
    Messages:
    50
    Likes Received:
    0
    in Elastix 2.0.3 I have updatet FreePBX to 2.7.10 but nothing changes...
     
  17. fred0

    Joined:
    Jun 11, 2010
    Messages:
    8
    Likes Received:
    0
    My 2 cents:

    FreePBX 2.8 has a built in fix for DADHI extensions in that you can create a new extension as either DADHI or ZAP. That sets the extension type and name in the database accordingly.
    Not sure about trunks as I checked this in a virtual machine test environment with no DAHDI hardware.

    I'm still on 2.7 on my production box so here's how I got it working:

    There are 2 (identical) files that need to be changed:
    /var/lib/asterisk/bin/retrieve_op_conf_from_mysql.php
    /var/www/html/admin/modules/fw_fop/bin/retrieve_op_conf_from_mysql.php

    I believe the reason there are 2 files is that the elastix pbx interface uses 1 while the Unembedded FreePBX interface uses the other.

    For trunks, I found the fix at http://www.freepbx.org/trac/ticket/4185
    Basically, at line 196, replace
    Code:
                                                    if (!($inzaplines)) {
                                                            array_push($zaplines,array( "Zap/$i","$newlabel" ));
                                                    }
    with
    Code:
                                                    if (!($inzaplines)) {
                                                       if ($chan_dahdi) {
                                                            array_push($zaplines,array( "DAHDI/$i","$newlabel" ));
                                                       } else {
                                                            array_push($zaplines,array( "Zap/$i","$newlabel" ));
                                                       }
                                                    }



    For extensions:

    At line 418 (415 if you didn't do the trunk fix above) after the lines that read
    Code:
            foreach ( $extensionrange as $row ) {
                    $description = $row[0];
                    $id = $row[1];
                    $dial = $row[2];
    I added
    Code:
                    # fix DAHDI extensions
                    if ($chan_dahdi) {
                            $dial = str_replace(ZAP,DAHDI,$dial);
                    }
    Both changes check if you're using chan_dadhi.cfg instead of zapconf.cfg and, if so, replaces "ZAP" with "DAHDI" when it writes out the FOP config.
    Again, be sure to make these changes to both files so that the elastix pbx or Unembedded FreePBX function the same way.
     
  18. MST

    MST

    Joined:
    Sep 25, 2009
    Messages:
    317
    Likes Received:
    0
    thank you fred0 !!!!!!!!!!!!!

    your fix works!!!!!!

    short and clear enought
     
  19. gmaoret

    Joined:
    Nov 13, 2007
    Messages:
    50
    Likes Received:
    0
    Very good, fred0!!!

    Now all works ok!

    Tahnks
     

Share This Page