Pick up phone notification on the server

So we have a Asterisk server and several computers with softphones installed on it.

When someone is calling our callcenter, all softphone are ringing, then someone pick up the phone and can talk with the client.

I will explain what I want.
I want to execute a script on the Asterisk server when one of the softphone pick up the phone line.

For this, I need notification from Asterisk server when someone pick up the line.
I also need to send some parameters to my server script :

  • The IP adress of the person who pick up the phone line
  • The remote phone number that is calling us

Can I get these 2 informations and can I have notification?

I am not very good with Asterisk configuration file, so maybe you can say me in which I can found notifications parameters.

Thanks in advance!

manager.conf

You know what is the syntax to capture pick up phone events?

Thanks a lot!

Please read chapter 10 and Appendix F of Asterisk: The Future of Telephony, then experiment to find out which events best fit your needs.

You might also be able to do this using an M parameter on the Dial application call, but anyone doing this sort of CTI seriously will use AMI. In my experience, as well as experimenting, you also need to be prepared to read the source code of Asterisk, to understand the exact meaning of the events.

So I tried to connected to the manager using telnet, then I logged in successfully.

So, now, I get some events like “link”, “unlink”, “dial” and so on.

I am very happy about this and I think this is a very good way to get events from asterisk.
I will make a java program to check and dispatch events. This is great!

My first question :
Can I get a list of all events with explanation for each?

Second question :
I have some information about user when I get a link event :
Event: Link
Privilege: call,all
Channel1: SIP/5878430290-081fce10
Channel2: SIP/18-08277df8
Uniqueid1: 1250085179.3123
Uniqueid2: 1250085179.3124
CallerID1: 5878430290
CallerID2: s

Can I found the IP of the softphone using these information? Maybe there is a link between SIP/5878430290-081fce10 and the IP? How can I go further?

Last question :
Is there a way to link this information (like SIP/5878430290-081fce10) to the calling phone number elsewhere in Asterisk.

Maybe for all these things, I can use some others command to get more information ?

Generally yes, but you need to do some of your own research. Use the command action with sip show channel will tell you that sort of information, although I can’t be sure that you won’t have to reverse resolve a domain name, sometimes.

I got the IP adress, that’s great.

Now, I just need remote phone number.

Maybe you know how I can get it?
That’s my last question, if I have this, I get all I need.

Do you think I must check with Channel1, Uniqueid1 or CallerID1?

Thanks!

Can I make a getVar command to get the remote calling phone number?

Thanks?

answer :

Action: GetVar
Channel: SIP/5878430290-08210ff0
Variable: CALLERID(name)