[Asterisk-Users] Mini Call-ID Winpopup

Adam Goryachev mailinglists at websitemanagers.com.au
Wed Nov 17 20:09:26 MST 2004


On Thu, 2004-11-18 at 13:51, Thomas Hutton wrote:
> Hey, thanks to everybody who posted to my earlier thread.  Here's a
> solution I came up with based on reading your scripts and advice.
> 
> It's really simple and stupid- but seems to work great.  Incoming
> calls for any type of extension can be configured to make winpopups
> (or linpopups : ) on any local network machine show Caller ID info. 
> You need to write no scripts other than what's below.  I use a scratch
> file but somebody smarter than me could probably even figure out a way
> to do it without one.
> 
> Requirements- you need smbclient on your asterisk machine
> 
> Here's how to set up an entry in your extensions.conf
> 
> ; Extension 200 Call ID Popup Example
> exten => 200,1,NoOp(${CALLERID} ${DATETIME})
> exten => 200,2,System(/bin/echo "'Incoming Call From:
> ${CALLERID}'">>/etc/asterisk/callidmsg)
> exten => 200,3,System(/bin/echo 'Received:
> ${DATETIME}'>>/etc/asterisk/callidmsg)
> exten => 200,4,System(/usr/bin/smbclient -M target_netbios_name <
> /etc/asterisk/callidmsg)
> exten => 200,5,System(rm -f /etc/asterisk/callidmsg)
> exten => 200,6,Dial,sip/tom|30|t 
> exten => 200,7,Congestion
> 
> Note that I used both the " and the ' marks in one of the echo
> commands as the NAME part of $CALLERID contains " (double quotation
> marks), and messes up the echo.  

You might consider this a potential security issue if someone manages to
inject nasty characters into the callerid...
Perhaps someone else can suggest something less likely to cause
problems??

Also, you can use something like (untested code):
exten => 200,2,System(/bin/echo -e 'Incoming Call From: ${CALLERID}'\n
Received: ${DATETIME}\n > /tmp/asterisk/${UNIQUEID}
exten => 200,3,System(/usr/bin/smbclient -M target_netbios_name <
/tmp/asterisk/${UNIQUEID})

(I wouldn't bother with the rm command, it just 'looks' dangerous, since
the echo command will start with an empty file every time, it isn't
really needed).

People might also like to use a DB variable to retrieve the
"target_netbios_name" ....

> You can set this up per extension, of course, naming the file
> differently per extension to avoid any problems... also it might be
> smart to use a different working directory.  Just don't name your
> scratch file something really dumb like extensions.conf.

Better would be to name the file from ${UNIQUEID} which, as it suggests,
is definitely unique. Lots of people might also immediately think to use
/tmp/${UNIQUEID} but I would suggest against that! However, if you
create /tmp/asterisk and have the directory permissions owner/group to
asterisk user/group, and 0700 then you should use
/tmp/asterisk/${CALLERID} or something.

Hopefully this can be improved upon somewhat, and then posted to the
wiki, as a very useful dialplan snippet...

Regards,
Adam




More information about the asterisk-users mailing list