[Asterisk-Users] cmd curl crashes asterisk:
Tim Connolly
tim at timsnet.com
Sat May 28 15:19:09 MST 2005
I recently began using the curl cmd to do an external callerid
lookup on my own customer database. I've noticed certain lookups will cause
a crash and not show anything in the messages file or the console. The curl
command is connecting to an external webserver which has a oracle db
connection. The file its hitting is PHP and does a very simply lookup
showing the text like "C1234 Bobs mowing service" which I later cut off at
15 characters to squeeze it in setcidname(). Here is an example crash.
-- Goto (macro-getcustid,s,3)
-- Executing NoOp("Zap/2-1", "Call from using .") in new stack
-- Executing Curl("Zap/2-1",
"http://old-inside.theplanet.com/xmlservices/cnum_lookup.html?cid=") in new
stack
pbx01*CLI>
Disconnected from Asterisk server
[macro-getcustid]; ${DEFAULT} is my own number..i.e. no cid was given...
exten => s,1,setvar(CURL=)
exten => s,2,gotoif($["${CALLERIDNUM}" = "${DEFAULT}"]?9:3)
exten => s,3,noop(Call from ${CALLERIDNAME} using ${CALLERIDNUM}.)
exten =>
s,4,curl('http://mywebserver-name/xmlservices/cnum_lookup.html\?cid=${CALLER
IDNUM}')
exten => s,5,setvar(CURL=${CURL:0:15})
exten => s,6,noop(Setting callerid ${CALLERIDNUM} to ${CURL})
exten => s,7,setcidname(${CURL})
exten => s,8,goto(s,10)
exten => s,9,noop(Skipping because CID = ${CALLERIDNUM})
exten => s,10,noop
I can easily avoid these crashes (I hope) by not executing the curl
command if the ${CALLERID} variable is less than 10 characters, but I
thought I would point out that CURL should not be crashing the whole system
because a URL was disliked.
Asterisk CVS-HEAD-04/14/05-15:57:59
More information about the asterisk-users
mailing list