Utils.c:1164 ast_carefulwrite: write() returned error: Conne

== Using SIP RTP CoS mark 5

-- Executing [00011441904891101@ctx-incoming:1] AGI("SIP/xx.xxx.xxx.xx-00002358", "AGI://localhost/AppSIP.agi") in new stack

AGI Tx >> agi_network: yes
[Oct 6 08:58:13] ERROR[4651]: utils.c:1164 ast_carefulwrite: write() returned error: Connection refused

[Oct 6 08:58:13] WARNING[4651]: res_agi.c:1510 launch_netscript: Connect to ‘AGI://localhost/AppSIP.agi’ failed: Connection refused
– Auto fallthrough, channel ‘SIP/xx.xxx.xxx.xx-00002358’ status is ‘UNKNOWN’
[Oct 6 08:58:45] WARNING[18480]: chan_sip.c:3629 retrans_pkt: Retransmission timeout reached on transmission b89d2163c4f921cf0a5d55938a1e9024 for seqno 1 (Critical Response) – See wiki.asterisk.org/wiki/display/ … nsmissions
Packet timed out after 31999ms with no response

Can any body help me resolve this error?

Which error? There are two errors. The first indicates that your AGI server isn’t running, or is being blocked by a firewall, or a NAT problem.

The second problem can be caused by broken SIP implementations, but is most likely due to firewall or broken NAT configurations.

Hi Thanks for your response.

I started agi server but still there is some problem.

Here is the log

getcpr-nowCLI> agi set debug on
AGI Debugging Enabled
== Using SIP RTP CoS mark 5
– Executing [1011441904891101@ctx-incoming:1] AGI("SIP/.
..-0000237a", “AGI://localhost/AppSIP.agi”) in new stack
AGI Tx >> agi_network: yes
AGI Tx >> agi_network_script: AppSIP.agi
<SIP/
.*..-0000237a>AGI Tx >> agi_request: AGI://localhost/AppSIP.agi
<SIP/
.**..-0000237a>AGI Tx >> agi_channel: SIP/.**..-0000237a
<SIP/
.**..-0000237a>AGI Tx >> agi_language: en
<SIP/
.**..-0000237a>AGI Tx >> agi_type: SIP
<SIP/
.**..-0000237a>AGI Tx >> agi_uniqueid: 1412606358.9083
<SIP/
.**..-0000237a>AGI Tx >> agi_version: 1.8.8.1
<SIP/
.**..-0000237a>AGI Tx >> agi_callerid: 200
<SIP/
.**..-0000237a>AGI Tx >> agi_calleridname: 200
<SIP/
.**..-0000237a>AGI Tx >> agi_callingpres: 0
<SIP/
.**..-0000237a>AGI Tx >> agi_callingani2: 0
<SIP/
.**..-0000237a>AGI Tx >> agi_callington: 0
<SIP/
.**..-0000237a>AGI Tx >> agi_callingtns: 0
<SIP/
.**..-0000237a>AGI Tx >> agi_dnid: 1011441904891101
<SIP/
.**..-0000237a>AGI Tx >> agi_rdnis: unknown
<SIP/
.**..-0000237a>AGI Tx >> agi_context: ctx-incoming
<SIP/
.**..-0000237a>AGI Tx >> agi_extension: 1011441904891101
<SIP/
.**..-0000237a>AGI Tx >> agi_priority: 1
<SIP/
.**..-0000237a>AGI Tx >> agi_enhanced: 0.0
<SIP/
.**..-0000237a>AGI Tx >> agi_accountcode:
<SIP/
.**..-0000237a>AGI Tx >> agi_threadid: 1115089216
<SIP/
.**..-0000237a>AGI Tx >>
[b]<SIP/
.**..-0000237a>AGI Rx << SET VARIABLE “AJ_AGISTATUS” “NOT_FOUND”[/b]
<SIP/
.**..-0000237a>AGI Tx >> 200 result=1
<[b]SIP/
.**..-0000237a>AGI Rx << VERBOSE “No script configured for URL ‘AGI://localhost/AppSIP.agi’ (script ‘AppSIP.agi’)” 1
AGI://localhost/AppSIP.agi: No script configured for URL ‘AGI://localhost/AppSIP.agi’ (script ‘AppSIP.agi’)[/b]
<SIP/
.**..-0000237a>AGI Tx >> 200 result=1
– <SIP/
.**..-0000237a>AGI Script AGI://localhost/AppSIP.agi completed, returning 0
– Auto fallthrough, channel 'SIP/
.***.*.-0000237a’ status is ‘UNKNOWN’

Can you please tell me what should i do now?

Thanks

I can’t find any documentation that allows a script name to be used with FastAGI. Did you mean to use FastAGI?

Hi,

Java is used to write dial plan and to manage calls. There is source file called AppSIP.java and converted to AppSIP.class after compilation.

Now there is fastagi-mapping.properties file which has below lines…
AppSIP.agi = com.xxxx.xxx.AppSIP

Now, can you have some idea from given information?

Let me know if you still need anything.

Don’t know about the Java side, but put the script in the standard AGI script directory and do not use an AGI: URL. Remove any code that supports the use of TCP access to the script.

Hi,

Here are the 2 logs.

Oct 6, 2014 11:33:10 AM org.asteriskjava.fastagi.DefaultAgiServer startup
INFO: Listening on *:4573.
Oct 6, 2014 11:33:48 AM org.asteriskjava.fastagi.DefaultAgiServer startup
INFO: Received connection from /127.0.0.1
Oct 6, 2014 11:33:48 AM org.asteriskjava.fastagi.AbstractAgiServer getPool
INFO: Thread pool started.
Oct 6, 2014 11:33:48 AM org.asteriskjava.fastagi.ResourceBundleMappingStrategy loadResourceBundle
INFO: Added mapping for ‘AppSIP.agi’ to class com.xxx.xxx.AppSIP
Oct 6, 2014 11:33:48 AM org.asteriskjava.fastagi.ResourceBundleMappingStrategy loadResourceBundle
Oct 6, 2014 11:33:48 AM org.asteriskjava.fastagi.internal.AgiConnectionHandler runScript
INFO: Begin AgiScript com.xxx.xxx.AppSIP on Asterisk-Java DaemonPool-1-thread-1
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.xxx.xxx.DBConnection.openConnection(DBConnection.java:12)
at com.xxx.xxx.AppSIP.execute(AppSIP.java:40)
at com.xxx.xxx.AppSIP.service(AppSIP.java:29)
at org.asteriskjava.fastagi.internal.AgiConnectionHandler.runScript(AgiConnectionHandler.java:144)
at org.asteriskjava.fastagi.internal.AgiConnectionHandler.run(AgiConnectionHandler.java:116)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
java.lang.NullPointerException
at com.xxx.xxx.AppSIP.execute(AppSIP.java:56)
at com.xxx.xxx.AppSIP.service(AppSIP.java:29)
at org.asteriskjava.fastagi.internal.AgiConnectionHandler.runScript(AgiConnectionHandler.java:144)
at org.asteriskjava.fastagi.internal.AgiConnectionHandler.run(AgiConnectionHandler.java:116)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
java.lang.NullPointerException
at com.xxx.xxx.AppSIP.execute(AppSIP.java:183)
at com.xxx.xxx.AppSIP.service(AppSIP.java:29)
at org.asteriskjava.fastagi.internal.AgiConnectionHandler.runScript(AgiConnectionHandler.java:144)
at org.asteriskjava.fastagi.internal.AgiConnectionHandler.run(AgiConnectionHandler.java:116)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Oct 6, 2014 11:33:48 AM org.asteriskjava.fastagi.internal.AgiConnectionHandler runScript
INFO: End AgiScript com.xxx.xxx.AppSIP on Asterisk-Java DaemonPool-1-thread-1

Previously there was mysqlconnector.jar file which i moved to directly agi-bin dir.

2.

== Using SIP RTP CoS mark 5
– Executing [011972597637295@ctx-incoming:1] AGI(“SIP/xx.xx.xx.xx-00002391”, “AGI://localhost/AppSIP.agi”) in new stack


<SIP/xx.xx.xx.xx-00002391>AGI Rx << SET VARIABLE “AJ_AGISTATUS” “SUCCESS”
<SIP/xx.xx.xx.xx-00002391>AGI Tx >> 200 result=1
– <SIP/xx.xx.xx.xx-00002391>AGI Script AGI://localhost/AppSIP.agi completed, returning 0
– Auto fallthrough, channel ‘SIP/xx.xx.xx.xx-00002391’ status is ‘UNKNOWN’

Here you can see SUCCESS instead of UNKNOWN before.

Now i think once i fix java.lang.ClassNotFoundException: com.mysql.jdbc.Driver this then all things will be fine.

Can you please tell me now how can i resolve this error?

Thanks

Thanks

I have only written AGI in Perl or PHP.