Reuqest to fastAGI script rejected with extension not found

I am tryig to use asterisk to connect between Sip client and fastAGI server. I am able to make calls between two sip clients regsitered to Asterisk.

as for fastagi, as per docs I understood that all I need is to add fastaGI extension to asterisk is a line in extensions.conf as follows
exten => myAgi, 1, Agi(agi://domain) and realod the dialplan.

so added the above exten in [default] section of extensions.conf and relaoded dialplan. when I make calls from my sip client to “myAgi” , asterisk rejects the call with extension not found.

I even tried the fastagi-test script available in usr/src/asterisk/agi, but even it did not work.

Can some body please help what I am missing here?

Thanks
Venkat

Post some console output with verbosity cranked up and include the relevant bits of your dialplan. I’m sure it’s something simple.

Thanks for quick response. Here are the logs from Asterisk server as well fastagi-test (comes with asterisk distribution) I am using .

Sip Client is "venkat"
fastAGI extention is “335”, SIPDART is the domain for the Asterisk and fasagi-test

I appriciate you help
Thanks
Venkat

Asterisk Logs

sipdart*CLI> sip show peers
Name/username Host Dyn Nat ACL Port Status
vkunpuli (Unspecified) D 5060 Unmonitored
venkat 10.1.2.204 D 5060 Unmonitored
2 sip peers [Monitored: 0 online, 0 offline Unmonitored: 2 online, 0 offline]

sipdartCLI> dialplan show
[ Context ‘ael-dundi-e164-canonical’ created by ‘pbx_ael’ ]
sipdart
CLI>
[ Context ‘ael-dundi-e164-customers’ created by ‘pbx_ael’ ]
sipdartCLI>
[ Context ‘ael-dundi-e164-via-pstn’ created by ‘pbx_ael’ ]
sipdart
CLI>
[ Context ‘ael-dundi-e164-local’ created by ‘pbx_ael’ ]
Include => ‘ael-dundi-e164-canonical’ [pbx_ael]
Include => ‘ael-dundi-e164-customers’ [pbx_ael]
Include => ‘ael-dundi-e164-via-pstn’ [pbx_ael]
sipdartCLI>
[ Context ‘ael-dundi-e164-switch’ created by ‘pbx_ael’ ]
Alt. Switch => ‘DUNDi/e164’ [pbx_ael]
sipdart
CLI>
[ Context ‘ael-dundi-e164-lookup’ created by ‘pbx_ael’ ]
Include => ‘ael-dundi-e164-local’ [pbx_ael]
Include => ‘ael-dundi-e164-switch’ [pbx_ael]
sipdartCLI>
[ Context ‘ael-dundi-e164’ created by ‘pbx_ael’ ]
‘s’ => 1. Set(LOCAL(exten)=${ARG1}) [pbx_ael]
2. Goto(${exten},1) [pbx_ael]
3. Return() [pbx_ael]
sipdart
CLI>
[ Context ‘ael-iaxtel700’ created by ‘pbx_ael’ ]
’_91700XXXXXXX’ => 1. Dial(IAX2/${IAXINFO}@iaxtel.com/${EXTEN:1}@iaxtel) [pbx_ael]
sipdartCLI>
[ Context ‘ael-iaxprovider’ created by ‘pbx_ael’ ]
sipdart
CLI>
[ Context ‘ael-trunkint’ created by ‘pbx_ael’ ]
’_9011.’ => 1. Gosub(ael-dundi-e164,s,1(${EXTEN:4})) [pbx_ael]
2. Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) [pbx_ael]
Include => ‘ael-dundi-e164-lookup’ [pbx_ael]
sipdartCLI>
[ Context ‘ael-trunkld’ created by ‘pbx_ael’ ]
’_91NXXNXXXXXX’ => 1. Gosub(ael-dundi-e164,s,1(${EXTEN:1})) [pbx_ael]
2. Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) [pbx_ael]
Include => ‘ael-dundi-e164-lookup’ [pbx_ael]
sipdart
CLI>
[ Context ‘ael-trunklocal’ created by ‘pbx_ael’ ]
’_9NXXXXXX’ => 1. Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) [pbx_ael]
sipdartCLI>
[ Context ‘ael-trunktollfree’ created by ‘pbx_ael’ ]
’_91800NXXXXXX’ => 1. Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) [pbx_ael]
’_91866NXXXXXX’ => 1. Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) [pbx_ael]
’_91877NXXXXXX’ => 1. Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) [pbx_ael]
’_91888NXXXXXX’ => 1. Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) [pbx_ael]
sipdart
CLI>
[ Context ‘ael-international’ created by ‘pbx_ael’ ]
Include => ‘ael-longdistance’ [pbx_ael]
Include => ‘ael-trunkint’ [pbx_ael]
Ignore pattern => ‘9’ [pbx_ael]
sipdartCLI>
[ Context ‘ael-longdistance’ created by ‘pbx_ael’ ]
Include => ‘ael-local’ [pbx_ael]
Include => ‘ael-trunkld’ [pbx_ael]
Ignore pattern => ‘9’ [pbx_ael]
sipdart
CLI>
[ Context ‘ael-local’ created by ‘pbx_ael’ ]
Include => ‘ael-default’ [pbx_ael]
Include => ‘ael-trunklocal’ [pbx_ael]
Include => ‘ael-iaxtel700’ [pbx_ael]
Include => ‘ael-trunktollfree’ [pbx_ael]
Include => ‘ael-iaxprovider’ [pbx_ael]
Ignore pattern => ‘9’ [pbx_ael]
sipdart*CLI>
[ Context ‘ael-std-exten-ael’ created by ‘pbx_ael’ ]
‘a’ => 1. VoiceMailMain(${ext}) [pbx_ael]
2. Return() [pbx_ael]
‘s’ => 1. Set(LOCAL(ext)=${ARG1}) [pbx_ael]
2. Set(LOCAL(dev)=${ARG2}) [pbx_ael]
3. Set(EXTEN=${EXTEN}) [pbx_ael]
4. Dial(${dev}/${ext},20) [pbx_ael]
5. Goto(sw-1-${DIALSTATUS},10) [pbx_ael]
6. NoOp(Finish switch-ael-std-exten-ael-1) [pbx_ael]
7. Return() [pbx_ael]
‘sw-1-’ => 10. Goto(sw-1-.,10) [pbx_ael]
‘sw-1-BUSY’ => 10. Voicemail(${ext},b) [pbx_ael]
11. Goto(s,6) [pbx_ael]
’_sw-1-.’ => 10. Voicemail(${ext},u) [pbx_ael]
11. Goto(s,6) [pbx_ael]

[ Context ‘ael-demo’ created by ‘pbx_ael’ ]
’#’ => 1. Playback(demo-thanks) [pbx_ael]
2. Hangup() [pbx_ael]
‘1000’ => 1. Goto(ael-default,s,1) [pbx_ael]
‘2’ => 1. Background(demo-moreinfo) [pbx_ael]
2. Goto(s,instructions) [pbx_ael]
‘3’ => 1. Set(LANGUAGE()=fr) [pbx_ael]
2. Goto(s,restart) [pbx_ael]
‘500’ => 1. Playback(demo-abouttotry) [pbx_ael]
2. Dial(IAX2/guest@misery.digium.com/s@default) [pbx_ael]
3. Playback(demo-nogo) [pbx_ael]
4. Goto(s,instructions) [pbx_ael]
‘600’ => 1. Playback(demo-echotest) [pbx_ael]
2. Echo() [pbx_ael]
3. Playback(demo-echodone) [pbx_ael]
4. Goto(s,instructions) [pbx_ael]
‘8500’ => 1. VoicemailMain() [pbx_ael]
2. Goto(s,instructions) [pbx_ael]
‘i’ => 1. Playback(invalid) [pbx_ael]
‘s’ => 1. Wait(1) [pbx_ael]
2. Answer() [pbx_ael]
3. Set(TIMEOUT(digit)=5) [pbx_ael]
4. Set(TIMEOUT(response)=10) [pbx_ael]
[restart] 5. Background(demo-congrats) [pbx_ael]
[instructions] 6. Set(x=$[0]) [pbx_ael]
7. GotoIf($[ ${x} < 3]?8:12) [pbx_ael]
8. Background(demo-instruct) [pbx_ael]
9. WaitExten() [pbx_ael]
10. Set(x=$[${x} + 1]) [pbx_ael]
11. Goto(7) [pbx_ael]
12. NoOp(Finish for-ael-demo-3) [pbx_ael]
‘t’ => 1. Goto(#,1) [pbx_ael]
’_1234’ => 1. Gosub(ael-std-exten-ael,s,1(${EXTEN}, “IAX2”)) [pbx_ael]

[ Context ‘ael-default’ created by ‘pbx_ael’ ]
Include => ‘ael-demo’ [pbx_ael]

[ Context ‘app_queue_gosub_virtual_context’ created by ‘app_queue’ ]
‘s’ => 1. KeepAlive() [app_queue]

[ Context ‘app_dial_gosub_virtual_context’ created by ‘app_dial’ ]
‘s’ => 1. KeepAlive() [app_dial]

[ Context ‘parkedcalls’ created by ‘features’ ]
‘700’ => 1. Park() [features]

[ Context ‘app_stack_gosub_virtual_context’ created by ‘app_stack’ ]
‘s’ => 1. KeepAlive() [app_stack]

[ Context ‘phones’ created by ‘pbx_config’ ]
Include => ‘internal’ [pbx_config]

[ Context ‘internal’ created by ‘pbx_config’ ]
‘venkat’ => 1. Verbose(1|Extension venkat) [pbx_config]
2. Dial(SIP/venkat,30) [pbx_config]
3. Hangup() [pbx_config]
‘vkunpuli’ => 1. Verbose(1|Extension venkat) [pbx_config]
2. Dial(SIP/venkat,30) [pbx_config]
3. Hangup() [pbx_config]

[ Context ‘incoming calls’ created by ‘pbx_config’ ]

[ Context ‘default’ created by ‘pbx_config’ ]
‘335’ => 1. AGI(agi://sipdart) [pbx_config]
‘venkat’ => 1. Verbose(1|Unrouted call handler) [pbx_config]
2. Annwer() [pbx_config]
3. Wait(1) [pbx_config]
4. Playback(tt-veasels) [pbx_config]
5. Hangup() [pbx_config]
‘vkunpuli’ => 1. Verbose(1|Unrouted call handler) [pbx_config]
2. Annwer() [pbx_config]
3. Wait(1) [pbx_config]
4. Playback(tt-veasels) [pbx_config]
5. Hangup() [pbx_config]
‘vxml’ => 1. Agi(agi://10.1.2.207) [pbx_config]

[ Context ‘global’ created by ‘pbx_config’ ]

-= 35 extensions (81 priorities) in 28 contexts. =-
sipdartCLI>
== Using SIP RTP CoS mark 5
[Jan 7 14:02:58] NOTICE[22849]: chan_sip.c:17032 handle_request_invite: Call from ‘venkat’ to extension ‘335’ rejected because extension not found.
sipdart
CLI>

extensions.conf

[global]
[general]
autofallthrough=yes
[default]
exten => vxml,1,Agi(agi://10.1.2.207)
exten => 335,1,AGI(agi://sipdart)
exten => venkat,1,Verbose(1|Unrouted call handler)
exten => venkat,n,Annwer()
exten => venkat,n,Wait(1)
exten => venkat,n,Playback(tt-veasels)
exten => venkat,n,Hangup()
exten => vkunpuli,1,Verbose(1|Unrouted call handler)
exten => vkunpuli,n,Annwer()
exten => vkunpuli,n,Wait(1)
exten => vkunpuli,n,Playback(tt-veasels)
exten => vkunpuli,n,Hangup()
[incoming calls]
[internal]
exten => venkat,1,Verbose(1|Extension venkat)
exten => venkat,n,Dial(SIP/venkat,30)
exten => venkat,n,Hangup()
exten => vkunpuli,1,Verbose(1|Extension venkat)
exten => vkunpuli,n,Dial(SIP/venkat,30)
exten => vkunpuli,n,Hangup()
[phones]
include => internal

how about your sip.conf file… specifically for your venkat user.

i’m on my way out right now, so perhaps someone else can chime in… otherwise i’ll take a look in a few hours.

Thanks for having a look at it. Here is my sip.conf

[general]
[venkat]
type=friend
context=phones
host=dynamic
[vkunpuli]
type=friend
context=phones
host=dynamic

change context=phones to context=default and it should work as expected.

Thanks a lot it worked , looks like asterisk dialplan is the craziest thing in this world for me :smile: .

If want both calls to Agi script and other clients work , should I move the agi extension also to [internal] context?

Also I have the following other issue. I am still trying to figure out but if you have any suggestions , I will appreciate a lot
basically it is not able to find the fastagi-mapping, though I added it as fastagi-mapping.properties

Thanks
Venkat

INFO: Thread pool started.
Jan 8, 2009 11:43:59 AM org.asteriskjava.util.internal.JavaLoggingLog info
INFO: Listening on *:4573.
Jan 8, 2009 11:44:22 AM org.asteriskjava.util.internal.JavaLoggingLog info
INFO: Received connection from /10.1.2.4
Jan 8, 2009 11:44:22 AM org.asteriskjava.util.internal.JavaLoggingLog info
INFO: Resource bundle ‘fastagi-mapping’ not found.
Jan 8, 2009 11:44:22 AM org.asteriskjava.util.internal.JavaLoggingLog error
SEVERE: Unable to create AgiScript instance of type hello.agi: Class not found, make sure the class exists and is available on the CLASSPATH
Jan 8, 2009 11:44:22 AM org.asteriskjava.util.internal.JavaLoggingLog error
SEVERE: No script configured for URL ‘agi://10.1.2.207/hello.agi’ (script ‘hello.agi’)

Are you running this as a standalone .class file, or is it an executable JAR?

If it’s a .class file, make sure you have the .properties in the same directory as the class. If it’s a JAR, make sure you build the .properties into the root of the JAR tree.

Post up the contents of your fastagi-mapping so I can take a look.

The content of fastagi-mapping.properties is just one line
hello.agi = HelloAgiScript

I am using netbeans iDE to run, so I guess it uses the jar file it created.

Thanks
Venkat

if you are using netbeans, just create a file called fastagi-mapping.properties in the under the Source Packages.

Also, if you are using any standard class path naming for your Java classes, you will need to include the full path to the file. i.e.

hello.agi = com.somedomain.myproject.HelloAgiScript

Thanks, yup I forgot to give full path. it works now .

Thanks a lot for quick help.

Venkat

how does the streamFile function work.
I tried channel.streamFile(abcd.wav) does not work. I tried even cahnnel.streamFile(“welcome”) that did not work either. But channel.sayAlpha(“test”) works. What am I missing here

Thanks
Venkat

channel.streamFile() will play audio out of the default asterisk directory. You don’t need to include the file extension, just the filename.

On most installs the default audio dir is /var/lib/asterisk/sounds/

Make sure whatever file you are asking the system to play exists in that directory…

then is there a way I can play some real time finite streams on to that channel? otherwise I do not see much value to fastAGI interface usage.

Venkat

Please define real-time finite streams… are you talking about piping audio from something other than a file on the filesystem?

The channel.streamFile() is the equivalent of calling the Playback() application in the dial plan.

Yes, Say I want to do some web services/streaming services, user request for a song and I pick from web and post it to the user channel. Basically I want play some kind of audio file that captured from some where on the web onto the channel. I want to capture the user audio from channel at AGI server (java) parse and analyze it and based on that I want to play some audio back to the channel (not pre-recorded audio on the asterisk system).

channel.streamFile() is not going to be what you need for that functionality. Stream audio is possible with asterisk, but it takes a bit of work.

Do some google searches and you will find a bunch of methods for streaming audio from an online source.