# FAQ: Difference between revisions

## Asterisk

How can I setup Asterisk to use TLS
Asterisk can use TLS as transport for the signalling, increasing the authentication security and providing extra privacy about the number dialed and other info usually transmitted in clear over the SIP channel. TLS will encrypt only the signalling part, without offering any extra security to the RTP (voice) part. In the [general] section of sip.conf, add the following info, replacing the IP address with the IP address of the server. Provide the certificate and key in pem format.
tlsenable=yes
tlscertfile=/etc/asterisk/certificates/demo.mirtapbx.com.pem
tlsdontverifyserver=no
tlscipher=DES-­CBC3-­SHA
tlsclientmethod=tlsv1
transport=udp,tls 

Optionally you can add a port number to tlsbindaddr parameter

Don't forget to set asterisk to listen on tcp:

tcpenable=yes

Optionally you can provide a separate certificate and key

tlscertfile=/etc/ssl/demo.mirtapbx.com.crt
tlsprivatekey=/etc/ssl/demo.mirtapbx.com.key

I think my Asterisk is locked... how can I check it?
If you think your asterisk is locked, probably it is. To be 100% sure, just run the following command and check the result:

This is a locked asterisk

# netstat -nap | grep 5060
tcp        0      0 0.0.0.0:5060                0.0.0.0:*                   LISTEN      26090/asterisk
udp   213504      0 0.0.0.0:5060                0.0.0.0:*                               26090/asterisk


This is a normal asterisk

# netstat -nap | grep 5060
tcp        0      0 0.0.0.0:5060                0.0.0.0:*                   LISTEN      4127/asterisk
udp        0      0 0.0.0.0:5060                0.0.0.0:*                               4127/asterisk


When asterisk locks up, it stops processing SIP packets, so the UDP buffer fills up. In this case an asterisk restart is needed.

How can I enable TCP for SIP (port 5060)?

You need to add the following rows to /etc/asterisk/sip.conf and then reload the SIP module (when you have no traffic)

tcpenable=yes

How can I configure Asterisk to listen to multiple ports?

You can't, it is not possible to configure Asterisk to listen to multiple ports. However, you can use an iptables REDIRECT to get the same result. To redirect a single port with iptables:

 iptables -t nat -A PREROUTING -i eth0 -p udp --dport 5090 -j REDIRECT --to-ports 5060

This example redirects UPD port 5090 to port 5060, so you can connect to Asterisk on both of them.

Remember to add this command to any init script, like /etc/rc.local

BLF monitoring is not working!

One of the common pitfall about BLF is to monitor just the extension number and not the "username" as required. So if you are in the tenant "DEMO" and you want to monitor extension 100 with username "100-DEMO", you need to monitor 100-DEMO and not just 100.

What is HANGUP_CAUSE XX?

You can check this piece of code:

#define AST_CAUSE_UNALLOCATED 1
#define AST_CAUSE_NO_ROUTE_TRANSIT_NET 2
#define AST_CAUSE_NO_ROUTE_DESTINATION 3
#define AST_CAUSE_MISDIALLED_TRUNK_PREFIX 5
#define AST_CAUSE_CHANNEL_UNACCEPTABLE 6
#define AST_CAUSE_CALL_AWARDED_DELIVERED 7
#define AST_CAUSE_PRE_EMPTED 8
#define AST_CAUSE_NUMBER_PORTED_NOT_HERE 14
#define AST_CAUSE_NORMAL_CLEARING 16
#define AST_CAUSE_USER_BUSY 17
#define AST_CAUSE_NO_USER_RESPONSE 18
#define AST_CAUSE_SUBSCRIBER_ABSENT 20
#define AST_CAUSE_CALL_REJECTED 21
#define AST_CAUSE_NUMBER_CHANGED 22
#define AST_CAUSE_REDIRECTED_TO_NEW_DESTINATION 23
#define AST_CAUSE_DESTINATION_OUT_OF_ORDER 27
#define AST_CAUSE_INVALID_NUMBER_FORMAT 28
#define AST_CAUSE_FACILITY_REJECTED 29
#define AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY 30
#define AST_CAUSE_NORMAL_UNSPECIFIED 31
#define AST_CAUSE_NORMAL_CIRCUIT_CONGESTION 34
#define AST_CAUSE_NETWORK_OUT_OF_ORDER 38
#define AST_CAUSE_NORMAL_TEMPORARY_FAILURE 41
#define AST_CAUSE_SWITCH_CONGESTION 42
#define AST_CAUSE_REQUESTED_CHAN_UNAVAIL 44
#define AST_CAUSE_FACILITY_NOT_SUBSCRIBED 50
#define AST_CAUSE_OUTGOING_CALL_BARRED 52
#define AST_CAUSE_INCOMING_CALL_BARRED 54
#define AST_CAUSE_BEARERCAPABILITY_NOTAUTH 57
#define AST_CAUSE_BEARERCAPABILITY_NOTAVAIL 58
#define AST_CAUSE_BEARERCAPABILITY_NOTIMPL 65
#define AST_CAUSE_CHAN_NOT_IMPLEMENTED 66
#define AST_CAUSE_FACILITY_NOT_IMPLEMENTED 69
#define AST_CAUSE_INVALID_CALL_REFERENCE 81
#define AST_CAUSE_INCOMPATIBLE_DESTINATION 88
#define AST_CAUSE_INVALID_MSG_UNSPECIFIED 95
#define AST_CAUSE_MANDATORY_IE_MISSING 96
#define AST_CAUSE_MESSAGE_TYPE_NONEXIST 97
#define AST_CAUSE_WRONG_MESSAGE 98
#define AST_CAUSE_IE_NONEXIST 99
#define AST_CAUSE_INVALID_IE_CONTENTS 100
#define AST_CAUSE_WRONG_CALL_STATE 101
#define AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE 102
#define AST_CAUSE_MANDATORY_IE_LENGTH_ERROR 103
#define AST_CAUSE_PROTOCOL_ERROR 111
#define AST_CAUSE_INTERWORKING 127
#define AST_CAUSE_BUSY AST_CAUSE_USER_BUSY
#define AST_CAUSE_FAILURE AST_CAUSE_NETWORK_OUT_OF_ORDER
#define AST_CAUSE_NORMAL AST_CAUSE_NORMAL_CLEARING
#define AST_CAUSE_CONGESTION AST_CAUSE_NORMAL_CIRCUIT_CONGESTION
#define AST_CAUSE_UNREGISTERED AST_CAUSE_SUBSCRIBER_ABSENT
#define AST_CAUSE_NOTDEFINED 0
#define AST_CAUSE_NOSUCHDRIVER AST_CAUSE_CHAN_NOT_IMPLEMENTED

When I change the name of an extension or any properties requiring an extension reload, the extension goes offline after few minutes

Asterisk caches the info for the extension, so when updating the extension, it is pruned and reloaded. It is automatically reloaded with an expire time of 120 seconds. If you have an expire time longer, it will go offline. You can avoid this by setting a longer default expiration time using the following parameter in sip.conf

rtautoclear=3600

Calls are dropping after around 30 seconds when using PJSIP

Some softphones sends INFO packets to the pbx and if you have not activated "TrustRPID", the pbx will not answer and the softphone may hangup the call

Asterisk is not using the correct audio file

When using audio translations, even if placed correctly in /var/lib/asterisk/sounds/<your language code> is always possible asterisk will choose to use the english version because in the "best" format. In this case, it can be good to convert all audio files in multiple formats. Let's make the example to have all audio files for da_DK language in "wav" format, while asterisk is picking up the "ulaw" english version. We can easily convert them using:

 cd /var/lib/asterisk/sounds/da_DK
for i in ls *.wav; do asterisk -x "file convert /var/lib/asterisk/sounds/da_DK/$i /var/lib/asterisk/sounds/da_DK/basename$i .wav.ulaw"; done

Asterisk is not reporting the PAUSE event when a phone is auto paused

The name of the event changed from asterisk 13.x to asterisk 16.x and your manager.conf may be still using the old event name. Please check and fix:

 eventfilter=Event: QueueMemberPause

My provider uses DNS SRV entry, how should I configure it?

Configure it as a normal entry, but leave the port to zero. That will force a DNS SRV resolution

How to configure TOS and COS for PJSIP?

The configuration of TOS and COS for PJSIP is separated between the realtime extension and the transport. You can check the PJSIP extension security section and insert the following values:

TOS Audio: ef
TOS Video: af41
COS Audio: 5
COS Video: 4


You can also edit pjsip.conf and enter the following values for each type of transport:

tos=ef
cos=5

I am getting an error in WebRTC client about digest

It can be worth trying to enable the dtls in sip.conf, disable the SSL Cert in Admin/Settings and set the Auto DTLS in the ps_endpoint configuration for PJSIP

## Asterisk Errors

What is this error? WARNING[23261]: res_musiconhold.c:719 monmp3thread: poll() failed: Interrupted system call
Nothing to worry, when the Musing On Hold process terminates to play the media file, this error is thrown out, just ignore it
What is this error? WARNING[3221]: func_cdr.c:352 cdr_write_callback: CDR requires a value (CDR(variable)=value)
Nothing to worry, it is a small glitch in the dialplan, but avoiding it will require an extra check, slowing down the call processing, so it is avoided, preferring the warning. Just ignore it.
What is this error? ERROR[24984][C-00008457]: res_fax.c:4364 acf_faxopt_read: channel 'SIP/201-#######-0001547a' can't read FAXOPT(gateway) because it has never been written.
Nothing to worry, it is a small glitch in the dialplan, but avoiding it will require an extra check, slowing down the call processing, so it is avoided, preferring the error. Just ignore it.
What is this error? WARNING[3221]: func_cdr.c:364 cdr_write_callback: Using the CDR function to set 'accountcode' is deprecated. Please use the CHANNEL function instead.
I am using an old syntax to preserve compatibility with older asterisk versions. Just ignore it.
What is this error? WARNING[25144][C-0000845c]: dsp.c:1489 ast_dsp_process: Inband DTMF is not supported on codec #####. Use RFC2833
This is important, you are using an incompatible DTMF format for the codec you selected. Inband DTMF is supported in only a limited number of codec. Use RFC2833 as suggested.
What is this error? NOTICE[9505] manager.c: 217.28.216.250 tried to authenticate with nonexistent user 'admin'
What is this error? NOTICE[9505] manager.c: 217.28.216.250 failed to authenticate as 'admin'

## Phones

How can I avoid to receive a new call while I am already in a conversation?
You can receive another call while on line because the feature “Call Waiting” is active on your phone. Turn it off and the second call will get a BUSY signal. Disabling on the phone depends by the phone model, for example on Yealink it is here:
How can I allow a SNOM phone to auto answer on paging?
SNOM has a security setting to prevent auto answer, so it has to be enabled to make it to work. On version V8 you need to go to Advanced / Behaviour (tab) / Phone Behaviour / Intercom policy

## Provisioning

My phone refuse to provision, but when I download the configuration, it seems perfect
If you are trying to provision over https, then check if the SSL certificate is valid. Phones require a valid certificate for provisioning. Verify the date and time on the phone because the certificate has a start and end date of validity. As last chance, try provisioning with http, but just to verify if the problem is in the certificate (some phones are really picky about certificates), then change the key and the extension password.

## PHP

I have upgraded PHP to version 5.x/7.x but now my Admin/Settings is no more working
The Admin/Settings page and few others include the Ivona library and you need to upgrade the requirements, based on your php version. Please move in that directory and then update using composer:

cd /var/www/html/pbx/libs/IvonaSpeechCloudSdkPhp

php composer.phar update