Possibility to make agi call when ringing or even before?


#1

hi,

got another problem :confused:

i would like to call an agi script when a call is comming in, not when it
is ansered or hung up on.

background: when my phone is in one room, i am in another and
the doors are closed, then i can not hear the phone.
i have set up an agi script to display a message on my TV screen (digital vid)
when someone is calling.
the problem ist, that the agi script is being called after the person has
hung up or the call has been answered. that is too late tough :smiley: :smiley:

has anyone got an idea what i need to use, to make the script get called
as soon as the callerID is known ?

this is what i got:

[quote][the-rest]
exten => 12345,1,agi,incommingCalls.agi ;show a line on the vdr to show that someone is calling
exten => 12345,2,WaitExten(15)
exten => 12345,3,Answer()
exten => 12345,4,Playback(vm-MartinDefaultVoicemail)
exten => 12345,5,VoiceMail(s12345)
exten => 12345,6,Hangup()

(have swapped my num with 12345)[/quote]

this i would expect to call the script as soon as the call is signalled, then
wait for 15s and then let the voicemail take over. it does not though.

i have also tried other commands like ringing, but no go.
there must be a way, because if i use “asterisk -cvvvv”, then
a message about an incomming call is shown, before the phone rings.

anyone got an idea ?

ciao
Martin


#2

I would like to know how as well because I would like to do a screen pop on a PC. The CALLERID is defenitely known at that stage, so I cannot understand why it would not execute your script. Are you sure your script is marked as executable? Is it displaying it on the Asterisk console executing or is there an error maybe?

Let me know in any case if you find a solution please. I will do a bit of research too - it is on my list I will just move it up a bit :smile:

Gerhard


#3

hi Gerhard,

The CALLERID is defenitely known at that stage
yes.

comes up before the first ring.

Are you sure your script is marked as executable?
it is working already, only that the script gets called when the caller hangs
up. i would expect(would like) it to get called as soon as the call comes in,
so before the first ring.

Is it displaying it on the Asterisk console executing or is there an error maybe?
see above

it is on my list I will just move it up a bit
sounds good. are you one of the developers ? if so, can you also have
a look at the “ex-girlfriend logic” ? it aint working either.
if you need some special debugging with changes in the code, let me
know, i am also a developer.

ciao
Martin


#4

Make sure you have the latest version ( 1.0.9 ) of Asterisk. I guesss there was a logic error in 1.0.8 with the “ex-girlfriend logic”. It is supposed to be fixed in the newest version. This topic talks about it more.

forums.digium.com./viewtopic.php?t=808

Dan


#5

hi Dan,

i think you are answering the wrong thread.
the “ex-girlfriend logic” does not work in 1.0.9 either, as seen in the link.

here i am trying to get a script to get called BEFORE the phone rings and
NOT AFTER the call is hung up on.

ciao
Martin


#6

In your setup, the behaviour to the caller is like this?

  1. Asterisk picks up the phone immediately, even before the first ring
  2. <You expect a message on your TV, but there is none>
  3. The caller hears silence for 15 seconds
  4. The caller hears your voicemail

Wouldn’t it be nicer to keep the phone(s) ringing in the third step, instead of ‘playing’ silence to the caller?

This is how I would do it.

[the-rest]
exten => 12345,1,Ringing
exten => 12345,2,agi,incommingCalls.agi 
exten => 12345,3,Wait(15)
exten => 12345,4,Answer()
exten => 12345,5,Playback(vm-MartinDefaultVoicemail)
exten => 12345,6,VoiceMail(s12345)
exten => 12345,7,Hangup() 

I tested it with some other agi-script. The agi script is called when the phone is still ringing. (Asterisk 1.0.7)

Maybe you can test if this works for you as well?


#7

hi Samson,

In your setup, the behaviour to the caller is like this?
no.

asterisk does not pick up the phone, unless the wait of 15s is done.
after 15s it answers the line, plays the message and lets the user talk
to the voicemail.

!!!
!!! i found the problem!! !!!
!!!

it is not a logic problem in the extensions.conf, it seems like a problem
in the hfc driver.
apparently it looses sync and it puts out sooooooooooooo much logging,
that the load is 99,7% just for syslogd and klogd.
therefor the script does not get enough time to execute.

this is what messages sais:

[quote]Aug 4 08:33:39 ra kernel: zaphfc: sync lost, pci performance too low. you might have some cpu throrformance too low. you might have some cpu throrformance too low. you might have some cpu throtteling enabled.
Aug 4 08:33:39 ra kernel: zaphfc: sync lost, pci performance too low. you might have some cpu throtteling enabled.
Aug 4 08:34:09 ra last message repeated 245647 times
Aug 4 08:35:02 ra last message repeated 419312 times
[/quote]

i find it a bit strange, to log the same errors every microsec. wouldn’t
1/sec do ??

the card does not share an irq and this comp is not throttled. it is just a
duron 600 with 512mb ram.

!!!
!!!
!!!

got to do some research on this, but it screems for another posting :smile:

anyone got an idea ?

ciao
Martin


#8

I had the same problem.
I changed to vzaphfc instead of zaphfc, and since then it did not happen again.
orlandi.com/visdn/
orlandi.com/zaphfc/


#9

hi Samson,

thanx for that.

i found something at zaphfc.florz.dyndns.org which integrates
into my bristuff quiet well.

ciao
Martin


#10

well, that was not it…

the script does get called as soon as the call comes in, BUT
for some reason systemcalls are being held back until the call
is hung up.

anyone got an idea on how to circumvent this ?

[code]#!/bin/bash

echo "date script start" >> /tmp/asterisk.log

awk ‘{
if ( $1 == “agi_callerid:” )
callerID = $2
else if ( $1 == “agi_extension:” )
extensionID = $2
}
END{
if ( extensionID == “12346” )
{
cmd = "svdrpsend.pl -d 192.168.2.100 MESG "Natascha: Anruf von " callerID “” &"
system( cmd )
}
else if ( extensionID == “12347” )
{
cmd = "svdrpsend.pl -d 192.168.2.100 MESG "Fax von " callerID “” &"
system( cmd )
}
else if ( extensionID == “12345” )
{
cmd = "svdrpsend.pl -d 192.168.2.100 MESG "Martin: Anruf von " callerID “” &"
print cmd
system( cmd )
}
}’

echo "date script done." >> /tmp/asterisk.log
[/code]

[code]output in asterisk.log after call was hung up.

Sat Aug 13 13:19:59 CEST 2005 script start
Sat Aug 13 13:20:08 CEST 2005 script done.[/code]

the linuxbox is just about idle, so the systemcall should not get stuck.

ciao
Martin


#11

ok, got it to work with the system call in extensions.conf

it also eliminates the agi script :smiley:

[the-rest] exten => 12345,1,System(svdrpsend.pl -d 192.168.2.100 MESG "Martin: Anruf von ${CALLERID}") ;show a line on the vdr to show that someone is calling exten => 12345,2,WaitExten(15) exten => 12345,3,Answer() exten => 12345,4,Playback(vm-MartinDefaultVoicemail) exten => 12345,5,VoiceMail(s12345) exten => 12345,6,Hangup()

thanx to all.

ciao
Martin