Read the default configuration to understand how routing within Kamailio works.
Regarding REGISTER: just remove all the REGISTER handling (and PUBLISH, SUBSCRIBE and NOTIFY) in the config, then the REGISTERs will be routed like all other messages.
Then take a look at the PSTN gateway feature. Use this (or similar) to route the calls to Asterisk (just do not analyze the userpart if it is a phone number but handle all requests like PSTN calls and send them to the gateway (-> the Asterisk server).
Further, use 2 listen statements: listen=udp:external-IP:port listen=udp:internal-IP:port
When sending from internal to external (or in the othe direction) use the force_send_socket() to force the proper outgoing socket.
regards Klaus
On 04.02.2014 17:41, *sm1Ly wrote:
hello all again. trying the third day... my cfg is: http://pastebin.com/vMHd7kki
I need scheme like:
any_sip_device_on_internet_nated_and_not => kamailio ext ip (194.190.8.171) | kamailio int ip (50.0.0.1) => asterisk (50.0.0.10)
a do not need realtime configuration of asterisk. I only need forward everything to asterisk. and after signalling will work, I need rtp too... but its the long way I think.
so how I must config kamailio that it doesnt answer 200 when I send register? it looks like sip device send register, kamailio fwd it, but answer to device 200. and than my device doesnt resend register normal. some dump:
20:40:44.649660 IP (tos 0x0, ttl 121, id 14950, offset 0, flags [none], proto UDP (17), length 583) 77.37.241.151.5060 > 194.190.8.171.5060: SIP, length: 555 REGISTER sip:194.190.8.171 SIP/2.0 Via: SIP/2.0/UDP 192.168.1.119:5060;branch=z9hG4bK009318ba288ce311b95a985a85ad1a82;rport From: <sip:1001@194.190.8.171 mailto:sip%3A1001@194.190.8.171>;tag=3041452802 To: <sip:1001@194.190.8.171 mailto:sip%3A1001@194.190.8.171> Call-ID: 00C48A3A-288C-E311-B956-985A85AD1A82@192.168.1.119 mailto:00C48A3A-288C-E311-B956-985A85AD1A82@192.168.1.119 CSeq: 4 REGISTER Contact: <sip:1001@192.168.1.119:5060 http://sip:1001@192.168.1.119:5060>;Expires=0;+sip.instance="urn:uuid:8012D316-1188-E311-99FF-536675A7CDE6" Allow: INVITE, OPTIONS, ACK, BYE, CANCEL, INFO, NOTIFY, MESSAGE, UPDATE Max-Forwards: 70 User-Agent: SIPPER for PhonerLite Expires: 0 Content-Length: 0
20:40:44.651668 IP (tos 0x10, ttl 64, id 33739, offset 0, flags [none], proto UDP (17), length 422) 194.190.8.171.5060 > 77.37.241.151.5060: SIP, length: 394 SIP/2.0 200 OK Via: SIP/2.0/UDP 192.168.1.119:5060;branch=z9hG4bK009318ba288ce311b95a985a85ad1a82;rport=5060;received=77.37.241.151 From: <sip:1001@194.190.8.171 mailto:sip%3A1001@194.190.8.171>;tag=3041452802 To: <sip:1001@194.190.8.171 mailto:sip%3A1001@194.190.8.171>;tag=c5aea4efd01978ba46557f38f3d08cfc.63a1 Call-ID: 00C48A3A-288C-E311-B956-985A85AD1A82@192.168.1.119 mailto:00C48A3A-288C-E311-B956-985A85AD1A82@192.168.1.119 CSeq: 4 REGISTER Server: kamailio (4.1.1 (x86_64/linux)) Content-Length: 0
20:40:44.653916 IP (tos 0x10, ttl 64, id 33740, offset 0, flags [none], proto UDP (17), length 582) 194.190.8.171.5060 > 77.37.241.151.5060: SIP, length: 554 SIP/2.0 401 Unauthorized Via: SIP/2.0/UDP 192.168.1.119:5060;received=77.37.241.151;branch=z9hG4bK009318ba288ce311b95a985a85ad1a82;rport=5060 From: <sip:1001@194.190.8.171 mailto:sip%3A1001@194.190.8.171>;tag=3041452802 To: <sip:1001@194.190.8.171 mailto:sip%3A1001@194.190.8.171>;tag=as40c64a63 Call-ID: 00C48A3A-288C-E311-B956-985A85AD1A82@192.168.1.119 mailto:00C48A3A-288C-E311-B956-985A85AD1A82@192.168.1.119 CSeq: 4 REGISTER Server: Asterisk PBX 1.8.20.0 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH Supported: replaces, timer WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="4cffbc95" Content-Length: 0
20:40:45.073854 IP (tos 0x0, ttl 121, id 14953, offset 0, flags [none], proto UDP (17), length 575) 77.37.241.151.5060 > 194.190.8.171.5060: SIP, length: 547 REGISTER sip:194.190.8.171 SIP/2.0 Via: SIP/2.0/UDP 192.168.1.119:5060;branch=z9hG4bK009318ba288ce311b1713a64da149374;rport From: <sip:1001@194.190.8.171 mailto:sip%3A1001@194.190.8.171>;tag=3123771917 To: <sip:1001@194.190.8.171 mailto:sip%3A1001@194.190.8.171> Call-ID: 009318BA-288C-E311-B16F-3A64DA149374@192.168.1.119 mailto:009318BA-288C-E311-B16F-3A64DA149374@192.168.1.119 CSeq: 1 REGISTER Contact: <sip:1001@192.168.1.119:5060 http://sip:1001@192.168.1.119:5060>;+sip.instance="urn:uuid:8012D316-1188-E311-99FF-536675A7CDE6" Allow: INVITE, OPTIONS, ACK, BYE, CANCEL, INFO, NOTIFY, MESSAGE, UPDATE Max-Forwards: 70 User-Agent: SIPPER for PhonerLite Expires: 900 Content-Length: 0
20:40:45.076169 IP (tos 0x10, ttl 64, id 33741, offset 0, flags [none], proto UDP (17), length 572) 194.190.8.171.5060 > 77.37.241.151.5060: SIP, length: 544 SIP/2.0 200 OK Via: SIP/2.0/UDP 192.168.1.119:5060;branch=z9hG4bK009318ba288ce311b1713a64da149374;rport=5060;received=77.37.241.151 From: <sip:1001@194.190.8.171 mailto:sip%3A1001@194.190.8.171>;tag=3123771917 To: <sip:1001@194.190.8.171 mailto:sip%3A1001@194.190.8.171>;tag=c5aea4efd01978ba46557f38f3d08cfc.795d Call-ID: 009318BA-288C-E311-B16F-3A64DA149374@192.168.1.119 mailto:009318BA-288C-E311-B16F-3A64DA149374@192.168.1.119 CSeq: 1 REGISTER Contact: <sip:1001@192.168.1.119:5060 http://sip:1001@192.168.1.119:5060>;expires=900;received="sip:77.37.241.151:5060 http://77.37.241.151:5060";+sip.instance="urn:uuid:8012D316-1188-E311-99FF-536675A7CDE6" Server: kamailio (4.1.1 (x86_64/linux)) Content-Length: 0
-- yours respectfully, Alexander Vasin.
8 926 1437200 icq: 9906064
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users