Shaun Dwyer
2005-Mar-30 23:51 UTC
[Asterisk-Users] Asterisk::AGI script calling macro with arguments - has to be a simpler way...
Hi All, I'm hoping that some one has come across this one before or knows of a better solution for this problem... I've (partially) written a perl AGI script with Asterisk::AGI. I need to be able to execute a macro within the dialplan and pass it a single option (the external phone number to dial). I can't seem to get the argument passed thru though. I want to be able to do something along the lines of: $return = $AGI->exec('Macro(outdial,' . @num[1] . ')'); where @num[1] is the variable containing the phone number to dial. I must use the macro 'outdial' as it does alsorts of funky stuff like failover between different phone providers. the outdial macro expects a single argument (the phone number to dial). I've also tried: $return = $AGI->exec('Macro', outdial, @num[1]); $return = $AGI->exec('Macro', 'outdial, @num[1]'); $return = $AGI->exec('Macro', outdial,@num[1]); my $odparam = "outdial," . @num[1]; $return = $AGI->exec('Macro' , $odparam); but nothing seems to work. My current workaround for this is to: in the AGI script: my $odparam = "Local/" . @num[1] . "\@agidial" ; $return = $AGI->exec('Dial' , $odparam); Where in my extensions.conf I have: [agidial] exten => _X.,1,Macro(outdial,${EXTEN}) This dodgy workaround seems to work OK, but its rather messy and I think that there should be a better way of doing it :) Any thoughts? Cheers, -Shaun