[ENGLISCH] HOWTO: 5050 guide for the UK

pepsi_max2k

Neuer User
Mitglied seit
27 Mai 2008
Beiträge
31
Punkte für Reaktionen
0
Punkte
0
Last Updated: 29 / 03 / 10 - Added some small info to the firmware flashing info. If you couldn't get it working before, try again with new info.

Scope...

The following guide contains info on using the Fritz!Box Fon 5050 model in the UK, including various english modifications, cabling and setup info. Some of it may be applicable to the 7050 or other models but it's all majorly 5050 centric.

In short it contains everything I've done with my FB so far. In what was meant to be a simple attempt to change dialplans automatically based on the number of outgoing PSTN calls since a given date (how hard could it be? :p ), I've encountered numerous problems, gone through 3 different VoIP routers, too many firmware flashes to count, a million workarounds and a good few scripts n tricks to boot. And about 6 months trying so far. So I figure this could be handy to anyone else wanting to do any of the following.

Also, having looked around I could find very little on the 5050 and what there was was in various non-english languages or not very good translations (no offence to you Europeans, it's just good to know for sure when dealing with firmware changes ;) ). So I hope this is helpful to any english speakers who get here via google or wherever.


The 5050

The 5050 is basically a 7050 (seemingly the defacto choice for international users) without the WLAN. All the other functionality remains, so a quick look through the AVM 7050 manual should give you all the info you need.

Price

The main reason I got a 5050 was the price. I didn't need WLAN, and to be honest, becuase you shouldn't really be using it for DSL in the UK anyway (it syncs pretty badly with our DSLAMS), you probably have another router with WLAN anyway so... It also goes for a lot less than the 7050 on ebay. Mine was £22 shipped.

Buying tips:

Check www.ebay.de, go to Erweiterte Suche (advanced search), click the Erweiterte Suche at the bottom of this page, then under Ort tick Artikel erhältlich in (Products Available To) and chose GroBbritannien. Now everything you search for should have a Euro or World shipping option.

Many German users don't accept PayPal (not been conned in like the rest of us) and use Bank Transfer. This actually costs loads to do from the UK, so I'd avoid that and either look for someone with a cash-on-collection option or the little PP logo by the search items.

If you need to ask, or even if you don't, try and see if you can have it shipped by DHL Päckchen. This is a surface mail option but is still relatively quick to the UK (mine took only 4 days), and so long as the item is under 2 kg it's half the price of the DHL Paket airmail that most people seem to use (8.60 vs 17.00 euros).

Branding:

5050s come in at least standard AVM versions and 1und1 versions, both Red/Grey and Black in colour. The choice doesn't matter, just get whatever's cheapest and you can mod them both the same. Also, the age and firmware revision doesn't matter either, both ways you'll end up with the latest 12.4.31 firmware at some point during modding.

Stats:

CPU: AR7 150 Mhz
Flash: 4 MB
RAM: 16 MB

DSL In
ISDN or Analog In
ISDN Out
RJ11 Analog Out x 2
Bare Wire Analog Out
USB Out
RJ45 Out x2
Power

ADSL & ADSL2+

Wiring

Power Adapter

The german 5050s should come with a Europlug rated at 230v 50/60Hz. This is perfectly compatible with the UK power system as it's within a small margin allowed for electrical equipment (usually 250v). Your only problem is getting the thing to fit in a UK socket. You can either buy a simple adapter, or just use a sharp scoring knife to shave off a very small amount (half an mm) of the inside of the two horizontal hole until the Europlug just slides in. The vertical hole is the earth and you need to use a small object to push the earth catch down until it opens the live socket covers and then insert the europlug (either way round should be fine).
IMPORTANT: obviously, you really shouldn't be doing any of this on a wall socket. Do it on an extension lead or something that you can completely disconnect from the mains power before doing any of the above. But, once it's in and on, it's perfectly safe. The only thing it's missing over UK plugs is the earth and, take a look at some of the UK plugs you have lying around, you'll find that many of them don't have an earth pin either and just use a plastic replacement to open the live sockets by pushing the earth pin down.

Phone Wiring

Other than the ISDN / Analog input, all other wiring conforms to UK standards. A regular RJ11 to RJ11 can be connected between a microfilter and the DSL in (even a BT to RJ11 should sufice, although may give lower sync than via an mf).

A regular RJ11 to you phone (RJ11 or BT) can be used in the FON1 & FON2 sockets.

The POTS/PSTN (ISND/Analog) input though isn't standard. For the pinout, check inquisitor's web page on New Zealand Fritz!Box wiring as luckily they use the same BT standards as the UK. In short though, you want to connect pins 2 and 5 of a BT socket (out of 6, although there's usually only 4 actually wired up) to pins 1 and 8 respectively of an RJ45 plug (see the linked page's image for exact locations).
The easiest way to do this is just cut the end off a BT phone cable, strip about 1cm of the outer sheathe off carefully with a knife, figure out which wires are 2 and 5 (you should be able to see the colouring inside the BT plug), clip wires 3 and 4 down to the sheathe, then inset 2 and 5 in to pins 1 and 8 of an RJ45 plug and crimp it down. RJ45 plugs and a crimp tool can be picked up for only a few pounds from eg. Maplins or eBay and are pretty handy for many networking needs :)


CLIP

One last thing, it *does* support CLIP (caller ID presentation) both incoming and outgoing perfectly, at least in the UK, regardless of what some sites say. If you have problems with it, you may want to use a surge protector for the power plug as some have noted problems with power supply fluctuations affecting the CLIP transfer.


Modding

Files

Firstly, thanks to massinge on the vocesuip.com forums for most of these, and help with the rest of the mods. For a german box I really rely on others who know what they're doing to translate or explain things for me. On the plus side, at least I don't understand all the "you can totally brick things" warning messages I'd be paranoid by if things were in english ;)

The files referenced below, some of which you might need, are as follows. The contents of the .tar files should be a folder called var (not .var) and inside that a single file called index. The contents of these is contained after the relavent links just so that you can make sure you have the correct version (or re-make one if they become unavailable).


fritz_as_annex_a_kernel_args_newer.tar
Update 11/01/10: Use this in replacement of Fritz_kernel_args_annex_a.tar . This is the newer version of the Annex A conversion software which avoids problems with differing kernels on boxes. Taken from http://www.ip-phone-forum.de/showpost.php?p=971638&postcount=1057.


Code:
#! /bin/sh
##################################################################################
# get Kernelversion for further handling (update 2.4<->2.6)
##################################################################################
case `uname -r` in
    2.4*)
        echo "install: have Kernel 2.4";
        kversion=24
        ;;
    2.6*)
        echo "install: have Kernel 2.6";
        kversion=26
        ;;
    *)
        exit $INSTALL_OTHER_ERROR
        ;;
esac
#############################################################################
#
# Set Box to Annex A
#
#############################################################################
if [ "${kversion}" = 24 ] ; then
	echo "kernel_args annex=A" > /proc/avalanche/env
else
	echo "kernel_args annex=A" > /proc/sys/urlader/environment    
fi
##################################################################################

ctlmgr

## Bitte keine "rote Meldung" 
major=$(grep tffs /proc/devices)
tffs_major=${major%%tffs}
rm -f /var/flash/fw_attrib
mknod /var/flash/fw_attrib c $tffs_major 87
echo -n "" > /var/flash/fw_attrib
rm -f /var/flash/fw_attrib

## Fehler: Kein Fehler
exit 0

change_brand.tar
This is for changing any 5050 to an avm branded one.

Code:
#! /bin/sh
INSTALL_SUCCESS_REBOOT=1
INSTALL_OTHER_ERROR=6

LED_DEVICE=/proc/led_mod/led
if [ ! -f /proc/led_mod/led  ] ; then
    LED_DEVICE=/var/led
    echo "set led: ${LED_DEVICE}"
fi
##################################################################################
# Power LED blink
##################################################################################
echo "set INFO led to blink (modul=7, state=4)"
echo 7,4>${LED_DEVICE}

##################################################################################
#cambio in AVM
##################################################################################
echo "firmware_version avm" > /proc/sys/urlader/environment

echo 'echo $0: done' >/var/post_install
chmod +x /var/post_install
echo "set INFO led to blink (modul=7, state=4)"
echo 7,4>${LED_DEVICE}
exit $INSTALL_SUCCESS_REBOOT

5050_EN_04.36_alpa-b0.3.rar
Massinge's custom English 5050 firmware. Not compatible with ds-mod / freetz.

inglese.tar
Changes the branding of Massinge's firmware to avme (english). Won't work on regular 5050 firmware.

Code:
#! /bin/sh
INSTALL_SUCCESS_REBOOT=1
INSTALL_OTHER_ERROR=6

LED_DEVICE=/proc/led_mod/led
if [ ! -f /proc/led_mod/led  ] ; then
    LED_DEVICE=/var/led
    echo "set led: ${LED_DEVICE}"
fi
##################################################################################
# Power LED blink
##################################################################################
echo "set INFO led to blink (modul=7, state=4)"
echo 7,4>${LED_DEVICE}

##################################################################################
#cambio in AVME
##################################################################################
echo "firmware_version avme" > /proc/sys/urlader/environment

echo 'echo $0: done' >/var/post_install
chmod +x /var/post_install
echo "set INFO led to blink (modul=7, state=4)"
echo 7,4>${LED_DEVICE}
exit $INSTALL_SUCCESS_REBOOT



Official AVM Files

Latest firmware: ftp://ftp.avm.de/fritz.box/fritzbox.fon_5050/firmware/
Recovery tool: ftp://ftp.avm.de/fritz.box/fritzbox.fon_5050/x_misc/
 
Zuletzt bearbeitet:
NOTE: For all firmware flashing and bootloader configs you should wherever possible be connected directly by ethernet cable to LAN A (or LAN 1) on the FB, and use a static IP of 192.168.178.2, Sub 255.255.255.0, Gateway and DNS 192.168.178.1.

Installing Massinge's English Annex-A FW
UPDATED 11/01/10

The only English language AVM firmware for the 5050 is one made by massinge from the Italian voceuip.com forums. It was created by inserting the english web files from a 7050 AVME firmware in to the 5050's AVM firmware. If you really want English firmware and don't need Freetz / DS-MOD packages then this is the easiest way to get it.

For massinge's original instructions check out http://www.vocesuip.com/inglese_english_massinge_5050_english_firmware-t8538.0.html

Quicksteps: 1. flash avm firmware 2. change to annex a, brand to avm, 3. flash massinge's firmware

1. First make sure you're running the latest AVM 12.04.31 firmware at factory settings (the brand doesn't matter for now). You MUST flash the original AVM firmware before going any further, especially if you have a 1und1 or other branded box.

Grab the original firmware from ftp://ftp.avm.de/fritz.box/fritzbox.fon_5050/firmware/fritz.box_fon_5050.12.04.31.image, Go to Einstellungen > System > Firmware-Update, click Browse (step 2), select fritz.box_fon_5050.12.04.31.image, then click Update (step 3).

You'll get no warning, just DO NOT turn off power to the fritz box or do anything on your PC. The confirmation screen will show in german but just leave it for now.
Watch the info light, it should blink at normal speed for a minute, then slowly for another minute, then very fast for a few seconds, then slow for another minute. When it's done it'll go off and the power light will turn back to it's normal blinking state. Now wait another minute to be sure, and click Zur Ubersicht.

Now Log in to 192.168.178.1 and check top for screen for Firmware-Version, and check Internet > DSL-Informationen for Annex B.

Alternatively, you can just use the recovery tool to flash the original firmware. Get it from ftp://ftp.avm.de/fritz.box/fritzbox.fon_5050/x_misc/fritz.box_fon_5050.12.04.31.recover-image.exe. Make sure you're connected directly to the FB (LAN A), then run it, click the Next button (it's obvious which one...), it'll reboot your PC then just hit Next again until it searches for, finds, then updates the FB.


2. Now convert the box to Annex A using the fritz_as_annex_a_kernel_args_newer.tar file.
Go to Einstellungen > System > Firmware-Update, click Browse (step 2), select fritz_as_annex_a_kernel_args_newer.tar, then click Update (step 3). Wait for info led blink once, then click Update Fortsetzen on warning screen. WAIT until the info led stops blinking. It may not blink much, or at all, and will either hang on the firmware update box or show a confirmation screen. Either way, wait a few minutes then either click Zur Ubersicht on confirmation screen if you have one, or reboot the box if you don't see a confirmation screen. Now check Check Einstellungen > Internet > DSL-Informationen for Annex A.

Note: Step 2 WILL NOT work if you have not flashed an original AVM firmware. You will be stuck with a solid green Power light. To recover from this, open a command prompt (in windows, Start > Run > type "cmd" then enter), type "ftp 192.168.178.1" (no quotes), do NOT hit enter, power the FB off then on, then after a few seconds of it starting hit enter at the command prompt. You should be asked for a user name then password. They're both "adam2" (no quotes). Type "quote GETENV firmware_version". This should say avm if you just did step 2. To get the web interface working again, type "quote SETENV firmware_version 1und1" (assuming you flashed a 1&1 box), the "quote REBOOT". Now go back to step one and follow it ;)

3. If you have a 1&1 branded box or other non-AVM branded box you need to convert the branding to AVM now using the change_brand.tar file.
Go to Einstellungen > System > Firmware-Update, click Browse (step 2), select change_brand.tar, then click Update (step 3). WAIT until the info led stops blinking then click Zur Ubersicht on confirmation screen. Check Einstellungen > Telephonie > Internettelefonie > Neue Internetrufnummer and look through the first drop-down tab for around 12 different VoIP providers to prove unbranding has worked as branded machine usually only have a few.

4. Now we flash Massinge's firmware, 5050_EN_04.36_alpa-b0.3.rar. First though, RENAME this file with a ".image" extension - 5050_EN_04.36_alpa-b0.3image - otherwise it doesn't seem to flash properly, although a reboot fixes any issues. And if you are not already connected to LAN A directly by enthernet cable, do so now!
Go to System > Firmware-Update, click Browse (step 2), select 5050_EN_04.36_alpa-b0.3.image, then click Update (step 3). You'll get no warning, just DO NOT turn off power to the fritz box or do anything on your PC. The confirmation screen will show in german but just leave it for now.
Watch the info light, it should blink at normal speed for a minute, then slowly for another minute, then very fast for a few seconds, then slow for another minute. When it's done it'll go off and the power light will turn back to it's normal blinking state. Now wait another minute to be sure, and click Zur Ubersicht and you should be back to an English start page.

Note: There are later versions of Massinge's firmware available. I just tried b11, didn't seem to work so well, had to use recovery tool, stick with b0.3 for now.

5. UPDATE 11/10/01: This step doesn't seem to work, affect is similar to step 2 ie. have to change brand back to avm via adam2. So, skip this one, it seems to be fine with just avm branding anyway.

To ensure everything works correctly you now need to change the branding to AVME with inglese.tar.
Click Settings > System > Update Firmware, Browse to select inglese.tar, Update. WAIT for the info led to blink, then click Continue Update on the warning screen. WAIT for the info led to stop blinking then click To Overview on confirmation screen and enjoy :).


Installing Freetz

Read more about Freetz (unfortunately mostly in German) at http://wiki.ip-phone-forum.de/software:ds-mod:start
In short, it's basically the original AVM firmware with a few added extras (most of which you can choose) added in. The original AVM web panel remains, and all freetz info can be accessed at fritz.box:81 (admin/freetz). If you can use it I'd recommend it over the AVM firmware if only for the text editor and extra stability of the telnet shell.

Freetz 1.0 should run fine on the 5050 but may need a few specific options chosen when compiling.

And yes, I said "compile". If you've no idea what this means you may just want to run away now (or PM me to see if I can help). As complete AVM firmware images are copyrighted to AVM they cannot be distributes alone, so you need to create them yourself from source code.

If you don't already have a Linux distribution available to you the I suggest Ubuntu as it's extremely easy to work with. Once installed, use Synaptic to ensure you have all the packages included in this list: http://wiki.ip-phone-forum.de/software:ds-mod:installation#linux (make menuconfig will let you know if something's missing).

Now download the source: http://www.freetz.org/attachment/wiki/Releases/freetz-1.0.tar.bz2?format=raw

Choose Options

Extract the source, and from a command line cd to the freetz-1.0 folder and run:

Code:
make menuconfig

If any packages are missing it'll let you know, otherwise it'll give you a nice blue text gui from which to select options. Movement is controlled by arrows, tab and space bar, and type ? with a specific option highlighted to read more about it.

For the 5050 chose Type: 5050 and version de (deutch).

If you have a 1&1 branded box you MUST chose both 1und1 and AVM from the brandings section. Flashing a 1&1 box without 1&1 branding will lead to the info led blinking if the image is flashed. Just power cycle the box and it'll be back to normal, but no Freetz.

Also, for a 1&1 box you MUST chose Replace AVM web server by httpd option from the patches menu. Due to a bug, not doing this will likely lead to you being unable to access the web interface and the box rebooting every few minutes. You'll probably have to use the AVM recovery tool to get back.

Other than that, you can pretty much chose what you like, but as the 5050 only has 4 MB of flash memory your options are pretty limited. Chose Remove help, Remove asistant, and Remove any other options you understand to free up memory.

Chose Language en under the Mod section if you so wish, and select any packages you like but as I said, you won't be able to fit many in, probably only a few. Callmonitor is useful, maybe nano if you're so inclined, or dropbear, maybe one or two others. Anyway, once you're done just exit until you're asked to save and do so.

Compile

Before compiling it's best to run

Code:
make config-clean-deps

just to clean up any files that were included in the makefile before you selected your current options. Now run

Code:
make

and wait. Ages like. It'll likely stop for quite a while after downloading the main ~500 MB firmware source, just hang in there and pray. Mine took around 30 minutes to complete the first time on a 2500+.

Now, if all goes well, you'll get to the end with no errors. If you get errors it should be obvious. The main one of these will be "firmware image is too big" which just means you had too many packages selected for the 5050's 4 MB flash. Go back to the beginning and deselect some.

If you succeed you should have a .image file in the freetz-1.0 folder containing the date and time of compile.


Flash Freetz

The brave can now attempt to flash this image. Again, you're best off doing this from a default AVM 12.04.31 firmware at factory defaults.

A successful flash will give you a slow flashing INFO LED, then quick, then really quick, then slow again, then the box'll reboot.

If anything doesn't work, re-read through the above (especially concerning branding and httpd options). And you'll probably need to use the recovery tool if a simple reboot doesn't fix things.

Otherwise, enjoy Freetz and whatever packages you installed.
 
Zuletzt bearbeitet:
Note: Beware the URL language formats below; change en to de (& vice versa) and any IPs to suit.


Call Stats Fritz!Fun

By default the Fritz!Box collects call stats for all incoming calls over VoIP and PSTN, and all successful outgoing over VoIP and PSTN (outgoing calls that aren't answered aren't recorded), and makes these available via the web interface which you can access quickly at:
http://fritz.box/cgi-bin/webcm?getp...pagename=foncalls&var:menu=home&var:showall=1

The total number of outgoing VoIP calls (though no other stats) are available via telnet in /var/flash/stat.cfg .


Given a few modifications or workarounds, stats are also available in a number of different formats. In short, you can access all stats - in/out, failed or successful, duration, ports, and various other things - in a plain text file parsed to your liking right on the FB, if you so need such a thing for later script useage.

Here's the options I've used so far:


Push Email

The FB's Push Email service will email all call stats (among other things) in a MIME email format. It's kinda hard to set up, and for the life of me I never got it working with gmail.

I did get it working with my shared hosting website's webmail server's smtp server, which is probably preferable if you want to do any script based stuff with the included data. Here's the settings I used

Tick to activate Push Service.
Chose daily.
Leave the extended stats tickbox unticked unless you need em.
Email out: any email address. But, for my needs, this needed to be an email address set up on my webserver, so [email protected].
Senders Email: the email used with smtp, so I used [email protected]
SMTP-Server: other
mail.mydomain.com:26
Enable SMTP authentication.
[email protected]
mypassword
mypassword

For CPanel users, login and go to Email Accounts, set one up, then hit Configure Email Client next to it to see all the details required above including specific port (if not :26 or :25), outgoing (smtp) server and username (it may use a + instead of @, you can still use @).

Anyway, that got me a base64 MIME email delivered to my website. Logging in via FTP this was stored in the /mail/mydomain.com/me/inbox file.

Textify Those Stats

If the email isn't enough, so long as you have Cron scripting enabled on your webserver (should be accessible via Cpanel) you can (or make the file publicly available to) convert the base64 text to ascii.

Make Publicly Available

In Cpanel click Cron, hit advanced, figure out how the timing works (it's not too hard, * * * * * is every minute) then use the following command to move the whole webmail inbox to a http accessible file.

cp /home/username/mail/mydomain.com/me/inbox /home/username/public_html/inbox

Where username is your cpanel login, mydomain.com is as expected, and me is your email name. You can now wget this file from any internet enabled device.

Convert Text

You can either do this bit directly on your webserver (possibly in place of the cp command above), or use wget to transfer the file to another device (possibly another router on your network, or the fritzbox itself).

wget http://www.mydomain.com/inbox

Now the hard stuff. You basically wanna cut out everything but the base64 encoded call stats. The line just before these will read " filename="Anrufliste_vom_11.06.2008.csv" ", then you get call stats, then you get " --------=_Boundary._ .... ". You could probably use an "awk {'print $X'} > file.txt" command to select the correct paragraph (X being a number). Then add this in to a new file titled stats.txt.base64, and start the file with the text

begin-base64 644 stats.txt

Followed on a new line by your base64 stats. Now run "uudecode stats.txt.base64" and you'll have a new text file that looks a lot like:

sep=;
Typ; Datum; Name; Rufnummer; Nebenstelle; Eigene Rufnummer; Dauer
2;11.06.08 15:59;;01904XXXXXX;;Festnetz;0:00
3;11.06.08 15:57;;01904XXXXXX;Fon 1;Festnetz;0:01
2;11.06.08 15:57;;01904XXXXXX;;Internet: 71XXXX0;0:00
1;11.06.08 15:56;;08003289393;Fon 1;Festnetz;0:01
3;11.06.08 15:56;;17070;Fon 1;Festnetz;0:01

The layout is as such:

Direction;Date Time;Name;Number;Port;Account;Duration

Direction is 1 incoming, 2 missed, 3 outgoing. The rest should be obvious (Festnetz is Analog/PSTN).

We now have a text based file on, presumably, another router (maybe the fritz) that we can parse in a bash script to do what you like with.


Text Browser

Option 2 (or is it 3?) is to use a text browser such as lynx or elinks to access the webpage's javascript enabled source (seeings how wget won't do this). You should be able to install these on any full-featured linux OS, and lucky router owners running DD-WRT or OpenWRT on a router with at least around 500 Kb permanent file storage (eg. JFFS) available will be able to install elinks on said router.

Personally I installed elinks on a la fonera router, which involved enabling JFFS2, wget'ing elinks_0.11.1-2_mips.ipk and libopenssl_0.9.8e-1_mips.ipk from http://downloads.x-wrt.org/xwrt/kamikaze/7.07/atheros-2.6/packages/ then running "ipkg install" for both files. That was about it :)

Before I go on I should give big thanks to Serge Hauser for the script that first let me in to this method. You can get it at http://clu.es/fritzbox/ but I've copied the fun stuff below, and note you don't need to do the first two lines if you don't have web login enabled:

Code:
echo "getpage=..%2Fhtml%2Fde%2Fmenus%2Fmenu2.html&login%3Acommand%2Fpassword=$PASSWORD" > $TMPFILE
lynx -post_data http://$HOST/cgi-bin/webcm < $TMPFILE >/dev/null
rm $TMPFILE
lynx -source "http://$HOST/cgi-bin/webcm?getpage=../html/de/menus/menu2.html&var:lang=de&var:pagename=foncalls&var:menu=fon" | grep "TrCall(\"2\"" | awk {'print $3" "$4" "$6'} | sed -e "s/\"//g" -e "s/,//g" > $TMPFILE

The final line is the important one, and works identically if you replace lynx with elinks. The output as-is is as follows:

24.06.08 13:55 0190XXXXXXX
24.06.08 13:54 10000

Though you can adapt the awking and greping and do what you like.

Code:
#!/bin/sh

NUM=1

echo "Number initialised to:" $NUM
sleep 5

NUM=`elinks -source "http://192.168.1.116/cgi-bin/webcm?getpage=../html/de/menus/menu2.html&var:lang=de&var:pagename=foncalls&var:menu=fon" | grep "TrCall(\"" | awk {'print $3" "$4" "$6" "$8'} | grep "\"0\"" | sed -e "s/\"//g" -e "s/,//g" | wc -l`

echo "Number of parsed calls:" $NUM

if [ $NUM = "2" ]; then
        echo "Parsed call number match, do stuff."
else
        echo "Parsed call number not matched."
fi

So there's a load of debug output there, but basically I'm grabbing the call date ($3), time (4), outgoing number (6) and port (8), cutting that down to all those on the first SIP account (grep "\"0\"" - replace the 0 for other sip accounts, or delete it for PSTN) then just counting the resulting lines to give me the total number of PSTN calls.

Change TrCall(\"" to TrCall(\"X" to grep only incoming (X=1), outgoing (3) or failed (2) calls.

I'm sure there's a more efficient way of doing that but I moved on to bigger and better things...


Callmonitor

If you've been able to compile Freetz at all, you can chose callmonitor from the additional packages list to compile it in to the firmware. When working, this will give you the ability to record virtually all stats in any format you like, and do whatever you like with the output.

The german wiki page for callmonitor is at http://wiki.ip-phone-forum.de/software:callmonitor:start . It's simple enough to understand and you can always translate it online. Basically though, once running you need only concern yourself with one thing - the Listeners section.

NOTE: Before I actually added any listeners I had a load of problems with incoming calls causing the FB to hang and reboot. I don't know if it was my problem, a cm bug, or normal behaviour, but beware of running callmonitor without setting up listeners :)

The wiki will give you loads of info on listener line setup and output options, but to start with I just use:

out:connect ^7XXXX7$ ^ echo -en "callout ${SOURCE} to ${DEST} via ${PROVIDER}\n" >> /var/tmp/calltest

With the first number being my analog phone number setup in the web pages. This now dumps an entry in to a file on the box for every successfully connected (as oposed to just rung, answered or not - that would be out:requested) outgoing PSTN call made. Personally I'm just gonna wc -l this to see how many lines/calls have gone out, but you do whatever.

If you wanted, asuming you were using freetz and rc.custom for any permanent scripts and kept /var/flash/debug.cfg otherwise blank, you could just echo the call data in to there to have it kept permanently, or run a cronjob to copy the data over to default.cfg every now and then - the latter probably more preferable as you don't wanna write to flash based data too often to avoid wearing out the flash.


Calllog

Probably the most basic option, but also requires the most coding. The script /var/flash/calllog (empty by default) is called every time a call is recieved. I've not played with it at all but there's a good example script at http://nodomain.cc/archives/2006/11/16/661-Fritz!Box-Anrufinfo-per-SMS-inkl.-Rueckwaertssuche.html

In short; if you've password protected the thing, you'll have to figure out yourself how to do stuff. Otherwise, a simple script in calllog can just export the REQUEST_METHOD="GET", export REMOTE_ADDR="fon's ip",
export QUERY_STRING "getpage=../fon's phone page", then run webcm which should display the queried page's html and sed it for the first TrFon line, and generally parse it and do with it as you will.
 
Zuletzt bearbeitet:
Alter *Anything* Via CLI

NOTE: THIS IS DANGEROUS; you could right f things up by manually editing config files though hopefully not enough to mean recovery isn't possible. And on we go...


The easy but useless way

Firsly, there are a limited number of things you can alter in the default firmware via a telnet cli connection. Primarily the only interesting one is /var/flash/voip.cfg though anything in /var/flash/ can be changed.

If you have a firmware with vi or nvi available (freetz, earlier AVM) then you can use those to edit files, though note neither are available in latter versions of the default AVM folder. In that case you can pre-create a file, upload it somewhere publicly available to the router and wget it to the box.

In order to edit anything, basically you need to edit it in /var/tmp/ then move it elsewhere. So to edit /var/flash/voip.cfg we...

cat /var/flash/voip.cfg > /var/tmp/voip.cfg
vi /var/tmp/voip.cfg
cat /var/tmp/voip.cfg > /var/flash/voip.cfg

That's fine for whatever's available to edit, but unfortunately it's not much, more's the pity.

At the very least you can create two voip.cfg files with differing voip setups in them, and just copy these at will in to voip.cfg by a cronjob or anything else.



The hard but full featured way

Never fear, there's always a way. You can edit presumably anything available via the web interface right from the command line, you just need a wee script to do it.

Huge thanks to whoever added the script based javascript interfacting bit at http://www.wehavemorefun.de/fritzbo...ode_.2F_Ein-_und_Ausschalten_der_SIP-Accounts as without this I'd be lost for any other methods.

Anyway, basically...

Code:
#!/bin/sh
#--------------------------------------------------------------------
# Set SIP, ON or OFF, on FBF
#--------------------------------------------------------------------

echo "POST /cgi-bin/webcm HTTP/1.0
Content-Type: application/x-www-form-urlencoded
User-Agent: dBox2-status
Host: fbox
Content-length: 78

getpage=..%2Fhtml%2Fde%2Fmenus%2Fmenu2.html&login%3Acommand%2Fpassword=$SITEPASSWORD

" |
nc -i 1 -w 1 fritz.box 80 > /dev/null

echo "POST /cgi-bin/webcm HTTP/1.0
Content-Type: application/x-www-form-urlencoded
User-Agent: dBox2-status
Host: fbox
Content-length: 174

getpage=..%2Fhtml%2Fde%2Fmenus%2Fmenu2.html&&sip%3Asettings%2Fsip0%2Factivated=0&sip%3Asettings%2Fsip0%2FID=0&sip%3Asettings%2Fsip1%2Factivated=0&sip%3Asettings%2Fsip1%2FID=1

" |
nc -i 1 -w 1 fritz.box 80 > /dev/null # NetCat der Parameter und Ausgabe unterdrücken

And that'll deactivate all voip accounts (or activate them oif activate=1).

Hopefully you get the point from the above. You can leave out the first part if you have no web login, change fritz.box to the FB's IP, and apparently the above will only work when you have a sip entry (0,1,2,3) for the same number of sip accounts you have.

It'll also only work on a system with the NetCat (nc) command available (like, Freetz, but not my dd-wrt).

Oh and, "Content-length:" MUST equal the exact number of characters in the following line. You can add new lines to the getpage string, but each line break accounts for +1 in the content-length.


The same type of code should also work with wget as shown in the wiki, but I didn't get it working when I tried.


Anyway, in short, you should be able to do just about anything so long as you can figure out the input commands needed. Take a look at the source of any page and look out for lines with ":settings" in them, and also selection source (in firefox) for the various options that can be used with settings input commands.


For example, I found the following commands at the bottom of the source for the Dial Rules page, and with a bit of experimentation figured out what each does. Also, checking the selection source for the outgoing provider let me in on why 0 was SIP0, 1 SIP1, but analog nowhere to be found (it's actually f0 ).

WARNING: The GroupX bit is very important. It starts from 0, and when adding a new rule you need to chose the next number available (eg. if you have three rules, you need to use Group3 as 0,1+2 refer to the current rules).

Obviously then, using Group0, 1 or 2 will modify any of the existing three rules instead of adding a new one.

And because of this, either know exactly how many rules you have and don't change them without changing the script, or be prepared for weird stuff happening. You can even delete the undeletable emergency dial plans if you enter the wrong thing :cool:

Code:
#!/bin/sh
#--------------------------------------------------------------------
# Change DialRules, on FBF
#--------------------------------------------------------------------

echo "POST /cgi-bin/webcm HTTP/1.0
Content-Type: application/x-www-form-urlencoded
User-Agent: dBox2-status
Host: fbox
Content-length: 240

getpage=..%2Fhtml%2Fde%2Fmenus%2Fmenu2.html&&telcfg%3Asettings%2FRouting%2FGroup6%2FNumber=011&telcfg%3Asettings%2FRouting%2FGroup6%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup0%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup1%2FRoute=f0

" |
nc -i 1 -w 1 192.168.1.116 80 > /dev/null # NetCat der Parameter und Ausgabe unterdrcken
 
Zuletzt bearbeitet:
Tips & Tricks

Freetz Security Settings

If you notice any Freetz config pages with red text saying you can't change something at your current security level, then run the following command via telnet (0 is no restrictions, 1 is some, 2 is fully restricted):

Code:
echo 0 > /tmp/flash/security
modsave

Change Timezone

Unless you're running the AVME european firmware (eg. Massinge's on the 5050) then you don't have any time options available via the web. No worries.

First, find out what the current timezone string is with this command via telnet, and just keep the string in mind incase you ever want to change it back:

cat /var/TZ

To permanently alter the time zone, find your local timezone from the main list at http://wiki.openwrt.org/OpenWrtDocs/Configuration#head-a7708420e79025405daa939605108397c2bd7343
Eg. London is GMT+0BST-1,M3.5.0/01:00:00,M10.5.0/02:00:00
France is CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00
Brisbane is AEST-10

You need to add this in to the ar7.cfg file so:

cat /var/flash/ar7.cfg > /var/tmp/ar7.cfg
vi ar7.cfg

If vi isn't available to you on the box, you'll have to wget a pre edited version from elsewhere to /var/tmp. Otherwise, scroll down to the very bottom and you should see:

Code:
timezone_manual {
        enabled = no;
        offset = 0;
        dst_enabled = no;
        TZ_string = "";
}

Change enabled = no to enabled = yes, and add your timezone string between the quotes, as in the following example for UK (GMT/BST) time. Note that is you leave out the quotes you'll have no web access and have to reset the thing to defaults via a phone.

Code:
timezone_manual {
        enabled = yes;
        offset = 0;
        dst_enabled = no;
        TZ_string = "GMT+0BST-1,M3.5.0/01:00:00,M10.5.0/02:00:00";
}

Once done, save and copy the file back to /var/flash:

cat /var/tmp/ar7.cfg > /var/flash/ar7.cfg

Now reboot from the web interface or otherwise power cycle the router, then "cat /var/TZ" should give you your correct timezone stiring and "uptime" or "date" should give you the correct time/date.


UK VoIP Account Settings

Generic
For most VoIP accounts, numbers require dialing in international format even for local calls. In the UK, this is 0044 (UK from abroad), then drop the leading 0 from the area code and continue as normal.

Firstly, ensure your phone codes are correct on Internettelefonie (Internet Telephony) > Erweiterte Einstellungen (Advanced Settings). Under Standortangaben (Location data) select either GroBbritannien, United Kingdom, or Anderes Land if neither of those are available. Insert 00 and 44 for Landesvorwahl (Country code) and then for the first part of Ortsvorwahl (Area code) enter 0, then the rest of the area code in the next box. Eg. For Leeds (0113), enter 0 then 113, for London (020) enter 0 then 20, etc etc.

Now on the account setup tab, you want to tick 00, 44 and the last part of your area code (eg. 113, 20) and leave the leading 0 of the area code UNTICKED. Now calls will be made in the correct format, eg. 0044113XXXXXXX, 004420XXXXXXX.

Note that you don't need to worry about dialing the correct thing on your phone. Local numbers (XXXXXXX) will be dialed with the correct country and area code prefix. National numbers (eg. 0113 XXXXXXX) will have the leading 0 dropped and 0044 appended. International numbers will go out as normal.

Betamax / Finera

VoipCheap, VoipBuster etc users should use the following setup (CallerID should work fine too):

Internetrufnummer: Your Betamax registered number in international format, eg. for 0113 area code use 044113XXXXXXX.
Benutzername: Your Betamax user name.
Kennwort: Your Betamax password.
Registrar: sip.voipcheap.com
Proxy-Server: sip.voipcheap.com
STUN-Serve: stun.voipcheap.com
And tick "Internetrufnummer für die Anmeldung verwenden".

Sipgate

Internetrufnummer: Your 7 number SIP-ID (available on settings page).
Benutzername: SIP-ID
Kennwort: Your 8 digit SIP password (available on settings page).
Registrar: sipgate.co.uk
Proxy-Server: sipgate.co.uk
STUN-Server: stun.sipgate.net
Leave "Internetrufnummer für die Anmeldung verwenden" UNTICKED.


VoIP Behind NAT

If you use your FB as an ATA, chances are it's behind a NAT enabled router (eg. it's using a static 192.168.X.X address). In this case, you may have carious problems with VoIP, either being unable to register, unable to receive calls, or stuttering voice during calls. There's a number of solutions, mostly with the same result but one may be preferable over the other depending on your needs. What you need to remember is the main problem is any data being send to various ports at your IP address isn't getting sent through to the ATA correctly so you need to solve this.

1. Force ports open.
Telefonie > Internettelefonie > Erweiterte Einstellungen > Portweiterleitung des Internet-Routers... (Telephony > Internet Telephony > Advanced Settings> Keep port forwarding enabled...).
Enabling and setting this to, say, 2 minutes will have the FB send a packet to a specific port on your main router. This will force the firewall to keep this port open to the FB for a short period allowing data through. This is a simple hack to solve the problem, but should work well so long as you get the timing correct.

2. Forward ports on main router.
Basically the result is the same as above, but this is the correct way of doing it :) If your main router has port forwarding options, forward both FB specific ports and your VoIP provider's specific ports to your FB. I use the following, for both TCP and UDP regardless of what other places said as it's what worked for me :) :

5050 Ports
3478-3479
5060-5062
5070-5072
7077-7098
30000-30005

Additional Sipgate.co.uk Ports
5004
8000 - 8012
10000

In reality though, using both steps 1 and 2 worked best for me. Without the "Portweiterleitung des Internet-Routers" setting enabled I got a lot of voice dropout at the start of some calls (voipd -v printed out a lot of "capiconn_send: failed 1"). Enabling this setting made the problem a lot better.

3. VoIP Aware Firewall / Proxy

Unless you can forward ports to multiple IPs, the above will only work for a single ATA on a single IP. For multiple ATAs you may want to use some form of VoIP proxy. The DD-WRT Voip version features the Milkfish VoIP proxy that can be used as a go-between for the ATAs and external VoIP transmissions.

Setup of Milkfish on a DD-WRT router can be found at http://wiki.milkfish.org/index.php?n=Milkfish-dd.RouterConfiguration (steps 1-3, basically you just turn it on).

Setup of a 5050 FB to use Milkfish can be found at http://wiki.milkfish.org/index.php?n=TheMilkfish.FritzBox (basically just use your main router's IP for the voip proxy-server).
 
Zuletzt bearbeitet:
Quite a lot of work! Just a comment to change annex from B to A and debrand to AVM (or avme): The ..tar you use is good for older models - it will not work for those having a firmware higher than 04.30 - reason: Linux-Kernel change from 2.4 to 2.6 by AVM. The archives that will work on either the old AND the new kernel are "fritz_as_annex_a_kernel_args_newer.tar" and "fritz_as_avme_newer.tar" to flash (or debrand) the english firmware version - author of both is "telefonicus"
 
Thanks. I actually used the annex A script I linked on a 1und1 branded 5050 with default 1und1 12.04.31 firmware, and it worked fine (checked via adam2). I don't know if there's anything weird with the 5050 firmware or the one I had or what. I never checked which kernel was on but I also had to use "firmware_version avm" instead of ",avm" which was kernel related though I don't know which version used which standard... anyway, I'll be updating with firmware flashing info later (only just got Freetz working).
 
Though I'd just update this with my current setup. It's for automating dialplan settings for a UK based BT phone line with CallerID enabled, and VoipCheap.

For those who don't know, BT charge you money for using CallerID unless you make 6 chargeable calls a month, give you free weekend calls to landlines, and are cheaper than VoipCheap for 08 numbers. So the below trys to automate dialplan switching based on this.

Setup is pretty simple, just log in to Freetz config page (need callmonitor installed) and add the following to the correct sections and save. And it generally requires things to be setup in the regular fritz config pages correctly.


Crontab

Used to run the scripts at specific times, checking for 6 calls having been made daily, backing up stats to flash every other day, setting outgoing calls to BT at the weekend, and resetting everything every 3 months (depending on my BT billing dates).

Code:
9 0 * * * /var/tmp/pepsi/callcheck > /dev/null 2>&1 &
6 0 */2 * * /var/tmp/pepsi/backupstats > /dev/null 2>&1 &
12 0 * * 6 /var/tmp/pepsi/dialfreepstn > /dev/null 2>&1 &
3 0 25 3,6,9,12 * /var/tmp/pepsi/dialallpstn && > /var/tmp/pepsi/callstats; > /var/flash/debug.cfg


Listeners

Note: 777777 is my PSTN landline number.

Code:
out:connect ^777777$ !^(1|3|9|080) if [ "`date | egrep '^Sat|^Sun'`" != "" ]; then echo -en "# ${DEST} from ${SOURCE} over ${PROVIDER} on ${TIMESTAMP}\n" | egrep '^# 00|^# 0[4-9]' >> /var/tmp/pepsi/callstats; else echo -en "# ${DEST} from ${SOURCE} over ${PROVIDER} on ${TIMESTAMP}\n" >> /var/tmp/pepsi/callstats; fi; > /dev/null 2>&1 &


rc.custom


The big boy. Creates a number of scripts called by crontab. First lot are just for interfacing with and changing dialplans. backupstats copies the call stats data from ram to flash every other day to ovoid both loss of data and flash overuse. callcheck combines both temp and flash call data to get the current call stats, and runs dialplans depending on the outcome (in my case >6 calls every 3 months).

Be aware content length in the dialplan changer scripts must be the exact length of the following text. iirc that includes returns, but just cross-check the below to see if it does or not.


Code:
#!/bin/sh

# Fritz!Box rc.custom startup script for Freetz
# By pepsi_max2k 26/06/08 v 1.0

# Create custom folder and files
mkdir /var/tmp/pepsi
touch /var/tmp/pepsi/callstats


### Create Dialplan To PSTN script (all). ###

echo "#!/bin/sh

# Dialplan to PSTN (all)
# By pepsi_max2k 26/06/08 v1.0

# Echo password if enabled
echo \"POST /cgi-bin/webcm HTTP/1.0
Content-Type: application/x-www-form-urlencoded
User-Agent: dBox2-status
Host: fbox
Content-length: 79

getpage=..%2Fhtml%2Fde%2Fmenus%2Fmenu2.html&login%3Acommand%2Fpassword=mypassword

\" |
nc -i 1 -w 1 127.0.0.1 80 > /dev/null

# Echo commands. GroupX must reflect existing plan.
# Route=f0 for PSTN, Route=0/1/2/3 etc for VoIP.
echo \"POST /cgi-bin/webcm HTTP/1.0
Content-Type: application/x-www-form-urlencoded
User-Agent: dBox2-status
Host: fbox
Content-length: 735

getpage=..%2Fhtml%2Fde%2Fmenus%2Fmenu2.html&&telcfg%3Asettings%2FRouting%2FGroup0%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup1%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup2%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup3%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup4%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup5%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup6%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup9%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup10%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup11%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup12%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup13%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup14%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup15%2FRoute=f0

\" |
nc -i 1 -w 1 127.0.0.1 80 > /dev/null" > /var/tmp/pepsi/dialallpstn




### Create Dialplan To PSTN script (free). ###

echo "#!/bin/sh

# Dialplan to PSTN (free)
# By pepsi_max2k 26/06/08 v1.0

# Echo password if enabled.
echo \"POST /cgi-bin/webcm HTTP/1.0
Content-Type: application/x-www-form-urlencoded
User-Agent: dBox2-status
Host: fbox
Content-length: 79

getpage=..%2Fhtml%2Fde%2Fmenus%2Fmenu2.html&login%3Acommand%2Fpassword=mypassword

\" |
nc -i 1 -w 1 127.0.0.1 80 > /dev/null

# Echo commands. GroupX must reflect existing plan.
# Route=f0 for PSTN, Route=0/1/2/3 etc for VoIP.
echo \"POST /cgi-bin/webcm HTTP/1.0
Content-Type: application/x-www-form-urlencoded
User-Agent: dBox2-status
Host: fbox
Content-length: 490

getpage=..%2Fhtml%2Fde%2Fmenus%2Fmenu2.html&&telcfg%3Asettings%2FRouting%2FGroup1%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup2%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup9%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup10%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup11%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup12%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup13%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup14%2FRoute=f0
&telcfg%3Asettings%2FRouting%2FGroup15%2FRoute=f0

\" |
nc -i 1 -w 1 127.0.0.1 80 > /dev/null" > /var/tmp/pepsi/dialfreepstn





### Create Dialplan To VoIP script (all). ###

echo "#!/bin/sh

# Dialplan to VoIP (all)
# By pepsi_max2k 26/06/08 v1.0

# Echo password if enabled.
echo \"POST /cgi-bin/webcm HTTP/1.0
Content-Type: application/x-www-form-urlencoded
User-Agent: dBox2-status
Host: fbox
Content-length: 79

getpage=..%2Fhtml%2Fde%2Fmenus%2Fmenu2.html&login%3Acommand%2Fpassword=mypassword

\" |
nc -i 1 -w 1 127.0.0.1 80 > /dev/null

# Echo commands. GroupX must reflect existing plan.
# Route=f0 for PSTN, Route=0/1/2/3 etc for VoIP.
echo \"POST /cgi-bin/webcm HTTP/1.0
Content-Type: application/x-www-form-urlencoded
User-Agent: dBox2-status
Host: fbox
Content-length: 721

getpage=..%2Fhtml%2Fde%2Fmenus%2Fmenu2.html&&telcfg%3Asettings%2FRouting%2FGroup0%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup1%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup2%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup3%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup4%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup5%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup6%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup9%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup10%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup11%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup12%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup13%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup14%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup15%2FRoute=0

\" |
nc -i 1 -w 1 127.0.0.1 80 > /dev/null" > /var/tmp/pepsi/dialallvoip



### Create Dialplan To VoIP script (non free). ###

echo "#!/bin/sh

# Dialplan to VoIP (non free)
# By pepsi_max2k 27/06/08 v1.0

# Echo password if enabled.
echo \"POST /cgi-bin/webcm HTTP/1.0
Content-Type: application/x-www-form-urlencoded
User-Agent: dBox2-status
Host: fbox
Content-length: 79

getpage=..%2Fhtml%2Fde%2Fmenus%2Fmenu2.html&login%3Acommand%2Fpassword=mypassword

\" |
nc -i 1 -w 1 127.0.0.1 80 > /dev/null

# Echo commands. GroupX must reflect existing plan.
# Route=f0 for PSTN, Route=0/1/2/3 etc for VoIP.
echo \"POST /cgi-bin/webcm HTTP/1.0
Content-Type: application/x-www-form-urlencoded
User-Agent: dBox2-status
Host: fbox
Content-length: 283

getpage=..%2Fhtml%2Fde%2Fmenus%2Fmenu2.html&&telcfg%3Asettings%2FRouting%2FGroup0%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup3%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup4%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup5%2FRoute=0
&telcfg%3Asettings%2FRouting%2FGroup6%2FRoute=0

\" |
nc -i 1 -w 1 127.0.0.1 80 > /dev/null" > /var/tmp/pepsi/dialnonfreevoip




### Create call checker script ###

echo "#!/bin/sh

# Callcheck script to check call stats and react.
# Used with callmonitor under Freetz; a new line is echoed
# in to a file for each successful listener match.
# By pepsi_max2k 26/06/08 v1.1


# Workaround to avoid flash overuse; store regular stats
# in /var/tmp and copy to /var/flash infrequently.
# After a reboot /var/flash should contain correct stats.

# Get stats from temp mem
TEMPSTATS=\`cat /var/tmp/pepsi/callstats | wc -l\`

# Get stats from perm flash backup
PERMSTATS=\`cat /var/flash/debug.cfg | wc -l\`

# Set STATS to sum of the above.
STATS=\$((\$TEMPSTATS+\$PERMSTATS))

# Compare stats to set value and change plans if matched.
if [ \$STATS -ge 6 ]; then
    # If weekend do not alter free PSTN plans.
    if [ \"\`date | egrep '^Sat|^Sun'\`\" != \"\" ]; then
        /var/tmp/pepsi/dialnonfreevoip
    else
        /var/tmp/pepsi/dialallvoip
    fi
fi" > /var/tmp/pepsi/callcheck




### Create Backup Stats script ###

echo "#!/bin/sh

# Backup Stats script to copy stats from volatile storage
# to non volatile storage tri-weekly.
# By pepsi_max2k 27/06/08 v1.1

cat /var/flash/debug.cfg /var/tmp/pepsi/callstats > /var/tmp/pepsi/tmpstats
cat /var/tmp/pepsi/tmpstats > /var/flash/debug.cfg
> /var/tmp/pepsi/callstats
rm /var/tmp/pepsi/tmpstats" > /var/tmp/pepsi/backupstats


chmod 755 /var/tmp/pepsi/dialallpstn
chmod 755 /var/tmp/pepsi/dialfreepstn
chmod 755 /var/tmp/pepsi/dialallvoip
chmod 755 /var/tmp/pepsi/dialnonfreevoip
chmod 755 /var/tmp/pepsi/callcheck
chmod 755 /var/tmp/pepsi/backupstats
 
Holen Sie sich 3CX - völlig kostenlos!
Verbinden Sie Ihr Team und Ihre Kunden Telefonie Livechat Videokonferenzen

Gehostet oder selbst-verwaltet. Für bis zu 10 Nutzer dauerhaft kostenlos. Keine Kreditkartendetails erforderlich. Ohne Risiko testen.

3CX
Für diese E-Mail-Adresse besteht bereits ein 3CX-Konto. Sie werden zum Kundenportal weitergeleitet, wo Sie sich anmelden oder Ihr Passwort zurücksetzen können, falls Sie dieses vergessen haben.