Unable to Connect Softphone to Remote Asterisk Server for Outgoing Calls

Hello Asterisk community,

I am new to Asterisk and I am having trouble making calls using a softphone on my computer with my remote Asterisk server. I have successfully set up a standard Asterisk server and can make calls from the CLI on the server itself.

To configure a standard Asterisk server setup, I used the configuration details provided to me by my third-party VoIP provider.

Below is my configurations for sip.conf, extensions.conf and the Asterisk CLI output for `sip show peers`, as well as commands and output when making a call using Asterisk CLI and my computer softphone.

sip.conf:

[373046-100]
host=pbx.zadarma.com
insecure=invite,port
type=peer
fromdomain=pbx.zadarma.com
disallow=all
allow=alaw
allow=ulaw
dtmfmode=auto
secret=***
defaultuser=373046-100
trunkname=373046-100
fromuser=373046-100
callbackextension=373046-100
context=zadarma-in
qualify=400
directmedia=no
nat=force_rport,comedia



[101]                                                  ;the Asterisk extension number
secret=***
host=dynamic
type=peer
context=zadarma-out



;my own configuraiton added to connect softphone to this asterisk server
[andy]
type=friend
username=andy
host=dynamic
context=zadarma-in

extensions.conf:

[zadarma-in]
exten => 373046-100,1, Dial(SIP/101)                     ; all incoming calls from trunk 373046-100 are routed to extension number 101
[zadarma-out]
exten => _XXX,1,Dial(SIP/${EXTEN})                     ; calls to 3-digit extension numbers of Asterisk
exten => _XXX.,1,Dial(SIP/${EXTEN}@373046-100)           ; calls to numbers with 4 digits or more using the trunk 373046-100

Output from `sip show peers` command:

ubuntu-hel1-ast*CLI> sip show users
Username                   Secret           Accountcode      Def.Context      ACL  Forcerport
andy                                                         zadarma-in       No   Yes       
ubuntu-hel1-ast*CLI> sip show peers
Name/username             Host                                    Dyn Forcerport Comedia    ACL Port     Status      Description                      
101                       (Unspecified)                            D  Auto (No)  No             0        Unmonitored                                  
373046-100/373046-100     xxx.xx.xxx.xxx                              Yes        Yes            5060     OK (21 ms)                                   
andy/andy                 yyy.yyy.yy.yy                            D  Auto (Yes) No             20000    Unmonitored                                  
3 sip peers [Monitored: 1 online, 0 offline Unmonitored: 1 online, 1 offline]
ubuntu-hel1-ast*CLI> 

With this configuration I am able to establish a call to any mobile/handset device using Asterisk server’s CLI:

Connected to Asterisk 18.10.0~dfsg+~cs6.10.40431411-2 currently running on ubuntu-hel1-ast (pid = 10537)
ubuntu-hel1-ast*CLI> channel originate SIP/373046-100/+447XXXXXXXXX extension 101
  == Using SIP RTP CoS mark 5
    -- Called 373046-100/+447XXXXXXXXX
    -- SIP/373046-100-00000000 is making progress
ubuntu-hel1-ast*CLI> channel request hangup all
Requested Hangup on channel 'SIP/373046-100-00000000'
ubuntu-hel1-ast*CLI>

However, when I try to establish a call from the softphone on my computer it fails to make a call. Here is the output from Asterisk’s CLI when I attempt this:

Connected to Asterisk 18.10.0~dfsg+~cs6.10.40431411-2 currently running on ubuntu-hel1-ast (pid = 11137)
  == Using SIP RTP CoS mark 5
[Mar 14 14:25:45] NOTICE[11185][C-00000003]: chan_sip.c:26824 handle_request_invite: Call from 'andy' (yyy.yyy.yy.yy:20000) to extension '+447XXXXXXXXX' rejected because extension not found in context 'zadarma-in'.
[Mar 14 14:26:00] WARNING[11185]: chan_sip.c:4151 retrans_pkt: Retransmission timeout reached on transmission K~iuVezjBJ for seqno 20 (Critical Response) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 32000ms with no response
ubuntu-hel1-ast*CLI>

I would appreciate any help or guidance on how to troubleshoot this issue and successfully make calls using my computer’s voip softphone.

Thank you!

[Mar 14 14:25:45] NOTICE[11185][C-00000003]: chan_sip.c:26824 handle_request_invite: Call from 'andy' (yyy.yyy.yy.yy:20000) to extension '+447XXXXXXXXX' rejected because extension not found in context 'zadarma-in'.

The actual error is in extensions.conf; “+” is not a digit between 0 and 9, so does not match X.

[Mar 14 14:26:00] WARNING[11185]: chan_sip.c:4151 retrans_pkt: Retransmission timeout reached on transmission K~iuVezjBJ for seqno 20 (Critical Response) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions

You are probably behind NAT, but haven’t set your public address and listed your local networks. This probably causes for incoming calls longer than 32 seconds, as well.

However, you should throw away the information from your provider, as chan_sip is obsolete, and will not be present in the next release of Asterisk.

I cannot see anything that would prevent the basic example of a chan_pjsip provider connection from working, as documented in res_pjsip Configuration Examples - Asterisk Project - Asterisk Project Wiki

Also note that you should only use type=friend if you have more than one soft phone with the same IP address.

You should also specify disallow all and only the needed codecs, for your phones, as sending all possible codecs can cause problems.

You are inconsistent in your names for defaultuser, also using the obsolete “username”. It is definitely not meaningful for provider, and unlikely to be useful, especially on its own, for the phone.

Hello, it’s simple as it seems the error.
Please Chek that your context matches your current context like the error shows you.

With your guidance, I was able to get the softphone to connect to the Asterisk server and make a call. Below are the updated configurations for the extensions.conf and sip.conf files which were modified.

In the extensions.conf file, I included a new line that enables calling numbers with more than 4 digits and automatically adds a “+” to the dialed number. The previous default configuration provided by the third-party VoIP provider did not support dialing numbers with more than 4 digits.

`exten => _+X.,1,Dial(SIP/${EXTEN}@373046-100)     ; allows calls with more than 4 digits and appends '+' using the trunk 373046-100`

So the updated extensions.conf file now has this configuration:

[zadarma-in]
exten => 373046-100,1, Dial(SIP/101)                     ; all incoming calls from trunk 373046-100 are routed to extension number 101
[zadarma-out]
exten => _XXX,1,Dial(SIP/${EXTEN})                     ; calls to 3-digit extension numbers of Asterisk
exten => _XXX.,1,Dial(SIP/${EXTEN}@373046-100)           ; calls to numbers with 4 digits or more using the trunk 373046-100
exten => _+X.,1,Dial(SIP/${EXTEN}@373046-100)     ; calls with country code using the trunk 373046-100

Additionally, I updated the configurations in the sip.conf file for the trunk and the SIP phone as follows:

srvlookup=yes
[373046-100]
type=peer
host=pbx.zadarma.com
insecure=invite,port
fromuser=373046-100
defaultuser=373046-100
secret=***
context=zadarma-in
trunkname=373046-100
fromdomain=pbx.zadarma.com
disallow=all
allow=alaw
allow=ulaw
dtmfmode=auto
qualify=400
nat=force_rport,comedia
directmedia=no
callbackextension=373046-100

[101]
type=peer
host=dynamic
secret=***
context=zadarma-out

[303]
type=friend
host=dynamic
secret=***
context=zadarma-out
nat=force_rport,comedia

I updated the extension’s username and number from “andy” to more fitting numeric characters, specifically “303”.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.