i testetd this function with the following script:
#!/bin/sh
echo $@ >/var/test.call
set >> /var/test.call
==============================================
the script was named "test" and was wrote to the NVRAM memory with:
You can see all variables CALLER, DURATION, EVENT, EVENT_DATE and LINE.
The path in the Howto is NOT wrong. The script which do the execute the call events (/usr/bin/call_mon_event.sh) use the file "/var/custom_call_event.sh". If this file is not existend, it try to load it from NVRAM memory. If a file with this name exists, then this is used. Maybe this is your mistake?
But maybe i know the problem. If you use the router with analog PSTN the calling party number is sent with CLIP. The CLIP signal is sent between the first and second ring signal. Ordinary the CLIP information arrives within a few 100ms. The phone monitoring program 'vodsl_monitor' waits 800ms. If the CLIP information arrives to late, the event script starts without the calling party number. To change this behavior, download the Source Code and change the parameter
#define CLIP_DELAY 800000
to a value that works with your telephone switchboard.
There is no standard - as far as i know - which say whats the maximum CLIP_DELAY. This value is a compromise between fast feedback and surety to get the number.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the howto it is written, that the filename must be
/var/custom_call_SCRIPT.sh
but correct is
/var/custom_call_EVENT.sh
and that is the filename you did also use.
But okay I understand now, that the filename can be what ever, because it will be loaded from NVRAM if it has been set correctly with the command
nvram setfile custom_call_event=WHAT_EVER_FILENAME
So this is confusing in the Howto.
But it does still not work for me.
Which version of the image do you use?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
if [ "$EVENT" == "CALL" ]
then
case "$CALLER" in
"55*0*")
etherwake 00:00:FB:25:DA:4C
;;
*)
# sonst nix
;;
esac
exit 0
fi
if [ "$EVENT" == "RING" ]
then
message "`(grep "$CALLER" /opt/fritzboxcallmon.addr || echo "notfound|$CALLER") | cut -f2 -d"|"`"
exit 0
fi
if [ "$EVENT" == "DISCONNECT" ]
then
case "$CALLER" in
*)
# sonst nix
;;
esac
exit 0
fi
================== SNAP ==========================================
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Image: 0.3.1_OPENVPN
SIP-Provider: sipgate
I've tried the custom call monitor script to display incoming calls on my dboxes.
But the CALLER is always empty on "RING" event.
Only on DISCONNECT the CALLER is set.
Simple test script:
#!/bin/sh
echo "==============================================" >>/tmp/tks.call
date >>/tmp/tks.call
export >>/tmp/tks.call
echo "EVENT=$EVENT" >>/tmp/tks.call
echo "CALLER=$CALLER" >>/tmp/tks.call
echo "1=$1 2=$2 3=$3 4=$4 5=$5 6=$6" >>/tmp/tks.call
echo "==============================================" >>/tmp/tks.call
The caller is completly empty. That causes also, that the parameters 1-6 are not set correctly.
Example output:
root@BS:/var #cat /tmp/tks.call
Fri Oct 17 04:13:19 UTC 2008
export CALLER=''
export DURATION='0'
export EVENT='RING'
export EVENT_DATE='17.10.08 03:13:19'
export LINE='1'
export PATH='/bin:/etc/start_scripts:/sbin:/usr/sbin:/bin:/usr/bin'
export PWD='/'
EVENT=RING
CALLER=
1=RING 2=1 3=17.10.08 4=03:13 5=0 6=
==============================================
==============================================
Fri Oct 17 04:13:26 UTC 2008
export CALLER='1234567'
export DURATION='0'
export EVENT='DISCONNECT'
export EVENT_DATE='17.10.08 03:13:26'
export LINE='1'
export PATH='/bin:/etc/start_scripts:/sbin:/usr/sbin:/bin:/usr/bin'
export PWD='/'
EVENT=DISCONNECT
CALLER=1234567
1=DISCONNECT 2=1234567 3=1 4=17.10.08 5=03:13 6=0
==============================================
BTW: The Path in the Howto is not correct. It referes to /var/custom_call_script.sh but it must be /var/custom_call_event.sh
Best regards
Thomas
Hello,
i testetd this function with the following script:
#!/bin/sh
echo $@ >/var/test.call
set >> /var/test.call
==============================================
the script was named "test" and was wrote to the NVRAM memory with:
root@BS:/var # nvram setfile custom_call_event=test
Then i called my SIP number and the file "/var/test.call" contained this during my phone was ringing:
RING 0160******* 1 17.10.08 09:20 0
CALLER='0160*********'
DURATION='0'
EVENT='RING'
EVENT_DATE='17.10.08 09:20:20'
IFS='
'
LINE='1'
OPTIND='1'
PATH='/bin:/etc/start_scripts:/sbin:/usr/sbin:/bin:/usr/bin'
PPID='697'
PS1='\w \$ '
==============================================
You can see all variables CALLER, DURATION, EVENT, EVENT_DATE and LINE.
The path in the Howto is NOT wrong. The script which do the execute the call events (/usr/bin/call_mon_event.sh) use the file "/var/custom_call_event.sh". If this file is not existend, it try to load it from NVRAM memory. If a file with this name exists, then this is used. Maybe this is your mistake?
But maybe i know the problem. If you use the router with analog PSTN the calling party number is sent with CLIP. The CLIP signal is sent between the first and second ring signal. Ordinary the CLIP information arrives within a few 100ms. The phone monitoring program 'vodsl_monitor' waits 800ms. If the CLIP information arrives to late, the event script starts without the calling party number. To change this behavior, download the Source Code and change the parameter
#define CLIP_DELAY 800000
to a value that works with your telephone switchboard.
There is no standard - as far as i know - which say whats the maximum CLIP_DELAY. This value is a compromise between fast feedback and surety to get the number.
Hi nobody,
thank you for your answer.
I'm not using PSTN, but SIP only.
In the howto it is written, that the filename must be
/var/custom_call_SCRIPT.sh
but correct is
/var/custom_call_EVENT.sh
and that is the filename you did also use.
But okay I understand now, that the filename can be what ever, because it will be loaded from NVRAM if it has been set correctly with the command
nvram setfile custom_call_event=WHAT_EVER_FILENAME
So this is confusing in the Howto.
But it does still not work for me.
Which version of the image do you use?
Okay, I have found the reason. In "Phone Settings" -> "Phone" -> "VoIP Settings" -> "Phone Options" -> "enable CLIP" must be set to on, even for VoIP.
Now it works for me.
FYI the script that I use to display incoming calls on 2 dboxes (living room and sleeping room):
it uses the same "phonebook" format as described in the tuxbox wiki:
http://wiki.dbox2-tuning.net/wiki/index.php/Fritzboxcallmon#fritzboxcallmon.addr
The "phonebook" must be installed at
/opt/fritzboxcallmon.addr
================== SNIP ==========================================
#!/bin/sh
[ "$#" -lt "5" ] && exit 1
echo "Call custom event..."
message()
{
export TEXT="Anruf von $1"
wget -qO /dev/null "http://192.168.1.91/control/message?nmsg=$TEXT"
wget -qO /dev/null "http://192.168.1.93/control/message?nmsg=$TEXT"
}
if [ "$EVENT" == "CALL" ]
then
case "$CALLER" in
"55*0*")
etherwake 00:00:FB:25:DA:4C
;;
*)
# sonst nix
;;
esac
exit 0
fi
if [ "$EVENT" == "RING" ]
then
message "`(grep "$CALLER" /opt/fritzboxcallmon.addr || echo "notfound|$CALLER") | cut -f2 -d"|"`"
exit 0
fi
if [ "$EVENT" == "DISCONNECT" ]
then
case "$CALLER" in
*)
# sonst nix
;;
esac
exit 0
fi
================== SNAP ==========================================