How can I get localnet value in my sip.conf file

In my sip.conf file.

There are 2 variables externip which is the IP address of the asterisk server and localnet which is the local IP of the asterisk server.

The externip is set to the asterisk server IP address

For the localnet, I use the command ifconfig and I use the value of the eth0 as the localnet value but I dont think I am right cos whenever I try DTMF. It is not working, it always gives a feedback of “user entered nothing”

You should provide the value that you are using, as well as the output of “sip set debug on” and “rtp set debug on”. This will confirm what is actually communicated and if media is flowing.

My sip.conf file

[general]
context=unauthenticated
allowguest=yes
alwaysauthreject=yes
srvlookup=yes
udpbindaddr=0.0.0.0
tcpenable=no
qualify=yes
match_auth_username=yes
allowoverlap=no
allowtransfer=no
canreinvite=no
disallow=all
allow=g729
allow=ulaw
allow=alaw
directmedia=no
nat=force_rport,comedia
externip=163.172.172.79
localnet=10.6.29.167/255.255.255.254
dtmfmode=rfc2833

I got the value of localnet by doing ifconfig and getting the inet value for eth0

– Executing [proceed@forward:2] Read(“SIP/46.19.209.14-000001c1”, “phonenumber,/var/lib/asterisk/sounds/es/enter_destination_pound,8,i,1,3”) in new stack
– Accepting a maximum of 8 digits.
Audio is at 17110
Adding codec g729 to SDP
Adding codec ulaw to SDP
Adding codec alaw to SDP

<— Reliably Transmitting (NAT) to 46.19.209.14:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 46.19.209.14;branch=z9hG4bK1.YbdavV;received=46.19.209.14;rport=5060
From: 16173730982 sip:16173730982@46.19.209.14;tag=700EC36B-58AC6755000C8C8E-EC6FC700
To: sip:17818100188@163.172.172.79:5060;tag=as029fc903
Call-ID: 12-57D54FC2-58AC6755000C8D48-EC6FC700
CSeq: 10 INVITE
Server: Asterisk PBX 13.10.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: sip:17818100188@163.172.172.79:5060
Content-Type: application/sdp
Content-Length: 265

v=0
o=root 1230487151 1230487151 IN IP4 163.172.172.79
s=Asterisk PBX 13.10.0
c=IN IP4 163.172.172.79
t=0 0
m=audio 17110 RTP/AVP 18 0 8
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=ptime:20
a=maxptime:150
a=sendrecv

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

<— SIP read from UDP:46.19.209.14:5060 —>
ACK sip:17818100188@163.172.172.79:5060 SIP/2.0
Via: SIP/2.0/UDP 46.19.209.14;branch=z9hG4bKEXN2baBf;rport
From: 16173730982 sip:16173730982@46.19.209.14;tag=700EC36B-58AC6755000C8C8E-EC6FC700
To: sip:17818100188@163.172.172.79:5060;tag=as029fc903
CSeq: 10 ACK
Call-ID: 12-57D54FC2-58AC6755000C8D48-EC6FC700
Contact: sip:46.19.209.14:5060
Max-Forwards: 70
Content-Length: 0

<------------->
— (9 headers 0 lines) —
– <SIP/46.19.209.14-000001c1> Playing ‘/var/lib/asterisk/sounds/es/enter_destination_pound.slin’ (language ‘es’)
> 0x7f330097b6b0 – Probation passed - setting RTP source address to 46.19.209.80:58404
– User entered nothing.
– Executing [proceed@forward:3] Read(“SIP/46.19.209.14-000001c1”, “phonenumber=”) in new stack

<— SIP read from UDP:46.19.209.14:5060 —>
BYE sip:17818100188@163.172.172.79:5060 SIP/2.0
Via: SIP/2.0/UDP 46.19.209.14;branch=z9hG4bKNyV3hakZ;rport
From: 16173730982 sip:16173730982@46.19.209.14;tag=700EC36B-58AC6755000C8C8E-EC6FC700
To: sip:17818100188@163.172.172.79:5060;tag=as029fc903
CSeq: 11 BYE
Call-ID: 12-57D54FC2-58AC6755000C8D48-EC6FC700
Max-Forwards: 70
User-Agent: DIDWW SBC node
Content-Length: 0

<------------->
— (9 headers 0 lines) —
Sending to 46.19.209.14:5060 (NAT)
Scheduling destruction of SIP dialog ‘12-57D54FC2-58AC6755000C8D48-EC6FC700’ in 32000 ms (Method: BYE)

<— Transmitting (NAT) to 46.19.209.14:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 46.19.209.14;branch=z9hG4bKNyV3hakZ;received=46.19.209.14;rport=5060
From: 16173730982 sip:16173730982@46.19.209.14;tag=700EC36B-58AC6755000C8C8E-EC6FC700
To: sip:17818100188@163.172.172.79:5060;tag=as029fc903
Call-ID: 12-57D54FC2-58AC6755000C8D48-EC6FC700
CSeq: 11 BYE
Server: Asterisk PBX 13.10.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

There is nothing out of the ordinary in the signaling, and there appears to be an RTP stream so media is flowing. An “rtp set debug on” would confirm if we are receiving RFC2833 or not.

This is my RTP media response

len 000020)
Got RTP packet from 46.19.209.80:57154 (type 18, seq 013178, ts 1600762896, len 000020)
Got RTP packet from 46.19.209.80:57154 (type 18, seq 013179, ts 1600763056, len 000020)
Got RTP packet from 46.19.209.80:57154 (type 18, seq 013180, ts 1600763216, len 000020)

Do you think my localnet value is right?

You are receiving media from the other side and the session is established, so yes, either the other side is doing NAT traversal or your localnet is working.

I did just notice something in our 200 OK. We never negotiated RFC2833 with the other side, so that probably means they never offered it. That would be why it would not work.

So what do you suggest I do?

Determine what DTMF method you should be using with the remote side and use it. Simply setting “rfc2833” as the dtmfmode won’t work if the other side does not offer it.

Perviously, I have used dtmfmode=auto but it didnt work

Whilst I think localnets is unrelated to your main problem, if you are installing Asterisk, you are either a system administrator for the network, or you should be working closely with the system administrator. The system administrator should know the answer to the question without even having to look it up.

The local network specification you gave is malformed, although it might work, if Asterisk handles the parameters in a particular way. Treated as binary there should be no bits set to the left of the / that are not set to the right of it.

Also, a /31 network means you, effectively, have nothing on your local network to which you might want to send SIP traffic, so localnets is pretty irrelevant. In any case, I believe Asterisk will deduce localnets from the ifconfig information, as long as that is is the only sub-network in your local networks. Normally the smallest sub-network is a /30 one.

I am very confused now. Dont even know what to do

Until you know how DTMF is conveyed and supposed to be configured then you can’t really go anywhere. RFC2833 isn’t being negotiated, so it won’t work.

If I set the dialplan to be same => n,SIPDtmfMode(RFC2833). It works but with a maximum digit of 8 specified in the Read statement. I still have to put # before it goes through

That will be a problem with the phone’s dialplan, not the Asterisk one.

So are you saying, that is beyond my control

Most people setting up VoIP systems have control of the phones.

However, thinking about it, phones normally only hold back DTMF before the call is started, so maybe there is a problem in the Asterisk dialplan, but you haven’t provided us with that yet.

This is how my dialplan on getting user input

same => n,SIPDtmfMode(RFC2833)
same => n,Read(phonenumber,enter_destination,8,i,1,3)
same => n,Read(phonenumber=${FILTER(0-9,${phonenumber})})

I incorrectly diagnosed a bug. The loop termination condition on the surrounding for loop should deal with maximum length numbers.

You think removing the i option can make things work?