[SR-Users] Use RTPProxy in 302 scenario
Fabian Borot
fborot at hotmail.com
Mon Feb 12 19:55:10 CET 2018
I have this scenario
Customer --> Kamailio --> Provider1
The route where l route the call to Provider1 is called route["INCOMING"] and I "arm" the replies and failures to : t_on_reply("INCOMING") and t_on_failure("INCOMING"). Provider1 always replies with a 302 Redirect and in the failure_route["INCOMING'] I have this code:
if (t_check_status("302")) {
get_redirects("*");
t_on_branch("REDIRECT_BRANCH");
t_load_contacts();
t_next_contacts();
t_on_failure("SERIAL_FORKING");
t_relay();
exit;
}
In the t_on_failure("SERIAL_FORKING") block I do t_relay() as long as there are more contacts to be processed. Lets say I need to try Provider_2 and Provider_3
failure_route["SERIAL_FORKING"]
{
xlog("L_INFO","mylog: In Failure Route SERIAL_FORKING. Reply [$rs]\n");
if (!t_next_contacts()) {
exit;
}
xlog("L_INFO","mylog: In Failure Route SERIAL_FORKING. Trying next Contact.\n");
t_on_failure("SERIAL_FORKING");
t_relay();
}
I want to use RTPProxy in this scenario and I am using the function rtpproxy_manage() to let kamailio handle it automatically.
RTPProxy
↑
|
|
Customer --> Kamailio --> Provider1
|
|
↓
Provider N
After the 302 response is processed I would like to have the signaling flow "Customer -> Kamailio --> ProviderN" and the RTP flow "Customer --> RTPProxy --> ProviderN"
I have tried inserting the function in several places but can't make it work and what I mean is that sometimes the rtpproxy creates the 1st session and then deletes it as soon as I call it the 2nd time with a message similar to this one (log of rtpproxy) : "INFO:416f20b74a58fb75168175e61b2edece at 192.168.1.61:5060:rtpp_cmd_delete_ematch: forcefully deleting session 1 on ports 63502/0". Sometimes the kamailio log shows this message: "ERROR: rtpproxy [rtpproxy.c:2536]: force_rtp_proxy(): incorrect port 0 in reply from rtp proxy"
I think I must call rtpproxy_manage() before I send the INVITE to each of the Providers in the Contact list so they receive a SDP offer with an IP:Port combination provided by the RTPProxy (instead of the ones coming from the Customer). That would be in my route["INCOMING']
Then once Provider_N replies with a 183 with SDP or a 200 OK I would call it again to get a new session to be passed on the reply to my customer. But is the part I am struggling with. Should I add a new reply route inside the failure_route["INCOMING'] only if I am dealing with 302 and do it there ?
I am out of ideas guys and any idea is welcome
More information about the sr-users
mailing list