I'm working on setting up mid_registrar and it's mostly working but I have a problem with RTP being sent to the wrong address.
I'm trying to fix this by using fix_contact in my script but it doesn't appear to be rewriting the contact when the registrar is sent on to my Asterisk box. I see the request from my phone to my proxy: U 2018/03/19 12:04:54.650203 X.X.X.X:5060 -> 192.168.69.159:5060 REGISTER sip:pi.lzrd.net:5060 SIP/2.0. Via: SIP/2.0/UDP 172.16.52.76:5060;branch=z9hG4bK2864496306;rport. From: "John Kiniston" <sip:[email protected]:5060>;tag=2815321839. To: "John Kiniston" <sip:[email protected]:5060>. Call-ID: [email protected]. CSeq: 1 REGISTER. Contact: <sip:[email protected]:5060>. Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE. Max-Forwards: 70. User-Agent: Yealink SIP-T42S 66.81.0.110. Expires: 0. Allow-Events: talk,hold,conference,refer,check-sync. Mac: 00:15:65:b4:d3:d3. Line: 1. Content-Length: 0. . And here is the request from my proxy to my PBX: U 2018/03/19 12:04:54.808558 192.168.69.159:5060 -> 64.119.36.19:5060 REGISTER sip:pi.lzrd.net SIP/2.0. Via: SIP/2.0/UDP 64.119.34.211:5060;branch=z9hG4bK0e8e.34dfaf97.0. Via: SIP/2.0/UDP 172.16.52.76:5060 ;received=x.x.x.x;branch=z9hG4bK2864496306;rport=5060. From: "John Kiniston" <sip:[email protected]:5060>;tag=2815321839. To: "John Kiniston" <sip:[email protected]:5060>. Call-ID: [email protected]. CSeq: 1 REGISTER. Contact: <sip:[email protected]:5060>. Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE. Max-Forwards: 69. User-Agent: Yealink SIP-T42S 66.81.0.110. Expires: 0. Allow-Events: talk,hold,conference,refer,check-sync. Mac: 00:15:65:b4:d3:d3. Line: 1. Content-Length: 0. Path: <sip:64.119.34.211:5060;lr>. Shouldn't the Contact be rewritten with the source IP of the request from the phone to X.X.X.X? OpenSIPS$:ul show Domain:: location table=512 records=1 AOR:: 7002kiniston Contact:: sip:[email protected]:5060 Q= ContactID:: 2933602576022647686 Expires:: 3330 Callid:: [email protected] Cseq:: 2 User-agent:: Yealink SIP-T42S 66.81.0.110 State:: CS_NEW Flags:: 0 Cflags:: Socket:: udp:X.X.X.X:5060 Methods:: 16383 In my main script I have: if ($si == "X.X.X.X"){ route(FromEndPoint); } route[FromEndPoint]{ route("nat_test_and_correct"); if (is_method("INVITE")){ if (is_registered("location","$fu")) { route(outbound); } else { t_reply("503","Authentication failed"); } } if (is_method("SUBSCRIBE|NOTIFY|MESSAGE")){ route(outbound); }; if (is_method("REGISTER")) { route(register); } } route[register]{ if (is_method("REGISTER")) { xlog("L_INFO","Saving location to mid_registrar"); mid_registrar_save("location"); switch ($retcode) { case 1: xlog("forwarding REGISTER to main registrar($$ci=$ci) $ru\n"); $ru = "sip:" + $td:$rp; t_relay(); break; case 2: xlog("absorbing REGISTER! ($$ci=$ci)\n"); break; default: xlog("failed to save registration! ($$ci=$ci)\n"); } exit; } } route[outbound]{ t_relay(); exit; } route[nat_test_and_correct] { if ((method=="REGISTER|SUBSCRIBE|INVITE") && !has_totag() && client_nat_test("3")) { nat_keepalive(); } if (client_nat_test("3")) { force_rport(); fix_contact(); } } -- A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects. ---Heinlein
_______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users
