I am trying to make a call to asterisk server from my AGI. My AGI is basically a java code which uses Asterisk-java.jar library for communication with asterisk server. I opened up the connection with asterisk server and ran some commands on it and I got right response from the server. Now , when I try to make the call to the asterisk server, using the following code
OriginateAction act = new OriginateAction();
act.setChannel ("IAX2/3002");
act.setContext ("default");
act.setExten ("3002");
act.setPriority (new Integer(1));
act.setAsync (true);
act.setTimeout(3000l);
return mc.sendAction(act);
I got following on my serverCLI :
== Manager 'salman' logged on from 127.0.0.1
[Sep 12 19:39:14] NOTICE[12093]: channel.c:5619 __ast_request_and_dial: Unable to request channel IAX2/3002
== Manager 'salman' logged off from 127.0.0.1
Why is it saying "Unable to request channel IAX2/3002"? I have configured my manager.conf, I have a dialplan in my extensions.conf and I have created a user on iax.conf. Please help!
my manager.conf file:
[general]
enabled = yes
;webenabled = yes
port = 5038
bindaddr = 0.0.0.0
[salman]
secret=salman
permit=0.0.0.0/0.0.0.0
read=all
write=all
my extension.conf file :
[general]
static=yes
writeprotect=yes
clearglobalvars=no
autofallthrough=yes
priorityjumping=no
[default]
exten => 3001,1,Answer()
exten => 3001,2,Playback(/home/salman/Test_sound_file/main_menu)
exten => 3001,3,Hangup()
And my Iax.conf file:
[general]
bandwidth=medium
disallow=all
allow=alaw
trunkmaxsize=128000
trunkmtu=1240
iaxthreadcount=100
iaxmaxthreadcount=512
autokill=yes
trunkfreq=20
srvlookup=no
codecpriority=host
[3002]
type=friend
context=default
secret=3002
callerid=3002
requirecalltoken=no
host=dynamic
nat=yes
canreinvite=no
mailbox=1000@default
the above error shows that you have no registered user, It doesn’t only mean that you did not register it in iax.conf, Use twinkle or any other soft phone and register it with account 3002 and then execute you will get a call to the soft phone. The context in iax.conf should be [default] not [3002]