Script terminates with a busy signal

Hi!!
i’m new user of this forum!
I’m trying to execute a php script when i call a specific number.
my problem is that the call terminate with busy signal.
I don’t want the call is answered.
this is my dial plan:

custom-test
exten => s,n,AGI(/var/lib/asterisk/agi-bin/script_test.php)
exten => s,n,Hangup

script_test.php:

"#!/usr/bin/php -q

<? require '/var/lib/asterisk/agi-bin/phpagi.php'; $agi = new AGI(); $var=fopen("/var/lib/asterisk/agi-bin/documento.txt","a+"); fwrite($var, 'numero chiamante: '.$nocaller.' ; '); fwrite($var, 'numero chiamato: '.$nocalled.' ; '); ?>"

can someone help me?
Thanks!!

Please explain what you are trying to do and why.

When you call Hangup, or the dialplan ends, the call WILL be rejected.

If it is being rejected earlier, you need to provide verbose CLI, with AGI debugging.

At the moment, it looks to me as though calling System() could do the same job, with less complexity.

thanks for the reply.
my goal is to run a script when I receive a call on a particular number.
I have to make a statistical and store each call data such as caller ID, date, time etc
the call should not be answered and must end with a call ended, not with busy signal as it is now.

this is my debug:

== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
== Using SIP VRTP TOS bits 136
== Using SIP VRTP CoS mark 6
– Executing [39071XXXXXX@from-trunk:1] NoOp(“SIP/Principale_out-0000001d”, “Catch-All DID Match - Found 39071XXXXXX - You probably want a DID for this.”) in new stack
– Executing [39071XXXXXX@from-trunk:2] Goto(“SIP/Principale_out-0000001d”, “ext-did,s,1”) in new stack
– Goto (ext-did,s,1)
– Executing [s@ext-did:1] Set(“SIP/Principale_out-0000001d”, “__FROM_DID=s”) in new stack
– Executing [s@ext-did:2] Gosub(“SIP/Principale_out-0000001d”, “app-blacklist-check,s,1”) in new stack
– Executing [s@app-blacklist-check:1] GotoIf(“SIP/Principale_out-0000001d”, “0?blacklisted”) in new stack
– Executing [s@app-blacklist-check:2] Return(“SIP/Principale_out-0000001d”, “”) in new stack
– Executing [s@ext-did:3] ExecIf(“SIP/Principale_out-0000001d”, “0 ?Set(CALLERID(name)=34xxxxxx)”) in new stack
– Executing [s@ext-did:4] Set(“SIP/Principale_out-0000001d”, “__CALLINGPRES_SV=allowed_not_screened”) in new stack
– Executing [s@ext-did:5] Set(“SIP/Principale_out-0000001d”, “CALLERPRES()=allowed_not_screened”) in new stack
– Executing [s@ext-did:6] Goto(“SIP/Principale_out-0000001d”, “custom-test,s,1”) in new stack
– Goto (custom-test,s,1)
– Executing [s@custom-test:1] Progress(“SIP/Principale_out-0000001d”, “”) in new stack
– Executing [s@custom-test:2] AGI(“SIP/Principale_out-0000001d”, “/var/lib/asterisk/agi-bin/script_test.php”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/script_test.php
– <SIP/Principale_out-0000001d>AGI Script /var/lib/asterisk/agi-bin/script_test.php completed, returning 0
– Auto fallthrough, channel ‘SIP/Principale_out-0000001d’ status is ‘UNKNOWN’

Not possible. You have to answer the call before you can end it. If you don’t answer, you can only reject, although you can do so as, for example, number unobtainable, rather than busy.

there is no way to run the script without answering the call?
thanks

You don’t have to answer the call, but you can’t end it without answering. I suppose you could end the script with a very long wait and hope the caller gives up first, but that is a bit anti-social.

Incidentally, if a lot of your calls are not answered, the SIP service provider might consider it non-fair usage.

Also note that some networks use busy tone when calls are cleared normally.