Asterisk - How to forward SIP call from Nexmo to softclient

I bought voice numbers from Nexmo. I setup softclient and number is registered with nexmo. I am able to make outbound calls. Inbound calls are forwarded to SIP address by Nexmo.

I am trying to receive and attend the inbound calls in softclient. The call will be coming to the nexmo number from a normal mobile number/landline number(PSTN). [i.e, Real mobile number --> Nexmo server --> *forward to sip --> asterisk server --> softphone]*

I finished setting up asterisk, went through documentation, modified sip.conf and extensions.conf, and now my soft client is registering to asterisk server

Issue 1: Soft client is not receiving the call forwarded by Nexmo (I made the change as per this document https://help.nexmo.com/hc/en-us/articles/204015313?page=1#comment_205657928 ) My Nexmo dashboard says
"Forward to SIP" : sip:@mydomain-IP-Address , but call is not redirected to softclient.

*Issue 2: How to set up SRV records?
^Issue 3: How to change dynamically ‘fromuser’ in sip.conf? I read that calls will not be aborted when we do ‘sip reload’, but I am struck how to dynamically change fromuser as I will be having 10 fromuser numbers.

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>
registerattempts=0
srvlookup=yes  ; *Issue 2: I am not sure how to set up srvlookup. But I need this. ; ;https://docs.nexmo.com/voice/configuring-sip

[nexmo]
username=<api-key>
host=sip.nexmo.com
defaultuser=<api-key>
fromuser=<myNumber123>  ; ^Issue 3: dynamically changing fromuser
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 is the nexmo virtual number I bought & it registers with my 
;new asterisk server. But struck how to redirect the inbound call from Nexmo to softclient
type=friend
context=nexmo-sip1
host=dynamic
secret=<myNumber123>
qualify=yes

extension.conf

[general]
[globals]

[nexmo-sip1]

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

[default]
exten => s,1,Answer()

Please help me. I am struck with this issue for almost a week.

foward the calls to a sip uri on the Nexmo panel to something like this

sip:DID-NUMBER@ASTERISK-IP

Then he easiest way is to enable guest calls on the general section of you sip.conf file add this allowguest=yes, then you need to make an special context for those unauthenticated calls that context need to be also define on your general section of you sip.conf file

The other method is to configure the remote sip peer on your sip.conf and then a context for inbound calls received by this peer

if still stuck enable sip debug in order we can track the invite received from Nexmo

Thanks for answering.

Setting sip:DID-NUMBER@ASTERISK-IP is already done in Nexmo dashboard.

I have added allowguest=yes in general context of sip.conf. But could you help me with code for sip.conf and extensions.conf for either of the methods you suggested. It would be really helpful.

you need to call to your DID and then enable the sip debug " sip set debug on" and verify if you are receiving the invite from Nexmo, if you are receiving the invite then it is just configure the context to answer or foward the call

This a community support forum,only specialized on Asterisk. Any third party product like Like FreePBX, Nexmo’s Dashboard need to be addressed on their respective community. Also if you need direct support from any of the members or any step by step guide you will need to pay for consultation service.

Ok I am sorry. I fixed the login issue by myself http://www.freepbxhosting.com/blog/reset-freepbx-password/

I am a newbie to programming world. I try to do basic homework before I ask in forums. But with this sip.conf issue I lost almost 9 days. Please help me with sip.conf (call forwarding issue). Please.

Here is the log after doing “sip set debug on”

OPTIONS sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM SIP/2.0
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK5536f29a
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.XXX.XX..63>;tag=as138c1542
To: <sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM>
Contact: <sip:asterisk@192.XXX.XX..63:5060>
Call-ID: 0f048349541cfd255496b4764d821be7@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.9.1
Date: Mon, 27 Jun 2016 05:25:26 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2016-06-26 22:25:26] VERBOSE[2999] chan_sip.c: Reliably Transmitting (no NAT) to 174.37.245.34:5060:
OPTIONS sip:sip.nexmo.com SIP/2.0
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK359aa396
Max-Forwards: 70
From: "asterisk" <sip:12345678901@192.XXX.XX..63>;tag=as72ffdb7e
To: <sip:sip.nexmo.com>
Contact: <sip:12345678901@192.XXX.XX..63:5060>
Call-ID: 6c752b422441fd663e25b3194f6de7a5@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.9.1
Date: Mon, 27 Jun 2016 05:25:26 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2016-06-26 22:25:26] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->
SIP/2.0 200 Ok
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK5536f29a
From: "asterisk" <sip:asterisk@192.XXX.XX..63>;tag=as138c1542
To: <sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM>;tag=Bsv1r
Call-ID: 0f048349541cfd255496b4764d821be7@192.XXX.XX..63:5060
CSeq: 102 OPTIONS

<------------->
[2016-06-26 22:25:26] VERBOSE[2999] chan_sip.c: --- (6 headers 0 lines) ---
[2016-06-26 22:25:26] VERBOSE[2999] chan_sip.c: Really destroying SIP dialog '0f048349541cfd255496b4764d821be7@192.XXX.XX..63:5060' Method: OPTIONS
[2016-06-26 22:25:26] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:174.37.245.34:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK359aa396;rport=5060;received=73.222.242.203
From: "asterisk" <sip:12345678901@192.XXX.XX..63>;tag=as72ffdb7e
To: <sip:sip.nexmo.com>;tag=52b520789d2d701d194ad9677121e546.951c
Call-ID: 6c752b422441fd663e25b3194f6de7a5@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
Server: Nexmo Customer Proxy - 2
Content-Length: 0

<------------->
[2016-06-26 22:25:26] VERBOSE[2999] chan_sip.c: --- (8 headers 0 lines) ---
[2016-06-26 22:25:26] VERBOSE[2999] chan_sip.c: Really destroying SIP dialog '6c752b422441fd663e25b3194f6de7a5@192.XXX.XX..63:5060' Method: OPTIONS
[2016-06-26 22:25:28] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->


<------------->
[2016-06-26 22:25:58] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->


<------------->
[2016-06-26 22:26:26] VERBOSE[2999] chan_sip.c: Reliably Transmitting (no NAT) to 192.XXX.XX..141:5060:
OPTIONS sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM SIP/2.0
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK0db528b1
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.XXX.XX..63>;tag=as15ee4c5c
To: <sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM>
Contact: <sip:asterisk@192.XXX.XX..63:5060>
Call-ID: 2c2e14db791d4214769e6761495177dc@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.9.1
Date: Mon, 27 Jun 2016 05:26:26 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2016-06-26 22:26:26] VERBOSE[2999] chan_sip.c: Reliably Transmitting (no NAT) to 174.37.245.34:5060:
OPTIONS sip:sip.nexmo.com SIP/2.0
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK56d975b9
Max-Forwards: 70
From: "asterisk" <sip:12345678901@192.XXX.XX..63>;tag=as1221d51d
To: <sip:sip.nexmo.com>
Contact: <sip:12345678901@192.XXX.XX..63:5060>
Call-ID: 600c3a3902e3e57235ae60ea5f858728@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.9.1
Date: Mon, 27 Jun 2016 05:26:26 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2016-06-26 22:26:27] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:174.37.245.34:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK56d975b9;rport=5060;received=73.222.242.203
From: "asterisk" <sip:12345678901@192.XXX.XX..63>;tag=as1221d51d
To: <sip:sip.nexmo.com>;tag=52b520789d2d701d194ad9677121e546.789a
Call-ID: 600c3a3902e3e57235ae60ea5f858728@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
Server: Nexmo Customer Proxy - 2
Content-Length: 0

<------------->
[2016-06-26 22:26:27] VERBOSE[2999] chan_sip.c: --- (8 headers 0 lines) ---
[2016-06-26 22:26:27] VERBOSE[2999] chan_sip.c: Really destroying SIP dialog '600c3a3902e3e57235ae60ea5f858728@192.XXX.XX..63:5060' Method: OPTIONS
[2016-06-26 22:26:27] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->
SIP/2.0 200 Ok
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK0db528b1
From: "asterisk" <sip:asterisk@192.XXX.XX..63>;tag=as15ee4c5c
To: <sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM>;tag=B1vdD
Call-ID: 2c2e14db791d4214769e6761495177dc@192.XXX.XX..63:5060
CSeq: 102 OPTIONS

<------------->
[2016-06-26 22:26:27] VERBOSE[2999] chan_sip.c: --- (6 headers 0 lines) ---
[2016-06-26 22:26:27] VERBOSE[2999] chan_sip.c: Really destroying SIP dialog '2c2e14db791d4214769e6761495177dc@192.XXX.XX..63:5060' Method: OPTIONS
[2016-06-26 22:26:28] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->


<------------->
[2016-06-26 22:26:58] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->


<------------->
[2016-06-26 22:27:27] VERBOSE[2999] chan_sip.c: Reliably Transmitting (no NAT) to 174.37.245.34:5060:
OPTIONS sip:sip.nexmo.com SIP/2.0
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK14dac936
Max-Forwards: 70
From: "asterisk" <sip:12345678901@192.XXX.XX..63>;tag=as4ae18669
To: <sip:sip.nexmo.com>
Contact: <sip:12345678901@192.XXX.XX..63:5060>
Call-ID: 56c94966256d50f45176ceab3acfef2a@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.9.1
Date: Mon, 27 Jun 2016 05:27:27 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2016-06-26 22:27:27] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:174.37.245.34:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK14dac936;rport=5060;received=73.222.242.203
From: "asterisk" <sip:12345678901@192.XXX.XX..63>;tag=as4ae18669
To: <sip:sip.nexmo.com>;tag=52b520789d2d701d194ad9677121e546.1279
Call-ID: 56c94966256d50f45176ceab3acfef2a@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
Server: Nexmo Customer Proxy - 2
Content-Length: 0

<------------->
[2016-06-26 22:27:27] VERBOSE[2999] chan_sip.c: --- (8 headers 0 lines) ---
[2016-06-26 22:27:27] VERBOSE[2999] chan_sip.c: Really destroying SIP dialog '56c94966256d50f45176ceab3acfef2a@192.XXX.XX..63:5060' Method: OPTIONS
[2016-06-26 22:27:27] VERBOSE[2999] chan_sip.c: Reliably Transmitting (no NAT) to 192.XXX.XX..141:5060:
OPTIONS sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM SIP/2.0
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK64956937
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.XXX.XX..63>;tag=as34a7003d
To: <sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM>
Contact: <sip:asterisk@192.XXX.XX..63:5060>
Call-ID: 091a518b0edbcaf77836516f6d9b78a8@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.9.1
Date: Mon, 27 Jun 2016 05:27:27 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2016-06-26 22:27:27] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->
SIP/2.0 200 Ok
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK64956937
From: "asterisk" <sip:asterisk@192.XXX.XX..63>;tag=as34a7003d
To: <sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM>;tag=RBhGp
Call-ID: 091a518b0edbcaf77836516f6d9b78a8@192.XXX.XX..63:5060
CSeq: 102 OPTIONS

<------------->
[2016-06-26 22:27:27] VERBOSE[2999] chan_sip.c: --- (6 headers 0 lines) ---
[2016-06-26 22:27:27] VERBOSE[2999] chan_sip.c: Really destroying SIP dialog '091a518b0edbcaf77836516f6d9b78a8@192.XXX.XX..63:5060' Method: OPTIONS
[2016-06-26 22:27:28] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->


<------------->
[2016-06-26 22:27:58] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->


<------------->
[2016-06-26 22:28:27] VERBOSE[2999] chan_sip.c: Reliably Transmitting (no NAT) to 174.37.245.34:5060:
OPTIONS sip:sip.nexmo.com SIP/2.0
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK133b8304
Max-Forwards: 70
From: "asterisk" <sip:12345678901@192.XXX.XX..63>;tag=as62919e3a
To: <sip:sip.nexmo.com>
Contact: <sip:12345678901@192.XXX.XX..63:5060>
Call-ID: 3c0c1172347f79ac0c919a0c6313ff24@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.9.1
Date: Mon, 27 Jun 2016 05:28:27 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2016-06-26 22:28:27] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:174.37.245.34:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK133b8304;rport=5060;received=73.222.242.203
From: "asterisk" <sip:12345678901@192.XXX.XX..63>;tag=as62919e3a
To: <sip:sip.nexmo.com>;tag=52b520789d2d701d194ad9677121e546.64e7
Call-ID: 3c0c1172347f79ac0c919a0c6313ff24@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
Server: Nexmo Customer Proxy - 2
Content-Length: 0

<------------->
[2016-06-26 22:28:27] VERBOSE[2999] chan_sip.c: --- (8 headers 0 lines) ---
[2016-06-26 22:28:27] VERBOSE[2999] chan_sip.c: Really destroying SIP dialog '3c0c1172347f79ac0c919a0c6313ff24@192.XXX.XX..63:5060' Method: OPTIONS
[2016-06-26 22:28:27] VERBOSE[2999] chan_sip.c: Reliably Transmitting (no NAT) to 192.XXX.XX..141:5060:
OPTIONS sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM SIP/2.0
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK1e84941b
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.XXX.XX..63>;tag=as7990de64
To: <sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM>
Contact: <sip:asterisk@192.XXX.XX..63:5060>
Call-ID: 0becad9607e998fb1fabde945f55bf34@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.9.1
Date: Mon, 27 Jun 2016 05:28:27 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2016-06-26 22:28:27] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->
SIP/2.0 200 Ok
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK1e84941b
From: "asterisk" <sip:asterisk@192.XXX.XX..63>;tag=as7990de64
To: <sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM>;tag=HIWnC
Call-ID: 0becad9607e998fb1fabde945f55bf34@192.XXX.XX..63:5060
CSeq: 102 OPTIONS

<------------->
[2016-06-26 22:28:27] VERBOSE[2999] chan_sip.c: --- (6 headers 0 lines) ---
[2016-06-26 22:28:27] VERBOSE[2999] chan_sip.c: Really destroying SIP dialog '0becad9607e998fb1fabde945f55bf34@192.XXX.XX..63:5060' Method: OPTIONS
[2016-06-26 22:28:28] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->


<------------->
[2016-06-26 22:28:58] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->


<------------->
[2016-06-26 22:29:27] VERBOSE[2999] chan_sip.c: Reliably Transmitting (no NAT) to 174.37.245.34:5060:
OPTIONS sip:sip.nexmo.com SIP/2.0
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK72d8621b
Max-Forwards: 70
From: "asterisk" <sip:12345678901@192.XXX.XX..63>;tag=as0aabbb33
To: <sip:sip.nexmo.com>
Contact: <sip:12345678901@192.XXX.XX..63:5060>
Call-ID: 6c984f8b57094d495b7a7a535d6ce54e@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.9.1
Date: Mon, 27 Jun 2016 05:29:27 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2016-06-26 22:29:27] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:174.37.245.34:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK72d8621b;rport=5060;received=73.222.242.203
From: "asterisk" <sip:12345678901@192.XXX.XX..63>;tag=as0aabbb33
To: <sip:sip.nexmo.com>;tag=52b520789d2d701d194ad9677121e546.da34
Call-ID: 6c984f8b57094d495b7a7a535d6ce54e@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
Server: Nexmo Customer Proxy - 2
Content-Length: 0

<------------->
[2016-06-26 22:29:27] VERBOSE[2999] chan_sip.c: --- (8 headers 0 lines) ---
[2016-06-26 22:29:27] VERBOSE[2999] chan_sip.c: Really destroying SIP dialog '6c984f8b57094d495b7a7a535d6ce54e@192.XXX.XX..63:5060' Method: OPTIONS
[2016-06-26 22:29:27] VERBOSE[2999] chan_sip.c: Reliably Transmitting (no NAT) to 192.XXX.XX..141:5060:
OPTIONS sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM SIP/2.0
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK4c03ffc7
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.XXX.XX..63>;tag=as6df41f79
To: <sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM>
Contact: <sip:asterisk@192.XXX.XX..63:5060>
Call-ID: 24aca9ad565d0f1f2993e9dc17d11851@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.9.1
Date: Mon, 27 Jun 2016 05:29:27 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2016-06-26 22:29:27] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->
SIP/2.0 200 Ok
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK4c03ffc7
From: "asterisk" <sip:asterisk@192.XXX.XX..63>;tag=as6df41f79
To: <sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM>;tag=4LW2c
Call-ID: 24aca9ad565d0f1f2993e9dc17d11851@192.XXX.XX..63:5060
CSeq: 102 OPTIONS

<------------->
[2016-06-26 22:29:27] VERBOSE[2999] chan_sip.c: --- (6 headers 0 lines) ---
[2016-06-26 22:29:27] VERBOSE[2999] chan_sip.c: Really destroying SIP dialog '24aca9ad565d0f1f2993e9dc17d11851@192.XXX.XX..63:5060' Method: OPTIONS
[2016-06-26 22:29:28] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->


<------------->
[2016-06-26 22:29:59] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->


<------------->
[2016-06-26 22:30:27] VERBOSE[2999] chan_sip.c: Reliably Transmitting (no NAT) to 174.37.245.34:5060:
OPTIONS sip:sip.nexmo.com SIP/2.0
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK4614a5f4
Max-Forwards: 70
From: "asterisk" <sip:12345678901@192.XXX.XX..63>;tag=as0baf0510
To: <sip:sip.nexmo.com>
Contact: <sip:12345678901@192.XXX.XX..63:5060>
Call-ID: 06c549af6368c26516f77011219f8101@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.9.1
Date: Mon, 27 Jun 2016 05:30:27 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2016-06-26 22:30:27] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:174.37.245.34:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK4614a5f4;rport=5060;received=73.222.242.203
From: "asterisk" <sip:12345678901@192.XXX.XX..63>;tag=as0baf0510
To: <sip:sip.nexmo.com>;tag=52b520789d2d701d194ad9677121e546.3a22
Call-ID: 06c549af6368c26516f77011219f8101@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
Server: Nexmo Customer Proxy - 2
Content-Length: 0

<------------->
[2016-06-26 22:30:27] VERBOSE[2999] chan_sip.c: --- (8 headers 0 lines) ---
[2016-06-26 22:30:27] VERBOSE[2999] chan_sip.c: Really destroying SIP dialog '06c549af6368c26516f77011219f8101@192.XXX.XX..63:5060' Method: OPTIONS
[2016-06-26 22:30:27] VERBOSE[2999] chan_sip.c: Reliably Transmitting (no NAT) to 192.XXX.XX..141:5060:
OPTIONS sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM SIP/2.0
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK4fd799fe
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.XXX.XX..63>;tag=as091a5093
To: <sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM>
Contact: <sip:asterisk@192.XXX.XX..63:5060>
Call-ID: 7d0b7212608c08827449d2f911fbbccb@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.9.1
Date: Mon, 27 Jun 2016 05:30:27 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2016-06-26 22:30:28] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->
SIP/2.0 200 Ok
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK4fd799fe
From: "asterisk" <sip:asterisk@192.XXX.XX..63>;tag=as091a5093
To: <sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM>;tag=apIqD
Call-ID: 7d0b7212608c08827449d2f911fbbccb@192.XXX.XX..63:5060
CSeq: 102 OPTIONS

<------------->
[2016-06-26 22:30:28] VERBOSE[2999] chan_sip.c: --- (6 headers 0 lines) ---
[2016-06-26 22:30:28] VERBOSE[2999] chan_sip.c: Really destroying SIP dialog '7d0b7212608c08827449d2f911fbbccb@192.XXX.XX..63:5060' Method: OPTIONS
[2016-06-26 22:30:28] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->


<------------->
[2016-06-26 22:30:58] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->


<------------->
[2016-06-26 22:31:27] VERBOSE[2999] chan_sip.c: Reliably Transmitting (no NAT) to 174.37.245.34:5060:
OPTIONS sip:sip.nexmo.com SIP/2.0
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK2d4be7f6
Max-Forwards: 70
From: "asterisk" <sip:12345678901@192.XXX.XX..63>;tag=as6e4767a3
To: <sip:sip.nexmo.com>
Contact: <sip:12345678901@192.XXX.XX..63:5060>
Call-ID: 395407174e5830d72f917795254a4e6b@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.9.1
Date: Mon, 27 Jun 2016 05:31:27 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2016-06-26 22:31:27] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:174.37.245.34:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK2d4be7f6;rport=5060;received=73.222.242.203
From: "asterisk" <sip:12345678901@192.XXX.XX..63>;tag=as6e4767a3
To: <sip:sip.nexmo.com>;tag=52b520789d2d701d194ad9677121e546.d54c
Call-ID: 395407174e5830d72f917795254a4e6b@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
Server: Nexmo Customer Proxy - 2
Content-Length: 0

<------------->
[2016-06-26 22:31:27] VERBOSE[2999] chan_sip.c: --- (8 headers 0 lines) ---
[2016-06-26 22:31:27] VERBOSE[2999] chan_sip.c: Really destroying SIP dialog '395407174e5830d72f917795254a4e6b@192.XXX.XX..63:5060' Method: OPTIONS
[2016-06-26 22:31:28] VERBOSE[2999] chan_sip.c: Reliably Transmitting (no NAT) to 192.XXX.XX..141:5060:
OPTIONS sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM SIP/2.0
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK6304c6a0
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.XXX.XX..63>;tag=as677ae34c
To: <sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM>
Contact: <sip:asterisk@192.XXX.XX..63:5060>
Call-ID: 16ee93aa02c7e6787e3b10e215ed0207@192.XXX.XX..63:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.9.1
Date: Mon, 27 Jun 2016 05:31:28 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2016-06-26 22:31:28] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->
SIP/2.0 200 Ok
Via: SIP/2.0/UDP 192.XXX.XX..63:5060;branch=z9hG4bK6304c6a0
From: "asterisk" <sip:asterisk@192.XXX.XX..63>;tag=as677ae34c
To: <sip:12345678901@192.XXX.XX..141;app-id=622464153529;pn-type=google;pn-tok=APA91bHQNbZhKL0pL5Q9hWdJbs3DJW51cjWXf4xljQ8NcAn1odMf04O03YM9OePNp_R3CwgXDWR1RftctrU2Vkob1s0mAjArVK6P2Aw-LWIHheyjwlzlOqM>;tag=a81gg
Call-ID: 16ee93aa02c7e6787e3b10e215ed0207@192.XXX.XX..63:5060
CSeq: 102 OPTIONS

<------------->
[2016-06-26 22:31:28] VERBOSE[2999] chan_sip.c: --- (6 headers 0 lines) ---
[2016-06-26 22:31:28] VERBOSE[2999] chan_sip.c: Really destroying SIP dialog '16ee93aa02c7e6787e3b10e215ed0207@192.XXX.XX..63:5060' Method: OPTIONS
[2016-06-26 22:31:28] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->


<------------->
[2016-06-26 22:31:58] VERBOSE[2999] chan_sip.c:
<--- SIP read from UDP:192.XXX.XX..141:5060 --->


<------------->

There isn’t any SIP INVITE request from a remote SIP peer, make sure you have forwarded the DID to the correct SIP uri and that you asterisk server is reachable from the outside world (PUBLIC IP)

I am able to make outbound calls from softclient to real mobile number via asterisk server (192.XXX.XX.141) . Also I have 5060 open and ports 10000-20000 open.

  1. So Can I assume that my asterisk server is reachable from public as I am able to make outbound calls via asterisk?
  2. I have whitelisted here
    I added the IP addresses from here Nexmo SIP whitelist IP addresses
    Please let me know if I am on right track. And Thanks a lot for helping. Thanks a ton.

That you can make outbound calls doesn’t means your server is accessible through a SIP URI from the outside world. (Internet). If your asterisk server is behind a natted network make sure you foward the UDP ports 5060 and 10K-20K to the Asterisk server IP. Related to the screen showed on your post it is the fail2ban administration page , and it is good to white list any the trusted IP.

If you want to get more help from this community avoid those GUI and try to configure your system using plain Asterisk, but in order you be able to do that you need to read this book http://www.asteriskdocs.org/

For sip.conf and extensions.conf I do it via command line and not GUI.

  1. How to find if my server is behind a natted network? - UPDATED: In my sip.conf I have mentioned nat=no and log debug also says NAT=no . So this is resolved (I guess).
  2. In my sip.conf I have set srvenabled=yes, I went through this link http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html/asterisk-book.html#InternetCallRouting_id266470 It explains what is SRV record and how to test one, but I am struck how to configure SRV record in asterisk server. As per this link I should set up SRV record.

You are right. I have given the forward SIP address as sip:DID-Number@192.168.1.63 . That address is a private IP. I need to figure out how to reach to the asterisk server behind my IP address.

Could you at least give an acknowledgement that my existing sip.conf and extensions.conf are correct for the considered scenario? That would be really helpful.

Thanks.

I can’t comment on the various uses of api-key and myNumebr123, etc., except that most ITSPs don’t need them in all these places.

I believe insecure=very no longer works. It should either insecure=invite, or you should use remotesecret instead of secret.

type=peer is almost always better than type=friend, and not just in the ITSP section.

Leaving nat unset is possibly better than nat=no. nat=no implies disabling something that would normally be enabled.

If you don’t start with disallow, you will already have every possible codec enabled, I believe.

Your myNumber123 section is weird. It might actually work for incoming calls because of the type=friend, but if you are wanting to do from user matching on incoming calls, with no registration, type=user would be more honest.

I’m not aware of being able to use register without domain name.

Set up for srvlookup has to be done by the ITSP. If they want you do have SRV records, you do that in a DNS server, not in Asterisk.

For any normal DID configuration, your nexmo-sip1 context will result in a routing loop, as it will send calls arriving with your DID number back out to the ITSP who will either fault the call because of the loop or send them back to you.

type=friend definitely serves no useful purpose on nexmo-sip* as they will never send the section name in the user part of the from header.

fromdomain is not useful on a section that can only handle incoming calls.

insecure=invite is not useful on a section that has no secret.

I can see no reference to the softclient in either sip.conf or extensions.conf.

allowguest=yes is not useful without a default context that can handle incoming calls. Your default context, starts billing for the caller then immediately drops the call.

Wow. Thanks for the detailed reply. May I know how to setup the conf files to redirect the calls to softclient.