asterisk dialplan: sending sms before dial

exten => 579,1,Set(foo=${CURL(https://localhost/sendsms.php?msg=SALES-CALL:%20NUM=%20${CALLERID(num)}%20.%20NAME=%20${CALLERID(name)})})
exten => 579,2,Dial(Local/580@from-internal)

issue: replace space in callerid(name) with “-“

interesting part: caller name and caller number is dynamic for extension 581