AGI script - voicemail

Hello everyone

I am new to these forums, so i hope i’m posting this in the right place, excuse me if not.

I have an asterisk server running, and an AGI script who is supposed to check in a database if a client is absent or present. If he is present, his telephone line gets activated, and people can call him on his cell phone.

If he is absent, when people try to call his phone, they should directly go to the voicemail. But this is the part that is not working : I can’t manage to force users on the voicemail, it either hangs up immediatly, or calls the number anyways.

Here is the concerned portion of my script (it’s in python)

[code]if (presence.count(‘present’)):
sys.stdout.write(“answer \n”)

else :

I have tried replacing the ${EXTEN} with an extension number, but the results are the same.

Thank you all for your time, and I will gladly accept any piece of advice.


why AGI? use normal dial plan:

exten => s,1,Dial(dahdi/1)
exten => s,102,Voicemail(b100)

Well I’m using AGI because I need asterisk to check in an external database, to see if the client is present or absent.

That should be possible from the dialplan. Or the AGI could just do the database access and set a variable.

That sounds good, thank you

Do you perhaps know of a guide/tutorial to achieve such a task ? I am new to the Asterisk world, this is a school project, I still have a lot to learn. … 87624.html

Thank you very much !