Nedi,

I believe your issue is due to this line in your agi script:
/
echo 'SET VARIABLE LONGNAME '"\"$NAME\"" >/tmp/stdout/

In order for your script to communicate with Asterisk, you need to send the commands directly to stdout. But in your case, you are redirecting the output to a file called /tmp/stdout. Try changing it to this:

/echo 'SET VARIABLE LONGNAME '"\"$NAME\""/

and see if that works.

If you're still having problems, you can log the response you are getting (via the 'in' variable) to a file and see what Asterisk is responding with.

-James

On 11/16/2011 10:15 PM, Nedi wrote:
Hi,
can anyone help me with the script for caller name lookup through tel.search.ch <http://tel.search.ch> ? I found a script for trixbox and after some change to use it with write protected Astlinux I think I'm almost done about 90 % works the caller nummer is recognised and writen to the but the asterisk don’t tell me the Name of the caller I get only the Callerid nummer

the script use the snoopy.class.php <http://snoopy.sourceforge.net/> and I thing taht works I have only problem on the Asterisk side to show me the right Name in te CLI I see
 -- Called 15@15
-- Executing [15@15:1] Set("Local/15@15-6c26;2", "CHANNEL(language)=de") in new stack -- Executing [15@15:2] AGI("Local/15@15-6c26;2", "lookup.agi, 0796003185") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/lookup.agi
    -- <Local/15@15-6c26;2>AGI Script lookup.agi completed, returning 0
-- Executing [15@15:3] Set("Local/15@15-6c26;2", "CALLERID(name)=") in new stack -- Executing [15@15:4] Dial("Local/15@15-6c26;2", "SIP/15,10,r") in new stack

my lookup.agi

#!/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="/tmp/invsuche_cache"

#pfad um das tempfile anzulegen
TMPFILE="/tmp/tmpsuche.html"
TMPFILE2="/tmp/tmpclir"
LOG="/tmp/anrufliste_log"
echo "$1-$2-$3" >/tmp/reverse.tmp
if [ "$1" = " " ] || [ -z "$1" ]; then
echo "Keine Nummer"
#echo | tail -n 10 /var/log/syslog | grep "RING (" >>$TMPFILE2
#if [ "`tail -c 10 $TMPFILE2`" = "z audio) " ]; then
NAME="analoger Anrufer"
DETAILS="Keine details"
#fi
#if [ "`tail -c 10 $TMPFILE2`" = "(Speech) " ]; then
# NAME="aktiv unterdrueckt"
# DETAILS="ISDN anrufer ohne Nummer"
#fi
else
NUMMER=`echo $1 | sed -e "s/\ //g" -e "s/+41/0/"`
echo "Suche nach $NUMMER im cache"
NAME=`awk -F '---' '{ if ($1 == "'$NUMMER'") print $2 }' $CACHE`
if [ -z "$NAME" ]; then
wget -O $TMPFILE "http://allversal.ch/telsearch.php?tel=$NUMMER";
NAME=`cat $TMPFILE`
if [ ! -z "$NAME" ]; then
printf "$NUMMER---$NAME\n" >> $CACHE
fi
fi
if [ -z "$NAME" ]; then
NAME="$NUMMER"
fi
fi
###
### Here you can add "additional alert code"
###
# directly source an external scriptlet, for better separation with this publicly updated script
#. /usr/local/asterisk/reverse.agi_notifier_sh
printf "`date +%Y-%m-%d\ %H:%M` $NAME\t$NUMMER\n" >>$LOG
echo 'SET VARIABLE LONGNAME '"\"$NAME\"" >/tmp/stdout
read in
exit 0


in my extensions.conf I have:

exten =>15,1,Set(CHANNEL(language)=de)
exten =>15,n,AGI(lookup.agi, ${CALLERID(num)})
exten =>15,n,Set(CALLERID(name)=${LONGNAME})
exten =>15,n,Dial(SIP/15,10,r)
exten =>15,n,Answer
exten =>15,n,Playback(vm-nobodyavail)
exten =>15,n,Voicemail(15)
exten =>15,n,Hangup


after a call in my  /tmp  folder I have  5 files

1.) file  anrufliste_log  with

2011-11-17 03:56 Grgic Nedeljko0796003185

2.) file invsuche_cache with

0796003185---Grgic Nedeljko

3.) file reverse.tmp with

0796003185--

4.) file  stdout

SET VARIABLE LONGNAME "Grgic Nedeljko"

5.) file tmpsuche.html with

Grgic Nedeljko

Can anyone see what is there wrong ??

best regards
Nedi








------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d


_______________________________________________
Astlinux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/astlinux-users

Donations to support AstLinux are graciously accepted via PayPal to 
[email protected].

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Astlinux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/astlinux-users

Donations to support AstLinux are graciously accepted via PayPal to 
[email protected].

Reply via email to