Handling offline SIP clients

Hello,

I’m getting my feet wet with Asterisk for our home telephone system and I have a working basic setup.

I do have a question on handling a situation that I assume quite some users have encountered. I have 2 real phones with an ATA that are online whenever Asterisk is up. Next to that, I have two softphones that are not on all the time (they are on when the computers where they are installed on are on). All clients are connected through SIP to Asterisk.

Furthermore I have a POTS trunk for incoming/outgoing calls.

In my extensions.conf I have a dialplan that rings all SIP clients when a call comes in from the POTS. I construct the argument for the Dial command by concatenating all client ID’s with an ampersand:

[globals]
PHONE1=SIP/line1
PHONE2=SIP/line2

[pstn_trunk]
exten => s,1,Dial(${PHONE1}&${PHONE2}&${PC_LIVING}&${PC_HOBBY},30)

Now, when there is an incoming ring and one of the softphones is not alive, then (of course) there is a notification in the logs of Asterisk like:

app_dial.c:1745 dial_exec_full: Unable to create channel of type ‘SIP’ (cause 20 - Unknown)

This is normal, as the SIP client is not active.

I tried to work around this with the ChanIsAvail application, but this only returns the first available channel. So I guess I will need to make a macro that tests every channel with the ChanIsAvail, and then concatenate the results?

Are there other more elegant solutions to this?

Best regards,
Hollie.

Hi,
I think it’s be more easy to use queue. there are several ways for you to ring your SIP phones.
We can chat my email would be more convenient.My email: michaelbryant81@gmail.com

Hi

The best way of handling status is Devstate function, This will report back on the status better.

I wouldnt worry too much about the log message.

Ian

Hello Ian,

thanks for your tip on DEVICE_STATE: when the SIP client is offline I get a nice ‘UNAVAILABLE’ returned by this function.

And yes, maybe I should not worry about the log message. On the other hand, the number of soft SIP clients is increasing here, which means I get at least 3 error messages for every incoming call when all soft clients are offline. This is not a blocking problem, but it causes me a little ‘itch’ that needs to be scratched :wink:

Best regards,
Hollie.