0
votes

This is my sip.conf

; inbound configuration

[nexmo-sip]
fromdomain=sip.nexmo.com
type=friend
context=nexmo
insecure=port,invite
nat=no
;Add your codec list here.
; Note: Use "ulaw" for US only, "alaw" for the rest of the world.
allow=ulaw
allow=alaw
allow=G729
dtmfmode=rfc2833

[nexmo-sip-01](nexmo-sip)
host=173.193.199.24

[nexmo-sip-02](nexmo-sip)
host=174.37.245.34

[nexmo-sip-03](nexmo-sip)
host=5.10.112.121

[nexmo-sip-04](nexmo-sip)
host=5.10.112.122

[nexmo-sip-05](nexmo-sip)
host=119.81.44.6

[nexmo-sip-06](nexmo-sip)
host=119.81.44.7

;outbound configuration

[general]
register => <api-key>:<api-secret>@sip.nexmo.com
registerattempts=0
srvlookup=yes  
context=nexmo-sip1

[nexmo]
username=<api-key>
host=sip.nexmo.com
defaultuser=<api-key>
fromuser=<myNumber123>  
fromdomain=sip.nexmo.com
secret=<api-secret>
type=friend
context=nexmo-sip1
insecure=very
qualify=yes
nat=no
;Add your codec list here.
; Note: Use "ulaw" for US only, "alaw" for the rest of the world.
allow=ulaw
allow=alaw
allow=G729
dtmfmode=rfc2833

[<myNumber123>]   ; this number is at soft phone client
type=friend
context=nexmo-sip1
host=dynamic
secret=<myNumber123>
qualify=yes

[<mynumber123456>]  ; this is my mobile number
type=friend
context=nexmo-sip1
host=dynamic
secret=<secretkey>
qualify=yes

This is extensions.conf

[general]
live_dangerously=yes
[globals]

[nexmo-sip1]

exten => _X.,1,Dial(SIP/${EXTEN}@nexmo)

[default]
exten => s,1,gosub(nexmo-sip1,${EXTEN},1)

Setting 1: If above is the setting of extensions.conf, I am able to make outbound calls from my soft client, but not able to get inbound calls to that soft client

Setting 2: If I change the settings of extensions.conf as follows, I am able to get incoming calls at softclient, but not able to make outbound calls.

[general]
live_dangerously=yes
[globals]

[nexmo-sip1]

exten => _X.,1,Dial(SIP/${EXTEN},30)

[default]
exten => s,1,gosub(nexmo-sip1,${EXTEN},1)

Question 1) What should I change so that I get both outbound and inbound calls?

Question 2: When I set extensions.conf as in Setting 1, I don't hear the other side, but I hear both the side conversation when extensions.conf is set as in Setting 2. How to fix that? And this is the log I see when I don't hear

[Jul 1 22:50:38] WARNING[11299]: chan_sip.c:4175 retrans_pkt: Retransmission timeout reached on transmission tvK9cRGNN- for seqno 21 (Critical Response) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions Packet timed out after 8383ms with no response [Jul 1 22:50:38] WARNING[11299]: chan_sip.c:4204 retrans_pkt: Hanging up call tvK9cRGNN- - no reply to our critical packet (see https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions).

I understand that there are lot of wrong configurations like insecure=very etc. But right now I want to make this prototype to work successfully

1
You should create different contexts for inbound and outbound. You should setup asterisk server nat traversal/firewall correctly.arheops
NAT traversal and firewall are done correctly. Because if it was wrong I wouldn't get outbound working in Settings 1 and inbound working in Settings 2. I know the issue is with extensions.conf.sofs1

1 Answers

0
votes

To make inbound and outbound calls work, you need to have 2 separate contexts inbound and for outbound.

Try to change your configs in following way, extensions.conf:

[general]

[globals]

[nexmo-sip2]
exten => _X.,1,Dial(SIP/${EXTEN}@nexmo)

[nexmo-sip1]
exten => _X.,1,Dial(SIP/${EXTEN},30)

In sip.conf please leave all what you have, just update lines what I pasted here:

[<myNumber123>]   ; this number is at soft phone client
type=friend
context=nexmo-sip2
host=dynamic
secret=<myNumber123>
qualify=yes

[<mynumber123456>]  ; this is my mobile number
type=friend
context=nexmo-sip2
host=dynamic
secret=<secretkey>
qualify=yes

As you can see we need to have 2 separate contexts for calls from your SIP extensions(nexmo-sip2) and for calls from your sip provider(nexmo-sip1).