swaesch schrieb:Hier hat sich was geändert:
NEU:
Code:http://www0.dasoertliche.de/DB4Web/es/oetb2suche/home.htm?main=Antwort&s=2&kw_invers=123456
lynx "http://www.dasoertliche.de/Controller?form_name=search_inv&ph=$NUMMER" \
-dump -nolist -connect_timeout=3> $TMPFILE
NAME=`grep RTRTRTRT -A 6 $TMPFILE | awk '{ if (FNR == 1) print $0 }' | sed -e "s/RTRTRTRT//" -e "s/\ \+//" -e "s/\ \+/\ /g" -e "s/\[_\]//g"`
DETAILS=`grep RTRTRTRT -A 6 $TMPFILE | awk '{ if (FNR == 2) print $0 }' | sed -e "s/\ \+//" -e "s/\ \+/\ /g" -e "s/\[_\]//g"`
LinuxQ schrieb:Ich bin jetzt total verwirrt. Geht jetzt wieder irgend eine Version mit der Rückwärtssuche?
#!/bin/sh
#
read agi_request
read agi_language
read agi_channel
read agi_type
read agi_uniqueid
read agi_callerid
read agi_dnid
read agi_rdnis
read agi_context
read agi_extension
read agi_priority
read agi_enhanced
read agi_accountcode
read emptyline
#pfad zum cachefile
CACHE="/var/spool/asterisk/invsuche_cache"
#pfad um das tempfile anzulegen
TMPFILE="/tmp/tmpsuche"
LOG="/var/log/asterisk/anrufliste_log"
echo "Hallo"
if [ "$1" == " " ]; then
NAME="anonymer Anrufer"
DETAILS="Keine details"
else
NUMMER=`echo $1 | sed -e "s/\ //g" -e "s/+49/0/"`
#echo "Suche nach $NUMMER im cache"
NAME=`awk -F '\t' '{ if ($1 == "'$NUMMER'") print $2 }' $CACHE`
DETAILS=`awk -F '\t' '{ if ($1 == "'$NUMMER'") print $3 }' $CACHE`
echo "Name: $NAME"
echo "Details: $DETAILS"
if [ "$NAME" == "" ]; then
# echo "Suche nach $NUMMER in www.dasoertliche.de"
lynx "http://www.dasoertliche.de/Controller?form_name=search_inv&ph=$NUMMER" \
-dump -nolist -connect_timeout=3> $TMPFILE
NAME=`grep RTRTRTRT -A 6 $TMPFILE | awk '{ if (FNR == 1) print $0 }' | sed -e "s/RTRTRTRT//" -e "s/\ \+//" -e "s/\ \+/\ /g" -e "s/\[_\]//g"`
DETAILS=`grep RTRTRTRT -A 6 $TMPFILE | awk '{ if (FNR == 7) print $0 }' | sed -e "s/\ \+//" -e "s/\ \+/\ /g" -e "s/\[_\]//g"`
if [ "$NAME" == "" ]; then
if grep "Kein Teilnehmer gefunden" $TMPFILE > /dev/null; then
NAME="Telefonnummer $NUMMER"
DETAILS="Kein Eintrag $2"
fi;
fi;
if [ "$NAME" == "" ]; then
NAME="Telefonnummer $NUMMER"
DETAILS="Fehler $2"
else
echo -e "$NUMMER\t$NAME\t$DETAILS" >> $CACHE
fi;
fi
fi
#echo -e -n "mesg TEL:$NAME \nquit\n" | telnet vdr.gehrig.lan 2001
#echo -e -n "mesg $DETAILS \nquit\n" | telnet vdr.gehrig.lan 2001
#echo -e "/bin/callcheckasterisk.sh \"$NAME\" \"TelNr $NUMMER\"" > /tmp/vdrmessage.txt /usr/bin/at now -f /tmp/vdrmessage.txt
echo -e "`date +%e.%m\ %H:%M ` $NAME " >>$LOG
echo 'SET VARIABLE LONGNAME '"\"$NAME\"" >/dev/stdout
read in
exit 0
exten => 436...,1,Set(Language()=de)
exten => 436...,2,AGI,reverse.agi | ${CALLERIDNUM}
exten => 436...,3,Set(CALLERID(name)=${LONGNAME})
exten => 436...,4,Set(CALLERID(number)=${CALLERIDNUM})
exten => 436...,5,Dial(SIP/200&IAX2/100) ; auf Nokia E 60 und PC
-- Accepting voice call from '6233.....' to '436.....' on channel 0/1, span 1
-- Executing Set("Zap/1-1", "Language()=de") in new stack
Oct 28 11:37:22 ERROR[14725]: pbx.c:1418 ast_func_write: Function Language not registered
-- Executing AGI("Zap/1-1", "reverse.agi | 6233.....") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/reverse.agi
-- AGI Script reverse.agi completed, returning 0
-- Executing Set("Zap/1-1", "CALLERID(name)=") in new stack
-- Executing Set("Zap/1-1", "CALLERID(number)=6233.....") in new stack
-- Executing Dial("Zap/1-1", "SIP/200&IAX2/100") in new stack
-- Called 200
-- Called 100
-- Call accepted by 192.168.0.106 (format ulaw)
-- Format for call is ulaw
-- IAX2/100-2 is ringing
-- SIP/200-0817db88 is ringing
-- Channel 0/1, span 1 got hangup, cause 16
-- Hungup 'IAX2/100-2'
== Spawn extension (isdn, 436..., 5) exited non-zero on 'Zap/1-1'
-- Hungup 'Zap/1-1'
maryland*CLI>
-- AGI Script agi-test.agi completed, returning 0
-- Executing AGI("SIP/217.10.67.5-081c2ce8", "reverse.agi|0822xxxx") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/reverse.agi
: No such file or directory
-- AGI Script reverse.agi completed, returning 0
-- Executing SetCIDName("SIP/217.10.67.5-081c2ce8", "") in new stack
#!/bin/sh
#
echo "Hallo"
echo $1
exit 0
Danke Dir,e18 schrieb:chown asterisk:asterisk reverse.agi
/usr/local/bin/sendmessage.pl [email protected] "$NUMMER $NAME $DETAILS" &