Checking if the SIP user is off_hook

Hi,

I’ve got SIP IP phones connected to Asterisk 1.4. When user is on the phone and incomming call wants to achive him asterisk informs user of new incomming call and caller has the signal like “wait for answering”. I would like asterisk to check the status of user and in case of “off_hook” to inform caller that he’s on the phone and let him choose to wait or switch to voicemail. How can I do that when $DIALSTATUS is not set to BUSY. I can see ongoing conversation on CLI “core show channels”, but how to get this information in dialplan?

Any hints?

Cieniu

You need to look into the call limit option. Note that this has changed recently (and may have a different name), and I’m not sure that it copes with mixed incoming and outgoing calls well, even now.

Alternatively, configure the phone to reject the call, if that is possible.

I don’t want this call to be rejected or limited. I know I can do that, but I want just to aware the caller that recipient is off_hook and then he can choose he wants to wait or switch to voicemail.

You’ll need to use the device status functions. You may also need to set a token call limit, greater than the actual maximum, as I’m not sure that in-use status is recorded without it.

Use core show functions, or look in the Asterisk book, to work out which function you need.

You will probably need to do this before offering the call.

That’s the point. Tell me how to use informations from “core show channels” in dialplan. $DIALSTATUS gives just RINGING.

core show channels is unlkely to be of much use. Even then, you probably could extract the necessary information.

As I hinted, you run core show functions and look for something with a name similar to device state. You will find it, at least in the case of version 1.6.

I also said that you may need to enable call limits for the device state to be useful.