0

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

  • You should create different contexts for inbound and outbound. You should setup asterisk server nat traversal/firewall correctly. – arheops Jul 03 '16 at 08:18
  • 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 Jul 03 '16 at 17:43

1 Answers1

0

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).

os11k
  • 1,210
  • 2
  • 13
  • 26
  • Wow, You are amazing. You solved my problem which I was facing for almost two weeks. Thanks a ton. –  Jul 06 '16 at 11:16
  • I have another question in general. Lets say I have more extensions (in this case mobile number) coming up, how can I dynamically add them to sip.conf and get it registered to the SIP server? –  Jul 06 '16 at 11:21
  • Check asterisk realtime, it might help you – os11k Jul 06 '16 at 11:24
  • Thanks a ton for your help. –  Jul 06 '16 at 11:37
  • Hi, With respect to the above sip.conf and extensions.conf, I don't hear the both parties' voice during the outbound call . But I hear both parties voice during inbound call. Any idea? –  Jul 06 '16 at 23:48
  • Check your NAT config, one way audio is 99% related to NAT. – os11k Jul 07 '16 at 07:11
  • Thanks again. Adding externip and localnet under general context in sip.conf worked. Thanks. –  Jul 13 '16 at 07:25
  • Hi, Could you answer this http://stackoverflow.com/questions/38385876/why-is-dynamic-real-time-not-recommended-as-per-asterisk –  Jul 15 '16 at 00:28