Softphone unavailable

Hello All. How are you doing?

When I call to an extension which is unavailable. the softphone which made the call don’t get any message. I want that the agent says something like the phone is unreacheble or is offline.

exten => 1400,1,Dial(SIP/HumanReasources,30)

What I must to add to that line?

thanks in advance and best regards.

https://www.voip-info.org/wiki/view/Asterisk+variable+DIALSTATUS

1 Like

Try something like this:

exten => 1400,1,GotoIf($[${DEVICE_STATE(SIP/HumanReasources)}=UNAVAILABLE]?skip_dial) ;Device not registered
same => n,Dial(SIP/HumanReasources,30)
same => n,GotoIf($["${DIALSTATUS}"=“BUSY” | “${DIALSTATUS}”=“DONTCALL”]?dialed_busy)
same => n,NoOp(Do More Stuff here, like dial another extension, whatever) ;no answer
same => n,Hangup
same => n(skip_dial),Playback(extension&is-curntly-unavail)
same => n,Hangup
same => n(dialed_busy),Playback(extension&is-curntly-busy)
same => n,Hangup(17) ; generate busy signal

And by the way, it would be better for you to use PJSIP which is replacing SIP in Asterisk. You would have to configure Asterisk with the PJSIP channel driver modules and modify your dialplan, replacing instances of SIP/ with PJSIP/

1 Like

Just I must replace extensions.conf changing SIP by PJSIP? or I must configure the file PJSIP.conf, too?

Best Regards.

It’s a bit more complicated than that. In your extensions.conf file, yes - the changes to make is anywhere you see SIP as the channel technology, it becomes PJSIP, so for example your Dial line would be: Dial(PJSIP/HumanReasources,30). Similarly, the DEVICE_STATE() parameter would like this this: DEVICE_STATE(PJSIP/HumanReasources)

But you first need to install the various PJSIP modules onto your system and configure them with pjsip.conf. In addition, you need to turn off the chan_sip channel driver so that it no longer listens to port 5060, by adding this line to modules.conf:
noload => chan_sip.so

Configuring pjsip.conf has similarities to sip.conf, but pjsip.con is quite a bit more complex. Unlike sip.conf that uses a single section for adding a [devicename], pjsip.conf uses multiple sections for a single device. Reference https://wiki.asterisk.org/wiki/display/AST/res_pjsip+Configuration+Examples Also, installing PJSIP as part of your Asterisk setup may require additional dependencies not yet installed on your system. Using the bundled version of PJSIP for Asterisk is preferred because it applies patches. Reference https://wiki.asterisk.org/wiki/display/AST/PJSIP-pjproject

Here is an example of what would be required for PJSIP.conf to register your HumanReasources device. First, you must define the transport and templates:

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

[ipfone] (!)
type=endpoint
allow=!all,ulaw
context=YOURCONTEXT
transport=transport-udp
direct_media=no
send_pai=yes
refer_blind_progress=no
rtp_timeout=45

[auth] (!)
type=auth
auth_type=userpass

[aor] (!)
type=aor
max_contacts=1
remove_existing=yes

;Now you can add devices,

[HumanReasources] (ipfone)
aors=HumanReasources
auth=HumanReasources
outbound_auth=HumanReasources
moh_suggest=YOURMUSICDIRNAME
allow_transfer=yes
set_var=CHANNEL(parkinglot)=YOURPARKING
[HumanReasources] (aor)
[HumanReasources] (auth)
username=HumanReasources
password=MYPASSWORD

1 Like

Thank you very very much. There is a command to see if all PJSIP modules are installed in the system? I can’t remember if I install it when I do with the Asterisk.

Well, there is more than one way to check, but for me the simplest way I check is to type at the CLI,

CLI> pjsip ?

This is what it shows when all the modules are installed,
CLI> pjsip ?
dump export list qualify reload send set show

But this is what it will show if they are not installed,
CLI> pjsip ?
CLI> pjsip reload

1 Like
pjsip reload
No such module 'res_pjsip.so'
No such module 'res_pjsip_authenticator_digest.so'
No such module 'res_pjsip_endpoint_identifier_ip.so'
No such module 'res_pjsip_mwi.so'
No such module 'res_pjsip_notify.so'
No such module 'res_pjsip_outbound_publish.so'
No such module 'res_pjsip_publish_asterisk.so'
No such module 'res_pjsip_outbound_registration.so'

To install it. I’ve to do it by make menuselect and select it, and then install asterisk again? or there is a command to do it without install from the begining?

King regards.

Menuselect does allow you to check previously unchecked items and add them to your installation of asterisk by performing a “make” and “make install” again. When “make” runs again, it will only build the new components, then"make install" will add those new components to your Asterisk without rebuilding the entirety of Asterisk again.

However, I don’t believe your menuselect will allow you to check the components of pjsip so that you could add them to your Asterisk installation, because pjsip is not distributed with Asterisk. You must download, compile and install pjsip into your system separately, then you must./configure again before those pjsip components are recognized by menuselect.

You really should study the information carefully on the Asterisk Docs page that I referred you to in my earlier post. This page gives you detailed instructions for the two Asterisk-supported methods of installing pjsip to your system.
https://wiki.asterisk.org/wiki/display/AST/PJSIP-pjproject