Hello,
I’m using Kamailio as SIP proxy between Session Manager and SBC
So here is the scenario :
Session Manager sends a call (Invite) to Kamailio, kamailio needs to relay it to SBC after doing some modification.
(-----Session Manager-----) ----------- > (----Kamailio----) ----------- > (-----SBC-----)
My routing logic is similar to the below:
route{
if ((method==OPTIONS) && (! uri=~"sip:.*[@]+.*")) {
options_reply();
}
if (is_method("INVITE")) {
sql_query("cb", "select number from pool1 order by random() limit 1", "ra");
$var(rand)=$dbr(ra=>[0,0]);
uac_replace_from($var(rand),"sip:$var(rand)@192.168.1.1");
xlog("L_INFO","Random: $var(rand)");
$var(ip) = $(ct{s.select,1,@}{s.select,0,;}{s.replace,>,});
remove_hf("Contact");
insert_hf("Contact: $var(rand) <sip:$var(rand)@$var(ip)>\r\n");
remove_hf("P-Asserted-Identity");
remove_hf("Route");
insert_hf("Route: <sip: 192.168.1.10>\r\n","Route");
record_route();
t_relay();
$td = "192.168.1.10";
$rd = "192.168.1.10";
t_relay();
}
}
Where:
192.168.1.1 is Kamailio IP
192.168.1.10 is SBC IP
My question here is that Kamailio handle all in dialog messages between Session Manager and SBC?
For example, after forwarding the invite packet to SBC, SBC sends 183 Session Progress to Kamailio, which in its turn relay it to the session manager, knowing that this is not mentioned in my routing logic, so how Kamailio knew that it
must relay it to session manager in this case?
Also I need to add to the 183 Session Progress sent to session manager by Kamailio record route and Via headers , how to do it ?
Regards,