[asterisk-users] asterisk manager and perl

cfh llcfhllml at gmail.com
Mon Nov 19 16:48:07 CST 2007


Hi,

I m trying to use perl script to generate call with a server asterik .
If I use telnet session to generate like this :

$telnet localhost 5038

Action: Login
Username: useroperator
Secret: password

Action: Originate
Context: context
Channel: Local/0123456789 at context
Exten: 221
Priority: 1

it works good :)


instead with a script perl like this :
....
use Net::Telnet ();
....
  $tn->print("Action: Login\nUsername:$USERNAME\n Secret:$SECRET\n\n");
  $tn->waitfor('/Authentication accept*/')

  $tn->print("Action: Originate\n");
  $tn->print("Context: context\n");
  $tn->print("Channel: Local/0123456789\@context \n");
  $tn->print("Exten: 221\n");
  $tn->print("Priority: 1 \n\n");
....

i get this error from asterisk cli :
chan_local.c:498 local_alloc: No such extension/context
0123456789 at context  creating local channel
channel.c:2491 __ast_request_and_dial: Unable to request channel
Local/0123456789 at context
and the call doesnt start.

What can i do to resolve this problem?

Thanks




More information about the asterisk-users mailing list