Kamailio (192.168.182.1) and Asterisk (192.168.182.24) realtime integration
by
http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb.
Kamailio have a public interface also.
Grep from debug on kamailio 4.2.1 on call from asterisk extensions/peers:
Mar 19 14:51:50 netbox /usr/sbin/kamailio[547784]: DEBUG: usrloc
[udomain.c:602]: db_load_urecord(): aor 101(a)192.168.182.1 not found in
table location
Mar 19 14:51:50 netbox /usr/sbin/kamailio[547784]: DEBUG: registrar
[lookup.c:158]: lookup(): '101(a)192.168.182.1' Not found in usrloc
Mar 19 14:51:50 netbox /usr/sbin/kamailio[547785]: DEBUG: usrloc
[udomain.c:602]: db_load_urecord(): aor 102(a)192.168.182.1 not found in
table location
Mar 19 14:51:50 netbox /usr/sbin/kamailio[547785]: DEBUG: registrar
[lookup.c:158]: lookup(): '102(a)192.168.182.1' Not found in usrloc
Kamailio forwards registration to Asterisk and store location of peer with
domain name sip.domain.tld. But Asterisk dials peer to peer in local
dialplan - to IP of kamailio.
asterisk1*CLI> sip show peers
Name/username Host Dyn
Forcerport Comedia ACL Port Status
Description Realtime
101/101 192.168.182.1 D
No No A 5060
Unmonitored Cached RT
102/102 192.168.182.1 D
No No A 5060
Unmonitored Cached RT
asterisk1*CLI> sip show peer 102
* Name : 102
Description :
Realtime peer: Yes, cached
Secret : <Not set>
MD5Secret : <Not set>
Remote Secret: <Not set>
Context : ext-local
Record On feature : automon
Record Off feature : automon
Subscr.Cont. : <Not set>
Language :
Tonezone : <Not set>
AMA flags : Unknown
Transfer mode: open
CallingPres : Presentation Allowed, Not Screened
FromUser : 102
FromDomain :
sip.domain.com Port 5060
Callgroup :
Pickupgroup :
Named Callgr :
Nam. Pickupgr:
MOH Suggest :
Mailbox :
VM Extension : asterisk
LastMsgsSent : 6/0
Call limit : 0
Max forwards : 0
Dynamic : Yes
Callerid : "" <>
MaxCallBR : 384 kbps
Expire : 252
Insecure : no
Force rport : No
Symmetric RTP: No
ACL : Yes
DirectMedACL : No
T.38 support : No
T.38 EC mode : Unknown
T.38 MaxDtgrm: -1
DirectMedia : Yes
PromiscRedir : No
User=Phone : No
Video Support: No
Text Support : No
Ign SDP ver : No
Trust RPID : No
Send RPID : No
Path support : No
Path : N/A
Subscriptions: Yes
Overlap dial : No
DTMFmode : rfc2833
Timer T1 : 500
Timer B : 32000
ToHost :
Addr->IP : 192.168.182.1:5060
Defaddr->IP : (null)
Prim.Transp. : UDP
Allowed.Trsp : UDP
Def. Username: 102
SIP Options : (none)
Codecs : (gsm|ulaw|alaw|h263|testlaw)
Codec Order : (none)
Auto-Framing : No
Status : Unmonitored
Useragent : kamailio (4.1.2 (x86_64/linux))
Reg. Contact : sip:102@192.168.182.1:5060
Qualify Freq : 60000 ms
Keepalive : 0 ms
Sess-Timers : Accept
Sess-Refresh : uas
Sess-Expires : 1800 secs
Min-Sess : 90 secs
RTP Engine : asterisk
Parkinglot :
Use Reason : No
Encryption : No
/etc/asterisk/extensions.conf:
...
[ext-local]
; our phones use 3 digit extensions, starting with 1
exten => _1XX,1,DumpChan(verbose)
exten => _1XX,n,Dial(SIP/${EXTEN})
exten => _1XX,n,Voicemail(${EXTEN},u)
exten => _1XX,n,Hangup
exten => _1XX,101,Voicemail(${EXTEN},b)
exten => _1XX,102,Hangup
Also strabge why I see user.pub.lic in Variables on channel during call:
...
SIPCALLID=GOB1.VSLU0SOTjG-u8jjarzXv.lJTjin
SIPDOMAIN=netbox.teleservice.com.ua
SIPURI=sip:101@user.pub.lic.ip:35835
Do I need rewrite To header with change IP to domain name? Maybe in this
section:
#!ifdef WITH_ASTERISK
# Test if coming from Asterisk
route[FROMASTERISK] {
if($si==$sel(cfg_get.asterisk.bindip)
&& $sp==$sel(cfg_get.asterisk.bindport))
return 1;
return -1;
}