Log incoming calls

Hi,

I’m totally new to Asterisk and I’ve been searching for like 2 days where I can make an action on an incoming call. I’ve tried to make an AGI but without succes this morning I looked into CDR CSV logging but noticed the field ‘duration’ so the log is made after the call which is not what I want.

So how can I retrieve an incoming call preferably with PHP?

Thanks in advance,

Sjors

Better you start reading
asteriskdocs.org/
and
wiki.asterisk.org/wiki/display/AST/Home

–Satish Barot

Actions on the incoming call are performed by the dial plan, so simply place your logging actions at the start of the dialplan for the extensions in question. Also, AMI events will be generated for incoming calls.

I seriously don’t know anything about Asterisk so could you explain where I can find the dialplan? A little tutorial would be great :smile:

[quote=“satish4asterisk”]Better you start reading
asteriskdocs.org/
and
wiki.asterisk.org/wiki/display/AST/Home

–Satish Barot[/quote]

Oke I’ve read the section of making a dial plan thanks for that. I call an AGI in the extensions.conf and I made a php file and stored in agi-bin directory. But do I have to call the AGI with or without extension? And does the file need an .agi extension or .php?

Best regards,

Sjors

I use the set() command along with the shell parameter.
For example
Same => n,Set(cdr=${shell(/user/bin/php -q /var/lib/asterisk/cgi/check.php “${CALLERID(num}”)})

Above the CALLERID is a variable I’m passing to my php script. You can pass as many variables as you want. in php you access the variables by $argv[1] etc. The asterisk cdr variable can be something you pass back to asterisk from your php script. It know it works because I use php scripts to access and update remote databases with credit card transactions.

Thanks I placed it in my extensions.conf file.

[incoming-entry] exten => 455,1,Answer() same => n,Set(cdr=${shell(/user/bin/php -q /var/lib/asterisk/agi-bin/ incoming.php "${CALLERID(num)}")}) same => n,Hangup()

Now I get an error:

[quote][Sep 2 10:45:25] WARNING[3723] pbx.c: Channel ‘DAHDI/1-1’ sent into invalid extension ‘s’ in context ‘incoming-entry’, but no invalid handler
[/quote]
What does this mean?

It means you got a call, on an analogue line, or or an ISDN line without DID, and therfore the channel driver indicated that it was for extension s. However, you don’t have a handler for extension s in your dialplan, under the context associated with the incomng line, and nor do you have a handler for extension i, which is the last resort extension used when no other extension matches.

I only want to detect incoming call from customers. Then I want to store the number from who is calling, the extension to who he is calling and the time and some additional stuff in PgSQL. How can I achieve this. I have been looking in the docs but I don’t have all the time to read it. Please give me an example.

There is a Jobs & Biz forum, for people who don’t have time to read the documentation themselves and want to employ someone who already has the knowledge.