asterisk - sip

最後更新: 2018-0-719

介紹

 

friend:  An entity which is both a user and a peer.

 


NAT Setting

 

New version

; asterisk >= 11
; nat=yes is deprecated
nat=force_rport,comedia

Old version

; asterisk version 10
nat=yes

解釋:

nat=yes is working for asterisk version 10 or older. From asterisk 11 , nat=yes is depricated.

In new version, nat=yes or nat=force_rport,comedia are same.

They said nat=yes and nat=force_rport,comedia are same. But i think both are different.

If we change to nat=force_rport,comedia the behavior seems to be fine, except for outside users behind NAT. Our server is also behind NAT.

When an outside NAT:ed user calls in to the network everything works as expected, but when calling the outside user, or when two outside NAT:ed users call each other, the audio only goes one way without any errors shown in the console. When changing back to nat=yes, everything work again.

By looking in the source code for sip/config_parser.c, it seems like the reason for the difference is that when using sip=yes, the auto_force_rport and auto_comedia are cleared. However, when using force_rport,comedia, the auto equivalents are not cleared away.

 


TCP

 

# sip.conf

; tcp, default no
tcpenable = yes
tcpbindaddr = 0.0.0.0:5060

; udp
udpbindaddr = 0.0.0.0
bindport = 5060

# checking

netstat -nlp | grep 5060

# users.conf

[NNN]
...
transport=tcp

P.S.

當 Server 不支援 tcp 的 sip 時, 會有以下 msg

... ERROR[24069]: chan_sip.c:14877 register_verify: 'TCP' is not a valid transport for '221'.
 we only use 'UDP'! ending call.

 


Debug

 

boxA*CLI> sip set debug on

 


Asterisk register sip provider

 

SIP REGISTER 的作用:

* Registration is the process in which the endpoint sends a "SIP REGISTER" to the SIP SERVER

* endpoints are located (否則點知 client 在那裡呢)
* validates the user's credentials
* Registration will then update on a regular schedule

* UDP 5060

call with SIP:

Caller initiates the call by sending an "invite" to Callee

exchange of media information

設定

format: register => user[:secret[:authuser]]@host[:port][/extension]

 

Creative Commons license icon Creative Commons license icon